diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-02-12 21:34:40 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-02-12 22:35:31 +0100 |
commit | 0365646737a1894ca6de94e8a9ad9dd6f28e0493 (patch) | |
tree | a51b0155275b835a56991f16d48021b798fd4d19 /views | |
parent | 1026c329afed70f5ab3b8db32756ea926049dbe9 (diff) | |
download | kube-0365646737a1894ca6de94e8a9ad9dd6f28e0493.tar.gz kube-0365646737a1894ca6de94e8a9ad9dd6f28e0493.zip |
A basic but working searchview
Diffstat (limited to 'views')
-rw-r--r-- | views/conversation/qml/View.qml | 27 | ||||
-rw-r--r-- | views/search/metadata.json | 4 | ||||
-rw-r--r-- | views/search/qml/View.qml | 57 |
3 files changed, 80 insertions, 8 deletions
diff --git a/views/conversation/qml/View.qml b/views/conversation/qml/View.qml index 7f1c78bb..5f0d362d 100644 --- a/views/conversation/qml/View.qml +++ b/views/conversation/qml/View.qml | |||
@@ -109,6 +109,18 @@ FocusScope { | |||
109 | anchors.fill: parent | 109 | anchors.fill: parent |
110 | activeFocusOnTab: true | 110 | activeFocusOnTab: true |
111 | Layout.minimumWidth: Kube.Units.gridUnit * 10 | 111 | Layout.minimumWidth: Kube.Units.gridUnit * 10 |
112 | Kube.Listener { | ||
113 | filter: Kube.Messages.folderSelection | ||
114 | onMessageReceived: mailListView.parentFolder = message.folder | ||
115 | } | ||
116 | |||
117 | Kube.Listener { | ||
118 | filter: Kube.Messages.search | ||
119 | onMessageReceived: mailListView.showFilter = true | ||
120 | } | ||
121 | onCurrentMailChanged: { | ||
122 | Kube.Fabric.postMessage(Kube.Messages.mailSelection, {"mail": currentMail}) | ||
123 | } | ||
112 | } | 124 | } |
113 | } | 125 | } |
114 | 126 | ||
@@ -118,6 +130,21 @@ FocusScope { | |||
118 | Layout.fillWidth: true | 130 | Layout.fillWidth: true |
119 | Layout.fillHeight: parent.height | 131 | Layout.fillHeight: parent.height |
120 | activeFocusOnTab: true | 132 | activeFocusOnTab: true |
133 | Kube.Listener { | ||
134 | filter: Kube.Messages.mailSelection | ||
135 | onMessageReceived: { | ||
136 | mailView.mail = message.mail | ||
137 | } | ||
138 | } | ||
139 | |||
140 | Kube.Listener { | ||
141 | filter: Kube.Messages.folderSelection | ||
142 | onMessageReceived: { | ||
143 | mailView.hideTrash = !message.trash | ||
144 | mailView.hideNonTrash = message.trash | ||
145 | } | ||
146 | } | ||
147 | |||
121 | } | 148 | } |
122 | } | 149 | } |
123 | } | 150 | } |
diff --git a/views/search/metadata.json b/views/search/metadata.json index 870ff2aa..a3f6d4a5 100644 --- a/views/search/metadata.json +++ b/views/search/metadata.json | |||
@@ -1,4 +1,4 @@ | |||
1 | { | 1 | { |
2 | "icon": "mail-message-inverted", | 2 | "icon": "edit-find-inverted", |
3 | "tooltip": "Follow conversations." | 3 | "tooltip": "Search" |
4 | } | 4 | } |
diff --git a/views/search/qml/View.qml b/views/search/qml/View.qml index d2c8ae65..437b0ba2 100644 --- a/views/search/qml/View.qml +++ b/views/search/qml/View.qml | |||
@@ -26,14 +26,59 @@ import QtQuick.Layouts 1.1 | |||
26 | import org.kube.framework 1.0 as Kube | 26 | import org.kube.framework 1.0 as Kube |
27 | 27 | ||
28 | FocusScope { | 28 | FocusScope { |
29 | Rectangle { | 29 | SplitView { |
30 | anchors.fill: parent | 30 | anchors.fill: parent |
31 | Kube.MailListView { | 31 | ColumnLayout { |
32 | id: mailListView | 32 | width: Kube.Units.gridUnit * 18 |
33 | anchors.fill: parent | ||
34 | activeFocusOnTab: true | ||
35 | Layout.minimumWidth: Kube.Units.gridUnit * 10 | 33 | Layout.minimumWidth: Kube.Units.gridUnit * 10 |
34 | Rectangle { | ||
35 | id: filterField | ||
36 | Layout.fillWidth: true | ||
37 | height: Kube.Units.gridUnit * 2 | ||
38 | color: Kube.Colors.textColor | ||
39 | |||
40 | function clearSearch() { | ||
41 | find.text = "" | ||
42 | mailListView.filter = "" | ||
43 | } | ||
44 | |||
45 | RowLayout { | ||
46 | anchors { | ||
47 | verticalCenter: parent.verticalCenter | ||
48 | } | ||
49 | |||
50 | width: parent.width - Kube.Units.smallSpacing | ||
51 | spacing: 0 | ||
52 | |||
53 | Kube.IconButton { | ||
54 | iconName: Kube.Icons.remove | ||
55 | onClicked: filterField.clearSearch() | ||
56 | } | ||
57 | |||
58 | Kube.TextField { | ||
59 | id: find | ||
60 | Layout.fillWidth: true | ||
61 | placeholderText: qsTr("Search...") | ||
62 | onTextChanged: mailListView.filter = text | ||
63 | focus: true | ||
64 | Keys.onEscapePressed: filterField.clearSearch() | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | Kube.MailListView { | ||
69 | id: mailListView | ||
70 | showFilter: false | ||
71 | Layout.fillWidth: true | ||
72 | Layout.fillHeight: true | ||
73 | } | ||
74 | } | ||
75 | Kube.ConversationView { | ||
76 | id: mailView | ||
77 | objectName: "mailView" | ||
78 | Layout.fillWidth: true | ||
79 | Layout.fillHeight: parent.height | ||
80 | activeFocusOnTab: true | ||
81 | mail: mailListView.currentMail | ||
36 | } | 82 | } |
37 | } | ||
38 | } | 83 | } |
39 | } | 84 | } |