From e89dc5e879f55e4111c82fd1b726e78452c460ff Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 30 Nov 2015 20:36:35 +0100 Subject: Ported the MailListModel to the new API --- framework/mail/maillistmodel.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'framework/mail/maillistmodel.cpp') 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 @@ #include "maillistmodel.h" +#include -MailListModel::MailListModel(QObject *parent) : ListModelResult(QList() << "subject" << "uid") + +MailListModel::MailListModel(QObject *parent) + : QIdentityProxyModel() { Akonadi2::Query query; query.syncOnDemand = false; query.processAll = false; query.liveQuery = true; - setEmitter(Akonadi2::Store::load(query)); + QList requestedProperties; + requestedProperties << "subject"; + query.requestedProperties = requestedProperties.toSet(); + mModel = Akonadi2::Store::loadModel(query); + setSourceModel(mModel.data()); } MailListModel::~MailListModel() @@ -27,9 +34,9 @@ QVariant MailListModel::data(const QModelIndex &idx, int role) const { switch (role) { case Subject: - return ListModelResult::data(index(idx.row(), 0, idx.parent()), Qt::DisplayRole); + return mapToSource(idx).data(Qt::DisplayRole).toString(); } - return QVariant(); + return QIdentityProxyModel::data(idx, role); } void MailListModel::runQuery(const QString& query) -- cgit v1.2.3