diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-01-02 11:43:48 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-01-02 11:43:48 +0100 |
commit | ab78738fad2785fbe26c4b4ee16f09a5df8d48dd (patch) | |
tree | cee8d44c9da96b8a94166fa3f508e5dfcdb92bcc /framework/domain/mailcontroller.cpp | |
parent | 7037e7270a2a06e726871d953061213b26d66ea7 (diff) | |
download | kube-ab78738fad2785fbe26c4b4ee16f09a5df8d48dd.tar.gz kube-ab78738fad2785fbe26c4b4ee16f09a5df8d48dd.zip |
Mark as important, restore from trash.
Diffstat (limited to 'framework/domain/mailcontroller.cpp')
-rw-r--r-- | framework/domain/mailcontroller.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/framework/domain/mailcontroller.cpp b/framework/domain/mailcontroller.cpp index 3d29ba22..0163d41e 100644 --- a/framework/domain/mailcontroller.cpp +++ b/framework/domain/mailcontroller.cpp | |||
@@ -23,14 +23,21 @@ | |||
23 | 23 | ||
24 | SINK_DEBUG_AREA("mailcontroller"); | 24 | SINK_DEBUG_AREA("mailcontroller"); |
25 | 25 | ||
26 | using namespace Sink; | ||
27 | using namespace Sink::ApplicationDomain; | ||
28 | |||
26 | MailController::MailController() | 29 | MailController::MailController() |
27 | : Kube::Controller(), | 30 | : Kube::Controller(), |
28 | action_markAsRead{new Kube::ControllerAction}, | 31 | action_markAsRead{new Kube::ControllerAction}, |
32 | action_markAsImportant{new Kube::ControllerAction}, | ||
29 | action_moveToTrash{new Kube::ControllerAction}, | 33 | action_moveToTrash{new Kube::ControllerAction}, |
34 | action_restoreFromTrash{new Kube::ControllerAction}, | ||
30 | action_remove{new Kube::ControllerAction} | 35 | action_remove{new Kube::ControllerAction} |
31 | { | 36 | { |
32 | QObject::connect(markAsReadAction(), &Kube::ControllerAction::triggered, this, &MailController::markAsRead); | 37 | QObject::connect(markAsReadAction(), &Kube::ControllerAction::triggered, this, &MailController::markAsRead); |
38 | QObject::connect(markAsImportantAction(), &Kube::ControllerAction::triggered, this, &MailController::markAsImportant); | ||
33 | QObject::connect(moveToTrashAction(), &Kube::ControllerAction::triggered, this, &MailController::moveToTrash); | 39 | QObject::connect(moveToTrashAction(), &Kube::ControllerAction::triggered, this, &MailController::moveToTrash); |
40 | QObject::connect(restoreFromTrashAction(), &Kube::ControllerAction::triggered, this, &MailController::restoreFromTrash); | ||
34 | QObject::connect(removeAction(), &Kube::ControllerAction::triggered, this, &MailController::remove); | 41 | QObject::connect(removeAction(), &Kube::ControllerAction::triggered, this, &MailController::remove); |
35 | 42 | ||
36 | QObject::connect(this, &MailController::mailChanged, &MailController::updateActions); | 43 | QObject::connect(this, &MailController::mailChanged, &MailController::updateActions); |
@@ -41,33 +48,44 @@ void MailController::updateActions() | |||
41 | { | 48 | { |
42 | if (auto mail = getMail()) { | 49 | if (auto mail = getMail()) { |
43 | action_moveToTrash->setEnabled(!mail->getTrash()); | 50 | action_moveToTrash->setEnabled(!mail->getTrash()); |
51 | action_restoreFromTrash->setEnabled(mail->getTrash()); | ||
44 | } | 52 | } |
45 | } | 53 | } |
46 | 54 | ||
47 | void MailController::markAsRead() | 55 | void MailController::markAsRead() |
48 | { | 56 | { |
49 | using namespace Sink; | ||
50 | using namespace Sink::ApplicationDomain; | ||
51 | auto mail = getMail(); | 57 | auto mail = getMail(); |
52 | mail->setUnread(false); | 58 | mail->setUnread(false); |
53 | SinkLog() << "Mark as read " << mail->identifier(); | 59 | SinkLog() << "Mark as read " << mail->identifier(); |
54 | run(Store::modify(*mail)); | 60 | run(Store::modify(*mail)); |
55 | } | 61 | } |
56 | 62 | ||
63 | void MailController::markAsImportant() | ||
64 | { | ||
65 | auto mail = getMail(); | ||
66 | mail->setImportant(true); | ||
67 | SinkLog() << "Mark as important " << mail->identifier(); | ||
68 | run(Store::modify(*mail)); | ||
69 | } | ||
70 | |||
57 | void MailController::moveToTrash() | 71 | void MailController::moveToTrash() |
58 | { | 72 | { |
59 | using namespace Sink; | ||
60 | using namespace Sink::ApplicationDomain; | ||
61 | auto mail = getMail(); | 73 | auto mail = getMail(); |
62 | mail->setTrash(true); | 74 | mail->setTrash(true); |
63 | SinkLog() << "Move to trash " << mail->identifier(); | 75 | SinkLog() << "Move to trash " << mail->identifier(); |
64 | run(Store::modify(*mail)); | 76 | run(Store::modify(*mail)); |
65 | } | 77 | } |
66 | 78 | ||
79 | void MailController::restoreFromTrash() | ||
80 | { | ||
81 | auto mail = getMail(); | ||
82 | mail->setTrash(false); | ||
83 | SinkLog() << "Move to trash " << mail->identifier(); | ||
84 | run(Store::modify(*mail)); | ||
85 | } | ||
86 | |||
67 | void MailController::remove() | 87 | void MailController::remove() |
68 | { | 88 | { |
69 | using namespace Sink; | ||
70 | using namespace Sink::ApplicationDomain; | ||
71 | auto mail = getMail(); | 89 | auto mail = getMail(); |
72 | mail->setTrash(true); | 90 | mail->setTrash(true); |
73 | SinkLog() << "Remove " << mail->identifier(); | 91 | SinkLog() << "Remove " << mail->identifier(); |