summaryrefslogtreecommitdiffstats
path: root/framework/mail/folderlistmodel.cpp
diff options
context:
space:
mode:
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}