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/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, message, isPrinting());
57 }
58 
59 void GrantleeHeaderTestStyle::setAbsolutePath(const QString &path)
60 {
61  d->mAbsolutePath = path;
62 }
63 
64 void GrantleeHeaderTestStyle::setMainFilename(const QString &filename)
65 {
66  d->mMainFilename = filename;
67 }
68 
69 void GrantleeHeaderTestStyle::setExtraDisplayHeaders(const QStringList &extraDisplay)
70 {
71  d->mExtraDisplay = extraDisplay;
72 }
This class encapsulates the visual appearance of message headers.
Definition: headerstyle.h:48
The GrantleeHeaderFormatter class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Mar 8 2021 23:13:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.