diff options
Diffstat (limited to 'framework/domain/actions/sinkactions.cpp')
-rw-r--r-- | framework/domain/actions/sinkactions.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/framework/domain/actions/sinkactions.cpp b/framework/domain/actions/sinkactions.cpp index a2d4c02c..460cb6a1 100644 --- a/framework/domain/actions/sinkactions.cpp +++ b/framework/domain/actions/sinkactions.cpp | |||
@@ -31,53 +31,6 @@ using namespace Kube; | |||
31 | using namespace Sink; | 31 | using namespace Sink; |
32 | using namespace Sink::ApplicationDomain; | 32 | using namespace Sink::ApplicationDomain; |
33 | 33 | ||
34 | static ActionHandlerHelper markAsReadHandler("org.kde.kube.actions.mark-as-read", | ||
35 | [](Context *context) -> bool { | ||
36 | return context->property("mail").isValid(); | ||
37 | }, | ||
38 | [](Context *context) { | ||
39 | auto mail = context->property("mail").value<Mail::Ptr>(); | ||
40 | if (!mail) { | ||
41 | SinkWarning() << "Failed to get the mail mail: " << context->property("mail"); | ||
42 | return; | ||
43 | } | ||
44 | mail->setProperty("unread", false); | ||
45 | SinkLog() << "Mark as read " << mail->identifier(); | ||
46 | Store::modify(*mail).exec(); | ||
47 | } | ||
48 | ); | ||
49 | |||
50 | static ActionHandlerHelper moveToTrashHandler("org.kde.kube.actions.move-to-trash", | ||
51 | [](Context *context) -> bool { | ||
52 | return context->property("mail").isValid(); | ||
53 | }, | ||
54 | [](Context *context) { | ||
55 | auto mail = context->property("mail").value<Mail::Ptr>(); | ||
56 | if (!mail) { | ||
57 | SinkWarning() << "Failed to get the mail mail: " << context->property("mail"); | ||
58 | return; | ||
59 | } | ||
60 | mail->setTrash(true); | ||
61 | SinkLog() << "Move to trash " << mail->identifier(); | ||
62 | Store::modify(*mail).exec(); | ||
63 | } | ||
64 | ); | ||
65 | |||
66 | static ActionHandlerHelper deleteHandler("org.kde.kube.actions.delete", | ||
67 | [](Context *context) -> bool { | ||
68 | return context->property("mail").isValid(); | ||
69 | }, | ||
70 | [](Context *context) { | ||
71 | auto mail = context->property("mail").value<Mail::Ptr>(); | ||
72 | if (!mail) { | ||
73 | SinkWarning() << "Failed to get the mail mail: " << context->property("mail"); | ||
74 | return; | ||
75 | } | ||
76 | SinkLog() << "Remove " << mail->identifier(); | ||
77 | Store::remove(*mail).exec(); | ||
78 | } | ||
79 | ); | ||
80 | |||
81 | class FolderContext : public Kube::ContextWrapper { | 34 | class FolderContext : public Kube::ContextWrapper { |
82 | using Kube::ContextWrapper::ContextWrapper; | 35 | using Kube::ContextWrapper::ContextWrapper; |
83 | KUBE_CONTEXTWRAPPER_PROPERTY(Sink::ApplicationDomain::Folder::Ptr, Folder, folder) | 36 | KUBE_CONTEXTWRAPPER_PROPERTY(Sink::ApplicationDomain::Folder::Ptr, Folder, folder) |
@@ -101,18 +54,3 @@ static ActionHandlerHelper synchronizeHandler("org.kde.kube.actions.synchronize" | |||
101 | } | 54 | } |
102 | ); | 55 | ); |
103 | 56 | ||
104 | static ActionHandlerHelper sendOutboxHandler("org.kde.kube.actions.sendOutbox", | ||
105 | [](Context *context) -> bool { | ||
106 | return true; | ||
107 | }, | ||
108 | ActionHandlerHelper::JobHandler{[](Context *context) -> KAsync::Job<void> { | ||
109 | using namespace Sink::ApplicationDomain; | ||
110 | Query query; | ||
111 | query.containsFilter<SinkResource::Capabilities>(ResourceCapabilities::Mail::transport); | ||
112 | return Store::fetchAll<SinkResource>(query) | ||
113 | .each([=](const SinkResource::Ptr &resource) -> KAsync::Job<void> { | ||
114 | return Store::synchronize(SyncScope{}.resourceFilter(resource->identifier())); | ||
115 | }); | ||
116 | }} | ||
117 | ); | ||
118 | |||