diff options
-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 | } |