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 | |
parent | 7037e7270a2a06e726871d953061213b26d66ea7 (diff) | |
download | kube-ab78738fad2785fbe26c4b4ee16f09a5df8d48dd.tar.gz kube-ab78738fad2785fbe26c4b4ee16f09a5df8d48dd.zip |
Mark as important, restore from trash.
-rw-r--r-- | components/mail/contents/ui/main.qml | 25 | ||||
-rw-r--r-- | framework/domain/mailcontroller.cpp | 30 | ||||
-rw-r--r-- | framework/domain/mailcontroller.h | 2 |
3 files changed, 44 insertions, 13 deletions
diff --git a/components/mail/contents/ui/main.qml b/components/mail/contents/ui/main.qml index bf3b4954..5fceaf30 100644 --- a/components/mail/contents/ui/main.qml +++ b/components/mail/contents/ui/main.qml | |||
@@ -202,9 +202,9 @@ Controls2.ApplicationWindow { | |||
202 | 202 | ||
203 | ToolButton { | 203 | ToolButton { |
204 | iconName: "mail-mark-unread" | 204 | iconName: "mail-mark-unread" |
205 | text: "Mark As Read" | 205 | text: tr("Mark As Read") |
206 | enabled: mailController.markAsRead.enabled | 206 | enabled: mailController.markAsRead.enabled |
207 | tooltip: "mark mail as read" | 207 | tooltip: tr("mark mail as read") |
208 | onClicked: { | 208 | onClicked: { |
209 | mailController.markAsRead.execute() | 209 | mailController.markAsRead.execute() |
210 | } | 210 | } |
@@ -212,22 +212,33 @@ Controls2.ApplicationWindow { | |||
212 | 212 | ||
213 | ToolButton { | 213 | ToolButton { |
214 | iconName: "mail-mark-important" | 214 | iconName: "mail-mark-important" |
215 | text: "Mark Important" | 215 | text: tr("Mark Important") |
216 | enabled: false | 216 | enabled: mailController.markAsImportant.enabled |
217 | tooltip: "mark mail as important" | 217 | tooltip: tr("mark mail as important") |
218 | onClicked: { | 218 | onClicked: { |
219 | mailController.markAsImportant.execute() | ||
219 | } | 220 | } |
220 | } | 221 | } |
221 | 222 | ||
222 | ToolButton { | 223 | ToolButton { |
223 | iconName: "edit-delete" | 224 | iconName: "edit-delete" |
224 | text: "Delete Mail" | 225 | text: tr("Delete Mail") |
225 | enabled: mailController.moveToTrashAction.enabled | 226 | enabled: mailController.moveToTrashAction.enabled |
226 | tooltip: "delete email" | 227 | tooltip: tr("delete email") |
227 | onClicked: { | 228 | onClicked: { |
228 | mailController.moveToTrashAction.execute() | 229 | mailController.moveToTrashAction.execute() |
229 | } | 230 | } |
230 | } | 231 | } |
232 | |||
233 | ToolButton { | ||
234 | iconName: "edit-delete" | ||
235 | text: tr("Restore Mail") | ||
236 | enabled: mailController.restoreFromTrashAction.enabled | ||
237 | tooltip: tr("restore email") | ||
238 | onClicked: { | ||
239 | mailController.restoreFromTrashAction.execute() | ||
240 | } | ||
241 | } | ||
231 | } | 242 | } |
232 | } | 243 | } |
233 | //END MailList section | 244 | //END MailList section |
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(); |
diff --git a/framework/domain/mailcontroller.h b/framework/domain/mailcontroller.h index c20cf595..324f6c62 100644 --- a/framework/domain/mailcontroller.h +++ b/framework/domain/mailcontroller.h | |||
@@ -27,7 +27,9 @@ class MailController : public Kube::Controller | |||
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | KUBE_CONTROLLER_PROPERTY(Sink::ApplicationDomain::Mail::Ptr, Mail, mail) | 28 | KUBE_CONTROLLER_PROPERTY(Sink::ApplicationDomain::Mail::Ptr, Mail, mail) |
29 | KUBE_CONTROLLER_ACTION(markAsRead) | 29 | KUBE_CONTROLLER_ACTION(markAsRead) |
30 | KUBE_CONTROLLER_ACTION(markAsImportant) | ||
30 | KUBE_CONTROLLER_ACTION(moveToTrash) | 31 | KUBE_CONTROLLER_ACTION(moveToTrash) |
32 | KUBE_CONTROLLER_ACTION(restoreFromTrash) | ||
31 | KUBE_CONTROLLER_ACTION(remove) | 33 | KUBE_CONTROLLER_ACTION(remove) |
32 | 34 | ||
33 | public: | 35 | public: |