Messagelib

grantleeheaderstyle.cpp
1 /*
2  SPDX-FileCopyrightText: 2013-2023 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 <GrantleeTheme/GrantleeTheme>
10 
11 #include <KMime/KMimeMessage>
12 
13 using namespace MessageViewer;
14 class MessageViewer::GrantleeHeaderStylePrivate
15 {
16 public:
17  GrantleeHeaderStylePrivate()
18  : mGrantleeFormatter(new GrantleeHeaderFormatter)
19  {
20  }
21 
22  ~GrantleeHeaderStylePrivate()
23  {
24  delete mGrantleeFormatter;
25  }
26 
27  GrantleeHeaderFormatter *const mGrantleeFormatter;
28 };
29 
30 GrantleeHeaderStyle::GrantleeHeaderStyle()
31  : HeaderStyle()
32  , d(new MessageViewer::GrantleeHeaderStylePrivate)
33 {
34 }
35 
36 GrantleeHeaderStyle::~GrantleeHeaderStyle() = default;
37 
38 const char *GrantleeHeaderStyle::name() const
39 {
40  return "grantlee";
41 }
42 
43 QString GrantleeHeaderStyle::format(KMime::Message *message) const
44 {
45  if (!message) {
46  return {};
47  }
48 
49  GrantleeHeaderFormatter::GrantleeHeaderFormatterSettings settings;
50  settings.isPrinting = isPrinting();
51  settings.theme = theme();
52  settings.style = this;
53  settings.message = message;
54  settings.showEmoticons = showEmoticons();
55  return d->mGrantleeFormatter->toHtml(settings);
56 }
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 Fri Mar 24 2023 04:08:31 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.