summaryrefslogtreecommitdiffstats
path: root/framework/qml/MailListView.qml
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-02-12 21:34:40 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-02-12 22:35:31 +0100
commit0365646737a1894ca6de94e8a9ad9dd6f28e0493 (patch)
treea51b0155275b835a56991f16d48021b798fd4d19 /framework/qml/MailListView.qml
parent1026c329afed70f5ab3b8db32756ea926049dbe9 (diff)
downloadkube-0365646737a1894ca6de94e8a9ad9dd6f28e0493.tar.gz
kube-0365646737a1894ca6de94e8a9ad9dd6f28e0493.zip
A basic but working searchview
Diffstat (limited to 'framework/qml/MailListView.qml')
-rw-r--r--framework/qml/MailListView.qml32
1 files changed, 12 insertions, 20 deletions
diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml
index 8fed8c9d..69b7d871 100644
--- a/framework/qml/MailListView.qml
+++ b/framework/qml/MailListView.qml
@@ -32,27 +32,18 @@ FocusScope {
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 34 property variant currentMail: null
35 property bool showFilter: false
36 property string filter: null
35 37
36 onCurrentMailChanged: { 38 onCurrentMailChanged: {
37 Kube.Fabric.postMessage(Kube.Messages.markAsRead, {"mail": currentMail}) 39 Kube.Fabric.postMessage(Kube.Messages.markAsRead, {"mail": currentMail})
38 Kube.Fabric.postMessage(Kube.Messages.mailSelection, {"mail": currentMail})
39 } 40 }
40 41 onParentFolderChanged: {
41 Kube.Listener { 42 currentMail = null
42 filter: Kube.Messages.folderSelection 43 filterField.clearSearch()
43 onMessageReceived: {
44 parentFolder = message.folder
45 currentMail = null
46 filterField.clearSearch()
47 }
48 } 44 }
49 45 onShowFilterChanged: {
50 Kube.Listener { 46 find.forceActiveFocus()
51 filter: Kube.Messages.search
52 onMessageReceived: {
53 filterField.visible = true
54 find.forceActiveFocus()
55 }
56 } 47 }
57 48
58 Shortcut { 49 Shortcut {
@@ -78,12 +69,12 @@ FocusScope {
78 Layout.fillWidth: true 69 Layout.fillWidth: true
79 height: Kube.Units.gridUnit * 2 70 height: Kube.Units.gridUnit * 2
80 color: Kube.Colors.buttonColor 71 color: Kube.Colors.buttonColor
81 visible: false 72 visible: root.showFilter
82 73
83 function clearSearch() { 74 function clearSearch() {
84 filterField.visible = false 75 root.showFilter = false
85 find.text = "" 76 find.text = ""
86 mailListModel.filter = "" 77 root.filter = ""
87 } 78 }
88 79
89 RowLayout { 80 RowLayout {
@@ -104,7 +95,7 @@ FocusScope {
104 id: find 95 id: find
105 Layout.fillWidth: true 96 Layout.fillWidth: true
106 placeholderText: qsTr("Filter...") 97 placeholderText: qsTr("Filter...")
107 onTextChanged: mailListModel.filter = text 98 onTextChanged: root.filter = text
108 activeFocusOnTab: visible 99 activeFocusOnTab: visible
109 focus: visible 100 focus: visible
110 Keys.onEscapePressed: filterField.clearSearch() 101 Keys.onEscapePressed: filterField.clearSearch()
@@ -150,6 +141,7 @@ FocusScope {
150 model: Kube.MailListModel { 141 model: Kube.MailListModel {
151 id: mailListModel 142 id: mailListModel
152 parentFolder: root.parentFolder 143 parentFolder: root.parentFolder
144 filter: root.filter
153 } 145 }
154 146
155 delegate: Kube.ListDelegate { 147 delegate: Kube.ListDelegate {