From e0604f713649186507db37be54cc3aaadcd99663 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 23 Jul 2018 12:16:08 +0200 Subject: Search view updates --- views/search/qml/View.qml | 163 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 120 insertions(+), 43 deletions(-) (limited to 'views/search/qml/View.qml') diff --git a/views/search/qml/View.qml b/views/search/qml/View.qml index 74e6cf5b..18098f30 100644 --- a/views/search/qml/View.qml +++ b/views/search/qml/View.qml @@ -20,64 +20,141 @@ import QtQuick 2.7 import QtQuick.Controls 1.3 as Controls1 -import QtQuick.Controls 2.0 as Controls2 +import QtQuick.Controls 2 import QtQuick.Layouts 1.1 import org.kube.framework 1.0 as Kube -FocusScope { - Controls1.SplitView { - anchors.fill: parent - ColumnLayout { - width: Kube.Units.gridUnit * 18 - Layout.minimumWidth: Kube.Units.gridUnit * 10 - Rectangle { - id: filterField - Layout.fillWidth: true - height: Kube.Units.gridUnit * 2 - color: Kube.Colors.darkBackgroundColor +Kube.View { + id: root + property string searchTerm: "" - function clearSearch() { - find.text = "" - mailListView.filter = "" - } - RowLayout { - anchors { - verticalCenter: parent.verticalCenter - } + Rectangle { + id: overlay + + parent: ApplicationWindow.overlay + height: app.height + width: app.width - app.sidebarWidth + x: app.sidebarWidth + y: 0 + + visible: root.searchTerm == "" + + Row { + anchors.centerIn: parent + + spacing: Kube.Units.smallSpacing + + Kube.TextField { + id: searchField + anchors.verticalCenter: parent.verticalCenter + width: Kube.Units.gridUnit * 30 + focus: true + text: root.searchTerm + Keys.onEscapePressed: root.searchTerm = "" + onAccepted: root.searchTerm = text + } - width: parent.width - Kube.Units.smallSpacing - spacing: 0 + Kube.PositiveButton { + anchors.verticalCenter: parent.verticalCenter + text: qsTr("Search") + enabled: searchField.text != "" + onClicked: root.searchTerm = searchField.text + } + } + } - Kube.IconButton { - iconName: Kube.Icons.remove - onClicked: filterField.clearSearch() + RowLayout { + spacing: 0 + Rectangle { + Layout.fillHeight: true + width: Kube.Units.gridUnit * 10 + color: Kube.Colors.darkBackgroundColor + ColumnLayout { + anchors { + left: parent.left + right: parent.right + top: parent.top + margins: Kube.Units.smallSpacing + } + RowLayout { + Kube.CheckBox { + checked: true + } + Kube.Label { + text: qsTr("Mail") + color: Kube.Colors.highlightedTextColor + } + } + RowLayout { + Kube.CheckBox { + checked: false } + Kube.Label { + text: qsTr("Contacts") + color: Kube.Colors.highlightedTextColor + } + } + RowLayout { + Kube.CheckBox { + checked: false + } + Kube.Label { + text: qsTr("Events") + color: Kube.Colors.highlightedTextColor + } + } + } + } + Item { + Layout.fillHeight: true + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + spacing: 0 + Rectangle { + id: toolbar + Layout.fillWidth: true + height: searchBar.height + Kube.Units.smallSpacing * 2 + color: Kube.Colors.backgroundColor Kube.TextField { - id: find - Layout.fillWidth: true + id: searchBar + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + text: root.searchTerm + width: parent.width * 0.5 placeholderText: qsTr("Search...") - onTextChanged: mailListView.filter = text - focus: true - Keys.onEscapePressed: filterField.clearSearch() + Keys.onEscapePressed: root.searchTerm = "" + onTextChanged: { + forceActiveFocus() + mailListView.filter = text + } + } + } + + Controls1.SplitView { + Layout.fillHeight: true + Layout.fillWidth: true + Kube.MailListView { + id: mailListView + width: Kube.Units.gridUnit * 18 + Layout.minimumWidth: Kube.Units.gridUnit * 10 + Layout.fillHeight: true + } + Kube.ConversationView { + id: mailView + Layout.minimumWidth: Kube.Units.gridUnit * 5 + Layout.fillWidth: true + Layout.fillHeight: true + activeFocusOnTab: true + model: Kube.MailListModel { + singleMail: mailListView.currentMail + } } } } - Kube.MailListView { - id: mailListView - Layout.fillWidth: true - Layout.fillHeight: true - } - } - Kube.ConversationView { - id: mailView - objectName: "mailView" - Layout.fillWidth: true - Layout.fillHeight: parent.height - activeFocusOnTab: true - mail: mailListView.currentMail } } } -- cgit v1.2.3