diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-04 12:10:06 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-04 12:10:06 +0200 |
commit | dd060cc5e3b336a77f8e5e76df4bc76a58e22cd4 (patch) | |
tree | 62237603acdcc1273a0017151ac72f89d1d3c645 /framework/domain/folderlistmodel.cpp | |
parent | acae662cf3aee020f3c5e2eb5876e562926cb931 (diff) | |
download | kube-dd060cc5e3b336a77f8e5e76df4bc76a58e22cd4.tar.gz kube-dd060cc5e3b336a77f8e5e76df4bc76a58e22cd4.zip |
Adapted to new query api
Diffstat (limited to 'framework/domain/folderlistmodel.cpp')
-rw-r--r-- | framework/domain/folderlistmodel.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/framework/domain/folderlistmodel.cpp b/framework/domain/folderlistmodel.cpp index 000dd263..98453ce9 100644 --- a/framework/domain/folderlistmodel.cpp +++ b/framework/domain/folderlistmodel.cpp | |||
@@ -72,19 +72,18 @@ void FolderListModel::runQuery(const Sink::Query &query) | |||
72 | 72 | ||
73 | void FolderListModel::setAccountId(const QVariant &accountId) | 73 | void FolderListModel::setAccountId(const QVariant &accountId) |
74 | { | 74 | { |
75 | using namespace Sink::ApplicationDomain; | ||
75 | const auto account = accountId.toString().toUtf8(); | 76 | const auto account = accountId.toString().toUtf8(); |
76 | Sink::Store::fetchAll<Sink::ApplicationDomain::SinkResource>(Sink::Query::PropertyFilter("account", QVariant::fromValue(account))) | 77 | |
77 | .syncThen<void, QList<Sink::ApplicationDomain::SinkResource::Ptr>>([this, account](const QList<Sink::ApplicationDomain::SinkResource::Ptr> &resources) { | 78 | //Get all folders of an account |
78 | Sink::Query query; | 79 | auto query = Sink::Query(); |
79 | query.liveQuery = true; | 80 | query.filter(SinkAccount(account)); |
80 | query.requestedProperties << "name" << "icon" << "parent"; | 81 | query.liveQuery = true; |
81 | query.parentProperty = "parent"; | 82 | query.request<Folder::Name>() |
82 | for (const auto &r : resources) { | 83 | .request<Folder::Icon>() |
83 | qDebug() << "Found resources for account: " << r->identifier() << account; | 84 | .request<Folder::Parent>(); |
84 | query.resources << r->identifier(); | 85 | query.parentProperty = Folder::Parent::name; |
85 | } | 86 | runQuery(query); |
86 | runQuery(query); | ||
87 | }).exec(); | ||
88 | } | 87 | } |
89 | 88 | ||
90 | QVariant FolderListModel::accountId() const | 89 | QVariant FolderListModel::accountId() const |