summaryrefslogtreecommitdiffstats
path: root/framework/domain/mimetreeparser/objecttreesource.cpp
diff options
context:
space:
mode:
authorSandro Knauß <sknauss@kde.org>2016-07-18 15:35:07 +0200
committerSandro Knauß <sknauss@kde.org>2016-07-19 09:26:49 +0200
commit2fdddd2f795da4645dc9a48fee4865324143a21b (patch)
treee4127945653e9ead83d3cf7eab9ed507bbeb8470 /framework/domain/mimetreeparser/objecttreesource.cpp
parent7815e94c52d092701804521eee850ac35d7f7781 (diff)
downloadkube-2fdddd2f795da4645dc9a48fee4865324143a21b.tar.gz
kube-2fdddd2f795da4645dc9a48fee4865324143a21b.zip
first tests with mimetreeparser interface
Diffstat (limited to 'framework/domain/mimetreeparser/objecttreesource.cpp')
-rw-r--r--framework/domain/mimetreeparser/objecttreesource.cpp151
1 files changed, 151 insertions, 0 deletions
diff --git a/framework/domain/mimetreeparser/objecttreesource.cpp b/framework/domain/mimetreeparser/objecttreesource.cpp
new file mode 100644
index 00000000..12cf88ab
--- /dev/null
+++ b/framework/domain/mimetreeparser/objecttreesource.cpp
@@ -0,0 +1,151 @@
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
27class ObjectSourcePrivate
28{
29public:
30 ObjectSourcePrivate()
31 : mWriter(0)
32 , mAllowDecryption(true)
33 , mHtmlLoadExternal(true)
34 , mHtmlMail(true)
35 {
36
37 }
38 MimeTreeParser::HtmlWriter *mWriter;
39 MimeTreeParser::BodyPartFormatterBaseFactory mBodyPartFormatterBaseFactory;
40 bool mAllowDecryption;
41 bool mHtmlLoadExternal;
42 bool mHtmlMail;
43};
44
45ObjectTreeSource::ObjectTreeSource(MimeTreeParser::HtmlWriter *writer)
46 : MimeTreeParser::Interface::ObjectTreeSource()
47 , d(new ObjectSourcePrivate)
48 {
49 d->mWriter = writer;
50 }
51
52ObjectTreeSource::~ObjectTreeSource()
53{
54 delete d;
55}
56
57void ObjectTreeSource::setAllowDecryption(bool allowDecryption)
58{
59 d->mAllowDecryption = allowDecryption;
60}
61
62MimeTreeParser::HtmlWriter *ObjectTreeSource::htmlWriter()
63{
64 return d->mWriter;
65}
66
67bool ObjectTreeSource::htmlLoadExternal() const
68{
69 return d->mHtmlLoadExternal;
70}
71
72void ObjectTreeSource::setHtmlLoadExternal(bool loadExternal)
73{
74 d->mHtmlLoadExternal = loadExternal;
75}
76
77bool ObjectTreeSource::htmlMail() const
78{
79 return d->mHtmlMail;
80}
81
82void ObjectTreeSource::setHtmlMail(bool htmlMail)
83{
84 d->mHtmlMail = htmlMail;
85}
86
87bool ObjectTreeSource::decryptMessage() const
88{
89 return d->mAllowDecryption;
90}
91
92bool ObjectTreeSource::showSignatureDetails() const
93{
94 return true;
95}
96
97int ObjectTreeSource::levelQuote() const
98{
99 return 1;
100}
101
102const QTextCodec *ObjectTreeSource::overrideCodec()
103{
104 return Q_NULLPTR;
105}
106
107QString ObjectTreeSource::createMessageHeader(KMime::Message *message)
108{
109 return QString();
110}
111
112const MimeTreeParser::AttachmentStrategy *ObjectTreeSource::attachmentStrategy()
113{
114 return MimeTreeParser::AttachmentStrategy::smart();
115}
116
117QObject *ObjectTreeSource::sourceObject()
118{
119 return Q_NULLPTR;
120}
121
122void ObjectTreeSource::setHtmlMode(MimeTreeParser::Util::HtmlMode mode)
123{
124 Q_UNUSED(mode);
125}
126
127bool ObjectTreeSource::autoImportKeys() const
128{
129 return false;
130}
131
132bool ObjectTreeSource::showEmoticons() const
133{
134 return false;
135}
136
137bool ObjectTreeSource::showExpandQuotesMark() const
138{
139 return false;
140}
141
142const MimeTreeParser::BodyPartFormatterBaseFactory *ObjectTreeSource::bodyPartFormatterFactory()
143{
144 return &(d->mBodyPartFormatterBaseFactory);
145}
146
147MimeTreeParser::Interface::MessagePartRenderer::Ptr ObjectTreeSource::messagePartTheme(MimeTreeParser::Interface::MessagePart::Ptr msgPart)
148{
149 Q_UNUSED(msgPart);
150 return MimeTreeParser::Interface::MessagePartRenderer::Ptr();
151}