Messagelib

grantleeheaderstyle.cpp
1 /*
2  SPDX-FileCopyrightText: 2013-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "grantleeheaderstyle.h"
8 #include "header/grantleeheaderformatter.h"
9 #include "header/headerstrategy.h"
10 #include <GrantleeTheme/GrantleeTheme>
11 
12 #include <KMime/KMimeMessage>
13 
14 using namespace MessageViewer;
15 class MessageViewer::GrantleeHeaderStylePrivate
16 {
17 public:
18  GrantleeHeaderStylePrivate()
19  {
20  mGrantleeFormatter = new GrantleeHeaderFormatter;
21  }
22 
23  ~GrantleeHeaderStylePrivate()
24  {
25  delete mGrantleeFormatter;
26  }
27 
28  GrantleeHeaderFormatter *mGrantleeFormatter = nullptr;
29 };
30 
31 GrantleeHeaderStyle::GrantleeHeaderStyle()
32  : HeaderStyle()
33  , d(new MessageViewer::GrantleeHeaderStylePrivate)
34 {
35 }
36 
37 GrantleeHeaderStyle::~GrantleeHeaderStyle() = default;
38 
39 const char *GrantleeHeaderStyle::name() const
40 {
41  return "grantlee";
42 }
43 
44 QString GrantleeHeaderStyle::format(KMime::Message *message) const
45 {
46  if (!message) {
47  return {};
48  }
49 
50  GrantleeHeaderFormatter::GrantleeHeaderFormatterSettings settings;
51  settings.isPrinting = isPrinting();
52  settings.theme = theme();
53  settings.style = this;
54  settings.message = message;
55  settings.showEmoticons = showEmoticons();
56  return d->mGrantleeFormatter->toHtml(settings);
57 }
This class encapsulates the visual appearance of message headers.
Definition: headerstyle.h:46
The GrantleeHeaderFormatter class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Nov 30 2021 23:05:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.