diff options
Diffstat (limited to 'framework/src/domain/mime/mimetreeparser/otp/autotests/setupenv.h')
-rw-r--r-- | framework/src/domain/mime/mimetreeparser/otp/autotests/setupenv.h | 170 |
1 files changed, 0 insertions, 170 deletions
diff --git a/framework/src/domain/mime/mimetreeparser/otp/autotests/setupenv.h b/framework/src/domain/mime/mimetreeparser/otp/autotests/setupenv.h deleted file mode 100644 index 78a450ce..00000000 --- a/framework/src/domain/mime/mimetreeparser/otp/autotests/setupenv.h +++ /dev/null | |||
@@ -1,170 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (C) 2010 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com | ||
3 | Copyright (c) 2010 Leo Franchi <lfranchi@kde.org> | ||
4 | |||
5 | This library is free software; you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Library General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, but WITHOUT | ||
11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||
13 | License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Library General Public License | ||
16 | along with this library; see the file COPYING.LIB. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
18 | 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef MESSAGECORE_TESTS_UTIL_H | ||
22 | #define MESSAGECORE_TESTS_UTIL_H | ||
23 | |||
24 | #include <gpgme++/key.h> | ||
25 | #include <attachmentstrategy.h> | ||
26 | #include <bodypartformatter.h> | ||
27 | #include <bodypartformatterbasefactory.h> | ||
28 | #include <objecttreesource.h> | ||
29 | |||
30 | namespace MimeTreeParser | ||
31 | { | ||
32 | |||
33 | namespace Test | ||
34 | { | ||
35 | |||
36 | /** | ||
37 | * setup a environment variables for tests: | ||
38 | * * set LC_ALL to C | ||
39 | * * set KDEHOME | ||
40 | */ | ||
41 | void setupEnv(); | ||
42 | |||
43 | // We can't use EmptySource, since we need to control some emelnets of the source for tests to also test | ||
44 | // loadExternal and htmlMail. | ||
45 | class TestObjectTreeSource : public MimeTreeParser::Interface::ObjectTreeSource | ||
46 | { | ||
47 | public: | ||
48 | TestObjectTreeSource(MimeTreeParser::HtmlWriter *writer) | ||
49 | : mWriter(writer) | ||
50 | , mAttachmentStrategy(QStringLiteral("smart")) | ||
51 | , mPreferredMode(Util::Html) | ||
52 | , mHtmlLoadExternal(false) | ||
53 | , mDecryptMessage(false) | ||
54 | { | ||
55 | } | ||
56 | |||
57 | MimeTreeParser::HtmlWriter *htmlWriter() Q_DECL_OVERRIDE { | ||
58 | return mWriter; | ||
59 | } | ||
60 | |||
61 | bool htmlLoadExternal() const Q_DECL_OVERRIDE | ||
62 | { | ||
63 | return mHtmlLoadExternal; | ||
64 | } | ||
65 | |||
66 | void setHtmlLoadExternal(bool loadExternal) | ||
67 | { | ||
68 | mHtmlLoadExternal = loadExternal; | ||
69 | } | ||
70 | |||
71 | void setAttachmentStrategy(QString strategy) | ||
72 | { | ||
73 | mAttachmentStrategy = strategy; | ||
74 | } | ||
75 | |||
76 | const AttachmentStrategy *attachmentStrategy() Q_DECL_OVERRIDE { | ||
77 | return AttachmentStrategy::create(mAttachmentStrategy); | ||
78 | } | ||
79 | |||
80 | bool autoImportKeys() const Q_DECL_OVERRIDE | ||
81 | { | ||
82 | return true; | ||
83 | } | ||
84 | |||
85 | bool showEmoticons() const Q_DECL_OVERRIDE | ||
86 | { | ||
87 | return false; | ||
88 | } | ||
89 | |||
90 | bool showExpandQuotesMark() const Q_DECL_OVERRIDE | ||
91 | { | ||
92 | return false; | ||
93 | } | ||
94 | |||
95 | const BodyPartFormatterBaseFactory *bodyPartFormatterFactory() Q_DECL_OVERRIDE { | ||
96 | return &mBodyPartFormatterBaseFactory; | ||
97 | } | ||
98 | |||
99 | bool decryptMessage() const Q_DECL_OVERRIDE | ||
100 | { | ||
101 | return mDecryptMessage; | ||
102 | } | ||
103 | |||
104 | void setAllowDecryption(bool allowDecryption) | ||
105 | { | ||
106 | mDecryptMessage = allowDecryption; | ||
107 | } | ||
108 | |||
109 | void setShowSignatureDetails(bool showSignatureDetails) | ||
110 | { | ||
111 | mShowSignatureDetails = showSignatureDetails; | ||
112 | } | ||
113 | |||
114 | bool showSignatureDetails() const Q_DECL_OVERRIDE | ||
115 | { | ||
116 | return mShowSignatureDetails; | ||
117 | } | ||
118 | |||
119 | void setHtmlMode(MimeTreeParser::Util::HtmlMode mode, const QList<MimeTreeParser::Util::HtmlMode> &availableModes) Q_DECL_OVERRIDE { | ||
120 | Q_UNUSED(mode); | ||
121 | Q_UNUSED(availableModes); | ||
122 | } | ||
123 | |||
124 | MimeTreeParser::Util::HtmlMode preferredMode() const Q_DECL_OVERRIDE | ||
125 | { | ||
126 | return mPreferredMode; | ||
127 | } | ||
128 | |||
129 | void setPreferredMode(MimeTreeParser::Util::HtmlMode mode) | ||
130 | { | ||
131 | mPreferredMode = mode; | ||
132 | } | ||
133 | |||
134 | int levelQuote() const Q_DECL_OVERRIDE | ||
135 | { | ||
136 | return 1; | ||
137 | } | ||
138 | |||
139 | const QTextCodec *overrideCodec() Q_DECL_OVERRIDE { | ||
140 | return nullptr; | ||
141 | } | ||
142 | |||
143 | QString createMessageHeader(KMime::Message *message) Q_DECL_OVERRIDE { | ||
144 | Q_UNUSED(message); | ||
145 | return QString(); //do nothing | ||
146 | } | ||
147 | |||
148 | QObject *sourceObject() Q_DECL_OVERRIDE { | ||
149 | return nullptr; | ||
150 | } | ||
151 | |||
152 | bool isPrinting() const Q_DECL_OVERRIDE | ||
153 | { | ||
154 | return false; | ||
155 | } | ||
156 | private: | ||
157 | MimeTreeParser::HtmlWriter *mWriter; | ||
158 | QString mAttachmentStrategy; | ||
159 | BodyPartFormatterBaseFactory mBodyPartFormatterBaseFactory; | ||
160 | MimeTreeParser::Util::HtmlMode mPreferredMode; | ||
161 | bool mHtmlLoadExternal; | ||
162 | bool mDecryptMessage; | ||
163 | bool mShowSignatureDetails; | ||
164 | }; | ||
165 | |||
166 | } | ||
167 | |||
168 | } | ||
169 | |||
170 | #endif | ||