summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-04-29 14:26:30 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-04-29 14:28:53 +0200
commit53e988faa295f245dea4f69249ecb165e245a9c3 (patch)
tree78c45e89e7bba5f4bb5a22dbe498561c98b7df34
parent90a5016995f43a5f65b7877dc206092af581f29e (diff)
downloadkube-53e988faa295f245dea4f69249ecb165e245a9c3.tar.gz
kube-53e988faa295f245dea4f69249ecb165e245a9c3.zip
Avoid assembling uid ourselves
-rw-r--r--accounts/maildir/maildirsettings.cpp16
-rw-r--r--framework/domain/accountscontroller.cpp5
2 files changed, 5 insertions, 16 deletions
diff --git a/accounts/maildir/maildirsettings.cpp b/accounts/maildir/maildirsettings.cpp
index e47b834f..96b75a1e 100644
--- a/accounts/maildir/maildirsettings.cpp
+++ b/accounts/maildir/maildirsettings.cpp
@@ -22,7 +22,6 @@
22 22
23#include <sink/store.h> 23#include <sink/store.h>
24#include <QDebug> 24#include <QDebug>
25#include <QUuid>
26#include <QDir> 25#include <QDir>
27#include <QUrl> 26#include <QUrl>
28 27
@@ -177,12 +176,9 @@ void MaildirSettings::save()
177 }) 176 })
178 .exec(); 177 .exec();
179 } else { 178 } else {
180 const auto resourceIdentifier = "org.kde.maildir." + QUuid::createUuid().toByteArray(); 179 auto resource = Sink::ApplicationDomain::ApplicationDomainType::createEntity<Sink::ApplicationDomain::SinkResource>();
181 mIdentifier = resourceIdentifier; 180 mIdentifier = resource.identifier();
182
183 Sink::ApplicationDomain::SinkResource resource;
184 resource.setProperty("path", property("path")); 181 resource.setProperty("path", property("path"));
185 resource.setProperty("identifier", resourceIdentifier);
186 resource.setProperty("type", "org.kde.maildir"); 182 resource.setProperty("type", "org.kde.maildir");
187 resource.setProperty("account", mAccountIdentifier); 183 resource.setProperty("account", mAccountIdentifier);
188 Sink::Store::create(resource).then<void>([]() {}, 184 Sink::Store::create(resource).then<void>([]() {},
@@ -202,12 +198,8 @@ void MaildirSettings::save()
202 }) 198 })
203 .exec(); 199 .exec();
204 } else { 200 } else {
205 //FIXME we shouldn't have to do this magic 201 auto resource = Sink::ApplicationDomain::ApplicationDomainType::createEntity<Sink::ApplicationDomain::SinkResource>();
206 const auto resourceIdentifier = "org.kde.mailtransport." + QUuid::createUuid().toByteArray(); 202 mMailtransportIdentifier = resource.identifier();
207 mMailtransportIdentifier = resourceIdentifier;
208
209 Sink::ApplicationDomain::SinkResource resource;
210 resource.setProperty("identifier", resourceIdentifier);
211 resource.setProperty("type", "org.kde.mailtransport"); 203 resource.setProperty("type", "org.kde.mailtransport");
212 resource.setProperty("account", mAccountIdentifier); 204 resource.setProperty("account", mAccountIdentifier);
213 resource.setProperty("server", mSmtpServer); 205 resource.setProperty("server", mSmtpServer);
diff --git a/framework/domain/accountscontroller.cpp b/framework/domain/accountscontroller.cpp
index b5e7e9ca..2f47fa03 100644
--- a/framework/domain/accountscontroller.cpp
+++ b/framework/domain/accountscontroller.cpp
@@ -24,7 +24,6 @@
24#include <sink/store.h> 24#include <sink/store.h>
25 25
26#include <QVariant> 26#include <QVariant>
27#include <QUuid>
28#include <QDebug> 27#include <QDebug>
29 28
30AccountsController::AccountsController(QObject *parent) : QObject(parent) 29AccountsController::AccountsController(QObject *parent) : QObject(parent)
@@ -33,9 +32,7 @@ AccountsController::AccountsController(QObject *parent) : QObject(parent)
33 32
34void AccountsController::createAccount(const QString &accountType) 33void AccountsController::createAccount(const QString &accountType)
35{ 34{
36 const auto identifier = QUuid::createUuid().toByteArray(); 35 auto account = Sink::ApplicationDomain::ApplicationDomainType::createEntity<Sink::ApplicationDomain::SinkAccount>();
37 Sink::ApplicationDomain::SinkAccount account;
38 account.setProperty("identifier", identifier);
39 account.setProperty("type", accountType); 36 account.setProperty("type", accountType);
40 Sink::Store::create(account).then<void>([]() {}, 37 Sink::Store::create(account).then<void>([]() {},
41 [](int errorCode, const QString &errorMessage) { 38 [](int errorCode, const QString &errorMessage) {