diff options
Diffstat (limited to 'framework/mail')
-rw-r--r-- | framework/mail/maillistmodel.cpp | 17 | ||||
-rw-r--r-- | framework/mail/maillistmodel.h | 7 |
2 files changed, 22 insertions, 2 deletions
diff --git a/framework/mail/maillistmodel.cpp b/framework/mail/maillistmodel.cpp index 5ffcec0f..015f20b3 100644 --- a/framework/mail/maillistmodel.cpp +++ b/framework/mail/maillistmodel.cpp | |||
@@ -10,7 +10,7 @@ MailListModel::MailListModel(QObject *parent) | |||
10 | query.processAll = false; | 10 | query.processAll = false; |
11 | query.liveQuery = true; | 11 | query.liveQuery = true; |
12 | QList<QByteArray> requestedProperties; | 12 | QList<QByteArray> requestedProperties; |
13 | requestedProperties << "subject"; | 13 | requestedProperties << "subject" << "sender" << "senderName" << "date" << "unread" << "important"; |
14 | query.requestedProperties = requestedProperties.toSet(); | 14 | query.requestedProperties = requestedProperties.toSet(); |
15 | mModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | 15 | mModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); |
16 | setSourceModel(mModel.data()); | 16 | setSourceModel(mModel.data()); |
@@ -26,6 +26,11 @@ QHash< int, QByteArray > MailListModel::roleNames() const | |||
26 | QHash<int, QByteArray> roles; | 26 | QHash<int, QByteArray> roles; |
27 | 27 | ||
28 | roles[Subject] = "subject"; | 28 | roles[Subject] = "subject"; |
29 | roles[Sender] = "sender"; | ||
30 | roles[SenderName] = "senderName"; | ||
31 | roles[Date] = "date"; | ||
32 | roles[Unread] = "unread"; | ||
33 | roles[Important] = "important"; | ||
29 | 34 | ||
30 | return roles; | 35 | return roles; |
31 | } | 36 | } |
@@ -35,6 +40,16 @@ QVariant MailListModel::data(const QModelIndex &idx, int role) const | |||
35 | switch (role) { | 40 | switch (role) { |
36 | case Subject: | 41 | case Subject: |
37 | return mapToSource(idx).data(Qt::DisplayRole).toString(); | 42 | return mapToSource(idx).data(Qt::DisplayRole).toString(); |
43 | case Sender: | ||
44 | return mapToSource(idx).data(Qt::DisplayRole).toString(); | ||
45 | case SenderName: | ||
46 | return mapToSource(idx).data(Qt::DisplayRole).toString(); | ||
47 | case Date: | ||
48 | return mapToSource(idx).data(Qt::DisplayRole).toString(); | ||
49 | case Unread: | ||
50 | return mapToSource(idx).data(Qt::DisplayRole).toString(); | ||
51 | case Important: | ||
52 | return mapToSource(idx).data(Qt::DisplayRole).toString(); | ||
38 | } | 53 | } |
39 | return QIdentityProxyModel::data(idx, role); | 54 | return QIdentityProxyModel::data(idx, role); |
40 | } | 55 | } |
diff --git a/framework/mail/maillistmodel.h b/framework/mail/maillistmodel.h index 4e360d96..3784bea0 100644 --- a/framework/mail/maillistmodel.h +++ b/framework/mail/maillistmodel.h | |||
@@ -15,7 +15,12 @@ public: | |||
15 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; | 15 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
16 | 16 | ||
17 | enum Roles { | 17 | enum Roles { |
18 | Subject = Qt::UserRole + 1 | 18 | Subject = Qt::UserRole + 1, |
19 | Sender, | ||
20 | SenderName, | ||
21 | Date, | ||
22 | Unread, | ||
23 | Important | ||
19 | }; | 24 | }; |
20 | 25 | ||
21 | QHash<int, QByteArray> roleNames() const; | 26 | QHash<int, QByteArray> roleNames() const; |