diff options
Diffstat (limited to 'framework/domain/messageparser.h')
-rw-r--r-- | framework/domain/messageparser.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/framework/domain/messageparser.h b/framework/domain/messageparser.h index 559fa6f9..203f7576 100644 --- a/framework/domain/messageparser.h +++ b/framework/domain/messageparser.h | |||
@@ -41,6 +41,7 @@ typedef std::shared_ptr<Content> ContentPtr; | |||
41 | class MessagePartPrivate; | 41 | class MessagePartPrivate; |
42 | 42 | ||
43 | class NewModelPrivate; | 43 | class NewModelPrivate; |
44 | class AttachmentModelPrivate; | ||
44 | 45 | ||
45 | class MessageParser : public QObject | 46 | class MessageParser : public QObject |
46 | { | 47 | { |
@@ -49,6 +50,7 @@ class MessageParser : public QObject | |||
49 | Q_PROPERTY (QString html READ html NOTIFY htmlChanged) | 50 | Q_PROPERTY (QString html READ html NOTIFY htmlChanged) |
50 | Q_PROPERTY (QAbstractItemModel* partTree READ partTree NOTIFY htmlChanged) | 51 | Q_PROPERTY (QAbstractItemModel* partTree READ partTree NOTIFY htmlChanged) |
51 | Q_PROPERTY (QAbstractItemModel* newTree READ newTree NOTIFY htmlChanged) | 52 | Q_PROPERTY (QAbstractItemModel* newTree READ newTree NOTIFY htmlChanged) |
53 | Q_PROPERTY (QAbstractItemModel* attachments READ attachments NOTIFY htmlChanged) | ||
52 | 54 | ||
53 | public: | 55 | public: |
54 | explicit MessageParser(QObject *parent = Q_NULLPTR); | 56 | explicit MessageParser(QObject *parent = Q_NULLPTR); |
@@ -60,6 +62,7 @@ public: | |||
60 | void setMessage(const QVariant &to); | 62 | void setMessage(const QVariant &to); |
61 | QAbstractItemModel *partTree() const; | 63 | QAbstractItemModel *partTree() const; |
62 | QAbstractItemModel *newTree() const; | 64 | QAbstractItemModel *newTree() const; |
65 | QAbstractItemModel *attachments() const; | ||
63 | 66 | ||
64 | signals: | 67 | signals: |
65 | void htmlChanged(); | 68 | void htmlChanged(); |
@@ -124,3 +127,28 @@ private: | |||
124 | std::unique_ptr<NewModelPrivate> d; | 127 | std::unique_ptr<NewModelPrivate> d; |
125 | }; | 128 | }; |
126 | 129 | ||
130 | class AttachmentModel : public QAbstractItemModel { | ||
131 | Q_OBJECT | ||
132 | public: | ||
133 | AttachmentModel(std::shared_ptr<Parser> parser); | ||
134 | ~AttachmentModel(); | ||
135 | |||
136 | public: | ||
137 | enum Roles { | ||
138 | TypeRole = Qt::UserRole + 1, | ||
139 | NameRole, | ||
140 | SizeRole, | ||
141 | IsEncryptedRole, | ||
142 | IsSignedRole | ||
143 | }; | ||
144 | |||
145 | QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; | ||
146 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
147 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | ||
148 | QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE; | ||
149 | int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
150 | int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | ||
151 | |||
152 | private: | ||
153 | std::unique_ptr<AttachmentModelPrivate> d; | ||
154 | }; | ||