diff options
Diffstat (limited to 'framework/domain/folderlistmodel.cpp')
-rw-r--r-- | framework/domain/folderlistmodel.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/framework/domain/folderlistmodel.cpp b/framework/domain/folderlistmodel.cpp index f212e336..14d3d5a7 100644 --- a/framework/domain/folderlistmodel.cpp +++ b/framework/domain/folderlistmodel.cpp | |||
@@ -72,20 +72,19 @@ 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 | const auto account = accountId.toString(); | 75 | const auto account = accountId.toString().toUtf8(); |
76 | Kube::Account accountSettings(account.toUtf8()); | 76 | Sink::Store::fetchAll<Sink::ApplicationDomain::SinkResource>(Sink::Query::PropertyFilter("account", QVariant::fromValue(account))) |
77 | //FIXME maildirResource is obviously not good. We need a way to find resources that belong to the account and provide folders. | 77 | .then<void, QList<Sink::ApplicationDomain::SinkResource::Ptr>>([this, account](const QList<Sink::ApplicationDomain::SinkResource::Ptr> &resources) { |
78 | const auto resourceId = accountSettings.property("maildirResource").toString(); | 78 | Sink::Query query; |
79 | qDebug() << "Running query for account " << account; | 79 | query.liveQuery = true; |
80 | qDebug() << "Found resources " << resourceId; | 80 | query.requestedProperties << "name" << "icon" << "parent"; |
81 | 81 | query.parentProperty = "parent"; | |
82 | Sink::Query query; | 82 | for (const auto &r : resources) { |
83 | query.liveQuery = true; | 83 | qDebug() << "Found resources for account: " << r->identifier() << account; |
84 | query.requestedProperties << "name" << "icon" << "parent"; | 84 | query.resources << r->identifier(); |
85 | query.parentProperty = "parent"; | 85 | } |
86 | query.resources << resourceId.toUtf8(); | 86 | runQuery(query); |
87 | 87 | }).exec(); | |
88 | runQuery(query); | ||
89 | } | 88 | } |
90 | 89 | ||
91 | QVariant FolderListModel::accountId() const | 90 | QVariant FolderListModel::accountId() const |