diff options
Diffstat (limited to 'framework/src/domain/mailcontroller.cpp')
-rw-r--r-- | framework/src/domain/mailcontroller.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/framework/src/domain/mailcontroller.cpp b/framework/src/domain/mailcontroller.cpp index b912567a..fe02afc3 100644 --- a/framework/src/domain/mailcontroller.cpp +++ b/framework/src/domain/mailcontroller.cpp | |||
@@ -32,12 +32,14 @@ MailController::MailController() | |||
32 | action_markAsRead{new Kube::ControllerAction{this, &MailController::markAsRead}}, | 32 | action_markAsRead{new Kube::ControllerAction{this, &MailController::markAsRead}}, |
33 | action_markAsUnread{new Kube::ControllerAction{this, &MailController::markAsUnread}}, | 33 | action_markAsUnread{new Kube::ControllerAction{this, &MailController::markAsUnread}}, |
34 | action_markAsImportant{new Kube::ControllerAction{this, &MailController::markAsImportant}}, | 34 | action_markAsImportant{new Kube::ControllerAction{this, &MailController::markAsImportant}}, |
35 | action_toggleImportant{new Kube::ControllerAction{this, &MailController::toggleImportant}}, | ||
35 | action_moveToTrash{new Kube::ControllerAction{this, &MailController::moveToTrash}}, | 36 | action_moveToTrash{new Kube::ControllerAction{this, &MailController::moveToTrash}}, |
36 | action_restoreFromTrash{new Kube::ControllerAction{this, &MailController::restoreFromTrash}}, | 37 | action_restoreFromTrash{new Kube::ControllerAction{this, &MailController::restoreFromTrash}}, |
37 | action_remove{new Kube::ControllerAction{this, &MailController::remove}}, | 38 | action_remove{new Kube::ControllerAction{this, &MailController::remove}}, |
38 | action_moveToFolder{new Kube::ControllerAction{this, &MailController::moveToFolder}} | 39 | action_moveToFolder{new Kube::ControllerAction{this, &MailController::moveToFolder}} |
39 | { | 40 | { |
40 | QObject::connect(this, &MailController::mailChanged, &MailController::updateActions); | 41 | QObject::connect(this, &MailController::mailChanged, &MailController::updateActions); |
42 | QObject::connect(this, &MailController::threadLeaderChanged, &MailController::updateActions); | ||
41 | updateActions(); | 43 | updateActions(); |
42 | } | 44 | } |
43 | 45 | ||
@@ -63,6 +65,11 @@ void MailController::updateActions() | |||
63 | action_restoreFromTrash->setEnabled(mail->getTrash()); | 65 | action_restoreFromTrash->setEnabled(mail->getTrash()); |
64 | action_markAsRead->setEnabled(mail->getUnread()); | 66 | action_markAsRead->setEnabled(mail->getUnread()); |
65 | action_markAsUnread->setEnabled(!mail->getUnread()); | 67 | action_markAsUnread->setEnabled(!mail->getUnread()); |
68 | } else { | ||
69 | action_moveToTrash->setEnabled(false); | ||
70 | action_restoreFromTrash->setEnabled(false); | ||
71 | action_markAsRead->setEnabled(false); | ||
72 | action_markAsUnread->setEnabled(false); | ||
66 | } | 73 | } |
67 | } | 74 | } |
68 | 75 | ||
@@ -90,6 +97,14 @@ void MailController::markAsImportant() | |||
90 | }); | 97 | }); |
91 | } | 98 | } |
92 | 99 | ||
100 | void MailController::toggleImportant() | ||
101 | { | ||
102 | runModification([] (ApplicationDomain::Mail &mail) { | ||
103 | mail.setImportant(!mail.getImportant()); | ||
104 | SinkLog() << "Toggle important " << mail.identifier() << mail.getImportant(); | ||
105 | }); | ||
106 | } | ||
107 | |||
93 | void MailController::moveToTrash() | 108 | void MailController::moveToTrash() |
94 | { | 109 | { |
95 | runModification([] (ApplicationDomain::Mail &mail) { | 110 | runModification([] (ApplicationDomain::Mail &mail) { |