summaryrefslogtreecommitdiffstats
path: root/framework/qml
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-04-24 15:34:31 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-04-24 15:34:31 +0200
commit74703d12ef6f72a057f11957181b6cf6f4730e2d (patch)
treea9126fd02863243e26fdc2881b3910b163d59c87 /framework/qml
parent68ed477e34756beb5b152f8077c2e2527bba4708 (diff)
downloadkube-74703d12ef6f72a057f11957181b6cf6f4730e2d.tar.gz
kube-74703d12ef6f72a057f11957181b6cf6f4730e2d.zip
Added the Fabric as an in application message bus
Diffstat (limited to 'framework/qml')
-rw-r--r--framework/qml/ConversationView.qml16
-rw-r--r--framework/qml/FolderListView.qml16
-rw-r--r--framework/qml/InlineAccountSwitcher.qml6
-rw-r--r--framework/qml/MailListView.qml32
-rw-r--r--framework/qml/Messages.qml31
5 files changed, 74 insertions, 27 deletions
diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml
index bdcd0aa0..85712a5a 100644
--- a/framework/qml/ConversationView.qml
+++ b/framework/qml/ConversationView.qml
@@ -37,6 +37,22 @@ Rectangle {
37 property bool hideTrash: true; 37 property bool hideTrash: true;
38 property bool hideNonTrash: false; 38 property bool hideNonTrash: false;
39 39
40
41 Kube.Listener {
42 filter: Kube.Messages.mailSelection
43 onMessageReceived: {
44 root.mail = message.mail
45 }
46 }
47
48 Kube.Listener {
49 filter: Kube.Messages.folderSelection
50 onMessageReceived: {
51 root.hideTrash = !message.trash
52 root.hideNonTrash = message.trash
53 }
54 }
55
40 onCurrentIndexChanged: { 56 onCurrentIndexChanged: {
41 markAsReadTimer.restart(); 57 markAsReadTimer.restart();
42 } 58 }
diff --git a/framework/qml/FolderListView.qml b/framework/qml/FolderListView.qml
index 4082e08d..78d3c5d0 100644
--- a/framework/qml/FolderListView.qml
+++ b/framework/qml/FolderListView.qml
@@ -26,18 +26,18 @@ import org.kube.framework 1.0 as Kube
26Rectangle { 26Rectangle {
27 id: root 27 id: root
28 28
29 property variant currentFolder: null
30 property variant accountId 29 property variant accountId
31 property bool isTrashFolder: false
32 30
33 color: Kube.Colors.textColor 31 color: Kube.Colors.textColor
34 32
35 Kube.FolderController { 33 Kube.FolderController {
36 id: folderController 34 id: folderController
37 Binding on folder { 35 }
38 //!! checks for the availability of the type 36 Kube.Listener {
39 when: !!root.currentFolder 37 id: controllerListener
40 value: root.currentFolder 38 filter: Kube.Messages.folderSelection
39 onMessageReceived: {
40 folderController.folder = message.folder
41 } 41 }
42 } 42 }
43 43
@@ -64,8 +64,8 @@ Rectangle {
64 64
65 onCurrentIndexChanged: { 65 onCurrentIndexChanged: {
66 model.fetchMore(currentIndex) 66 model.fetchMore(currentIndex)
67 root.currentFolder = model.data(currentIndex, Kube.FolderListModel.DomainObject) 67 Kube.Fabric.postMessage(Kube.Messages.folderSelection, {"folder":model.data(currentIndex, Kube.FolderListModel.DomainObject),
68 root.isTrashFolder = model.data(currentIndex, Kube.FolderListModel.Trash) 68 "trash":model.data(currentIndex, Kube.FolderListModel.Trash)})
69 folderController.synchronizeAction.execute() 69 folderController.synchronizeAction.execute()
70 console.error(model.data) 70 console.error(model.data)
71 } 71 }
diff --git a/framework/qml/InlineAccountSwitcher.qml b/framework/qml/InlineAccountSwitcher.qml
index b7e70746..b5b4bb9f 100644
--- a/framework/qml/InlineAccountSwitcher.qml
+++ b/framework/qml/InlineAccountSwitcher.qml
@@ -24,8 +24,6 @@ Rectangle {
24 id: root 24 id: root
25 25
26 property string currentAccount: null 26 property string currentAccount: null
27 property var currentFolder: null
28 property bool isTrashFolder: false
29 27
30 Kube.AccountsModel { 28 Kube.AccountsModel {
31 id: accountsModel 29 id: accountsModel
@@ -109,10 +107,6 @@ Rectangle {
109 accountId: model.accountId 107 accountId: model.accountId
110 visible: model.accountId == root.currentAccount 108 visible: model.accountId == root.currentAccount
111 109
112 onCurrentFolderChanged: {
113 root.currentFolder = currentFolder
114 root.isTrashFolder = isTrashFolder
115 }
116 } 110 }
117 } 111 }
118 } 112 }
diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml
index 96e266bb..5adc3f98 100644
--- a/framework/qml/MailListView.qml
+++ b/framework/qml/MailListView.qml
@@ -25,26 +25,25 @@ import org.kube.framework 1.0 as Kube
25 25
26Item { 26Item {
27 id: root 27 id: root
28 property variant parentFolder 28 //InterfaceProperties
29 property variant currentMail: null 29 property string filterString
30 //Private properties
31 property variant parentFolder: null
30 property bool isDraft : false 32 property bool isDraft : false
31 property bool isImportant : false 33 property bool isImportant : false
32 property bool isTrash : false 34 property bool isTrash : false
33 property bool isUnread : false 35 property bool isUnread : false
34 property int currentIndex
35 property string filterString
36 36
37 onParentFolderChanged: { 37 Kube.Listener {
38 currentMail = null 38 filter: Kube.Messages.folderSelection
39 onMessageReceived: {
40 parentFolder = message.folder
41 Kube.Fabric.postMessage(Kube.Messages.mailSelection, {"mail":null})
42 }
39 } 43 }
40 44
41 Kube.MailController { 45 Kube.MailController {
42 id: mailController 46 id: mailController
43 Binding on mail {
44 //!! checks for the availability of the type
45 when: !!root.currentMail
46 value: root.currentMail
47 }
48 unread: root.isUnread 47 unread: root.isUnread
49 trash: root.isTrash 48 trash: root.isTrash
50 important: root.isImportant 49 important: root.isImportant
@@ -52,6 +51,14 @@ Item {
52 operateOnThreads: mailListModel.isThreaded 51 operateOnThreads: mailListModel.isThreaded
53 } 52 }
54 53
54 Kube.Listener {
55 id: controllerListener
56 filter: Kube.Messages.mailSelection
57 onMessageReceived: {
58 mailController.mail = message.mail
59 }
60 }
61
55 Shortcut { 62 Shortcut {
56 sequence: StandardKey.Delete 63 sequence: StandardKey.Delete
57 onActivated: mailController.moveToTrashAction.execute() 64 onActivated: mailController.moveToTrashAction.execute()
@@ -93,9 +100,8 @@ Item {
93 } 100 }
94 //END keyboard nav 101 //END keyboard nav
95 102
96 currentIndex: root.currentIndex
97 onCurrentItemChanged: { 103 onCurrentItemChanged: {
98 root.currentMail = currentItem.currentData.domainObject; 104 Kube.Fabric.postMessage(Kube.Messages.mailSelection, {"mail":currentItem.currentData.mail})
99 root.isDraft = currentItem.currentData.draft; 105 root.isDraft = currentItem.currentData.draft;
100 root.isTrash = currentItem.currentData.trash; 106 root.isTrash = currentItem.currentData.trash;
101 root.isImportant = currentItem.currentData.important; 107 root.isImportant = currentItem.currentData.important;
diff --git a/framework/qml/Messages.qml b/framework/qml/Messages.qml
new file mode 100644
index 00000000..3241af0b
--- /dev/null
+++ b/framework/qml/Messages.qml
@@ -0,0 +1,31 @@
1/*
2 Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17*/
18
19pragma Singleton
20
21import QtQuick 2.7
22
23Item {
24 //Selections
25 property string folderSelection: "currentFolder"
26 property string mailSelection: "currentMail"
27
28 //Actions
29 property string moveToTrash: "moveToTrash"
30}
31