diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-13 12:29:04 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-13 12:29:04 +0200 |
commit | d9f64e2c37e9d5d289b2108bed8e3efacc33007d (patch) | |
tree | dd5211b4c96a650b217bbd671901c4fec7bf2bf9 | |
parent | 1a8098a5e5c0336c37dcdf3eb2d53e2fa5ae2d5f (diff) | |
download | kube-d9f64e2c37e9d5d289b2108bed8e3efacc33007d.tar.gz kube-d9f64e2c37e9d5d289b2108bed8e3efacc33007d.zip |
Only show relevant toolbuttons in the maillist view
-rw-r--r-- | framework/qml/Icons.qml | 1 | ||||
-rw-r--r-- | framework/qml/MailListView.qml | 27 | ||||
-rw-r--r-- | framework/src/domain/mailcontroller.cpp | 15 | ||||
-rw-r--r-- | framework/src/domain/mailcontroller.h | 1 |
4 files changed, 37 insertions, 7 deletions
diff --git a/framework/qml/Icons.qml b/framework/qml/Icons.qml index 252f9f43..0a633463 100644 --- a/framework/qml/Icons.qml +++ b/framework/qml/Icons.qml | |||
@@ -33,6 +33,7 @@ Item { | |||
33 | property string success_inverted: "dialog-ok-inverted" | 33 | property string success_inverted: "dialog-ok-inverted" |
34 | 34 | ||
35 | property string markAsRead: "mail-mark-unread-new" | 35 | property string markAsRead: "mail-mark-unread-new" |
36 | property string markAsUnread: "mail-mark-unread-new" | ||
36 | property string markImportant: "mail-mark-important" | 37 | property string markImportant: "mail-mark-important" |
37 | property string undo: "edit-undo" | 38 | property string undo: "edit-undo" |
38 | property string moveToTrash: "edit-delete" | 39 | property string moveToTrash: "edit-delete" |
diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml index 28386442..1e0123cc 100644 --- a/framework/qml/MailListView.qml +++ b/framework/qml/MailListView.qml | |||
@@ -48,28 +48,40 @@ Item { | |||
48 | Controls.ToolButton { | 48 | Controls.ToolButton { |
49 | iconName: Kube.Icons.markAsRead | 49 | iconName: Kube.Icons.markAsRead |
50 | text: qsTr("Mark As Read") | 50 | text: qsTr("Mark As Read") |
51 | tooltip: text | ||
51 | enabled: mailController.markAsReadAction.enabled | 52 | enabled: mailController.markAsReadAction.enabled |
52 | tooltip: qsTr("mark mail as read") | 53 | visible: enabled |
53 | onClicked: { | 54 | onClicked: { |
54 | mailController.markAsReadAction.execute() | 55 | mailController.markAsReadAction.execute() |
55 | } | 56 | } |
56 | } | 57 | } |
57 | 58 | ||
58 | Controls.ToolButton { | 59 | Controls.ToolButton { |
60 | iconName: Kube.Icons.markAsUnread | ||
61 | text: qsTr("Mark As Unread") | ||
62 | tooltip: text | ||
63 | enabled: mailController.markAsUnreadAction.enabled | ||
64 | visible: enabled | ||
65 | onClicked: { | ||
66 | mailController.markAsUnreadAction.execute() | ||
67 | } | ||
68 | } | ||
69 | |||
70 | Controls.ToolButton { | ||
59 | iconName: Kube.Icons.markImportant | 71 | iconName: Kube.Icons.markImportant |
60 | text: qsTr("Mark Important") | 72 | text: qsTr("Toggle Important") |
61 | enabled: mailController.markAsImportantAction.enabled | 73 | tooltip: text |
62 | tooltip: qsTr("mark mail as important") | 74 | enabled: mailController.toggleImportantAction.enabled |
63 | onClicked: { | 75 | onClicked: { |
64 | mailController.markAsImportantAction.execute() | 76 | mailController.toggleImportantAction.execute() |
65 | } | 77 | } |
66 | } | 78 | } |
67 | 79 | ||
68 | Controls.ToolButton { | 80 | Controls.ToolButton { |
69 | iconName: Kube.Icons.moveToTrash | 81 | iconName: Kube.Icons.moveToTrash |
70 | text: qsTr("Delete Mail") | 82 | text: qsTr("Delete Mail") |
83 | tooltip: text | ||
71 | enabled: mailController.moveToTrashAction.enabled | 84 | enabled: mailController.moveToTrashAction.enabled |
72 | tooltip: qsTr("delete email") | ||
73 | onClicked: { | 85 | onClicked: { |
74 | mailController.moveToTrashAction.execute() | 86 | mailController.moveToTrashAction.execute() |
75 | } | 87 | } |
@@ -78,8 +90,9 @@ Item { | |||
78 | Controls.ToolButton { | 90 | Controls.ToolButton { |
79 | iconName: Kube.Icons.undo | 91 | iconName: Kube.Icons.undo |
80 | text: qsTr("Restore Mail") | 92 | text: qsTr("Restore Mail") |
93 | tooltip: text | ||
81 | enabled: mailController.restoreFromTrashAction.enabled | 94 | enabled: mailController.restoreFromTrashAction.enabled |
82 | tooltip: qsTr("restore email") | 95 | visible: enabled |
83 | onClicked: { | 96 | onClicked: { |
84 | mailController.restoreFromTrashAction.execute() | 97 | mailController.restoreFromTrashAction.execute() |
85 | } | 98 | } |
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) { |
diff --git a/framework/src/domain/mailcontroller.h b/framework/src/domain/mailcontroller.h index ae0f32d5..f6613558 100644 --- a/framework/src/domain/mailcontroller.h +++ b/framework/src/domain/mailcontroller.h | |||
@@ -31,6 +31,7 @@ class MailController : public Kube::Controller | |||
31 | KUBE_CONTROLLER_ACTION(markAsRead) | 31 | KUBE_CONTROLLER_ACTION(markAsRead) |
32 | KUBE_CONTROLLER_ACTION(markAsUnread) | 32 | KUBE_CONTROLLER_ACTION(markAsUnread) |
33 | KUBE_CONTROLLER_ACTION(markAsImportant) | 33 | KUBE_CONTROLLER_ACTION(markAsImportant) |
34 | KUBE_CONTROLLER_ACTION(toggleImportant) | ||
34 | KUBE_CONTROLLER_ACTION(moveToTrash) | 35 | KUBE_CONTROLLER_ACTION(moveToTrash) |
35 | KUBE_CONTROLLER_ACTION(restoreFromTrash) | 36 | KUBE_CONTROLLER_ACTION(restoreFromTrash) |
36 | KUBE_CONTROLLER_ACTION(remove) | 37 | KUBE_CONTROLLER_ACTION(remove) |