diff options
Diffstat (limited to 'framework/src/domain/outboxcontroller.cpp')
-rw-r--r-- | framework/src/domain/outboxcontroller.cpp | 29 |
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 | ||
24 | using namespace Sink; | ||
25 | using namespace Sink::ApplicationDomain; | ||
26 | |||
24 | OutboxController::OutboxController() | 27 | OutboxController::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 | ||
30 | Kube::ControllerAction* OutboxController::sendOutboxAction() const | ||
31 | { | ||
32 | return mSynchronizeOutboxAction.data(); | ||
33 | } | ||
34 | |||
35 | void OutboxController::sendOutbox() | 35 | void 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 | ||
46 | void OutboxController::moveToTrash() | ||
47 | { | ||
48 | auto mail = getMail(); | ||
49 | mail->setTrash(true); | ||
50 | run(Store::modify(*mail)); | ||
51 | } | ||
52 | |||
53 | void 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 | |||