Messagelib

grantleeheaderstyle.cpp
1 /*
2  SPDX-FileCopyrightText: 2013-2022 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  : mGrantleeFormatter(new GrantleeHeaderFormatter)
20  {
21  }
22 
23  ~GrantleeHeaderStylePrivate()
24  {
25  delete mGrantleeFormatter;
26  }
27 
28  GrantleeHeaderFormatter *const mGrantleeFormatter;
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 }
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-2022 The KDE developers.
Generated on Wed May 25 2022 03:55:39 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.