summaryrefslogtreecommitdiffstats
path: root/framework/domain/mimetreeparser/interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'framework/domain/mimetreeparser/interface.h')
-rw-r--r--framework/domain/mimetreeparser/interface.h81
1 files changed, 62 insertions, 19 deletions
diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h
index a9e394db..320030b7 100644
--- a/framework/domain/mimetreeparser/interface.h
+++ b/framework/domain/mimetreeparser/interface.h
@@ -23,32 +23,41 @@
23#include <QMimeType> 23#include <QMimeType>
24 24
25class Part; 25class Part;
26typedef std::shared_ptr<Part> Part::Ptr;
26class EncryptionPart; 27class EncryptionPart;
28typedef std::shared_ptr<Part> EncryptionPart::Ptr;
27class SignaturePart; 29class SignaturePart;
30typedef std::shared_ptr<Part> SignaturePart::Ptr;
28 31
29class MimePart; 32class MimePart;
33typedef std::shared_ptr<Part> MimePart::Ptr;
30class MimePartPrivate; 34class MimePartPrivate;
31 35
32class ContentPart; 36class ContentPart;
37typedef std::shared_ptr<Part> ContentPart::Ptr;
33class ContentPartPrivate; 38class ContentPartPrivate;
34 39
35class EncryptionErrorPart; 40class EncryptionErrorPart;
41typedef std::shared_ptr<Part> EncryptionErrorPart::Ptr;
36class EncryptionErrorPartPrivate; 42class EncryptionErrorPartPrivate;
37 43
38class AttachmentPart; 44class AttachmentPart;
45typedef std::shared_ptr<Part> AttachmentPart::Ptr;
39class AttachmentPartPrivate; 46class AttachmentPartPrivate;
40 47
41class EncapsulatedPart; 48class EncapsulatedPart;
49typedef std::shared_ptr<Part> EncapsulatedPart::Ptr;
42class EncapsulatedPart; 50class EncapsulatedPart;
43 51
44class CertPart; 52class CertPart;
45class CertPart; 53typedef std::shared_ptr<Part> CertPart::Ptr;
46 54
47class Key; 55class Key;
48class Signature; 56class Signature;
49class Encryption; 57class Encryption;
50 58
51class Parser; 59class Parser;
60typedef std::shared_ptr<Parser> Parser::Ptr;
52class ParserPrivate; 61class ParserPrivate;
53 62
54class Parser 63class Parser
@@ -56,30 +65,71 @@ class Parser
56public: 65public:
57 Parser(const QByteArray &mimeMessage); 66 Parser(const QByteArray &mimeMessage);
58 67
59 std::shared_ptr<Part> getPart(QUrl url); 68 Part::Ptr getPart(QUrl url);
60 69
61 QVector<std::shared_ptr<AttachmentPart>> collect<AttachmentPart>() const; 70 QVector<AttachmentPart::Ptr> collect<AttachmentPart>() const;
62 QVector<std::shared_ptr<ContentPart>> collect<ContentPart>() const; 71 QVector<ContentPart:Ptr> collect<ContentPart>() const;
63 QVector<std::shared_ptr<T>> collect<T>(Part start, std::function<bool(const Part &)> select, std::function<bool(const std::shared_ptr<T> &)> filter) const; 72 QVector<T::Ptr> collect<T>(Part start, std::function<bool(const Part &)> select, std::function<bool(const T::Ptr &)> filter) const;
64 73
65private: 74private:
66 std::unique_ptr<ParserPrivate> d; 75 std::unique_ptr<ParserPrivate> d;
67}; 76};
68 77
78
69class Part 79class Part
70{ 80{
71public: 81public:
72 virtual QByteArray type() const = 0; 82 virtual QByteArray type() const = 0;
73 83
74 bool hasSubParts() const; 84 bool hasSubParts() const;
75 QList<Part> subParts() const; 85 QList<Part::Ptr> subParts() const;
76 Part partent() const; 86 Part parent() const;
87
88 virtual QVector<Signature> signatures() const;
89 virtual QVector<Encryption> encryptions() const;
77}; 90};
78 91
92//A structure element, that we need to reflect, that there is a Encryption starts
93// only add a new Encrption block to encryptions block
94class EncryptionPart : public Part
95{
96public:
97 QVector<Encryption> encryptions() const Q_DECL_OVERRIDE;
98 QByteArray type() const Q_DECL_OVERRIDE;
99};
100
101// A structure element, that we need to reflect, that there is a Signature starts
102// only add a new Signature block to signature block
103// With this we can a new Singature type like pep aka
104/*
105 * add a bodypartformatter, that returns a PEPSignaturePart with all signed subparts that are signed with pep.
106 * subclass Signature aka PEPSignature to reflect different way of properties of PEPSignatures.
107 */
108class SignaturePart : public Part
109{
110public:
111 QVector<Signature> signatures() const Q_DECL_OVERRIDE;
112 QByteArray type() const Q_DECL_OVERRIDE;
113};
114
115
116
117class TextPart : public Part
118{
119public:
120 QByteArray content() const;
121
122 //Use default charset
123 QString encodedContent() const;
124
125 // overwrite default charset with given charset
126 QString encodedContent(QByteArray charset) const;
127}
128
79/* 129/*
80 * A MessagePart that is based on a KMime::Content 130 * A MessagePart that is based on a KMime::Content
81 */ 131 */
82class MimePart : public Part 132class MimePart : public TextPart
83{ 133{
84public: 134public:
85 /** 135 /**
@@ -88,14 +138,12 @@ public:
88 enum Disposition { 138 enum Disposition {
89 Invalid, ///< Default, invalid value 139 Invalid, ///< Default, invalid value
90 Inline, ///< inline 140 Inline, ///< inline
91 Attachment, ///< attachment 141 Attachment ///< attachment
92 Parallel ///< parallel (invalid, do not use)
93 }; 142 };
94 143
95 // interessting header parts of a KMime::Content 144 // interessting header parts of a KMime::Content
96 QByteArray content() const;
97 QMimeType mimetype() const; 145 QMimeType mimetype() const;
98 Disposition dispossition() const 146 Disposition disposition() const;
99 QUrl label() const; 147 QUrl label() const;
100 QByteArray cid() const; 148 QByteArray cid() const;
101 QByteArray charset() const; 149 QByteArray charset() const;
@@ -123,7 +171,7 @@ private:
123 * for alternative, we are represating three messageparts 171 * for alternative, we are represating three messageparts
124 * - "headers" do we return?, we can use setType to make it possible to select and than return these headers 172 * - "headers" do we return?, we can use setType to make it possible to select and than return these headers
125 */ 173 */
126class ContentPart : public MimePart 174class MainContentPart : public MimePart
127{ 175{
128public: 176public:
129 enum Types { 177 enum Types {
@@ -132,14 +180,9 @@ public:
132 }; 180 };
133 Q_DECLARE_FLAGS(Types, Type) 181 Q_DECLARE_FLAGS(Types, Type)
134 182
135 QByteArray content(Content::Type ct) const; 183 QVector<TextPart> content(Content::Type ct) const;
136
137 // convert content with charset
138 QString content(Content::Type ct) const;
139 184
140 Content::Types availableContent() const; 185 Content::Types availableContent() const;
141 QVector<Signature> signature() const;
142 QVector<Encryption> encryption() const;
143 186
144 QByteArray type() const Q_DECL_OVERRIDE; 187 QByteArray type() const Q_DECL_OVERRIDE;
145 188