From e868e3058eb9d1b73204211507a4fd059c9123af Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 28 Jun 2016 00:11:25 +0200 Subject: Move-to-trash action --- components/mail/contents/ui/main.qml | 2 +- framework/domain/actions/sinkactions.cpp | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/components/mail/contents/ui/main.qml b/components/mail/contents/ui/main.qml index 22ff50a0..4cda7f8e 100644 --- a/components/mail/contents/ui/main.qml +++ b/components/mail/contents/ui/main.qml @@ -71,7 +71,7 @@ ApplicationWindow { KubeAction.Action { id: deleteAction - actionId: "org.kde.kube.actions.delete" + actionId: "org.kde.kube.actions.move-to-trash" context: maillistcontext } diff --git a/framework/domain/actions/sinkactions.cpp b/framework/domain/actions/sinkactions.cpp index e4fb73ed..6a0028e9 100644 --- a/framework/domain/actions/sinkactions.cpp +++ b/framework/domain/actions/sinkactions.cpp @@ -42,6 +42,22 @@ static ActionHandlerHelper markAsReadHandler("org.kde.kube.actions.mark-as-read" } ); +static ActionHandlerHelper moveToTrashHandler("org.kde.kube.actions.move-to-trash", + [](Context *context) -> bool { + return context->property("mail").isValid(); + }, + [](Context *context) { + auto mail = context->property("mail").value(); + if (!mail) { + qWarning() << "Failed to get the mail mail: " << context->property("mail"); + return; + } + mail->setTrash(true); + qDebug() << "Move to trash " << mail->identifier(); + Sink::Store::modify(*mail).exec(); + } +); + static ActionHandlerHelper deleteHandler("org.kde.kube.actions.delete", [](Context *context) -> bool { return context->property("mail").isValid(); @@ -52,7 +68,6 @@ static ActionHandlerHelper deleteHandler("org.kde.kube.actions.delete", qWarning() << "Failed to get the mail mail: " << context->property("mail"); return; } - mail->setProperty("unread", false); qDebug() << "Remove " << mail->identifier(); Sink::Store::remove(*mail).exec(); } -- cgit v1.2.3