diff options
Diffstat (limited to 'framework/mail/maillistmodel.cpp')
-rw-r--r-- | framework/mail/maillistmodel.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/framework/mail/maillistmodel.cpp b/framework/mail/maillistmodel.cpp index f18861c4..5ffcec0f 100644 --- a/framework/mail/maillistmodel.cpp +++ b/framework/mail/maillistmodel.cpp | |||
@@ -1,12 +1,19 @@ | |||
1 | #include "maillistmodel.h" | 1 | #include "maillistmodel.h" |
2 | #include <akonadi2common/clientapi.h> | ||
2 | 3 | ||
3 | MailListModel::MailListModel(QObject *parent) : ListModelResult<Akonadi2::ApplicationDomain::Mail::Ptr>(QList<QByteArray>() << "subject" << "uid") | 4 | |
5 | MailListModel::MailListModel(QObject *parent) | ||
6 | : QIdentityProxyModel() | ||
4 | { | 7 | { |
5 | Akonadi2::Query query; | 8 | Akonadi2::Query query; |
6 | query.syncOnDemand = false; | 9 | query.syncOnDemand = false; |
7 | query.processAll = false; | 10 | query.processAll = false; |
8 | query.liveQuery = true; | 11 | query.liveQuery = true; |
9 | setEmitter(Akonadi2::Store::load<Akonadi2::ApplicationDomain::Mail>(query)); | 12 | QList<QByteArray> requestedProperties; |
13 | requestedProperties << "subject"; | ||
14 | query.requestedProperties = requestedProperties.toSet(); | ||
15 | mModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query); | ||
16 | setSourceModel(mModel.data()); | ||
10 | } | 17 | } |
11 | 18 | ||
12 | MailListModel::~MailListModel() | 19 | MailListModel::~MailListModel() |
@@ -27,9 +34,9 @@ QVariant MailListModel::data(const QModelIndex &idx, int role) const | |||
27 | { | 34 | { |
28 | switch (role) { | 35 | switch (role) { |
29 | case Subject: | 36 | case Subject: |
30 | return ListModelResult<Akonadi2::ApplicationDomain::Mail::Ptr>::data(index(idx.row(), 0, idx.parent()), Qt::DisplayRole); | 37 | return mapToSource(idx).data(Qt::DisplayRole).toString(); |
31 | } | 38 | } |
32 | return QVariant(); | 39 | return QIdentityProxyModel::data(idx, role); |
33 | } | 40 | } |
34 | 41 | ||
35 | void MailListModel::runQuery(const QString& query) | 42 | void MailListModel::runQuery(const QString& query) |