summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/outboxcontroller.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-04-12 15:20:39 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-04-12 15:20:39 +0200
commit288b4ea4ae38b3548f6ab8739a3ef303854886fb (patch)
tree2bc6278f6448ec89f029871947ed09bdfe64ca4e /framework/src/domain/outboxcontroller.cpp
parentb07fad009b2cdfdd802bc3461c1c884c15856548 (diff)
downloadkube-288b4ea4ae38b3548f6ab8739a3ef303854886fb.tar.gz
kube-288b4ea4ae38b3548f6ab8739a3ef303854886fb.zip
Move back to trash or drafts.
The move back to drafts should also trigger an edit of the mail, but that's not implemented yet.
Diffstat (limited to 'framework/src/domain/outboxcontroller.cpp')
-rw-r--r--framework/src/domain/outboxcontroller.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/framework/src/domain/outboxcontroller.cpp b/framework/src/domain/outboxcontroller.cpp
index 590b6c49..51b481fe 100644
--- a/framework/src/domain/outboxcontroller.cpp
+++ b/framework/src/domain/outboxcontroller.cpp
@@ -21,21 +21,19 @@
21#include <sink/store.h> 21#include <sink/store.h>
22#include <sink/log.h> 22#include <sink/log.h>
23 23
24using namespace Sink;
25using namespace Sink::ApplicationDomain;
26
24OutboxController::OutboxController() 27OutboxController::OutboxController()
25 : Kube::Controller(), 28 : Kube::Controller(),
26 mSynchronizeOutboxAction{new Kube::ControllerAction{this, &OutboxController::sendOutbox}} 29 action_sendOutbox{new Kube::ControllerAction{this, &OutboxController::sendOutbox}},
30 action_edit{new Kube::ControllerAction{this, &OutboxController::edit}},
31 action_moveToTrash{new Kube::ControllerAction{this, &OutboxController::moveToTrash}}
27{ 32{
28} 33}
29 34
30Kube::ControllerAction* OutboxController::sendOutboxAction() const
31{
32 return mSynchronizeOutboxAction.data();
33}
34
35void OutboxController::sendOutbox() 35void OutboxController::sendOutbox()
36{ 36{
37 using namespace Sink;
38 using namespace Sink::ApplicationDomain;
39 Query query; 37 Query query;
40 query.containsFilter<SinkResource::Capabilities>(ResourceCapabilities::Mail::transport); 38 query.containsFilter<SinkResource::Capabilities>(ResourceCapabilities::Mail::transport);
41 auto job = Store::fetchAll<SinkResource>(query) 39 auto job = Store::fetchAll<SinkResource>(query)
@@ -45,3 +43,18 @@ void OutboxController::sendOutbox()
45 run(job); 43 run(job);
46} 44}
47 45
46void OutboxController::moveToTrash()
47{
48 auto mail = getMail();
49 mail->setTrash(true);
50 run(Store::modify(*mail));
51}
52
53void OutboxController::edit()
54{
55 auto mail = getMail();
56 mail->setDraft(true);
57 run(Store::modify(*mail));
58 //TODO trigger edit when item has been moved
59}
60