From 1213815b42e94f41817b79fc9e311742a330d9ae Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 12 Jul 2016 17:31:28 +0200 Subject: Remove account also if no resources are available --- accounts/imap/imapsettings.cpp | 10 +++++++++- accounts/maildir/maildirsettings.cpp | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'accounts') diff --git a/accounts/imap/imapsettings.cpp b/accounts/imap/imapsettings.cpp index 6e45b197..fcef8971 100644 --- a/accounts/imap/imapsettings.cpp +++ b/accounts/imap/imapsettings.cpp @@ -222,7 +222,7 @@ void ImapSettings::save() void ImapSettings::remove() { - if (mIdentifier.isEmpty()) { + if (mMailtransportIdentifier.isEmpty()) { qWarning() << "We're missing an identifier"; } else { Sink::ApplicationDomain::SinkResource mailTransportResource("", mMailtransportIdentifier, 0, QSharedPointer::create()); @@ -231,14 +231,22 @@ void ImapSettings::remove() qWarning() << "Error while removing resource: " << errorMessage; }) .exec(); + } + if (mIdentifier.isEmpty()) { + qWarning() << "We're missing an identifier"; + } else { Sink::ApplicationDomain::SinkResource resource("", mIdentifier, 0, QSharedPointer::create()); Sink::Store::remove(resource).then([]() {}, [](int errorCode, const QString &errorMessage) { qWarning() << "Error while removing resource: " << errorMessage; }) .exec(); + } + if (mAccountIdentifier.isEmpty()) { + qWarning() << "We're missing an identifier"; + } else { Sink::ApplicationDomain::SinkAccount account("", mAccountIdentifier, 0, QSharedPointer::create()); Sink::Store::remove(account).then([]() {}, [](int errorCode, const QString &errorMessage) { diff --git a/accounts/maildir/maildirsettings.cpp b/accounts/maildir/maildirsettings.cpp index 5125bbe7..5c1fb177 100644 --- a/accounts/maildir/maildirsettings.cpp +++ b/accounts/maildir/maildirsettings.cpp @@ -232,7 +232,7 @@ void MaildirSettings::save() void MaildirSettings::remove() { - if (mIdentifier.isEmpty()) { + if (mMailtransportIdentifier.isEmpty()) { qWarning() << "We're missing an identifier"; } else { Sink::ApplicationDomain::SinkResource mailTransportResource("", mMailtransportIdentifier, 0, QSharedPointer::create()); @@ -241,14 +241,22 @@ void MaildirSettings::remove() qWarning() << "Error while removing resource: " << errorMessage; }) .exec(); + } + if (mIdentifier.isEmpty()) { + qWarning() << "We're missing an identifier"; + } else { Sink::ApplicationDomain::SinkResource resource("", mIdentifier, 0, QSharedPointer::create()); Sink::Store::remove(resource).then([]() {}, [](int errorCode, const QString &errorMessage) { qWarning() << "Error while removing resource: " << errorMessage; }) .exec(); + } + if (mAccountIdentifier.isEmpty()) { + qWarning() << "We're missing an identifier"; + } else { Sink::ApplicationDomain::SinkAccount account("", mAccountIdentifier, 0, QSharedPointer::create()); Sink::Store::remove(account).then([]() {}, [](int errorCode, const QString &errorMessage) { -- cgit v1.2.3