Messagelib

objecttreeviewersource.cpp
1 /*
2  SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected]
3  SPDX-FileCopyrightText: 2009 Andras Mantia <[email protected]>
4 
5  SPDX-License-Identifier: GPL-2.0-or-later
6 */
7 
8 #include "objecttreeviewersource.h"
9 #include "csshelper.h"
10 #include <MimeTreeParser/BodyPartFormatterFactory>
11 
12 #include "messagepartthemes/default/defaultrenderer.h"
13 #include <MimeTreeParser/BodyPartFormatter>
14 
15 #include "settings/messageviewersettings.h"
16 #include "viewer/viewer_p.h"
17 #include "widgets/htmlstatusbar.h"
18 
19 using namespace MessageViewer;
20 
21 MailViewerSource::MailViewerSource(ViewerPrivate *viewer)
23  , mViewer(viewer)
24 {
25 }
26 
27 MailViewerSource::~MailViewerSource() = default;
28 
29 bool MailViewerSource::decryptMessage() const
30 {
31  return mViewer->decryptMessage();
32 }
33 
34 bool MailViewerSource::htmlLoadExternal() const
35 {
36  return mViewer->htmlLoadExternal();
37 }
38 
39 bool MailViewerSource::showSignatureDetails() const
40 {
41  return mViewer->mShowSignatureDetails;
42 }
43 
44 bool MailViewerSource::showEncryptionDetails() const
45 {
46  return mViewer->mShowEncryptionDetails;
47 }
48 
49 void MailViewerSource::setHtmlMode(MimeTreeParser::Util::HtmlMode mode, const QList<MimeTreeParser::Util::HtmlMode> &availableModes)
50 {
51  // qDebug() << " void MailViewerSource::setHtmlMode(MimeTreeParser::Util::HtmlMode mode, const QList<MimeTreeParser::Util::HtmlMode> &availableModes)";
52  // for (int i = 0; i < availableModes.count(); ++i) {
53  // qDebug() << "MailViewerSource::setHtmlMode Mode " << MimeTreeParser::Util::htmlModeToString(availableModes.at(i));
54  // }
55  // qDebug() << "MailViewerSource::setHtmlMode preferred " << MimeTreeParser::Util::htmlModeToString(mode);
56 
57  mViewer->mColorBar->setAvailableModes(availableModes);
58  mViewer->mColorBar->setMode(mode);
59 }
60 
61 MimeTreeParser::Util::HtmlMode MailViewerSource::preferredMode() const
62 {
63  switch (mViewer->displayFormatMessageOverwrite()) {
64  case MessageViewer::Viewer::UseGlobalSetting:
65  case MessageViewer::Viewer::Unknown:
66  return mViewer->htmlMailGlobalSetting() ? MimeTreeParser::Util::Html : MimeTreeParser::Util ::Normal;
67  case MessageViewer::Viewer::Html:
69  case MessageViewer::Viewer::Text:
71  case MessageViewer::Viewer::ICal:
73  }
74  Q_ASSERT(true);
76 }
77 
78 int MailViewerSource::levelQuote() const
79 {
80  return mViewer->mLevelQuote;
81 }
82 
83 const QTextCodec *MailViewerSource::overrideCodec()
84 {
85  return mViewer->overrideCodec();
86 }
87 
88 QString MailViewerSource::createMessageHeader(KMime::Message *message)
89 {
90  return mViewer->writeMessageHeader(message, nullptr, false);
91 }
92 
93 const AttachmentStrategy *MailViewerSource::attachmentStrategy() const
94 {
95  return mViewer->attachmentStrategy();
96 }
97 
98 CSSHelperBase *MailViewerSource::cssHelper() const
99 {
100  return mViewer->cssHelper();
101 }
102 
103 HtmlWriter *MailViewerSource::htmlWriter() const
104 {
105  return mViewer->htmlWriter();
106 }
107 
108 bool MailViewerSource::autoImportKeys() const
109 {
110  return MessageViewer::MessageViewerSettings::self()->autoImportKeys();
111 }
112 
113 bool MailViewerSource::showEmoticons() const
114 {
115  return mViewer->showEmoticons();
116 }
117 
118 bool MailViewerSource::showExpandQuotesMark() const
119 {
120  return MessageViewer::MessageViewerSettings::self()->showExpandQuotesMark();
121 }
122 
123 bool MailViewerSource::isPrinting() const
124 {
125  return mViewer->mPrinting;
126 }
HtmlMode
Describes the type of the displayed message.
A HTML message, non-multipart.
The EmptySource class.
A multipart/alternative message, the HTML part is currently displayed.
The CSSHelperBase class.
Definition: csshelperbase.h:26
bool decryptMessage() const override
Return true if an encrypted mail should be decrypted.
The AttachmentStrategy class.
A multipart/alternative message, the ICal part is currently displayed.
An interface for HTML sinks.
Definition: htmlwriter.h:28
A normal plaintext message, non-multipart.
A multipart/alternative message, the plain text part is currently displayed.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Dec 4 2021 23:12:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.