From 40dfb94d6443bb61ed349eb5c2bd483c876b1d23 Mon Sep 17 00:00:00 2001 From: Michael Bohlender Date: Tue, 8 Dec 2015 17:51:24 +0100 Subject: add Id role to folderlist model --- framework/mail/folderlistmodel.cpp | 4 ++++ framework/mail/folderlistmodel.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'framework/mail') diff --git a/framework/mail/folderlistmodel.cpp b/framework/mail/folderlistmodel.cpp index b0969060..86633de4 100644 --- a/framework/mail/folderlistmodel.cpp +++ b/framework/mail/folderlistmodel.cpp @@ -1,5 +1,6 @@ #include "folderlistmodel.h" #include +#include FolderListModel::FolderListModel(QObject *parent) : QIdentityProxyModel() { @@ -23,6 +24,7 @@ QHash< int, QByteArray > FolderListModel::roleNames() const roles[Name] = "name"; roles[Icon] = "icon"; + roles[Id] = "id"; return roles; } @@ -35,6 +37,8 @@ QVariant FolderListModel::data(const QModelIndex &idx, int role) const return srcIdx.sibling(srcIdx.row(), 0).data(Qt::DisplayRole).toString(); case Icon: return srcIdx.sibling(srcIdx.row(), 1).data(Qt::DisplayRole).toString(); + case Id: + return QString("some id"); } return QIdentityProxyModel::data(idx, role); } diff --git a/framework/mail/folderlistmodel.h b/framework/mail/folderlistmodel.h index 9a782327..829bebff 100644 --- a/framework/mail/folderlistmodel.h +++ b/framework/mail/folderlistmodel.h @@ -17,7 +17,8 @@ public: enum Roles { Name = Qt::UserRole + 1, - Icon + Icon, + Id }; QHash roleNames() const; -- cgit v1.2.3