diff options
Diffstat (limited to 'framework/src/domain/mime/messageparser.h')
-rw-r--r-- | framework/src/domain/mime/messageparser.h | 71 |
1 files changed, 8 insertions, 63 deletions
diff --git a/framework/src/domain/mime/messageparser.h b/framework/src/domain/mime/messageparser.h index de72a025..785b8f47 100644 --- a/framework/src/domain/mime/messageparser.h +++ b/framework/src/domain/mime/messageparser.h | |||
@@ -30,18 +30,19 @@ | |||
30 | 30 | ||
31 | class QAbstractItemModel; | 31 | class QAbstractItemModel; |
32 | 32 | ||
33 | class Parser; | ||
34 | class MessagePartPrivate; | 33 | class MessagePartPrivate; |
35 | 34 | ||
36 | class NewModelPrivate; | 35 | namespace MimeTreeParser { |
37 | class AttachmentModelPrivate; | 36 | class ObjectTreeParser; |
37 | } | ||
38 | 38 | ||
39 | class MessageParser : public QObject | 39 | class MessageParser : public QObject |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | Q_PROPERTY (QVariant message READ message WRITE setMessage) | 42 | Q_PROPERTY (QVariant message READ message WRITE setMessage) |
43 | Q_PROPERTY (QAbstractItemModel* newTree READ newTree NOTIFY htmlChanged) | 43 | Q_PROPERTY (QAbstractItemModel* parts READ parts NOTIFY htmlChanged) |
44 | Q_PROPERTY (QAbstractItemModel* attachments READ attachments NOTIFY htmlChanged) | 44 | Q_PROPERTY (QAbstractItemModel* attachments READ attachments NOTIFY htmlChanged) |
45 | Q_PROPERTY (QString rawContent READ rawContent NOTIFY htmlChanged) | ||
45 | 46 | ||
46 | public: | 47 | public: |
47 | explicit MessageParser(QObject *parent = Q_NULLPTR); | 48 | explicit MessageParser(QObject *parent = Q_NULLPTR); |
@@ -49,71 +50,15 @@ public: | |||
49 | 50 | ||
50 | QVariant message() const; | 51 | QVariant message() const; |
51 | void setMessage(const QVariant &to); | 52 | void setMessage(const QVariant &to); |
52 | QAbstractItemModel *newTree() const; | 53 | QAbstractItemModel *parts() const; |
53 | QAbstractItemModel *attachments() const; | 54 | QAbstractItemModel *attachments() const; |
55 | QString rawContent() const; | ||
54 | 56 | ||
55 | signals: | 57 | signals: |
56 | void htmlChanged(); | 58 | void htmlChanged(); |
57 | 59 | ||
58 | private: | 60 | private: |
59 | std::unique_ptr<MessagePartPrivate> d; | 61 | std::unique_ptr<MessagePartPrivate> d; |
62 | QString mRawContent; | ||
60 | }; | 63 | }; |
61 | 64 | ||
62 | class NewModel : public QAbstractItemModel { | ||
63 | Q_OBJECT | ||
64 | public: | ||
65 | NewModel(std::shared_ptr<Parser> parser); | ||
66 | ~NewModel(); | ||
67 | |||
68 | public: | ||
69 | enum Roles { | ||
70 | TypeRole = Qt::UserRole + 1, | ||
71 | ContentsRole, | ||
72 | ContentRole, | ||
73 | IsComplexHtmlContentRole, | ||
74 | IsEmbededRole, | ||
75 | SecurityLevelRole, | ||
76 | EncryptionErrorType, | ||
77 | EncryptionErrorString | ||
78 | }; | ||
79 | |||
80 | QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; | ||
81 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
82 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | ||
83 | QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE; | ||
84 | int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
85 | int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
86 | |||
87 | private: | ||
88 | std::unique_ptr<NewModelPrivate> d; | ||
89 | }; | ||
90 | |||
91 | class AttachmentModel : public QAbstractItemModel { | ||
92 | Q_OBJECT | ||
93 | public: | ||
94 | AttachmentModel(std::shared_ptr<Parser> parser); | ||
95 | ~AttachmentModel(); | ||
96 | |||
97 | public: | ||
98 | enum Roles { | ||
99 | TypeRole = Qt::UserRole + 1, | ||
100 | IconRole, | ||
101 | NameRole, | ||
102 | SizeRole, | ||
103 | IsEncryptedRole, | ||
104 | IsSignedRole | ||
105 | }; | ||
106 | |||
107 | QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; | ||
108 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
109 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | ||
110 | QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE; | ||
111 | int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
112 | int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
113 | |||
114 | Q_INVOKABLE bool saveAttachmentToDisk(const QModelIndex &parent); | ||
115 | Q_INVOKABLE bool openAttachment(const QModelIndex &index); | ||
116 | |||
117 | private: | ||
118 | std::unique_ptr<AttachmentModelPrivate> d; | ||
119 | }; | ||