diff options
author | Sandro Knauß <sknauss@kde.org> | 2016-10-24 13:02:40 +0200 |
---|---|---|
committer | Sandro Knauß <sknauss@kde.org> | 2016-10-24 13:02:40 +0200 |
commit | 6aa695939b63fc7370e5eb80ecf7528aea1bd5e1 (patch) | |
tree | 91e7951411f541d7b71d64f15a2a38c6bbd7c577 /framework/domain/messageparser.h | |
parent | 9be2b6515cf538673babda8764219b9af9691f6f (diff) | |
parent | a93a649f34ffa794884019e05c57869bd3bd4672 (diff) | |
download | kube-6aa695939b63fc7370e5eb80ecf7528aea1bd5e1.tar.gz kube-6aa695939b63fc7370e5eb80ecf7528aea1bd5e1.zip |
Merge branch 'dev/mimetreeinterface' into develop
Diffstat (limited to 'framework/domain/messageparser.h')
-rw-r--r-- | framework/domain/messageparser.h | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/framework/domain/messageparser.h b/framework/domain/messageparser.h index 3e0255df..559fa6f9 100644 --- a/framework/domain/messageparser.h +++ b/framework/domain/messageparser.h | |||
@@ -29,41 +29,49 @@ | |||
29 | #include <memory> | 29 | #include <memory> |
30 | #include <MimeTreeParser/MessagePart> | 30 | #include <MimeTreeParser/MessagePart> |
31 | 31 | ||
32 | namespace MimeTreeParser { | ||
33 | class NodeHelper; | ||
34 | }; | ||
35 | class QAbstractItemModel; | 32 | class QAbstractItemModel; |
36 | 33 | ||
34 | class Parser; | ||
35 | class Part; | ||
36 | class Encryption; | ||
37 | class Signature; | ||
38 | typedef std::shared_ptr<Part> PartPtr; | ||
39 | class Content; | ||
40 | typedef std::shared_ptr<Content> ContentPtr; | ||
41 | class MessagePartPrivate; | ||
42 | |||
43 | class NewModelPrivate; | ||
44 | |||
37 | class MessageParser : public QObject | 45 | class MessageParser : public QObject |
38 | { | 46 | { |
39 | Q_OBJECT | 47 | Q_OBJECT |
40 | Q_PROPERTY (QVariant message READ message WRITE setMessage) | 48 | Q_PROPERTY (QVariant message READ message WRITE setMessage) |
41 | Q_PROPERTY (QString html READ html NOTIFY htmlChanged) | 49 | Q_PROPERTY (QString html READ html NOTIFY htmlChanged) |
42 | Q_PROPERTY (QAbstractItemModel* partTree READ partTree NOTIFY htmlChanged) | 50 | Q_PROPERTY (QAbstractItemModel* partTree READ partTree NOTIFY htmlChanged) |
51 | Q_PROPERTY (QAbstractItemModel* newTree READ newTree NOTIFY htmlChanged) | ||
43 | 52 | ||
44 | public: | 53 | public: |
45 | explicit MessageParser(QObject *parent = Q_NULLPTR); | 54 | explicit MessageParser(QObject *parent = Q_NULLPTR); |
55 | ~MessageParser(); | ||
46 | 56 | ||
47 | QString html() const; | 57 | QString html() const; |
48 | 58 | ||
49 | QVariant message() const; | 59 | QVariant message() const; |
50 | void setMessage(const QVariant &to); | 60 | void setMessage(const QVariant &to); |
51 | QAbstractItemModel *partTree() const; | 61 | QAbstractItemModel *partTree() const; |
62 | QAbstractItemModel *newTree() const; | ||
52 | 63 | ||
53 | signals: | 64 | signals: |
54 | void htmlChanged(); | 65 | void htmlChanged(); |
55 | 66 | ||
56 | private: | 67 | private: |
57 | QSharedPointer<MimeTreeParser::MessagePart> mPartTree; | 68 | std::unique_ptr<MessagePartPrivate> d; |
58 | QString mHtml; | ||
59 | QMap<QByteArray, QUrl> mEmbeddedPartMap; | ||
60 | std::shared_ptr<MimeTreeParser::NodeHelper> mNodeHelper; | ||
61 | }; | 69 | }; |
62 | 70 | ||
63 | class PartModel : public QAbstractItemModel { | 71 | class PartModel : public QAbstractItemModel { |
64 | Q_OBJECT | 72 | Q_OBJECT |
65 | public: | 73 | public: |
66 | PartModel(QSharedPointer<MimeTreeParser::MessagePart> partTree, QMap<QByteArray, QUrl> embeddedPartMap); | 74 | PartModel(QSharedPointer<MimeTreeParser::MessagePart> partTree, std::shared_ptr<Parser> parser); |
67 | 75 | ||
68 | public: | 76 | public: |
69 | enum Roles { | 77 | enum Roles { |
@@ -86,5 +94,33 @@ public: | |||
86 | private: | 94 | private: |
87 | QSharedPointer<MimeTreeParser::MessagePart> mPartTree; | 95 | QSharedPointer<MimeTreeParser::MessagePart> mPartTree; |
88 | QMap<QByteArray, QUrl> mEmbeddedPartMap; | 96 | QMap<QByteArray, QUrl> mEmbeddedPartMap; |
97 | std::shared_ptr<Parser> mParser; | ||
98 | }; | ||
99 | |||
100 | |||
101 | class NewModel : public QAbstractItemModel { | ||
102 | Q_OBJECT | ||
103 | public: | ||
104 | NewModel(std::shared_ptr<Parser> parser); | ||
105 | ~NewModel(); | ||
106 | |||
107 | public: | ||
108 | enum Roles { | ||
109 | TypeRole = Qt::UserRole + 1, | ||
110 | ContentsRole, | ||
111 | ContentRole, | ||
112 | IsEmbededRole, | ||
113 | SecurityLevelRole | ||
114 | }; | ||
115 | |||
116 | QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; | ||
117 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
118 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | ||
119 | QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE; | ||
120 | int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
121 | int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
122 | |||
123 | private: | ||
124 | std::unique_ptr<NewModelPrivate> d; | ||
89 | }; | 125 | }; |
90 | 126 | ||