diff options
Diffstat (limited to 'framework/domain')
-rw-r--r-- | framework/domain/actions/sinkactions.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
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 | } |