From 91dae77f25cfb8e18c2b1ed0f9b9b2d0d8a96389 Mon Sep 17 00:00:00 2001 From: Michael Bohlender Date: Mon, 7 Dec 2015 23:14:21 +0100 Subject: rolenames for the maillistmodel --- framework/mail/maillistmodel.cpp | 17 ++++++++++++++++- framework/mail/maillistmodel.h | 7 ++++++- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'framework/mail') 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) query.processAll = false; query.liveQuery = true; QList requestedProperties; - requestedProperties << "subject"; + requestedProperties << "subject" << "sender" << "senderName" << "date" << "unread" << "important"; query.requestedProperties = requestedProperties.toSet(); mModel = Akonadi2::Store::loadModel(query); setSourceModel(mModel.data()); @@ -26,6 +26,11 @@ QHash< int, QByteArray > MailListModel::roleNames() const QHash roles; roles[Subject] = "subject"; + roles[Sender] = "sender"; + roles[SenderName] = "senderName"; + roles[Date] = "date"; + roles[Unread] = "unread"; + roles[Important] = "important"; return roles; } @@ -35,6 +40,16 @@ QVariant MailListModel::data(const QModelIndex &idx, int role) const switch (role) { case Subject: return mapToSource(idx).data(Qt::DisplayRole).toString(); + case Sender: + return mapToSource(idx).data(Qt::DisplayRole).toString(); + case SenderName: + return mapToSource(idx).data(Qt::DisplayRole).toString(); + case Date: + return mapToSource(idx).data(Qt::DisplayRole).toString(); + case Unread: + return mapToSource(idx).data(Qt::DisplayRole).toString(); + case Important: + return mapToSource(idx).data(Qt::DisplayRole).toString(); } return QIdentityProxyModel::data(idx, role); } 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: QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; enum Roles { - Subject = Qt::UserRole + 1 + Subject = Qt::UserRole + 1, + Sender, + SenderName, + Date, + Unread, + Important }; QHash roleNames() const; -- cgit v1.2.3