diff options
Diffstat (limited to 'framework/src/domain/mailcontroller.cpp')
-rw-r--r-- | framework/src/domain/mailcontroller.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/framework/src/domain/mailcontroller.cpp b/framework/src/domain/mailcontroller.cpp index fe02afc3..a6c5c555 100644 --- a/framework/src/domain/mailcontroller.cpp +++ b/framework/src/domain/mailcontroller.cpp | |||
@@ -39,7 +39,10 @@ MailController::MailController() | |||
39 | action_moveToFolder{new Kube::ControllerAction{this, &MailController::moveToFolder}} | 39 | action_moveToFolder{new Kube::ControllerAction{this, &MailController::moveToFolder}} |
40 | { | 40 | { |
41 | QObject::connect(this, &MailController::mailChanged, &MailController::updateActions); | 41 | QObject::connect(this, &MailController::mailChanged, &MailController::updateActions); |
42 | QObject::connect(this, &MailController::threadLeaderChanged, &MailController::updateActions); | 42 | QObject::connect(this, &MailController::importantChanged, &MailController::updateActions); |
43 | QObject::connect(this, &MailController::draftChanged, &MailController::updateActions); | ||
44 | QObject::connect(this, &MailController::trashChanged, &MailController::updateActions); | ||
45 | QObject::connect(this, &MailController::unreadChanged, &MailController::updateActions); | ||
43 | updateActions(); | 46 | updateActions(); |
44 | } | 47 | } |
45 | 48 | ||
@@ -47,24 +50,21 @@ void MailController::runModification(const std::function<void(ApplicationDomain: | |||
47 | { | 50 | { |
48 | if (auto mail = getMail()) { | 51 | if (auto mail = getMail()) { |
49 | f(*mail); | 52 | f(*mail); |
50 | run(Store::modify(*mail)); | 53 | if (getOperateOnThreads()) { |
51 | } else if (auto mail = getThreadLeader()) { | 54 | run(Store::modify(Sink::StandardQueries::completeThread(*mail), *mail)); |
52 | f(*mail); | 55 | } else { |
53 | run(Store::modify(Sink::StandardQueries::completeThread(*mail), *mail)); | 56 | run(Store::modify(*mail)); |
57 | } | ||
54 | } | 58 | } |
55 | } | 59 | } |
56 | 60 | ||
57 | void MailController::updateActions() | 61 | void MailController::updateActions() |
58 | { | 62 | { |
59 | auto mail = getMail(); | 63 | if (auto mail = getMail()) { |
60 | if (!mail) { | 64 | action_moveToTrash->setEnabled(!getTrash()); |
61 | mail= getThreadLeader(); | 65 | action_restoreFromTrash->setEnabled(getTrash()); |
62 | } | 66 | action_markAsRead->setEnabled(getUnread()); |
63 | if (mail) { | 67 | action_markAsUnread->setEnabled(getUnread()); |
64 | action_moveToTrash->setEnabled(!mail->getTrash()); | ||
65 | action_restoreFromTrash->setEnabled(mail->getTrash()); | ||
66 | action_markAsRead->setEnabled(mail->getUnread()); | ||
67 | action_markAsUnread->setEnabled(!mail->getUnread()); | ||
68 | } else { | 68 | } else { |
69 | action_moveToTrash->setEnabled(false); | 69 | action_moveToTrash->setEnabled(false); |
70 | action_restoreFromTrash->setEnabled(false); | 70 | action_restoreFromTrash->setEnabled(false); |
@@ -99,8 +99,8 @@ void MailController::markAsImportant() | |||
99 | 99 | ||
100 | void MailController::toggleImportant() | 100 | void MailController::toggleImportant() |
101 | { | 101 | { |
102 | runModification([] (ApplicationDomain::Mail &mail) { | 102 | runModification([this] (ApplicationDomain::Mail &mail) { |
103 | mail.setImportant(!mail.getImportant()); | 103 | mail.setImportant(!getImportant()); |
104 | SinkLog() << "Toggle important " << mail.identifier() << mail.getImportant(); | 104 | SinkLog() << "Toggle important " << mail.identifier() << mail.getImportant(); |
105 | }); | 105 | }); |
106 | } | 106 | } |