Messagelib

grantleeheaderformatter.h
1 /*
2  SPDX-FileCopyrightText: 2013-2023 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "messageviewer_export.h"
10 #include <GrantleeTheme/GrantleeTheme>
11 #include <QString>
12 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
13 #include <grantlee/templateloader.h>
14 #else
15 #include <KTextTemplate/TemplateLoader>
16 #endif
17 namespace KMime
18 {
19 class Message;
20 }
21 
22 namespace MessageViewer
23 {
24 class HeaderStyle;
25 /**
26  * @brief The GrantleeHeaderFormatter class
27  * @author Laurent Montel <[email protected]>
28  */
29 class MESSAGEVIEWER_EXPORT GrantleeHeaderFormatter
30 {
31 public:
32  struct GrantleeHeaderFormatterSettings {
33  GrantleeHeaderFormatterSettings() = default;
34 
36  bool isPrinting = false;
37  mutable const MessageViewer::HeaderStyle *style = nullptr;
38  KMime::Message *message = nullptr;
39  bool showEmoticons = true;
40  };
41 
42  explicit GrantleeHeaderFormatter();
44 
45  Q_REQUIRED_RESULT QString toHtml(const GrantleeHeaderFormatterSettings &settings) const;
46 
47  Q_REQUIRED_RESULT QString toHtml(const QStringList &displayExtraHeaders,
48  const QString &absolutPath,
49  const QString &filename,
50  const MessageViewer::HeaderStyle *style,
52  bool isPrinting) const;
53 
54 private:
55 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
56  Q_REQUIRED_RESULT QString format(const QString &absolutePath,
57  const Grantlee::Template &headerTemplate,
58  const QStringList &displayExtraHeaders,
59  bool isPrinting,
60  const MessageViewer::HeaderStyle *style,
62  bool showEmoticons = true) const;
63 #else
64  Q_REQUIRED_RESULT QString format(const QString &absolutePath,
65  const KTextTemplate::Template &headerTemplate,
66  const QStringList &displayExtraHeaders,
67  bool isPrinting,
68  const MessageViewer::HeaderStyle *style,
70  bool showEmoticons = true) const;
71 #endif
72  class GrantleeHeaderFormatterPrivate;
73  std::unique_ptr<GrantleeHeaderFormatterPrivate> const d;
74 };
75 }
The GrantleeHeaderFormatter class.
This class encapsulates the visual appearance of message headers.
Definition: headerstyle.h:46
QString message
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Mar 22 2023 04:07:14 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.