diff options
author | Sandro Knauß <sknauss@kde.org> | 2016-08-02 18:14:00 +0200 |
---|---|---|
committer | Sandro Knauß <sknauss@kde.org> | 2016-08-02 18:14:00 +0200 |
commit | 92d6fbd8f6a504da869454ca85f861e30c89a73c (patch) | |
tree | 99c7d66317659e129e2ed67f14d8f3a7006368c2 | |
parent | 2d0608ddf1b84991ca7a693ce00e70b6447644d9 (diff) | |
download | kube-92d6fbd8f6a504da869454ca85f861e30c89a73c.tar.gz kube-92d6fbd8f6a504da869454ca85f861e30c89a73c.zip |
make signs & encrytiopn work
-rw-r--r-- | framework/domain/mimetreeparser/interface.cpp | 204 | ||||
-rw-r--r-- | framework/domain/mimetreeparser/interface.h | 34 | ||||
-rw-r--r-- | framework/domain/mimetreeparser/tests/interfacetest.cpp | 12 |
3 files changed, 224 insertions, 26 deletions
diff --git a/framework/domain/mimetreeparser/interface.cpp b/framework/domain/mimetreeparser/interface.cpp index 04f0fdf2..d6354c9e 100644 --- a/framework/domain/mimetreeparser/interface.cpp +++ b/framework/domain/mimetreeparser/interface.cpp | |||
@@ -122,10 +122,21 @@ public: | |||
122 | void createMailMime(const MimeTreeParser::TextMessagePart::Ptr &part); | 122 | void createMailMime(const MimeTreeParser::TextMessagePart::Ptr &part); |
123 | void createMailMime(const MimeTreeParser::AlternativeMessagePart::Ptr &part); | 123 | void createMailMime(const MimeTreeParser::AlternativeMessagePart::Ptr &part); |
124 | void createMailMime(const MimeTreeParser::HtmlMessagePart::Ptr &part); | 124 | void createMailMime(const MimeTreeParser::HtmlMessagePart::Ptr &part); |
125 | |||
126 | void appendEncryption(const MimeTreeParser::EncryptedMessagePart::Ptr &part); | ||
127 | void appendSignature(const MimeTreeParser::SignedMessagePart::Ptr &part); | ||
128 | |||
129 | void setSignatures(const QVector<Signature::Ptr> &sigs); | ||
130 | void setEncryptions(const QVector<Encryption::Ptr> &encs); | ||
131 | |||
132 | const QVector<Encryption::Ptr> &encryptions() const; | ||
133 | const QVector<Signature::Ptr> &signatures() const; | ||
125 | private: | 134 | private: |
126 | Part *q; | 135 | Part *q; |
127 | Part *mParent; | 136 | Part *mParent; |
128 | QVector<Part::Ptr> mSubParts; | 137 | QVector<Part::Ptr> mSubParts; |
138 | QVector<Encryption::Ptr> mEncryptions; | ||
139 | QVector<Signature::Ptr> mSignatures; | ||
129 | MailMime::Ptr mMailMime; | 140 | MailMime::Ptr mMailMime; |
130 | }; | 141 | }; |
131 | 142 | ||
@@ -166,6 +177,27 @@ void PartPrivate::appendSubPart(Part::Ptr subpart) | |||
166 | mSubParts.append(subpart); | 177 | mSubParts.append(subpart); |
167 | } | 178 | } |
168 | 179 | ||
180 | void PartPrivate::appendEncryption(const MimeTreeParser::EncryptedMessagePart::Ptr& part) | ||
181 | { | ||
182 | mEncryptions.append(Encryption::Ptr(new Encryption)); | ||
183 | } | ||
184 | |||
185 | void PartPrivate::setEncryptions(const QVector< Encryption::Ptr >& encs) | ||
186 | { | ||
187 | mEncryptions = encs; | ||
188 | } | ||
189 | |||
190 | void PartPrivate::appendSignature(const MimeTreeParser::SignedMessagePart::Ptr& part) | ||
191 | { | ||
192 | mSignatures.append(Signature::Ptr(new Signature)); | ||
193 | } | ||
194 | |||
195 | |||
196 | void PartPrivate::setSignatures(const QVector< Signature::Ptr >& sigs) | ||
197 | { | ||
198 | mSignatures = sigs; | ||
199 | } | ||
200 | |||
169 | Part *PartPrivate::parent() const | 201 | Part *PartPrivate::parent() const |
170 | { | 202 | { |
171 | return mParent; | 203 | return mParent; |
@@ -181,6 +213,16 @@ const MailMime::Ptr& PartPrivate::mailMime() const | |||
181 | return mMailMime; | 213 | return mMailMime; |
182 | } | 214 | } |
183 | 215 | ||
216 | const QVector< Encryption::Ptr >& PartPrivate::encryptions() const | ||
217 | { | ||
218 | return mEncryptions; | ||
219 | } | ||
220 | |||
221 | const QVector< Signature::Ptr >& PartPrivate::signatures() const | ||
222 | { | ||
223 | return mSignatures; | ||
224 | } | ||
225 | |||
184 | Part::Part() | 226 | Part::Part() |
185 | : d(std::unique_ptr<PartPrivate>(new PartPrivate(this))) | 227 | : d(std::unique_ptr<PartPrivate>(new PartPrivate(this))) |
186 | { | 228 | { |
@@ -217,24 +259,24 @@ QVector<Content::Ptr> Part::content(const QByteArray& ct) const | |||
217 | return QVector<Content::Ptr>(); | 259 | return QVector<Content::Ptr>(); |
218 | } | 260 | } |
219 | 261 | ||
220 | QVector<Encryption> Part::encryptions() const | 262 | QVector<Encryption::Ptr> Part::encryptions() const |
221 | { | 263 | { |
264 | auto ret = d->encryptions(); | ||
222 | auto parent = d->parent(); | 265 | auto parent = d->parent(); |
223 | if (parent) { | 266 | if (parent) { |
224 | return parent->encryptions(); | 267 | ret.append(parent->encryptions()); |
225 | } else { | ||
226 | return QVector<Encryption>(); | ||
227 | } | 268 | } |
269 | return ret; | ||
228 | } | 270 | } |
229 | 271 | ||
230 | QVector<Signature> Part::signatures() const | 272 | QVector<Signature::Ptr> Part::signatures() const |
231 | { | 273 | { |
274 | auto ret = d->signatures(); | ||
232 | auto parent = d->parent(); | 275 | auto parent = d->parent(); |
233 | if (parent) { | 276 | if (parent) { |
234 | return parent->signatures(); | 277 | ret.append(parent->signatures()); |
235 | } else { | ||
236 | return QVector<Signature>(); | ||
237 | } | 278 | } |
279 | return ret; | ||
238 | } | 280 | } |
239 | 281 | ||
240 | MailMime::Ptr Part::mailMime() const | 282 | MailMime::Ptr Part::mailMime() const |
@@ -250,8 +292,23 @@ public: | |||
250 | Part *mParent; | 292 | Part *mParent; |
251 | Content *q; | 293 | Content *q; |
252 | MailMime::Ptr mMailMime; | 294 | MailMime::Ptr mMailMime; |
295 | QVector<Encryption::Ptr> mEncryptions; | ||
296 | QVector<Signature::Ptr> mSignatures; | ||
297 | void appendSignature(const MimeTreeParser::SignedMessagePart::Ptr &sig); | ||
298 | void appendEncryption(const MimeTreeParser::EncryptedMessagePart::Ptr &enc); | ||
253 | }; | 299 | }; |
254 | 300 | ||
301 | void ContentPrivate::appendEncryption(const MimeTreeParser::EncryptedMessagePart::Ptr& enc) | ||
302 | { | ||
303 | mEncryptions.append(Encryption::Ptr(new Encryption)); | ||
304 | } | ||
305 | |||
306 | void ContentPrivate::appendSignature(const MimeTreeParser::SignedMessagePart::Ptr& sig) | ||
307 | { | ||
308 | mSignatures.append(Signature::Ptr(new Signature)); | ||
309 | } | ||
310 | |||
311 | |||
255 | Content::Content(const QByteArray& content, Part *parent) | 312 | Content::Content(const QByteArray& content, Part *parent) |
256 | : d(std::unique_ptr<ContentPrivate>(new ContentPrivate)) | 313 | : d(std::unique_ptr<ContentPrivate>(new ContentPrivate)) |
257 | { | 314 | { |
@@ -261,24 +318,32 @@ Content::Content(const QByteArray& content, Part *parent) | |||
261 | d->mParent = parent; | 318 | d->mParent = parent; |
262 | } | 319 | } |
263 | 320 | ||
321 | Content::Content(ContentPrivate* d_ptr) | ||
322 | : d(std::unique_ptr<ContentPrivate>(d_ptr)) | ||
323 | { | ||
324 | d->q = this; | ||
325 | } | ||
326 | |||
264 | Content::~Content() | 327 | Content::~Content() |
265 | { | 328 | { |
266 | } | 329 | } |
267 | 330 | ||
268 | QVector<Encryption> Content::encryptions() const | 331 | QVector<Encryption::Ptr> Content::encryptions() const |
269 | { | 332 | { |
333 | auto ret = d->mEncryptions; | ||
270 | if (d->mParent) { | 334 | if (d->mParent) { |
271 | return d->mParent->encryptions(); | 335 | ret.append(d->mParent->encryptions()); |
272 | } | 336 | } |
273 | return QVector<Encryption>(); | 337 | return ret; |
274 | } | 338 | } |
275 | 339 | ||
276 | QVector<Signature> Content::signatures() const | 340 | QVector<Signature::Ptr> Content::signatures() const |
277 | { | 341 | { |
342 | auto ret = d->mSignatures; | ||
278 | if (d->mParent) { | 343 | if (d->mParent) { |
279 | return d->mParent->signatures(); | 344 | ret.append(d->mParent->signatures()); |
280 | } | 345 | } |
281 | return QVector<Signature>(); | 346 | return ret; |
282 | } | 347 | } |
283 | 348 | ||
284 | QByteArray Content::content() const | 349 | QByteArray Content::content() const |
@@ -327,6 +392,19 @@ PlainTextContent::PlainTextContent(const QByteArray& content, Part* parent) | |||
327 | 392 | ||
328 | } | 393 | } |
329 | 394 | ||
395 | PlainTextContent::PlainTextContent(ContentPrivate* d_ptr) | ||
396 | : Content(d_ptr) | ||
397 | { | ||
398 | |||
399 | } | ||
400 | |||
401 | HtmlContent::HtmlContent(ContentPrivate* d_ptr) | ||
402 | : Content(d_ptr) | ||
403 | { | ||
404 | |||
405 | } | ||
406 | |||
407 | |||
330 | QByteArray PlainTextContent::type() const | 408 | QByteArray PlainTextContent::type() const |
331 | { | 409 | { |
332 | return "PlainTextContent"; | 410 | return "PlainTextContent"; |
@@ -417,7 +495,23 @@ void SinglePartPrivate::fillFrom(MimeTreeParser::TextMessagePart::Ptr part) | |||
417 | mType = "plaintext"; | 495 | mType = "plaintext"; |
418 | mContent.clear(); | 496 | mContent.clear(); |
419 | foreach (const auto &mp, part->subParts()) { | 497 | foreach (const auto &mp, part->subParts()) { |
420 | mContent.append(std::make_shared<PlainTextContent>(mp->text().toLocal8Bit(), q)); | 498 | auto d_ptr = new ContentPrivate; |
499 | d_ptr->mContent = part->text().toLocal8Bit(); | ||
500 | d_ptr->mParent = q; | ||
501 | d_ptr->mCodec = "utf-8"; | ||
502 | const auto enc = mp.dynamicCast<MimeTreeParser::EncryptedMessagePart>(); | ||
503 | auto sig = mp.dynamicCast<MimeTreeParser::SignedMessagePart>(); | ||
504 | if (enc) { | ||
505 | d_ptr->appendEncryption(enc); | ||
506 | const auto s = enc->subParts(); | ||
507 | if (s.size() == 1) { | ||
508 | sig = s[0].dynamicCast<MimeTreeParser::SignedMessagePart>(); | ||
509 | } | ||
510 | } | ||
511 | if (sig) { | ||
512 | d_ptr->appendSignature(sig); | ||
513 | } | ||
514 | mContent.append(std::make_shared<PlainTextContent>(d_ptr)); | ||
421 | q->reachParentD()->createMailMime(part); | 515 | q->reachParentD()->createMailMime(part); |
422 | } | 516 | } |
423 | } | 517 | } |
@@ -472,6 +566,54 @@ PartPrivate* SinglePart::reachParentD() const | |||
472 | return Part::d.get(); | 566 | return Part::d.get(); |
473 | } | 567 | } |
474 | 568 | ||
569 | class SignaturePrivate | ||
570 | { | ||
571 | public: | ||
572 | Signature *q; | ||
573 | }; | ||
574 | |||
575 | Signature::Signature() | ||
576 | :d(std::unique_ptr<SignaturePrivate>(new SignaturePrivate)) | ||
577 | { | ||
578 | d->q = this; | ||
579 | } | ||
580 | |||
581 | |||
582 | Signature::Signature(SignaturePrivate *d_ptr) | ||
583 | :d(std::unique_ptr<SignaturePrivate>(d_ptr)) | ||
584 | { | ||
585 | d->q = this; | ||
586 | } | ||
587 | |||
588 | Signature::~Signature() | ||
589 | { | ||
590 | |||
591 | } | ||
592 | |||
593 | |||
594 | class EncryptionPrivate | ||
595 | { | ||
596 | public: | ||
597 | Encryption *q; | ||
598 | }; | ||
599 | |||
600 | Encryption::Encryption(EncryptionPrivate *d_ptr) | ||
601 | :d(std::unique_ptr<EncryptionPrivate>(d_ptr)) | ||
602 | { | ||
603 | d->q = this; | ||
604 | } | ||
605 | |||
606 | Encryption::Encryption() | ||
607 | :d(std::unique_ptr<EncryptionPrivate>(new EncryptionPrivate)) | ||
608 | { | ||
609 | d->q = this; | ||
610 | } | ||
611 | |||
612 | Encryption::~Encryption() | ||
613 | { | ||
614 | |||
615 | } | ||
616 | |||
475 | ParserPrivate::ParserPrivate(Parser* parser) | 617 | ParserPrivate::ParserPrivate(Parser* parser) |
476 | : q(parser) | 618 | : q(parser) |
477 | , mNodeHelper(std::make_shared<MimeTreeParser::NodeHelper>()) | 619 | , mNodeHelper(std::make_shared<MimeTreeParser::NodeHelper>()) |
@@ -513,21 +655,43 @@ void ParserPrivate::createTree(const MimeTreeParser::MessagePart::Ptr &start, co | |||
513 | if (attachment) { | 655 | if (attachment) { |
514 | auto part = std::make_shared<SinglePart>(); | 656 | auto part = std::make_shared<SinglePart>(); |
515 | part->d->fillFrom(attachment); | 657 | part->d->fillFrom(attachment); |
516 | mTree->d->appendSubPart(part); | 658 | tree->d->appendSubPart(part); |
517 | } else if (text) { | 659 | } else if (text) { |
518 | auto part = std::make_shared<SinglePart>(); | 660 | auto part = std::make_shared<SinglePart>(); |
519 | part->d->fillFrom(text); | 661 | part->d->fillFrom(text); |
520 | mTree->d->appendSubPart(part); | 662 | tree->d->appendSubPart(part); |
521 | } else if (alternative) { | 663 | } else if (alternative) { |
522 | auto part = std::make_shared<AlternativePart>(); | 664 | auto part = std::make_shared<AlternativePart>(); |
523 | part->d->fillFrom(alternative); | 665 | part->d->fillFrom(alternative); |
524 | mTree->d->appendSubPart(part); | 666 | tree->d->appendSubPart(part); |
525 | } else if (html) { | 667 | } else if (html) { |
526 | auto part = std::make_shared<SinglePart>(); | 668 | auto part = std::make_shared<SinglePart>(); |
527 | part->d->fillFrom(html); | 669 | part->d->fillFrom(html); |
528 | mTree->d->appendSubPart(part); | 670 | tree->d->appendSubPart(part); |
529 | } else { | 671 | } else { |
530 | createTree(m, tree); | 672 | const auto enc = mp.dynamicCast<MimeTreeParser::EncryptedMessagePart>(); |
673 | const auto sig = mp.dynamicCast<MimeTreeParser::SignedMessagePart>(); | ||
674 | if (enc || sig) { | ||
675 | auto subTree = std::make_shared<Part>(); | ||
676 | if (enc) { | ||
677 | subTree->d->appendEncryption(enc); | ||
678 | } | ||
679 | if (sig) { | ||
680 | subTree->d->appendSignature(sig); | ||
681 | } | ||
682 | createTree(m, subTree); | ||
683 | foreach(const auto &p, subTree->subParts()) { | ||
684 | tree->d->appendSubPart(p); | ||
685 | if (enc) { | ||
686 | p->d->setEncryptions(subTree->d->encryptions()); | ||
687 | } | ||
688 | if (sig) { | ||
689 | p->d->setSignatures(subTree->d->signatures()); | ||
690 | } | ||
691 | } | ||
692 | } else { | ||
693 | createTree(m, tree); | ||
694 | } | ||
531 | } | 695 | } |
532 | } | 696 | } |
533 | } | 697 | } |
diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index a6a7f39d..a482a824 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h | |||
@@ -54,7 +54,12 @@ class EncryptionError; | |||
54 | 54 | ||
55 | class Key; | 55 | class Key; |
56 | class Signature; | 56 | class Signature; |
57 | class SignaturePrivate; | ||
57 | class Encryption; | 58 | class Encryption; |
59 | class EncryptionPrivate; | ||
60 | |||
61 | typedef std::shared_ptr<Signature> SignaturePtr; | ||
62 | typedef std::shared_ptr<Encryption> EncryptionPtr; | ||
58 | 63 | ||
59 | class Parser; | 64 | class Parser; |
60 | class ParserPrivate; | 65 | class ParserPrivate; |
@@ -109,6 +114,7 @@ class Content | |||
109 | public: | 114 | public: |
110 | typedef std::shared_ptr<Content> Ptr; | 115 | typedef std::shared_ptr<Content> Ptr; |
111 | Content(const QByteArray &content, Part *parent); | 116 | Content(const QByteArray &content, Part *parent); |
117 | Content(ContentPrivate *d_ptr); | ||
112 | virtual ~Content(); | 118 | virtual ~Content(); |
113 | 119 | ||
114 | QByteArray content() const; | 120 | QByteArray content() const; |
@@ -121,8 +127,8 @@ public: | |||
121 | // overwrite default charset with given charset | 127 | // overwrite default charset with given charset |
122 | QString encodedContent(QByteArray charset) const; | 128 | QString encodedContent(QByteArray charset) const; |
123 | 129 | ||
124 | virtual QVector<Signature> signatures() const; | 130 | QVector<SignaturePtr> signatures() const; |
125 | virtual QVector<Encryption> encryptions() const; | 131 | QVector<EncryptionPtr> encryptions() const; |
126 | MailMime::Ptr mailMime() const; | 132 | MailMime::Ptr mailMime() const; |
127 | virtual QByteArray type() const; | 133 | virtual QByteArray type() const; |
128 | Part* parent() const; | 134 | Part* parent() const; |
@@ -134,6 +140,7 @@ class PlainTextContent : public Content | |||
134 | { | 140 | { |
135 | public: | 141 | public: |
136 | PlainTextContent(const QByteArray &content, Part *parent); | 142 | PlainTextContent(const QByteArray &content, Part *parent); |
143 | PlainTextContent(ContentPrivate *d_ptr); | ||
137 | QByteArray type() const Q_DECL_OVERRIDE; | 144 | QByteArray type() const Q_DECL_OVERRIDE; |
138 | }; | 145 | }; |
139 | 146 | ||
@@ -141,6 +148,7 @@ class HtmlContent : public Content | |||
141 | { | 148 | { |
142 | public: | 149 | public: |
143 | HtmlContent(const QByteArray &content, Part *parent); | 150 | HtmlContent(const QByteArray &content, Part *parent); |
151 | HtmlContent(ContentPrivate* d_ptr); | ||
144 | QByteArray type() const Q_DECL_OVERRIDE; | 152 | QByteArray type() const Q_DECL_OVERRIDE; |
145 | }; | 153 | }; |
146 | 154 | ||
@@ -171,9 +179,8 @@ public: | |||
171 | int keyLength() const; | 179 | int keyLength() const; |
172 | 180 | ||
173 | private: | 181 | private: |
174 | std::unique_ptr<CertContentPrivate> d; | 182 | std::unique_ptr<CertContentPrivate> d; |
175 | }; | 183 | }; |
176 | |||
177 | class Part | 184 | class Part |
178 | { | 185 | { |
179 | public: | 186 | public: |
@@ -189,8 +196,8 @@ public: | |||
189 | QVector<Part::Ptr> subParts() const; | 196 | QVector<Part::Ptr> subParts() const; |
190 | Part *parent() const; | 197 | Part *parent() const; |
191 | 198 | ||
192 | virtual QVector<Signature> signatures() const; | 199 | QVector<SignaturePtr> signatures() const; |
193 | virtual QVector<Encryption> encryptions() const; | 200 | QVector<EncryptionPtr> encryptions() const; |
194 | virtual MailMime::Ptr mailMime() const; | 201 | virtual MailMime::Ptr mailMime() const; |
195 | protected: | 202 | protected: |
196 | std::unique_ptr<PartPrivate> d; | 203 | std::unique_ptr<PartPrivate> d; |
@@ -298,12 +305,20 @@ class Key | |||
298 | 305 | ||
299 | class Signature | 306 | class Signature |
300 | { | 307 | { |
308 | public: | ||
309 | typedef std::shared_ptr<Signature> Ptr; | ||
310 | Signature(); | ||
311 | Signature(SignaturePrivate *); | ||
312 | ~Signature(); | ||
313 | |||
301 | Key key() const; | 314 | Key key() const; |
302 | QDateTime creationDateTime() const; | 315 | QDateTime creationDateTime() const; |
303 | QDateTime expirationTime() const; | 316 | QDateTime expirationTime() const; |
304 | bool neverExpires() const; | 317 | bool neverExpires() const; |
305 | 318 | ||
306 | //template <> StatusObject<SignatureVerificationResult> verify() const; | 319 | //template <> StatusObject<SignatureVerificationResult> verify() const; |
320 | private: | ||
321 | std::unique_ptr<SignaturePrivate> d; | ||
307 | }; | 322 | }; |
308 | 323 | ||
309 | /* | 324 | /* |
@@ -313,7 +328,14 @@ class Signature | |||
313 | */ | 328 | */ |
314 | class Encryption | 329 | class Encryption |
315 | { | 330 | { |
331 | public: | ||
332 | typedef std::shared_ptr<Encryption> Ptr; | ||
333 | Encryption(); | ||
334 | Encryption(EncryptionPrivate *); | ||
335 | ~Encryption(); | ||
316 | std::vector<Key> recipients() const; | 336 | std::vector<Key> recipients() const; |
337 | private: | ||
338 | std::unique_ptr<EncryptionPrivate> d; | ||
317 | }; | 339 | }; |
318 | 340 | ||
319 | class Parser | 341 | class Parser |
diff --git a/framework/domain/mimetreeparser/tests/interfacetest.cpp b/framework/domain/mimetreeparser/tests/interfacetest.cpp index fb073fc1..ac77b025 100644 --- a/framework/domain/mimetreeparser/tests/interfacetest.cpp +++ b/framework/domain/mimetreeparser/tests/interfacetest.cpp | |||
@@ -145,6 +145,8 @@ private slots: | |||
145 | QCOMPARE(contentList.size(), 1); | 145 | QCOMPARE(contentList.size(), 1); |
146 | QCOMPARE(contentList[0]->content(), QStringLiteral("The quick brown fox jumped over the lazy dog.").toLocal8Bit()); | 146 | QCOMPARE(contentList[0]->content(), QStringLiteral("The quick brown fox jumped over the lazy dog.").toLocal8Bit()); |
147 | QCOMPARE(contentList[0]->charset(), QStringLiteral("utf-8").toLocal8Bit()); | 147 | QCOMPARE(contentList[0]->charset(), QStringLiteral("utf-8").toLocal8Bit()); |
148 | QCOMPARE(contentList[0]->encryptions().size(), 1); | ||
149 | QCOMPARE(contentList[0]->signatures().size(), 0); | ||
148 | auto contentAttachmentList = parser.collectAttachmentParts(); | 150 | auto contentAttachmentList = parser.collectAttachmentParts(); |
149 | QCOMPARE(contentAttachmentList.size(), 0); | 151 | QCOMPARE(contentAttachmentList.size(), 0); |
150 | } | 152 | } |
@@ -162,12 +164,18 @@ private slots: | |||
162 | QCOMPARE(contentList.size(), 1); | 164 | QCOMPARE(contentList.size(), 1); |
163 | QCOMPARE(contentList[0]->content(), QStringLiteral("test text").toLocal8Bit()); | 165 | QCOMPARE(contentList[0]->content(), QStringLiteral("test text").toLocal8Bit()); |
164 | QCOMPARE(contentList[0]->charset(), QStringLiteral("utf-8").toLocal8Bit()); | 166 | QCOMPARE(contentList[0]->charset(), QStringLiteral("utf-8").toLocal8Bit()); |
167 | QCOMPARE(contentList[0]->encryptions().size(), 1); | ||
168 | QCOMPARE(contentList[0]->signatures().size(), 1); | ||
165 | auto contentAttachmentList = parser.collectAttachmentParts(); | 169 | auto contentAttachmentList = parser.collectAttachmentParts(); |
166 | QCOMPARE(contentAttachmentList.size(), 2); | 170 | QCOMPARE(contentAttachmentList.size(), 2); |
167 | QCOMPARE(contentAttachmentList[0]->availableContents(), QVector<QByteArray>() << "text/plain"); | 171 | QCOMPARE(contentAttachmentList[0]->availableContents(), QVector<QByteArray>() << "text/plain"); |
168 | QCOMPARE(contentAttachmentList[0]->content().size(), 1); | 172 | QCOMPARE(contentAttachmentList[0]->content().size(), 1); |
173 | QCOMPARE(contentAttachmentList[0]->encryptions().size(), 1); | ||
174 | QCOMPARE(contentAttachmentList[0]->signatures().size(), 1); | ||
169 | QCOMPARE(contentAttachmentList[1]->availableContents(), QVector<QByteArray>() << "image/png"); | 175 | QCOMPARE(contentAttachmentList[1]->availableContents(), QVector<QByteArray>() << "image/png"); |
170 | QCOMPARE(contentAttachmentList[1]->content().size(), 1); | 176 | QCOMPARE(contentAttachmentList[1]->content().size(), 1); |
177 | QCOMPARE(contentAttachmentList[1]->encryptions().size(), 0); | ||
178 | QCOMPARE(contentAttachmentList[1]->signatures().size(), 0); | ||
171 | } | 179 | } |
172 | 180 | ||
173 | void testOpenPPGInline() | 181 | void testOpenPPGInline() |
@@ -179,10 +187,14 @@ private slots: | |||
179 | auto contentPart = contentPartList[0]; | 187 | auto contentPart = contentPartList[0]; |
180 | QVERIFY((bool)contentPart); | 188 | QVERIFY((bool)contentPart); |
181 | QCOMPARE(contentPart->availableContents(), QVector<QByteArray>() << "plaintext"); | 189 | QCOMPARE(contentPart->availableContents(), QVector<QByteArray>() << "plaintext"); |
190 | QCOMPARE(contentPart->encryptions().size(), 0); | ||
191 | QCOMPARE(contentPart->signatures().size(), 0); | ||
182 | auto contentList = contentPart->content("plaintext"); | 192 | auto contentList = contentPart->content("plaintext"); |
183 | QCOMPARE(contentList.size(), 1); | 193 | QCOMPARE(contentList.size(), 1); |
184 | QCOMPARE(contentList[0]->content(), QStringLiteral("asdasd asd asd asdf sadf sdaf sadf äöü").toLocal8Bit()); | 194 | QCOMPARE(contentList[0]->content(), QStringLiteral("asdasd asd asd asdf sadf sdaf sadf äöü").toLocal8Bit()); |
185 | QCOMPARE(contentList[0]->charset(), QStringLiteral("utf-8").toLocal8Bit()); | 195 | QCOMPARE(contentList[0]->charset(), QStringLiteral("utf-8").toLocal8Bit()); |
196 | QCOMPARE(contentList[0]->encryptions().size(), 1); | ||
197 | QCOMPARE(contentList[0]->signatures().size(), 1); | ||
186 | auto contentAttachmentList = parser.collectAttachmentParts(); | 198 | auto contentAttachmentList = parser.collectAttachmentParts(); |
187 | QCOMPARE(contentAttachmentList.size(), 0); | 199 | QCOMPARE(contentAttachmentList.size(), 0); |
188 | } | 200 | } |