From b830955f98f360775e90a15e0cf431717b9e8572 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 14 Jul 2016 09:41:44 +0200 Subject: Start using Sink::Log for Kube as well. --- framework/domain/actions/sinkactions.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'framework') diff --git a/framework/domain/actions/sinkactions.cpp b/framework/domain/actions/sinkactions.cpp index 6a0028e9..6b59829c 100644 --- a/framework/domain/actions/sinkactions.cpp +++ b/framework/domain/actions/sinkactions.cpp @@ -23,6 +23,9 @@ #include #include +#include + +SINK_DEBUG_AREA("sinkactions") using namespace Kube; @@ -33,11 +36,11 @@ static ActionHandlerHelper markAsReadHandler("org.kde.kube.actions.mark-as-read" [](Context *context) { auto mail = context->property("mail").value(); if (!mail) { - qWarning() << "Failed to get the mail mail: " << context->property("mail"); + SinkWarning() << "Failed to get the mail mail: " << context->property("mail"); return; } mail->setProperty("unread", false); - qDebug() << "Mark as read " << mail->identifier(); + SinkLog() << "Mark as read " << mail->identifier(); Sink::Store::modify(*mail).exec(); } ); @@ -49,11 +52,11 @@ static ActionHandlerHelper moveToTrashHandler("org.kde.kube.actions.move-to-tras [](Context *context) { auto mail = context->property("mail").value(); if (!mail) { - qWarning() << "Failed to get the mail mail: " << context->property("mail"); + SinkWarning() << "Failed to get the mail mail: " << context->property("mail"); return; } mail->setTrash(true); - qDebug() << "Move to trash " << mail->identifier(); + SinkLog() << "Move to trash " << mail->identifier(); Sink::Store::modify(*mail).exec(); } ); @@ -65,10 +68,10 @@ static ActionHandlerHelper deleteHandler("org.kde.kube.actions.delete", [](Context *context) { auto mail = context->property("mail").value(); if (!mail) { - qWarning() << "Failed to get the mail mail: " << context->property("mail"); + SinkWarning() << "Failed to get the mail mail: " << context->property("mail"); return; } - qDebug() << "Remove " << mail->identifier(); + SinkLog() << "Remove " << mail->identifier(); Sink::Store::remove(*mail).exec(); } ); @@ -79,10 +82,10 @@ static ActionHandlerHelper synchronizeHandler("org.kde.kube.actions.synchronize" }, [](Context *context) { if (auto folder = context->property("folder").value()) { - qDebug() << "Synchronizing resource " << folder->resourceInstanceIdentifier(); + SinkLog() << "Synchronizing resource " << folder->resourceInstanceIdentifier(); Sink::Store::synchronize(Sink::Query::ResourceFilter(folder->resourceInstanceIdentifier())).exec(); } else { - qDebug() << "Synchronizing all"; + SinkLog() << "Synchronizing all"; Sink::Store::synchronize(Sink::Query()).exec(); } } @@ -97,7 +100,7 @@ static ActionHandlerHelper sendMailHandler("org.kde.kube.actions.sendmail", [](Context *context) { auto accountId = context->property("accountId").value(); auto message = context->property("message").value(); - qWarning() << "Sending a mail: "; + SinkLog() << "Sending a mail: "; Sink::Query query; query += Sink::Query::CapabilityFilter(Sink::ApplicationDomain::ResourceCapabilities::Mail::transport); @@ -106,12 +109,12 @@ static ActionHandlerHelper sendMailHandler("org.kde.kube.actions.sendmail", .then>([=](const QList &resources) { if (!resources.isEmpty()) { auto resourceId = resources[0]->identifier(); - qDebug() << "Sending message via resource: " << resourceId; + SinkTrace() << "Sending message via resource: " << resourceId; Sink::ApplicationDomain::Mail mail(resourceId); mail.setBlobProperty("mimeMessage", message->encodedContent()); return Sink::Store::create(mail); } - qWarning() << "Failed to find a mailtransport resource"; + SinkWarning() << "Failed to find a mailtransport resource"; return KAsync::error(0, "Failed to find a MailTransport resource."); }).exec(); } @@ -124,12 +127,12 @@ static ActionHandlerHelper saveAsDraft("org.kde.kube.actions.save-as-draft", return !accountId.isEmpty() && message; }, ActionHandlerHelper::JobHandler([](Context *context) -> KAsync::Job { - qWarning() << "executing 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(); if (!message) { - qWarning() << "Failed to get the mail: " << context->property("mail"); + SinkWarning() << "Failed to get the mail: " << context->property("mail"); return KAsync::error(1, "Failed to get the mail: " + context->property("mail").toString()); } @@ -145,7 +148,7 @@ static ActionHandlerHelper saveAsDraft("org.kde.kube.actions.save-as-draft", return Sink::Store::create(mail); }); } else { - qWarning() << "Modifying an existing mail" << existingMail.identifier(); + SinkWarning() << "Modifying an existing mail" << existingMail.identifier(); existingMail.setBlobProperty("mimeMessage", message->encodedContent()); return Sink::Store::modify(existingMail); } -- cgit v1.2.3