Changeset View
Changeset View
Standalone View
Standalone View
messageviewer/src/viewer/objecttreeparser.cpp
Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Line(s) | 130 | public: | |||
---|---|---|---|---|---|
140 | { | 140 | { | ||
141 | if (otp) { | 141 | if (otp) { | ||
142 | otp->setCryptoProtocol(protocol); | 142 | otp->setCryptoProtocol(protocol); | ||
143 | } | 143 | } | ||
144 | } | 144 | } | ||
145 | }; | 145 | }; | ||
146 | 146 | | |||
147 | ObjectTreeParser::ObjectTreeParser(const ObjectTreeParser *topLevelParser, | 147 | ObjectTreeParser::ObjectTreeParser(const ObjectTreeParser *topLevelParser, | ||
148 | bool showOnlyOneMimePart, bool keepEncryptions, | 148 | bool showOnlyOneMimePart, | ||
149 | const AttachmentStrategy *strategy) | 149 | const AttachmentStrategy *strategy) | ||
150 | : mSource(topLevelParser->mSource), | 150 | : mSource(topLevelParser->mSource), | ||
151 | mNodeHelper(topLevelParser->mNodeHelper), | 151 | mNodeHelper(topLevelParser->mNodeHelper), | ||
152 | mHtmlWriter(topLevelParser->mHtmlWriter), | 152 | mHtmlWriter(topLevelParser->mHtmlWriter), | ||
153 | mTopLevelContent(topLevelParser->mTopLevelContent), | 153 | mTopLevelContent(topLevelParser->mTopLevelContent), | ||
154 | mCryptoProtocol(topLevelParser->mCryptoProtocol), | 154 | mCryptoProtocol(topLevelParser->mCryptoProtocol), | ||
155 | mShowOnlyOneMimePart(showOnlyOneMimePart), | 155 | mShowOnlyOneMimePart(showOnlyOneMimePart), | ||
156 | mKeepEncryptions(keepEncryptions), | | |||
157 | mHasPendingAsyncJobs(false), | 156 | mHasPendingAsyncJobs(false), | ||
158 | mAllowAsync(topLevelParser->mAllowAsync), | 157 | mAllowAsync(topLevelParser->mAllowAsync), | ||
159 | mAttachmentStrategy(strategy), | 158 | mAttachmentStrategy(strategy), | ||
160 | mPrinting(false) | 159 | mPrinting(false) | ||
161 | { | 160 | { | ||
162 | init(); | 161 | init(); | ||
163 | } | 162 | } | ||
164 | 163 | | |||
165 | ObjectTreeParser::ObjectTreeParser(ObjectTreeSourceIf *source, | 164 | ObjectTreeParser::ObjectTreeParser(ObjectTreeSourceIf *source, | ||
166 | MessageViewer::NodeHelper *nodeHelper, | 165 | MessageViewer::NodeHelper *nodeHelper, | ||
167 | const Kleo::CryptoBackend::Protocol *protocol, | 166 | const Kleo::CryptoBackend::Protocol *protocol, | ||
168 | bool showOnlyOneMimePart, bool keepEncryptions, | 167 | bool showOnlyOneMimePart, | ||
169 | const AttachmentStrategy *strategy) | 168 | const AttachmentStrategy *strategy) | ||
170 | : mSource(source), | 169 | : mSource(source), | ||
171 | mNodeHelper(nodeHelper), | 170 | mNodeHelper(nodeHelper), | ||
172 | mHtmlWriter(0), | 171 | mHtmlWriter(0), | ||
173 | mTopLevelContent(0), | 172 | mTopLevelContent(0), | ||
174 | mCryptoProtocol(protocol), | 173 | mCryptoProtocol(protocol), | ||
175 | mShowOnlyOneMimePart(showOnlyOneMimePart), | 174 | mShowOnlyOneMimePart(showOnlyOneMimePart), | ||
176 | mKeepEncryptions(keepEncryptions), | | |||
177 | mHasPendingAsyncJobs(false), | 175 | mHasPendingAsyncJobs(false), | ||
178 | mAllowAsync(false), | 176 | mAllowAsync(false), | ||
179 | mAttachmentStrategy(strategy), | 177 | mAttachmentStrategy(strategy), | ||
180 | mPrinting(false) | 178 | mPrinting(false) | ||
181 | { | 179 | { | ||
182 | init(); | 180 | init(); | ||
183 | } | 181 | } | ||
184 | 182 | | |||
Show All 14 Lines | |||||
199 | 197 | | |||
200 | ObjectTreeParser::ObjectTreeParser(const ObjectTreeParser &other) | 198 | ObjectTreeParser::ObjectTreeParser(const ObjectTreeParser &other) | ||
201 | : mSource(other.mSource), | 199 | : mSource(other.mSource), | ||
202 | mNodeHelper(other.nodeHelper()), //TODO(Andras) hm, review what happens if mDeleteNodeHelper was true in the source | 200 | mNodeHelper(other.nodeHelper()), //TODO(Andras) hm, review what happens if mDeleteNodeHelper was true in the source | ||
203 | mHtmlWriter(other.mHtmlWriter), | 201 | mHtmlWriter(other.mHtmlWriter), | ||
204 | mTopLevelContent(other.mTopLevelContent), | 202 | mTopLevelContent(other.mTopLevelContent), | ||
205 | mCryptoProtocol(other.cryptoProtocol()), | 203 | mCryptoProtocol(other.cryptoProtocol()), | ||
206 | mShowOnlyOneMimePart(other.showOnlyOneMimePart()), | 204 | mShowOnlyOneMimePart(other.showOnlyOneMimePart()), | ||
207 | mKeepEncryptions(other.keepEncryptions()), | | |||
208 | mHasPendingAsyncJobs(other.hasPendingAsyncJobs()), | 205 | mHasPendingAsyncJobs(other.hasPendingAsyncJobs()), | ||
209 | mAllowAsync(other.allowAsync()), | 206 | mAllowAsync(other.allowAsync()), | ||
210 | mAttachmentStrategy(other.attachmentStrategy()), | 207 | mAttachmentStrategy(other.attachmentStrategy()), | ||
211 | mDeleteNodeHelper(false) // TODO see above | 208 | mDeleteNodeHelper(false) // TODO see above | ||
212 | { | 209 | { | ||
213 | 210 | | |||
214 | } | 211 | } | ||
215 | 212 | | |||
▲ Show 20 Lines • Show All 1007 Lines • ▼ Show 20 Line(s) | |||||
1223 | 1220 | | |||
1224 | bool ObjectTreeParser::processMultiPartEncryptedSubtype(KMime::Content *node, ProcessResult &result) | 1221 | bool ObjectTreeParser::processMultiPartEncryptedSubtype(KMime::Content *node, ProcessResult &result) | ||
1225 | { | 1222 | { | ||
1226 | KMime::Content *child = MessageCore::NodeHelper::firstChild(node); | 1223 | KMime::Content *child = MessageCore::NodeHelper::firstChild(node); | ||
1227 | if (!child) { | 1224 | if (!child) { | ||
1228 | return false; | 1225 | return false; | ||
1229 | } | 1226 | } | ||
1230 | 1227 | | |||
1231 | if (keepEncryptions()) { | | |||
1232 | mNodeHelper->setEncryptionState(node, KMMsgFullyEncrypted); | | |||
1233 | const QByteArray cstr = node->decodedContent(); | | |||
1234 | if (htmlWriter()) { | | |||
1235 | writeBodyString(cstr, NodeHelper::fromAsString(node), | | |||
1236 | codecFor(node), result, false); | | |||
1237 | } | | |||
1238 | return true; | | |||
1239 | } | | |||
1240 | | ||||
1241 | const Kleo::CryptoBackend::Protocol *useThisCryptProto = 0; | 1228 | const Kleo::CryptoBackend::Protocol *useThisCryptProto = 0; | ||
1242 | 1229 | | |||
1243 | /* | 1230 | /* | ||
1244 | ATTENTION: This code is to be replaced by the new 'auto-detect' feature. -------------------------------------- | 1231 | ATTENTION: This code is to be replaced by the new 'auto-detect' feature. -------------------------------------- | ||
1245 | */ | 1232 | */ | ||
1246 | KMime::Content *data = findType(child, "application/octet-stream", false, true); | 1233 | KMime::Content *data = findType(child, "application/octet-stream", false, true); | ||
1247 | if (data) { | 1234 | if (data) { | ||
1248 | useThisCryptProto = Kleo::CryptoBackendFactory::instance()->openpgp(); | 1235 | useThisCryptProto = Kleo::CryptoBackendFactory::instance()->openpgp(); | ||
▲ Show 20 Lines • Show All 1756 Lines • ▼ Show 20 Line(s) | 2991 | { | |||
3005 | return mShowOnlyOneMimePart; | 2992 | return mShowOnlyOneMimePart; | ||
3006 | } | 2993 | } | ||
3007 | 2994 | | |||
3008 | void ObjectTreeParser::setShowOnlyOneMimePart(bool show) | 2995 | void ObjectTreeParser::setShowOnlyOneMimePart(bool show) | ||
3009 | { | 2996 | { | ||
3010 | mShowOnlyOneMimePart = show; | 2997 | mShowOnlyOneMimePart = show; | ||
3011 | } | 2998 | } | ||
3012 | 2999 | | |||
3013 | bool ObjectTreeParser::keepEncryptions() const | | |||
3014 | { | | |||
3015 | return mKeepEncryptions; | | |||
3016 | } | | |||
3017 | | ||||
3018 | void ObjectTreeParser::setKeepEncryptions(bool keep) | | |||
3019 | { | | |||
3020 | mKeepEncryptions = keep; | | |||
3021 | } | | |||
3022 | | ||||
3023 | const AttachmentStrategy *ObjectTreeParser::attachmentStrategy() const | 3000 | const AttachmentStrategy *ObjectTreeParser::attachmentStrategy() const | ||
3024 | { | 3001 | { | ||
3025 | return mAttachmentStrategy; | 3002 | return mAttachmentStrategy; | ||
3026 | } | 3003 | } | ||
3027 | 3004 | | |||
3028 | HtmlWriter *ObjectTreeParser::htmlWriter() const | 3005 | HtmlWriter *ObjectTreeParser::htmlWriter() const | ||
3029 | { | 3006 | { | ||
3030 | if (mHtmlWriter) { | 3007 | if (mHtmlWriter) { | ||
Show All 14 Lines |