From 268eb7207b955bb92e4ae2572996877e7f837325 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 4 Oct 2016 12:19:27 +0200 Subject: Less namespaces improve readability --- framework/domain/actions/sinkactions.cpp | 37 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'framework/domain/actions/sinkactions.cpp') diff --git a/framework/domain/actions/sinkactions.cpp b/framework/domain/actions/sinkactions.cpp index 47041a5b..e79e79c9 100644 --- a/framework/domain/actions/sinkactions.cpp +++ b/framework/domain/actions/sinkactions.cpp @@ -29,20 +29,21 @@ SINK_DEBUG_AREA("sinkactions") using namespace Kube; using namespace Sink; +using namespace Sink::ApplicationDomain; static ActionHandlerHelper markAsReadHandler("org.kde.kube.actions.mark-as-read", [](Context *context) -> bool { return context->property("mail").isValid(); }, [](Context *context) { - auto mail = context->property("mail").value(); + auto mail = context->property("mail").value(); if (!mail) { SinkWarning() << "Failed to get the mail mail: " << context->property("mail"); return; } mail->setProperty("unread", false); SinkLog() << "Mark as read " << mail->identifier(); - Sink::Store::modify(*mail).exec(); + Store::modify(*mail).exec(); } ); @@ -51,14 +52,14 @@ static ActionHandlerHelper moveToTrashHandler("org.kde.kube.actions.move-to-tras return context->property("mail").isValid(); }, [](Context *context) { - auto mail = context->property("mail").value(); + auto mail = context->property("mail").value(); if (!mail) { SinkWarning() << "Failed to get the mail mail: " << context->property("mail"); return; } mail->setTrash(true); SinkLog() << "Move to trash " << mail->identifier(); - Sink::Store::modify(*mail).exec(); + Store::modify(*mail).exec(); } ); @@ -67,13 +68,13 @@ static ActionHandlerHelper deleteHandler("org.kde.kube.actions.delete", return context->property("mail").isValid(); }, [](Context *context) { - auto mail = context->property("mail").value(); + auto mail = context->property("mail").value(); if (!mail) { SinkWarning() << "Failed to get the mail mail: " << context->property("mail"); return; } SinkLog() << "Remove " << mail->identifier(); - Sink::Store::remove(*mail).exec(); + Store::remove(*mail).exec(); } ); @@ -82,12 +83,12 @@ static ActionHandlerHelper synchronizeHandler("org.kde.kube.actions.synchronize" return true; }, [](Context *context) { - if (auto folder = context->property("folder").value()) { + if (auto folder = context->property("folder").value()) { SinkLog() << "Synchronizing resource " << folder->resourceInstanceIdentifier(); - Sink::Store::synchronize(Sink::Query::ResourceFilter(folder->resourceInstanceIdentifier())).exec(); + Store::synchronize(Query::ResourceFilter(folder->resourceInstanceIdentifier())).exec(); } else { SinkLog() << "Synchronizing all"; - Sink::Store::synchronize(Sink::Query()).exec(); + Store::synchronize(Query()).exec(); } } ); @@ -111,9 +112,9 @@ static ActionHandlerHelper sendMailHandler("org.kde.kube.actions.sendmail", if (!resources.isEmpty()) { auto resourceId = resources[0]->identifier(); SinkTrace() << "Sending message via resource: " << resourceId; - Sink::ApplicationDomain::Mail mail(resourceId); + Mail mail(resourceId); mail.setBlobProperty("mimeMessage", message->encodedContent()); - return Sink::Store::create(mail); + return Store::create(mail); } SinkWarning() << "Failed to find a mailtransport resource"; return KAsync::error(0, "Failed to find a MailTransport resource."); @@ -131,27 +132,27 @@ static ActionHandlerHelper saveAsDraft("org.kde.kube.actions.save-as-draft", SinkWarning() << "executing save as draft"; const auto accountId = context->property("accountId").value(); const auto message = context->property("message").value(); - auto existingMail = context->property("existingMail").value(); + auto existingMail = context->property("existingMail").value(); if (!message) { SinkWarning() << "Failed to get the mail: " << context->property("mail"); return KAsync::error(1, "Failed to get the mail: " + context->property("mail").toString()); } if (existingMail.identifier().isEmpty()) { - Sink::Query query; + Query query; query.containsFilter(ApplicationDomain::ResourceCapabilities::Mail::drafts); query.filter(ApplicationDomain::SinkAccount(accountId)); - return Sink::Store::fetchOne(query) - .then([=](const Sink::ApplicationDomain::SinkResource &resource) -> KAsync::Job { - Sink::ApplicationDomain::Mail mail(resource.identifier()); + return Store::fetchOne(query) + .then([=](const SinkResource &resource) -> KAsync::Job { + Mail mail(resource.identifier()); mail.setProperty("draft", true); mail.setBlobProperty("mimeMessage", message->encodedContent()); - return Sink::Store::create(mail); + return Store::create(mail); }); } else { SinkWarning() << "Modifying an existing mail" << existingMail.identifier(); existingMail.setBlobProperty("mimeMessage", message->encodedContent()); - return Sink::Store::modify(existingMail); + return Store::modify(existingMail); } }) ); -- cgit v1.2.3