summaryrefslogtreecommitdiffstats
path: root/framework/mail/folderlistmodel.cpp
diff options
context:
space:
mode:
authorMichael Bohlender <michael.bohlender@kdemail.net>2015-12-07 00:17:51 +0100
committerMichael Bohlender <michael.bohlender@kdemail.net>2015-12-07 00:17:51 +0100
commit58f9f288fc5b3a7edf42e4dc997fe93418977249 (patch)
tree0347d0af57ea3fe2eecb795951010a68078897e0 /framework/mail/folderlistmodel.cpp
parentf5b9f73e87d8263428d19b161bdb57b1a5172105 (diff)
downloadkube-58f9f288fc5b3a7edf42e4dc997fe93418977249.tar.gz
kube-58f9f288fc5b3a7edf42e4dc997fe93418977249.zip
add folderlistmodel
Diffstat (limited to 'framework/mail/folderlistmodel.cpp')
-rw-r--r--framework/mail/folderlistmodel.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/framework/mail/folderlistmodel.cpp b/framework/mail/folderlistmodel.cpp
new file mode 100644
index 00000000..d7889da4
--- /dev/null
+++ b/framework/mail/folderlistmodel.cpp
@@ -0,0 +1,42 @@
1#include "folderlistmodel.h"
2#include <akonadi2common/clientapi.h>
3
4FolderListModel::FolderListModel(QObject *parent) : QIdentityProxyModel()
5{
6 Akonadi2::Query query;
7 query.syncOnDemand = false;
8 query.processAll = false;
9 query.liveQuery = true;
10 QList<QByteArray> requestedProperties;
11 requestedProperties << "name" << "icon";
12 query.requestedProperties = requestedProperties.toSet();
13 //TODO
14 //mModel = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Mail>(query);
15 //setSourceModel(mModel.data());
16}
17
18FolderListModel::~FolderListModel()
19{
20
21}
22
23QHash< int, QByteArray > FolderListModel::roleNames() const
24{
25 QHash<int, QByteArray> roles;
26
27 roles[Name] = "name";
28 roles[Icon] = "icon";
29
30 return roles;
31}
32
33QVariant FolderListModel::data(const QModelIndex &idx, int role) const
34{
35 switch (role) {
36 case Name:
37 return mapToSource(idx).data(Qt::DisplayRole).toString();
38 case Icon:
39 return mapToSource(idx).data(Qt::DisplayRole).toString();
40 }
41 return QIdentityProxyModel::data(idx, role);
42}