Messagelib

grantleeheaderteststyle.cpp
1 /*
2  SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "grantleeheaderteststyle.h"
8 
9 #include "header/grantleeheaderformatter.h"
10 
11 #include <KMime/KMimeMessage>
12 
13 using namespace MessageViewer;
14 
15 class MessageViewer::GrantleeHeaderTestStylePrivate
16 {
17 public:
18  GrantleeHeaderTestStylePrivate()
19  : mGrantleeFormatter(new GrantleeHeaderFormatter)
20  {
21  }
22 
23  ~GrantleeHeaderTestStylePrivate()
24  {
25  delete mGrantleeFormatter;
26  }
27 
28  QStringList mExtraDisplay;
29  QString mAbsolutePath;
30  QString mMainFilename;
31  GrantleeHeaderFormatter *const mGrantleeFormatter;
32 };
33 
34 GrantleeHeaderTestStyle::GrantleeHeaderTestStyle()
35  : HeaderStyle()
36  , d(new MessageViewer::GrantleeHeaderTestStylePrivate)
37 {
38 }
39 
40 GrantleeHeaderTestStyle::~GrantleeHeaderTestStyle() = default;
41 
42 const char *GrantleeHeaderTestStyle::name() const
43 {
44  return "grantleetest";
45 }
46 
47 QString GrantleeHeaderTestStyle::format(KMime::Message *message) const
48 {
49  if (!message) {
50  return {};
51  }
52  return d->mGrantleeFormatter->toHtml(d->mExtraDisplay, d->mAbsolutePath, d->mMainFilename, this, message, isPrinting());
53 }
54 
55 void GrantleeHeaderTestStyle::setAbsolutePath(const QString &path)
56 {
57  d->mAbsolutePath = path;
58 }
59 
60 void GrantleeHeaderTestStyle::setMainFilename(const QString &filename)
61 {
62  d->mMainFilename = filename;
63 }
64 
65 void GrantleeHeaderTestStyle::setExtraDisplayHeaders(const QStringList &extraDisplay)
66 {
67  d->mExtraDisplay = extraDisplay;
68 }
The GrantleeHeaderFormatter class.
This class encapsulates the visual appearance of message headers.
Definition: headerstyle.h:46
QString path(const QString &relativePath)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Feb 15 2024 03:55:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.