Messagelib

grantleeheaderteststyle.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 "grantleeheaderteststyle.h"
8 
9 #include "header/grantleeheaderformatter.h"
10 #include "header/headerstrategy.h"
11 
12 #include <KMime/KMimeMessage>
13 
14 using namespace MessageViewer;
15 
16 class MessageViewer::GrantleeHeaderTestStylePrivate
17 {
18 public:
19  GrantleeHeaderTestStylePrivate()
20  : mGrantleeFormatter(new GrantleeHeaderFormatter)
21  {
22  }
23 
24  ~GrantleeHeaderTestStylePrivate()
25  {
26  delete mGrantleeFormatter;
27  }
28 
29  QStringList mExtraDisplay;
30  QString mAbsolutePath;
31  QString mMainFilename;
32  GrantleeHeaderFormatter *const mGrantleeFormatter;
33 };
34 
35 GrantleeHeaderTestStyle::GrantleeHeaderTestStyle()
36  : HeaderStyle()
37  , d(new MessageViewer::GrantleeHeaderTestStylePrivate)
38 {
39 }
40 
41 GrantleeHeaderTestStyle::~GrantleeHeaderTestStyle() = default;
42 
43 const char *GrantleeHeaderTestStyle::name() const
44 {
45  return "grantleetest";
46 }
47 
48 QString GrantleeHeaderTestStyle::format(KMime::Message *message) const
49 {
50  if (!message) {
51  return {};
52  }
53  return d->mGrantleeFormatter->toHtml(d->mExtraDisplay, d->mAbsolutePath, d->mMainFilename, this, message, isPrinting());
54 }
55 
56 void GrantleeHeaderTestStyle::setAbsolutePath(const QString &path)
57 {
58  d->mAbsolutePath = path;
59 }
60 
61 void GrantleeHeaderTestStyle::setMainFilename(const QString &filename)
62 {
63  d->mMainFilename = filename;
64 }
65 
66 void GrantleeHeaderTestStyle::setExtraDisplayHeaders(const QStringList &extraDisplay)
67 {
68  d->mExtraDisplay = extraDisplay;
69 }
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 Fri Nov 26 2021 23:16:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.