From 0365646737a1894ca6de94e8a9ad9dd6f28e0493 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 12 Feb 2018 21:34:40 +0100 Subject: A basic but working searchview --- framework/qml/ConversationView.qml | 15 --------------- framework/qml/MailListView.qml | 32 ++++++++++++-------------------- 2 files changed, 12 insertions(+), 35 deletions(-) (limited to 'framework/qml') diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml index f3011f65..2dab92ba 100644 --- a/framework/qml/ConversationView.qml +++ b/framework/qml/ConversationView.qml @@ -32,21 +32,6 @@ FocusScope { property bool hideTrash: true; property bool hideNonTrash: false; - Kube.Listener { - filter: Kube.Messages.mailSelection - onMessageReceived: { - root.mail = message.mail - } - } - - Kube.Listener { - filter: Kube.Messages.folderSelection - onMessageReceived: { - root.hideTrash = !message.trash - root.hideNonTrash = message.trash - } - } - Rectangle { anchors.fill: parent color: Kube.Colors.backgroundColor 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 { property bool isTrash : false property bool isUnread : false property variant currentMail: null + property bool showFilter: false + property string filter: null onCurrentMailChanged: { Kube.Fabric.postMessage(Kube.Messages.markAsRead, {"mail": currentMail}) - Kube.Fabric.postMessage(Kube.Messages.mailSelection, {"mail": currentMail}) } - - Kube.Listener { - filter: Kube.Messages.folderSelection - onMessageReceived: { - parentFolder = message.folder - currentMail = null - filterField.clearSearch() - } + onParentFolderChanged: { + currentMail = null + filterField.clearSearch() } - - Kube.Listener { - filter: Kube.Messages.search - onMessageReceived: { - filterField.visible = true - find.forceActiveFocus() - } + onShowFilterChanged: { + find.forceActiveFocus() } Shortcut { @@ -78,12 +69,12 @@ FocusScope { Layout.fillWidth: true height: Kube.Units.gridUnit * 2 color: Kube.Colors.buttonColor - visible: false + visible: root.showFilter function clearSearch() { - filterField.visible = false + root.showFilter = false find.text = "" - mailListModel.filter = "" + root.filter = "" } RowLayout { @@ -104,7 +95,7 @@ FocusScope { id: find Layout.fillWidth: true placeholderText: qsTr("Filter...") - onTextChanged: mailListModel.filter = text + onTextChanged: root.filter = text activeFocusOnTab: visible focus: visible Keys.onEscapePressed: filterField.clearSearch() @@ -150,6 +141,7 @@ FocusScope { model: Kube.MailListModel { id: mailListModel parentFolder: root.parentFolder + filter: root.filter } delegate: Kube.ListDelegate { -- cgit v1.2.3