diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-24 17:51:18 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-24 17:51:18 +0200 |
commit | 47e0f0c14b4bbcc64cb8bf562c566d29313db7ad (patch) | |
tree | c50362e5c6f68a8994bcc7177c7d401b48179371 /framework/qml/MailListView.qml | |
parent | b8962ee2d35772ab4f2bed1c415a386207067157 (diff) | |
download | kube-47e0f0c14b4bbcc64cb8bf562c566d29313db7ad.tar.gz kube-47e0f0c14b4bbcc64cb8bf562c566d29313db7ad.zip |
Ported more actions to the fabric
Diffstat (limited to 'framework/qml/MailListView.qml')
-rw-r--r-- | framework/qml/MailListView.qml | 66 |
1 files changed, 17 insertions, 49 deletions
diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml index 570b92f8..97a222a7 100644 --- a/framework/qml/MailListView.qml +++ b/framework/qml/MailListView.qml | |||
@@ -31,12 +31,15 @@ Item { | |||
31 | property bool isImportant : false | 31 | property bool isImportant : false |
32 | property bool isTrash : false | 32 | property bool isTrash : false |
33 | property bool isUnread : false | 33 | property bool isUnread : false |
34 | property variant currentMail: null | ||
35 | |||
36 | onCurrentMailChanged: Kube.Fabric.postMessage(Kube.Messages.mailSelection, {"mail":currentMail}) | ||
34 | 37 | ||
35 | Kube.Listener { | 38 | Kube.Listener { |
36 | filter: Kube.Messages.folderSelection | 39 | filter: Kube.Messages.folderSelection |
37 | onMessageReceived: { | 40 | onMessageReceived: { |
38 | parentFolder = message.folder | 41 | parentFolder = message.folder |
39 | Kube.Fabric.postMessage(Kube.Messages.mailSelection, {"mail":null}) | 42 | currentMail = null |
40 | } | 43 | } |
41 | } | 44 | } |
42 | 45 | ||
@@ -47,35 +50,10 @@ Item { | |||
47 | } | 50 | } |
48 | } | 51 | } |
49 | 52 | ||
50 | Kube.MailController { | ||
51 | id: mailController | ||
52 | unread: root.isUnread | ||
53 | trash: root.isTrash | ||
54 | important: root.isImportant | ||
55 | draft: root.isDraft | ||
56 | operateOnThreads: mailListModel.isThreaded | ||
57 | } | ||
58 | |||
59 | Kube.Listener { | ||
60 | id: controllerListener | ||
61 | filter: Kube.Messages.mailSelection | ||
62 | onMessageReceived: { | ||
63 | mailController.mail = message.mail | ||
64 | } | ||
65 | } | ||
66 | |||
67 | Shortcut { | 53 | Shortcut { |
68 | sequence: StandardKey.Delete | 54 | sequence: StandardKey.Delete |
69 | onActivated: mailController.moveToTrashAction.execute() | 55 | enabled: isTrash |
70 | enabled: mailController.moveToTrashAction.enabled | 56 | onActivated: Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail":currentMail}) |
71 | } | ||
72 | Shortcut { | ||
73 | sequence: StandardKey.MoveToNextLine | ||
74 | onActivated: root.currentIndex++ | ||
75 | } | ||
76 | Shortcut { | ||
77 | sequence: StandardKey.MoveToPreviousLine | ||
78 | onActivated: root.currentIndex-- | ||
79 | } | 57 | } |
80 | 58 | ||
81 | Kube.Label { | 59 | Kube.Label { |
@@ -106,7 +84,7 @@ Item { | |||
106 | //END keyboard nav | 84 | //END keyboard nav |
107 | 85 | ||
108 | onCurrentItemChanged: { | 86 | onCurrentItemChanged: { |
109 | Kube.Fabric.postMessage(Kube.Messages.mailSelection, {"mail":currentItem.currentData.mail}) | 87 | root.currentMail = currentItem.currentData.mail; |
110 | root.isDraft = currentItem.currentData.draft; | 88 | root.isDraft = currentItem.currentData.draft; |
111 | root.isTrash = currentItem.currentData.trash; | 89 | root.isTrash = currentItem.currentData.trash; |
112 | root.isImportant = currentItem.currentData.important; | 90 | root.isImportant = currentItem.currentData.important; |
@@ -286,50 +264,40 @@ Item { | |||
286 | Kube.Button { | 264 | Kube.Button { |
287 | id: readButton | 265 | id: readButton |
288 | text: "r" | 266 | text: "r" |
289 | enabled: mailController.markAsReadAction.enabled | ||
290 | visible: enabled | 267 | visible: enabled |
291 | onClicked: { | 268 | enabled: model.unread |
292 | mailController.markAsReadAction.execute() | 269 | onClicked: Kube.Fabric.postMessage(Kube.Messages.markAsRead, {"mail": model.mail}) |
293 | } | ||
294 | } | 270 | } |
295 | Kube.Button { | 271 | Kube.Button { |
296 | id: unreadButton | 272 | id: unreadButton |
297 | text: "u" | 273 | text: "u" |
298 | enabled: mailController.markAsUnreadAction.enabled | ||
299 | visible: enabled | 274 | visible: enabled |
300 | onClicked: { | 275 | enabled: !model.unread |
301 | mailController.markAsUnreadAction.execute() | 276 | onClicked: Kube.Fabric.postMessage(Kube.Messages.markAsUnread, {"mail": model.mail}) |
302 | } | ||
303 | } | 277 | } |
304 | 278 | ||
305 | Kube.Button { | 279 | Kube.Button { |
306 | id: importantButton | 280 | id: importantButton |
307 | text: "i" | 281 | text: "i" |
308 | enabled: mailController.toggleImportantAction.enabled | ||
309 | visible: enabled | 282 | visible: enabled |
310 | onClicked: { | 283 | enabled: !!model.mail |
311 | mailController.toggleImportantAction.execute() | 284 | onClicked: Kube.Fabric.postMessage(Kube.Messages.toggleImportant, {"mail": model.mail, "important": model.important}) |
312 | } | ||
313 | } | 285 | } |
314 | 286 | ||
315 | Kube.Button { | 287 | Kube.Button { |
316 | id: deleteButton | 288 | id: deleteButton |
317 | text: "d" | 289 | text: "d" |
318 | enabled: mailController.moveToTrashAction.enabled | ||
319 | visible: enabled | 290 | visible: enabled |
320 | onClicked: { | 291 | enabled: !!model.mail |
321 | mailController.moveToTrashAction.execute() | 292 | onClicked: Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": model.mail}) |
322 | } | ||
323 | } | 293 | } |
324 | 294 | ||
325 | Kube.Button { | 295 | Kube.Button { |
326 | id: restoreButton | 296 | id: restoreButton |
327 | text: "re" | 297 | text: "re" |
328 | enabled: mailController.restoreFromTrashAction.enabled | ||
329 | visible: enabled | 298 | visible: enabled |
330 | onClicked: { | 299 | enabled: !!model.trash |
331 | mailController.restoreFromTrashAction.execute() | 300 | onClicked: Kube.Fabric.postMessage(Kube.Messages.restoreFromTrash, {"mail": model.mail}) |
332 | } | ||
333 | } | 301 | } |
334 | } | 302 | } |
335 | } | 303 | } |