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 | |
parent | b8962ee2d35772ab4f2bed1c415a386207067157 (diff) | |
download | kube-47e0f0c14b4bbcc64cb8bf562c566d29313db7ad.tar.gz kube-47e0f0c14b4bbcc64cb8bf562c566d29313db7ad.zip |
Ported more actions to the fabric
Diffstat (limited to 'framework/qml')
-rw-r--r-- | framework/qml/ConversationView.qml | 24 | ||||
-rw-r--r-- | framework/qml/FolderListView.qml | 17 | ||||
-rw-r--r-- | framework/qml/MailListView.qml | 66 | ||||
-rw-r--r-- | framework/qml/Messages.qml | 10 |
4 files changed, 31 insertions, 86 deletions
diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml index 85712a5a..d7d33c78 100644 --- a/framework/qml/ConversationView.qml +++ b/framework/qml/ConversationView.qml | |||
@@ -548,32 +548,12 @@ Rectangle { | |||
548 | rightMargin: Kube.Units.largeSpacing | 548 | rightMargin: Kube.Units.largeSpacing |
549 | } | 549 | } |
550 | 550 | ||
551 | Kube.Context { | ||
552 | id: mailcontext | ||
553 | property variant mail | ||
554 | property bool isDraft | ||
555 | mail: model.mail | ||
556 | isDraft: model.draft | ||
557 | } | ||
558 | |||
559 | Kube.Action { | ||
560 | id: replyAction | ||
561 | actionId: "org.kde.kube.actions.reply" | ||
562 | context: maillistcontext | ||
563 | } | ||
564 | |||
565 | Kube.Action { | ||
566 | id: editAction | ||
567 | actionId: "org.kde.kube.actions.edit" | ||
568 | context: maillistcontext | ||
569 | } | ||
570 | |||
571 | iconName: model.draft ? Kube.Icons.edit : Kube.Icons.replyToSender | 551 | iconName: model.draft ? Kube.Icons.edit : Kube.Icons.replyToSender |
572 | onClicked: { | 552 | onClicked: { |
573 | if (model.draft) { | 553 | if (model.draft) { |
574 | editAction.execute() | 554 | Kube.Fabric.postMessage(Kube.Messages.edit, {"mail": model.mail, "isDraft": model.draft}) |
575 | } else { | 555 | } else { |
576 | replyAction.execute() | 556 | Kube.Fabric.postMessage(Kube.Messages.reply, {"mail": model.mail, "isDraft": model.draft}) |
577 | } | 557 | } |
578 | } | 558 | } |
579 | } | 559 | } |
diff --git a/framework/qml/FolderListView.qml b/framework/qml/FolderListView.qml index 78d3c5d0..42841221 100644 --- a/framework/qml/FolderListView.qml +++ b/framework/qml/FolderListView.qml | |||
@@ -30,17 +30,6 @@ Rectangle { | |||
30 | 30 | ||
31 | color: Kube.Colors.textColor | 31 | color: Kube.Colors.textColor |
32 | 32 | ||
33 | Kube.FolderController { | ||
34 | id: folderController | ||
35 | } | ||
36 | Kube.Listener { | ||
37 | id: controllerListener | ||
38 | filter: Kube.Messages.folderSelection | ||
39 | onMessageReceived: { | ||
40 | folderController.folder = message.folder | ||
41 | } | ||
42 | } | ||
43 | |||
44 | TreeView { | 33 | TreeView { |
45 | id: treeView | 34 | id: treeView |
46 | 35 | ||
@@ -66,7 +55,7 @@ Rectangle { | |||
66 | model.fetchMore(currentIndex) | 55 | model.fetchMore(currentIndex) |
67 | Kube.Fabric.postMessage(Kube.Messages.folderSelection, {"folder":model.data(currentIndex, Kube.FolderListModel.DomainObject), | 56 | Kube.Fabric.postMessage(Kube.Messages.folderSelection, {"folder":model.data(currentIndex, Kube.FolderListModel.DomainObject), |
68 | "trash":model.data(currentIndex, Kube.FolderListModel.Trash)}) | 57 | "trash":model.data(currentIndex, Kube.FolderListModel.Trash)}) |
69 | folderController.synchronizeAction.execute() | 58 | Kube.Fabric.postMessage(Kube.Messages.synchronize, {"folder":model.data(currentIndex, Kube.FolderListModel.DomainObject)}) |
70 | console.error(model.data) | 59 | console.error(model.data) |
71 | } | 60 | } |
72 | 61 | ||
@@ -117,9 +106,7 @@ Rectangle { | |||
117 | visible: parent.containsDrag | 106 | visible: parent.containsDrag |
118 | } | 107 | } |
119 | onDropped: { | 108 | onDropped: { |
120 | folderController.folder = model.domainObject | 109 | Kube.Fabric.postMessage(Kube.Messages.moveToFolder, {"mail": drop.source.mail, "folder":model.domainObject}) |
121 | folderController.mail = drop.source.mail | ||
122 | folderController.moveToFolderAction.execute() | ||
123 | drop.accept(Qt.MoveAction) | 110 | drop.accept(Qt.MoveAction) |
124 | drop.source.visible = false | 111 | drop.source.visible = false |
125 | } | 112 | } |
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 | } |
diff --git a/framework/qml/Messages.qml b/framework/qml/Messages.qml index b4b170ec..1b384bfa 100644 --- a/framework/qml/Messages.qml +++ b/framework/qml/Messages.qml | |||
@@ -27,6 +27,16 @@ Item { | |||
27 | 27 | ||
28 | //Actions | 28 | //Actions |
29 | property string moveToTrash: "moveToTrash" | 29 | property string moveToTrash: "moveToTrash" |
30 | property string restoreFromTrash: "restoreFromTrash" | ||
31 | property string markAsRead: "markAsRead" | ||
32 | property string markAsUnread: "markAsUnread" | ||
33 | property string toggleImportant: "toggleImportant" | ||
34 | property string moveToFolder: "moveToFolder" | ||
35 | |||
36 | property string notification: "notification" | ||
30 | property string search: "search" | 37 | property string search: "search" |
38 | property string synchronize: "synchronize" | ||
39 | property string reply: "reply" | ||
40 | property string edit: "edit" | ||
31 | } | 41 | } |
32 | 42 | ||