From 88e8ed3cc36939f220a7051062dd203054d2ade6 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 13 Apr 2016 09:05:31 +0200 Subject: Stop abusing the identifier property --- common/resourcefacade.cpp | 3 +-- 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 LocalStorageFacade::create(const DomainType &domai { return KAsync::start([domainObject, this]() { const QByteArray type = domainObject.getProperty("type").toByteArray(); - //FIXME use .identifier() instead - const QByteArray providedIdentifier = domainObject.getProperty("identifier").toByteArray(); + const QByteArray providedIdentifier = domainObject.identifier().isEmpty() ? domainObject.getProperty("identifier").toByteArray() : domainObject.identifier(); const QByteArray identifier = providedIdentifier.isEmpty() ? ResourceConfig::newIdentifier(type) : providedIdentifier; mConfigStore.add(identifier, type); 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: QString accountName("name"); QString accountIcon("icon"); auto account = ApplicationDomainType::createEntity(); - //FIXME Get rid of this line - account.setProperty("identifier", account.identifier()); account.setProperty("type", "maildir"); account.setProperty("name", accountName); account.setProperty("icon", accountIcon); @@ -54,8 +52,6 @@ private slots: QString smtpUsername("smtpUsername"); QString smtpPassword("smtpPassword"); auto resource = ApplicationDomainType::createEntity(); - //FIXME Get rid of this line - resource.setProperty("identifier", resource.identifier()); resource.setProperty("type", "org.kde.mailtransport"); resource.setProperty("account", account.identifier()); resource.setProperty("server", smtpServer); @@ -95,7 +91,11 @@ private slots: auto model = Store::loadModel(query); QSignalSpy spy(model.data(), &QAbstractItemModel::rowsInserted); QTRY_COMPARE(spy.count(), 1); - Store::create(account).exec().waitForFinished(); + + auto account2 = ApplicationDomainType::createEntity(); + account2.setProperty("type", "maildir"); + account2.setProperty("name", "name"); + Store::create(account2).exec().waitForFinished(); QTRY_COMPARE(spy.count(), 2); //Ensure the notifier only affects one type -- cgit v1.2.3