diff options
Diffstat (limited to 'framework/src/domain/objecttreesource.cpp')
-rw-r--r-- | framework/src/domain/objecttreesource.cpp | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/framework/src/domain/objecttreesource.cpp b/framework/src/domain/objecttreesource.cpp new file mode 100644 index 00000000..567f3516 --- /dev/null +++ b/framework/src/domain/objecttreesource.cpp | |||
@@ -0,0 +1,152 @@ | |||
1 | /* | ||
2 | Copyright (C) 2009 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net | ||
3 | Copyright (c) 2009 Andras Mantia <andras@kdab.net> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License along | ||
16 | with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | #include "objecttreesource.h" | ||
21 | |||
22 | #include <MimeTreeParser/AttachmentStrategy> | ||
23 | #include <MimeTreeParser/BodyPartFormatterBaseFactory> | ||
24 | #include <MimeTreeParser/MessagePart> | ||
25 | #include <MimeTreeParser/MessagePartRenderer> | ||
26 | |||
27 | class ObjectSourcePrivate | ||
28 | { | ||
29 | public: | ||
30 | ObjectSourcePrivate() | ||
31 | : mWriter(0) | ||
32 | , mAllowDecryption(true) | ||
33 | , mHtmlLoadExternal(true) | ||
34 | , mPreferredMode(MimeTreeParser::Util::Html) | ||
35 | { | ||
36 | |||
37 | } | ||
38 | MimeTreeParser::HtmlWriter *mWriter; | ||
39 | MimeTreeParser::BodyPartFormatterBaseFactory mBodyPartFormatterBaseFactory; | ||
40 | bool mAllowDecryption; | ||
41 | bool mHtmlLoadExternal; | ||
42 | MimeTreeParser::Util::HtmlMode mPreferredMode; | ||
43 | }; | ||
44 | |||
45 | ObjectTreeSource::ObjectTreeSource(MimeTreeParser::HtmlWriter *writer) | ||
46 | : MimeTreeParser::Interface::ObjectTreeSource() | ||
47 | , d(new ObjectSourcePrivate) | ||
48 | { | ||
49 | d->mWriter = writer; | ||
50 | } | ||
51 | |||
52 | ObjectTreeSource::~ObjectTreeSource() | ||
53 | { | ||
54 | delete d; | ||
55 | } | ||
56 | |||
57 | void ObjectTreeSource::setAllowDecryption(bool allowDecryption) | ||
58 | { | ||
59 | d->mAllowDecryption = allowDecryption; | ||
60 | } | ||
61 | |||
62 | MimeTreeParser::HtmlWriter *ObjectTreeSource::htmlWriter() | ||
63 | { | ||
64 | return d->mWriter; | ||
65 | } | ||
66 | |||
67 | bool ObjectTreeSource::htmlLoadExternal() const | ||
68 | { | ||
69 | return d->mHtmlLoadExternal; | ||
70 | } | ||
71 | |||
72 | void ObjectTreeSource::setHtmlLoadExternal(bool loadExternal) | ||
73 | { | ||
74 | d->mHtmlLoadExternal = loadExternal; | ||
75 | } | ||
76 | |||
77 | bool ObjectTreeSource::decryptMessage() const | ||
78 | { | ||
79 | return d->mAllowDecryption; | ||
80 | } | ||
81 | |||
82 | bool ObjectTreeSource::showSignatureDetails() const | ||
83 | { | ||
84 | return true; | ||
85 | } | ||
86 | |||
87 | int ObjectTreeSource::levelQuote() const | ||
88 | { | ||
89 | return 1; | ||
90 | } | ||
91 | |||
92 | const QTextCodec *ObjectTreeSource::overrideCodec() | ||
93 | { | ||
94 | return Q_NULLPTR; | ||
95 | } | ||
96 | |||
97 | QString ObjectTreeSource::createMessageHeader(KMime::Message *message) | ||
98 | { | ||
99 | return QString(); | ||
100 | } | ||
101 | |||
102 | const MimeTreeParser::AttachmentStrategy *ObjectTreeSource::attachmentStrategy() | ||
103 | { | ||
104 | return MimeTreeParser::AttachmentStrategy::smart(); | ||
105 | } | ||
106 | |||
107 | QObject *ObjectTreeSource::sourceObject() | ||
108 | { | ||
109 | return Q_NULLPTR; | ||
110 | } | ||
111 | |||
112 | void ObjectTreeSource::setHtmlMode(MimeTreeParser::Util::HtmlMode mode, const QList<MimeTreeParser::Util::HtmlMode> &availableModes) | ||
113 | { | ||
114 | Q_UNUSED(mode); | ||
115 | Q_UNUSED(availableModes); | ||
116 | } | ||
117 | |||
118 | MimeTreeParser::Util::HtmlMode ObjectTreeSource::preferredMode() const | ||
119 | { | ||
120 | return d->mPreferredMode; | ||
121 | } | ||
122 | |||
123 | bool ObjectTreeSource::autoImportKeys() const | ||
124 | { | ||
125 | return false; | ||
126 | } | ||
127 | |||
128 | bool ObjectTreeSource::showEmoticons() const | ||
129 | { | ||
130 | return false; | ||
131 | } | ||
132 | |||
133 | bool ObjectTreeSource::showExpandQuotesMark() const | ||
134 | { | ||
135 | return false; | ||
136 | } | ||
137 | |||
138 | bool ObjectTreeSource::isPrinting() const | ||
139 | { | ||
140 | return false; | ||
141 | } | ||
142 | |||
143 | const MimeTreeParser::BodyPartFormatterBaseFactory *ObjectTreeSource::bodyPartFormatterFactory() | ||
144 | { | ||
145 | return &(d->mBodyPartFormatterBaseFactory); | ||
146 | } | ||
147 | |||
148 | MimeTreeParser::Interface::MessagePartRenderer::Ptr ObjectTreeSource::messagePartTheme(MimeTreeParser::Interface::MessagePart::Ptr msgPart) | ||
149 | { | ||
150 | Q_UNUSED(msgPart); | ||
151 | return MimeTreeParser::Interface::MessagePartRenderer::Ptr(); | ||
152 | } | ||