diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-28 00:11:25 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-28 00:11:25 +0200 |
commit | e868e3058eb9d1b73204211507a4fd059c9123af (patch) | |
tree | 16ea98dd83fe4db4c9f7fe0e3832e72c776661ca | |
parent | 2961dd43a3e861e25d64a14ddc41165a4f09ded8 (diff) | |
download | kube-e868e3058eb9d1b73204211507a4fd059c9123af.tar.gz kube-e868e3058eb9d1b73204211507a4fd059c9123af.zip |
Move-to-trash action
-rw-r--r-- | components/mail/contents/ui/main.qml | 2 | ||||
-rw-r--r-- | 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 { | |||
71 | 71 | ||
72 | KubeAction.Action { | 72 | KubeAction.Action { |
73 | id: deleteAction | 73 | id: deleteAction |
74 | actionId: "org.kde.kube.actions.delete" | 74 | actionId: "org.kde.kube.actions.move-to-trash" |
75 | context: maillistcontext | 75 | context: maillistcontext |
76 | } | 76 | } |
77 | 77 | ||
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" | |||
42 | } | 42 | } |
43 | ); | 43 | ); |
44 | 44 | ||
45 | static ActionHandlerHelper moveToTrashHandler("org.kde.kube.actions.move-to-trash", | ||
46 | [](Context *context) -> bool { | ||
47 | return context->property("mail").isValid(); | ||
48 | }, | ||
49 | [](Context *context) { | ||
50 | auto mail = context->property("mail").value<Sink::ApplicationDomain::Mail::Ptr>(); | ||
51 | if (!mail) { | ||
52 | qWarning() << "Failed to get the mail mail: " << context->property("mail"); | ||
53 | return; | ||
54 | } | ||
55 | mail->setTrash(true); | ||
56 | qDebug() << "Move to trash " << mail->identifier(); | ||
57 | Sink::Store::modify(*mail).exec(); | ||
58 | } | ||
59 | ); | ||
60 | |||
45 | static ActionHandlerHelper deleteHandler("org.kde.kube.actions.delete", | 61 | static ActionHandlerHelper deleteHandler("org.kde.kube.actions.delete", |
46 | [](Context *context) -> bool { | 62 | [](Context *context) -> bool { |
47 | return context->property("mail").isValid(); | 63 | return context->property("mail").isValid(); |
@@ -52,7 +68,6 @@ static ActionHandlerHelper deleteHandler("org.kde.kube.actions.delete", | |||
52 | qWarning() << "Failed to get the mail mail: " << context->property("mail"); | 68 | qWarning() << "Failed to get the mail mail: " << context->property("mail"); |
53 | return; | 69 | return; |
54 | } | 70 | } |
55 | mail->setProperty("unread", false); | ||
56 | qDebug() << "Remove " << mail->identifier(); | 71 | qDebug() << "Remove " << mail->identifier(); |
57 | Sink::Store::remove(*mail).exec(); | 72 | Sink::Store::remove(*mail).exec(); |
58 | } | 73 | } |