Messagelib

grantleeheaderteststyle.cpp
1 /*
2  SPDX-FileCopyrightText: 2013-2020 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/kmime_message.h>
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()
42 {
43  delete d;
44 }
45 
46 const char *GrantleeHeaderTestStyle::name() const
47 {
48  return "grantleetest";
49 }
50 
51 QString GrantleeHeaderTestStyle::format(KMime::Message *message) const
52 {
53  if (!message) {
54  return QString();
55  }
56  return d->mGrantleeFormatter->toHtml(d->mExtraDisplay, d->mAbsolutePath, d->mMainFilename, this,
57  message, isPrinting());
58 }
59 
60 void GrantleeHeaderTestStyle::setAbsolutePath(const QString &path)
61 {
62  d->mAbsolutePath = path;
63 }
64 
65 void GrantleeHeaderTestStyle::setMainFilename(const QString &filename)
66 {
67  d->mMainFilename = filename;
68 }
69 
70 void GrantleeHeaderTestStyle::setExtraDisplayHeaders(const QStringList &extraDisplay)
71 {
72  d->mExtraDisplay = extraDisplay;
73 }
This class encapsulates the visual appearance of message headers.
Definition: headerstyle.h:45
The GrantleeHeaderFormatter class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Sep 17 2020 23:12:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.