summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/folderlistmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/domain/folderlistmodel.cpp')
-rw-r--r--framework/src/domain/folderlistmodel.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/framework/src/domain/folderlistmodel.cpp b/framework/src/domain/folderlistmodel.cpp
index 4437e75b..1ef6f761 100644
--- a/framework/src/domain/folderlistmodel.cpp
+++ b/framework/src/domain/folderlistmodel.cpp
@@ -105,7 +105,6 @@ void FolderListModel::setAccountId(const QVariant &accountId)
105 auto query = Query(); 105 auto query = Query();
106 query.resourceFilter<SinkResource::Account>(account); 106 query.resourceFilter<SinkResource::Account>(account);
107 query.setFlags(Sink::Query::LiveQuery | Sink::Query::UpdateStatus); 107 query.setFlags(Sink::Query::LiveQuery | Sink::Query::UpdateStatus);
108 query.requestTree<Folder::Parent>();
109 query.request<Folder::Name>() 108 query.request<Folder::Name>()
110 .request<Folder::Icon>() 109 .request<Folder::Icon>()
111 .request<Folder::Parent>() 110 .request<Folder::Parent>()
@@ -115,6 +114,11 @@ void FolderListModel::setAccountId(const QVariant &accountId)
115 runQuery(query); 114 runQuery(query);
116} 115}
117 116
117QVariant FolderListModel::accountId() const
118{
119 return {};
120}
121
118static int getPriority(const Sink::ApplicationDomain::Folder &folder) 122static int getPriority(const Sink::ApplicationDomain::Folder &folder)
119{ 123{
120 auto specialPurpose = folder.getSpecialPurpose(); 124 auto specialPurpose = folder.getSpecialPurpose();
@@ -144,8 +148,22 @@ bool FolderListModel::lessThan(const QModelIndex &left, const QModelIndex &right
144 return leftPriority < rightPriority; 148 return leftPriority < rightPriority;
145} 149}
146 150
147QVariant FolderListModel::accountId() const 151void FolderListModel::setFolderId(const QVariant &folderId)
148{ 152{
149 return QVariant(); 153 const auto folder = folderId.toString().toUtf8();
154
155 //Get all folders of an account
156 auto query = Query();
157 query.filter(folder);
158 query.request<Folder::Name>()
159 .request<Folder::Icon>()
160 .request<Folder::Parent>()
161 .request<Folder::SpecialPurpose>();
162 query.setId("folder" + folder);
163 runQuery(query);
150} 164}
151 165
166QVariant FolderListModel::folderId() const
167{
168 return {};
169}