diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-04-13 09:05:31 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-04-13 09:05:31 +0200 |
commit | 88e8ed3cc36939f220a7051062dd203054d2ade6 (patch) | |
tree | 5aa945b338a051ee164c7f980e2ac75b680d737b | |
parent | b9ad9462df22a4d5c50ecb7c1c581c637f22ed61 (diff) | |
download | sink-88e8ed3cc36939f220a7051062dd203054d2ade6.tar.gz sink-88e8ed3cc36939f220a7051062dd203054d2ade6.zip |
Stop abusing the identifier property
-rw-r--r-- | common/resourcefacade.cpp | 3 | ||||
-rw-r--r-- | tests/accountstest.cpp | 10 |
2 files changed, 6 insertions, 7 deletions
diff --git a/common/resourcefacade.cpp b/common/resourcefacade.cpp index accbd6d..e6d235f 100644 --- a/common/resourcefacade.cpp +++ b/common/resourcefacade.cpp | |||
@@ -54,8 +54,7 @@ KAsync::Job<void> LocalStorageFacade<DomainType>::create(const DomainType &domai | |||
54 | { | 54 | { |
55 | return KAsync::start<void>([domainObject, this]() { | 55 | return KAsync::start<void>([domainObject, this]() { |
56 | const QByteArray type = domainObject.getProperty("type").toByteArray(); | 56 | const QByteArray type = domainObject.getProperty("type").toByteArray(); |
57 | //FIXME use .identifier() instead | 57 | const QByteArray providedIdentifier = domainObject.identifier().isEmpty() ? domainObject.getProperty("identifier").toByteArray() : domainObject.identifier(); |
58 | const QByteArray providedIdentifier = domainObject.getProperty("identifier").toByteArray(); | ||
59 | const QByteArray identifier = providedIdentifier.isEmpty() ? ResourceConfig::newIdentifier(type) : providedIdentifier; | 58 | const QByteArray identifier = providedIdentifier.isEmpty() ? ResourceConfig::newIdentifier(type) : providedIdentifier; |
60 | mConfigStore.add(identifier, type); | 59 | mConfigStore.add(identifier, type); |
61 | auto changedProperties = domainObject.changedProperties(); | 60 | auto changedProperties = domainObject.changedProperties(); |
diff --git a/tests/accountstest.cpp b/tests/accountstest.cpp index 626a262..6f109f8 100644 --- a/tests/accountstest.cpp +++ b/tests/accountstest.cpp | |||
@@ -34,8 +34,6 @@ private slots: | |||
34 | QString accountName("name"); | 34 | QString accountName("name"); |
35 | QString accountIcon("icon"); | 35 | QString accountIcon("icon"); |
36 | auto account = ApplicationDomainType::createEntity<SinkAccount>(); | 36 | auto account = ApplicationDomainType::createEntity<SinkAccount>(); |
37 | //FIXME Get rid of this line | ||
38 | account.setProperty("identifier", account.identifier()); | ||
39 | account.setProperty("type", "maildir"); | 37 | account.setProperty("type", "maildir"); |
40 | account.setProperty("name", accountName); | 38 | account.setProperty("name", accountName); |
41 | account.setProperty("icon", accountIcon); | 39 | account.setProperty("icon", accountIcon); |
@@ -54,8 +52,6 @@ private slots: | |||
54 | QString smtpUsername("smtpUsername"); | 52 | QString smtpUsername("smtpUsername"); |
55 | QString smtpPassword("smtpPassword"); | 53 | QString smtpPassword("smtpPassword"); |
56 | auto resource = ApplicationDomainType::createEntity<SinkResource>(); | 54 | auto resource = ApplicationDomainType::createEntity<SinkResource>(); |
57 | //FIXME Get rid of this line | ||
58 | resource.setProperty("identifier", resource.identifier()); | ||
59 | resource.setProperty("type", "org.kde.mailtransport"); | 55 | resource.setProperty("type", "org.kde.mailtransport"); |
60 | resource.setProperty("account", account.identifier()); | 56 | resource.setProperty("account", account.identifier()); |
61 | resource.setProperty("server", smtpServer); | 57 | resource.setProperty("server", smtpServer); |
@@ -95,7 +91,11 @@ private slots: | |||
95 | auto model = Store::loadModel<SinkAccount>(query); | 91 | auto model = Store::loadModel<SinkAccount>(query); |
96 | QSignalSpy spy(model.data(), &QAbstractItemModel::rowsInserted); | 92 | QSignalSpy spy(model.data(), &QAbstractItemModel::rowsInserted); |
97 | QTRY_COMPARE(spy.count(), 1); | 93 | QTRY_COMPARE(spy.count(), 1); |
98 | Store::create(account).exec().waitForFinished(); | 94 | |
95 | auto account2 = ApplicationDomainType::createEntity<SinkAccount>(); | ||
96 | account2.setProperty("type", "maildir"); | ||
97 | account2.setProperty("name", "name"); | ||
98 | Store::create(account2).exec().waitForFinished(); | ||
99 | QTRY_COMPARE(spy.count(), 2); | 99 | QTRY_COMPARE(spy.count(), 2); |
100 | 100 | ||
101 | //Ensure the notifier only affects one type | 101 | //Ensure the notifier only affects one type |