summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-17 20:59:19 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-17 20:59:19 +0100
commitb0d06e04e4f4a0c8645288d4a31449215ce58770 (patch)
tree7f2a1de572a14274cb4992c48587d56286dcd619
parentdd240d06dc35c50239dec91dcf043f8d4c990953 (diff)
downloadkube-b0d06e04e4f4a0c8645288d4a31449215ce58770.tar.gz
kube-b0d06e04e4f4a0c8645288d4a31449215ce58770.zip
Store accounts in sink
-rw-r--r--accounts/maildir/maildirsettings.cpp75
-rw-r--r--accounts/maildir/maildirsettings.h9
-rw-r--r--accounts/maildir/package/contents/ui/MaildirAccountSettings.qml12
-rw-r--r--components/package/contents/ui/Settings.qml7
-rw-r--r--framework/domain/accountfactory.cpp19
-rw-r--r--framework/domain/accountfactory.h3
-rw-r--r--framework/domain/accountscontroller.cpp29
-rw-r--r--framework/domain/accountscontroller.h10
-rw-r--r--framework/domain/accountsmodel.cpp29
-rw-r--r--framework/domain/accountsmodel.h17
-rw-r--r--framework/domain/folderlistmodel.cpp27
11 files changed, 115 insertions, 122 deletions
diff --git a/accounts/maildir/maildirsettings.cpp b/accounts/maildir/maildirsettings.cpp
index 1d48fc24..847ce92e 100644
--- a/accounts/maildir/maildirsettings.cpp
+++ b/accounts/maildir/maildirsettings.cpp
@@ -31,23 +31,6 @@ MaildirSettings::MaildirSettings(QObject *parent)
31{ 31{
32} 32}
33 33
34void MaildirSettings::setIdentifier(const QByteArray &id)
35{
36 mIdentifier = id;
37 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::IdentityFilter(mIdentifier) + Sink::Query::RequestedProperties(QList<QByteArray>() << "path"))
38 .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) {
39 auto path = resource.getProperty("path").toString();
40 if (mPath != path) {
41 mPath = path;
42 emit pathChanged();
43 }
44 }).exec();
45}
46
47QByteArray MaildirSettings::identifier() const
48{
49 return mIdentifier;
50}
51 34
52void MaildirSettings::setAccountIdentifier(const QByteArray &id) 35void MaildirSettings::setAccountIdentifier(const QByteArray &id)
53{ 36{
@@ -56,9 +39,22 @@ void MaildirSettings::setAccountIdentifier(const QByteArray &id)
56 } 39 }
57 mAccountIdentifier = id; 40 mAccountIdentifier = id;
58 Q_ASSERT(!id.isEmpty()); 41 Q_ASSERT(!id.isEmpty());
59 Kube::Account account(id); 42 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkAccount>(Sink::Query::IdentityFilter(id))
60 auto maildirResource = account.property("maildirResource").toByteArray(); 43 .then<void, Sink::ApplicationDomain::SinkAccount>([this](const Sink::ApplicationDomain::SinkAccount &account) {
61 setIdentifier(maildirResource); 44 mIcon = account.getProperty("icon").toString();
45 mName = account.getProperty("name").toString();
46 emit changed();
47 }).exec();
48
49 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkResource>(Sink::Query::PropertyFilter("account", QVariant::fromValue(id)))
50 .then<void, Sink::ApplicationDomain::SinkResource>([this](const Sink::ApplicationDomain::SinkResource &resource) {
51 mIdentifier = resource.identifier();
52 auto path = resource.getProperty("path").toString();
53 if (mPath != path) {
54 mPath = path;
55 emit pathChanged();
56 }
57 }).exec();
62} 58}
63 59
64QByteArray MaildirSettings::accountIdentifier() const 60QByteArray MaildirSettings::accountIdentifier() const
@@ -102,6 +98,19 @@ void MaildirSettings::save()
102 qWarning() << "The path doesn't exist: " << mPath; 98 qWarning() << "The path doesn't exist: " << mPath;
103 return; 99 return;
104 } 100 }
101 qDebug() << "Saving account " << mAccountIdentifier << mIdentifier;
102 Q_ASSERT(!mAccountIdentifier.isEmpty());
103 Sink::ApplicationDomain::SinkAccount account(mAccountIdentifier);
104 account.setProperty("type", "maildir");
105 account.setProperty("name", mName);
106 account.setProperty("icon", mIcon);
107 Q_ASSERT(!account.identifier().isEmpty());
108 Sink::Store::modify(account).then<void>([]() {},
109 [](int errorCode, const QString &errorMessage) {
110 qWarning() << "Error while creating account: " << errorMessage;
111 })
112 .exec();
113
105 if (!mIdentifier.isEmpty()) { 114 if (!mIdentifier.isEmpty()) {
106 Sink::ApplicationDomain::SinkResource resource(mIdentifier); 115 Sink::ApplicationDomain::SinkResource resource(mIdentifier);
107 resource.setProperty("path", mPath); 116 resource.setProperty("path", mPath);
@@ -117,12 +126,8 @@ void MaildirSettings::save()
117 resource.setProperty("path", property("path")); 126 resource.setProperty("path", property("path"));
118 resource.setProperty("identifier", resourceIdentifier); 127 resource.setProperty("identifier", resourceIdentifier);
119 resource.setProperty("type", "org.kde.maildir"); 128 resource.setProperty("type", "org.kde.maildir");
120 Sink::Store::create(resource).then<void>([this, resourceIdentifier]() { 129 resource.setProperty("account", mAccountIdentifier);
121 Q_ASSERT(!mAccountIdentifier.isEmpty()); 130 Sink::Store::create(resource).then<void>([]() {},
122 Kube::Account account(mAccountIdentifier);
123 account.setProperty("maildirResource", resourceIdentifier);
124 account.save();
125 },
126 [](int errorCode, const QString &errorMessage) { 131 [](int errorCode, const QString &errorMessage) {
127 qWarning() << "Error while creating resource: " << errorMessage; 132 qWarning() << "Error while creating resource: " << errorMessage;
128 }) 133 })
@@ -136,20 +141,18 @@ void MaildirSettings::remove()
136 qWarning() << "We're missing an identifier"; 141 qWarning() << "We're missing an identifier";
137 } else { 142 } else {
138 Sink::ApplicationDomain::SinkResource resource("", mIdentifier, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); 143 Sink::ApplicationDomain::SinkResource resource("", mIdentifier, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create());
139 Sink::Store::remove(resource).then<void>([this]() { 144 Sink::Store::remove(resource).then<void>([]() {},
140 Kube::Account account(mAccountIdentifier);
141 account.remove();
142
143 Kube::Settings settings("accounts");
144 auto accounts = settings.property("accounts").toStringList();
145 accounts.removeAll(mAccountIdentifier);
146 settings.setProperty("accounts", accounts);
147 settings.save();
148 },
149 [](int errorCode, const QString &errorMessage) { 145 [](int errorCode, const QString &errorMessage) {
150 qWarning() << "Error while removing resource: " << errorMessage; 146 qWarning() << "Error while removing resource: " << errorMessage;
151 }) 147 })
152 .exec(); 148 .exec();
149
150 Sink::ApplicationDomain::SinkAccount account("", mAccountIdentifier, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create());
151 Sink::Store::remove(account).then<void>([]() {},
152 [](int errorCode, const QString &errorMessage) {
153 qWarning() << "Error while removing account: " << errorMessage;
154 })
155 .exec();
153 } 156 }
154} 157}
155 158
diff --git a/accounts/maildir/maildirsettings.h b/accounts/maildir/maildirsettings.h
index 9e5b6a4c..f79208db 100644
--- a/accounts/maildir/maildirsettings.h
+++ b/accounts/maildir/maildirsettings.h
@@ -24,17 +24,15 @@
24class MaildirSettings : public QObject 24class MaildirSettings : public QObject
25{ 25{
26 Q_OBJECT 26 Q_OBJECT
27 Q_PROPERTY(QByteArray identifier READ identifier WRITE setIdentifier)
28 Q_PROPERTY(QByteArray accountIdentifier READ accountIdentifier WRITE setAccountIdentifier) 27 Q_PROPERTY(QByteArray accountIdentifier READ accountIdentifier WRITE setAccountIdentifier)
29 Q_PROPERTY(QUrl path READ path WRITE setPath NOTIFY pathChanged) 28 Q_PROPERTY(QUrl path READ path WRITE setPath NOTIFY pathChanged)
30 Q_PROPERTY(QValidator* pathValidator READ pathValidator CONSTANT) 29 Q_PROPERTY(QValidator* pathValidator READ pathValidator CONSTANT)
30 Q_PROPERTY(QString icon MEMBER mIcon NOTIFY changed)
31 Q_PROPERTY(QString accountName MEMBER mName NOTIFY changed)
31 32
32public: 33public:
33 MaildirSettings(QObject *parent = 0); 34 MaildirSettings(QObject *parent = 0);
34 35
35 void setIdentifier(const QByteArray &);
36 QByteArray identifier() const;
37
38 void setAccountIdentifier(const QByteArray &); 36 void setAccountIdentifier(const QByteArray &);
39 QByteArray accountIdentifier() const; 37 QByteArray accountIdentifier() const;
40 38
@@ -47,9 +45,12 @@ public:
47 45
48signals: 46signals:
49 void pathChanged(); 47 void pathChanged();
48 void changed();
50 49
51private: 50private:
52 QByteArray mIdentifier; 51 QByteArray mIdentifier;
53 QByteArray mAccountIdentifier; 52 QByteArray mAccountIdentifier;
54 QString mPath; 53 QString mPath;
54 QString mIcon;
55 QString mName;
55}; 56};
diff --git a/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml b/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml
index 174683c4..0175fc46 100644
--- a/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml
+++ b/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml
@@ -49,8 +49,8 @@ Rectangle {
49 id: name 49 id: name
50 placeholderText: accountName 50 placeholderText: accountName
51 Layout.fillWidth: true 51 Layout.fillWidth: true
52 text: accountSettings.accountName 52 text: maildirSettings.accountName
53 onTextChanged: { accountSettings.accountName = text; } 53 onTextChanged: { maildirSettings.accountName = text; }
54 } 54 }
55 55
56 Text { 56 Text {
@@ -149,19 +149,11 @@ Rectangle {
149 property string password; 149 property string password;
150 } 150 }
151 151
152 KubeSettings.Settings {
153 id: accountSettings
154 identifier: "account." + accountId
155 property string accountName;
156 property string icon: root.icon;
157 }
158
159 Button { 152 Button {
160 text: "Save" 153 text: "Save"
161 onClicked: { 154 onClicked: {
162 transportSettings.save(); 155 transportSettings.save();
163 maildirSettings.save(); 156 maildirSettings.save();
164 accountSettings.save();
165 } 157 }
166 } 158 }
167 Button { 159 Button {
diff --git a/components/package/contents/ui/Settings.qml b/components/package/contents/ui/Settings.qml
index c17109a0..fa646372 100644
--- a/components/package/contents/ui/Settings.qml
+++ b/components/package/contents/ui/Settings.qml
@@ -61,6 +61,9 @@ Rectangle {
61 KubeFramework.AccountsController { 61 KubeFramework.AccountsController {
62 id: accountsController 62 id: accountsController
63 } 63 }
64 KubeFramework.AccountsModel {
65 id: accountsModel
66 }
64 67
65 SplitView { 68 SplitView {
66 anchors.fill: parent 69 anchors.fill: parent
@@ -76,7 +79,7 @@ Rectangle {
76 ListView { 79 ListView {
77 id: listView 80 id: listView
78 81
79 model: accountsController.accounts 82 model: accountsModel
80 83
81 currentIndex: -1 84 currentIndex: -1
82 85
@@ -90,7 +93,7 @@ Rectangle {
90 93
91 KubeFramework.AccountFactory { 94 KubeFramework.AccountFactory {
92 id: accountFactory 95 id: accountFactory
93 accountId: modelData 96 accountId: model.accountId
94 } 97 }
95 98
96 MouseArea { 99 MouseArea {
diff --git a/framework/domain/accountfactory.cpp b/framework/domain/accountfactory.cpp
index ab1a09e5..10f01f65 100644
--- a/framework/domain/accountfactory.cpp
+++ b/framework/domain/accountfactory.cpp
@@ -25,20 +25,29 @@
25#include <KPluginMetaData> 25#include <KPluginMetaData>
26 26
27#include "settings/settings.h" 27#include "settings/settings.h"
28#include <sink/store.h>
28 29
29AccountFactory::AccountFactory(QObject *parent) 30AccountFactory::AccountFactory(QObject *parent)
30 : QObject(parent) 31 : QObject(parent)
31{ 32{
32} 33}
33 34
35QString AccountFactory::name() const
36{
37 if (mName.isEmpty()) {
38 return tr("Account");
39 }
40 return mName;
41}
42
34void AccountFactory::setAccountId(const QString &accountId) 43void AccountFactory::setAccountId(const QString &accountId)
35{ 44{
36 mAccountId = accountId; 45 mAccountId = accountId;
37 46 Sink::Store::fetchOne<Sink::ApplicationDomain::SinkAccount>(Sink::Query::IdentityFilter(accountId.toUtf8()))
38 Kube::Account account(mAccountId.toUtf8()); 47 .then<void, Sink::ApplicationDomain::SinkAccount>([this](const Sink::ApplicationDomain::SinkAccount &account) {
39 mAccountType = account.type(); 48 mAccountType = account.getProperty("type").toByteArray();
40 49 loadPackage();
41 loadPackage(); 50 }).exec();
42} 51}
43 52
44void AccountFactory::loadPackage() 53void AccountFactory::loadPackage()
diff --git a/framework/domain/accountfactory.h b/framework/domain/accountfactory.h
index ed3c21d9..047454ae 100644
--- a/framework/domain/accountfactory.h
+++ b/framework/domain/accountfactory.h
@@ -29,13 +29,14 @@ class AccountFactory : public QObject
29{ 29{
30 Q_OBJECT 30 Q_OBJECT
31 Q_PROPERTY(QString accountId MEMBER mAccountId WRITE setAccountId); 31 Q_PROPERTY(QString accountId MEMBER mAccountId WRITE setAccountId);
32 Q_PROPERTY(QString name MEMBER mName NOTIFY accountLoaded); 32 Q_PROPERTY(QString name MEMBER mName READ name NOTIFY accountLoaded);
33 Q_PROPERTY(QString icon MEMBER mIcon NOTIFY accountLoaded); 33 Q_PROPERTY(QString icon MEMBER mIcon NOTIFY accountLoaded);
34 Q_PROPERTY(QString uiPath MEMBER mUiPath NOTIFY accountLoaded); 34 Q_PROPERTY(QString uiPath MEMBER mUiPath NOTIFY accountLoaded);
35public: 35public:
36 explicit AccountFactory(QObject *parent = Q_NULLPTR); 36 explicit AccountFactory(QObject *parent = Q_NULLPTR);
37 37
38 void setAccountId(const QString &); 38 void setAccountId(const QString &);
39 QString name() const;
39 40
40signals: 41signals:
41 void accountLoaded(); 42 void accountLoaded();
diff --git a/framework/domain/accountscontroller.cpp b/framework/domain/accountscontroller.cpp
index 1be03ba9..b5e7e9ca 100644
--- a/framework/domain/accountscontroller.cpp
+++ b/framework/domain/accountscontroller.cpp
@@ -21,6 +21,7 @@
21#include "accountscontroller.h" 21#include "accountscontroller.h"
22 22
23#include <settings/settings.h> 23#include <settings/settings.h>
24#include <sink/store.h>
24 25
25#include <QVariant> 26#include <QVariant>
26#include <QUuid> 27#include <QUuid>
@@ -28,27 +29,17 @@
28 29
29AccountsController::AccountsController(QObject *parent) : QObject(parent) 30AccountsController::AccountsController(QObject *parent) : QObject(parent)
30{ 31{
31 Kube::Settings settings("accounts");
32 mAccounts = settings.property("accounts").toStringList();
33 qWarning() << "Loaded accounts" << mAccounts;
34} 32}
35 33
36void AccountsController::createAccount(const QString &accountType) 34void AccountsController::createAccount(const QString &accountType)
37{ 35{
38 auto identifier = QUuid::createUuid().toByteArray(); 36 const auto identifier = QUuid::createUuid().toByteArray();
39 Kube::Account accountSettings(identifier); 37 Sink::ApplicationDomain::SinkAccount account;
40 accountSettings.setProperty("type", accountType); 38 account.setProperty("identifier", identifier);
41 accountSettings.save(); 39 account.setProperty("type", accountType);
42 40 Sink::Store::create(account).then<void>([]() {},
43 Kube::Settings settings("accounts"); 41 [](int errorCode, const QString &errorMessage) {
44 auto accounts = settings.property("accounts").toStringList(); 42 qWarning() << "Error while creating account: " << errorMessage;
45 accounts.append(identifier); 43 })
46 settings.setProperty("accounts", accounts); 44 .exec();
47 settings.save();
48
49 //TODO setup sink resources etc via plugin
50
51 qWarning() << "Created account " << identifier;
52 mAccounts.append(identifier);
53 emit accountsChanged();
54} 45}
diff --git a/framework/domain/accountscontroller.h b/framework/domain/accountscontroller.h
index 9d98de71..a4421de8 100644
--- a/framework/domain/accountscontroller.h
+++ b/framework/domain/accountscontroller.h
@@ -21,23 +21,13 @@
21 21
22#include <QObject> 22#include <QObject>
23#include <QString> 23#include <QString>
24#include <QStringList>
25#include <QVariant>
26 24
27class AccountsController : public QObject 25class AccountsController : public QObject
28{ 26{
29 Q_OBJECT 27 Q_OBJECT
30 Q_PROPERTY (QStringList accounts MEMBER mAccounts NOTIFY accountsChanged)
31
32public: 28public:
33 explicit AccountsController(QObject *parent = Q_NULLPTR); 29 explicit AccountsController(QObject *parent = Q_NULLPTR);
34 30
35signals:
36 void accountsChanged();
37
38public slots: 31public slots:
39 void createAccount(const QString &accountId); 32 void createAccount(const QString &accountId);
40
41private:
42 QStringList mAccounts;
43}; 33};
diff --git a/framework/domain/accountsmodel.cpp b/framework/domain/accountsmodel.cpp
index b5eafd53..8a3ab317 100644
--- a/framework/domain/accountsmodel.cpp
+++ b/framework/domain/accountsmodel.cpp
@@ -17,15 +17,14 @@
17 02110-1301, USA. 17 02110-1301, USA.
18*/ 18*/
19#include "accountsmodel.h" 19#include "accountsmodel.h"
20#include <sink/store.h>
20 21
21#include <settings/settings.h> 22AccountsModel::AccountsModel(QObject *parent) : QIdentityProxyModel()
22
23#include <QVariant>
24
25AccountsModel::AccountsModel(QObject *parent) : QAbstractListModel()
26{ 23{
27 Kube::Settings settings("accounts"); 24 Sink::Query query;
28 mAccounts = settings.property("accounts").toStringList(); 25 query.liveQuery = true;
26 query.requestedProperties << "name" << "icon";
27 runQuery(query);
29} 28}
30 29
31AccountsModel::~AccountsModel() 30AccountsModel::~AccountsModel()
@@ -46,20 +45,20 @@ QHash< int, QByteArray > AccountsModel::roleNames() const
46 45
47QVariant AccountsModel::data(const QModelIndex &idx, int role) const 46QVariant AccountsModel::data(const QModelIndex &idx, int role) const
48{ 47{
49 const auto identifier = mAccounts.at(idx.row()); 48 auto srcIdx = mapToSource(idx);
50 Kube::Account accountSettings(identifier.toLatin1());
51 switch (role) { 49 switch (role) {
52 case Name: 50 case Name:
53 return accountSettings.property("accountName").toString(); 51 return srcIdx.sibling(srcIdx.row(), 0).data(Qt::DisplayRole).toString();
54 case Icon: 52 case Icon:
55 return accountSettings.property("icon").toString(); 53 return srcIdx.sibling(srcIdx.row(), 1).data(Qt::DisplayRole).toString();
56 case AccountId: 54 case AccountId:
57 return identifier; 55 return srcIdx.data(Sink::Store::DomainObjectBaseRole).value<Sink::ApplicationDomain::ApplicationDomainType::Ptr>()->identifier();
58 } 56 }
59 return QVariant(); 57 return QIdentityProxyModel::data(idx, role);
60} 58}
61 59
62int AccountsModel::rowCount(const QModelIndex &idx) const 60void AccountsModel::runQuery(const Sink::Query &query)
63{ 61{
64 return mAccounts.size(); 62 mModel = Sink::Store::loadModel<Sink::ApplicationDomain::SinkAccount>(query);
63 setSourceModel(mModel.data());
65} 64}
diff --git a/framework/domain/accountsmodel.h b/framework/domain/accountsmodel.h
index a50c2e4a..9180bc09 100644
--- a/framework/domain/accountsmodel.h
+++ b/framework/domain/accountsmodel.h
@@ -20,11 +20,15 @@
20#pragma once 20#pragma once
21 21
22#include <QObject> 22#include <QObject>
23#include <QAbstractListModel> 23#include <QIdentityProxyModel>
24#include <QSharedPointer> 24#include <QSharedPointer>
25#include <QStringList> 25#include <QStringList>
26 26
27class AccountsModel : public QAbstractListModel 27namespace Sink {
28 class Query;
29}
30
31class AccountsModel : public QIdentityProxyModel
28{ 32{
29 Q_OBJECT 33 Q_OBJECT
30 34
@@ -32,8 +36,7 @@ public:
32 AccountsModel(QObject *parent = Q_NULLPTR); 36 AccountsModel(QObject *parent = Q_NULLPTR);
33 ~AccountsModel(); 37 ~AccountsModel();
34 38
35 int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; 39 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
36 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
37 40
38 enum Roles { 41 enum Roles {
39 Name = Qt::UserRole + 1, 42 Name = Qt::UserRole + 1,
@@ -42,7 +45,9 @@ public:
42 }; 45 };
43 Q_ENUMS(Roles) 46 Q_ENUMS(Roles)
44 47
45 QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; 48 QHash<int, QByteArray> roleNames() const;
49
46private: 50private:
47 QStringList mAccounts; 51 void runQuery(const Sink::Query &query);
52 QSharedPointer<QAbstractItemModel> mModel;
48}; 53};
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
73void FolderListModel::setAccountId(const QVariant &accountId) 73void 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
91QVariant FolderListModel::accountId() const 90QVariant FolderListModel::accountId() const