diff options
Diffstat (limited to 'common/resourcefacade.cpp')
-rw-r--r-- | common/resourcefacade.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/common/resourcefacade.cpp b/common/resourcefacade.cpp index 4bf4962..2969c44 100644 --- a/common/resourcefacade.cpp +++ b/common/resourcefacade.cpp | |||
@@ -152,7 +152,7 @@ static Sink::ApplicationDomain::SinkAccount::Ptr readAccountFromConfig(const QBy | |||
152 | auto account = Sink::ApplicationDomain::SinkAccount::Ptr::create(id); | 152 | auto account = Sink::ApplicationDomain::SinkAccount::Ptr::create(id); |
153 | 153 | ||
154 | account->setProperty("type", type); | 154 | account->setProperty("type", type); |
155 | const auto configurationValues = AccountConfig::getConfiguration(id); | 155 | const auto configurationValues = ConfigStore("accounts").get(id); |
156 | for (auto it = configurationValues.constBegin(); it != configurationValues.constEnd(); it++) { | 156 | for (auto it = configurationValues.constBegin(); it != configurationValues.constEnd(); it++) { |
157 | account->setProperty(it.key(), it.value()); | 157 | account->setProperty(it.key(), it.value()); |
158 | } | 158 | } |
@@ -160,7 +160,7 @@ static Sink::ApplicationDomain::SinkAccount::Ptr readAccountFromConfig(const QBy | |||
160 | } | 160 | } |
161 | 161 | ||
162 | 162 | ||
163 | AccountFacade::AccountFacade(const QByteArray &) : Sink::StoreFacade<Sink::ApplicationDomain::SinkAccount>() | 163 | AccountFacade::AccountFacade(const QByteArray &) : Sink::StoreFacade<Sink::ApplicationDomain::SinkAccount>(), mConfigStore("accounts") |
164 | { | 164 | { |
165 | } | 165 | } |
166 | 166 | ||
@@ -174,8 +174,8 @@ KAsync::Job<void> AccountFacade::create(const Sink::ApplicationDomain::SinkAccou | |||
174 | const QByteArray type = account.getProperty("type").toByteArray(); | 174 | const QByteArray type = account.getProperty("type").toByteArray(); |
175 | const QByteArray providedIdentifier = account.getProperty("identifier").toByteArray(); | 175 | const QByteArray providedIdentifier = account.getProperty("identifier").toByteArray(); |
176 | // It is currently a requirement that the account starts with the type | 176 | // It is currently a requirement that the account starts with the type |
177 | const QByteArray identifier = providedIdentifier.isEmpty() ? AccountConfig::newIdentifier(type) : providedIdentifier; | 177 | const QByteArray identifier = providedIdentifier.isEmpty() ? ResourceConfig::newIdentifier(type) : providedIdentifier; |
178 | AccountConfig::addAccount(identifier, type); | 178 | mConfigStore.add(identifier, type); |
179 | auto changedProperties = account.changedProperties(); | 179 | auto changedProperties = account.changedProperties(); |
180 | changedProperties.removeOne("identifier"); | 180 | changedProperties.removeOne("identifier"); |
181 | changedProperties.removeOne("type"); | 181 | changedProperties.removeOne("type"); |
@@ -185,7 +185,7 @@ KAsync::Job<void> AccountFacade::create(const Sink::ApplicationDomain::SinkAccou | |||
185 | for (const auto &property : changedProperties) { | 185 | for (const auto &property : changedProperties) { |
186 | configurationValues.insert(property, account.getProperty(property)); | 186 | configurationValues.insert(property, account.getProperty(property)); |
187 | } | 187 | } |
188 | AccountConfig::configureAccount(identifier, configurationValues); | 188 | mConfigStore.modify(identifier, configurationValues); |
189 | } | 189 | } |
190 | sConfig->add(readAccountFromConfig(identifier, type)); | 190 | sConfig->add(readAccountFromConfig(identifier, type)); |
191 | }); | 191 | }); |
@@ -208,10 +208,10 @@ KAsync::Job<void> AccountFacade::modify(const Sink::ApplicationDomain::SinkAccou | |||
208 | for (const auto &property : changedProperties) { | 208 | for (const auto &property : changedProperties) { |
209 | configurationValues.insert(property, account.getProperty(property)); | 209 | configurationValues.insert(property, account.getProperty(property)); |
210 | } | 210 | } |
211 | AccountConfig::configureAccount(identifier, configurationValues); | 211 | mConfigStore.modify(identifier, configurationValues); |
212 | } | 212 | } |
213 | 213 | ||
214 | const auto type = AccountConfig::getAccounts().value(identifier); | 214 | const auto type = mConfigStore.getEntries().value(identifier); |
215 | sConfig->modify(readAccountFromConfig(identifier, type)); | 215 | sConfig->modify(readAccountFromConfig(identifier, type)); |
216 | }); | 216 | }); |
217 | } | 217 | } |
@@ -224,7 +224,7 @@ KAsync::Job<void> AccountFacade::remove(const Sink::ApplicationDomain::SinkAccou | |||
224 | Warning() << "We need an \"identifier\" property to identify the account to configure"; | 224 | Warning() << "We need an \"identifier\" property to identify the account to configure"; |
225 | return; | 225 | return; |
226 | } | 226 | } |
227 | AccountConfig::removeAccount(identifier); | 227 | mConfigStore.remove(identifier); |
228 | sConfig->remove(Sink::ApplicationDomain::SinkAccount::Ptr::create(account)); | 228 | sConfig->remove(Sink::ApplicationDomain::SinkAccount::Ptr::create(account)); |
229 | }); | 229 | }); |
230 | } | 230 | } |
@@ -237,7 +237,7 @@ QPair<KAsync::Job<void>, typename Sink::ResultEmitter<Sink::ApplicationDomain::S | |||
237 | resultProvider->setFetcher([](const QSharedPointer<Sink::ApplicationDomain::SinkAccount> &) {}); | 237 | resultProvider->setFetcher([](const QSharedPointer<Sink::ApplicationDomain::SinkAccount> &) {}); |
238 | resultProvider->onDone([=]() { delete resultProvider; delete guard; }); | 238 | resultProvider->onDone([=]() { delete resultProvider; delete guard; }); |
239 | auto job = KAsync::start<void>([=]() { | 239 | auto job = KAsync::start<void>([=]() { |
240 | const auto configuredAccounts = AccountConfig::getAccounts(); | 240 | const auto configuredAccounts = mConfigStore.getEntries(); |
241 | for (const auto &res : configuredAccounts.keys()) { | 241 | for (const auto &res : configuredAccounts.keys()) { |
242 | const auto type = configuredAccounts.value(res); | 242 | const auto type = configuredAccounts.value(res); |
243 | if (!query.ids.isEmpty() && !query.ids.contains(res)) { | 243 | if (!query.ids.isEmpty() && !query.ids.contains(res)) { |