summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--views/search/qml/View_new.qml206
1 files changed, 206 insertions, 0 deletions
diff --git a/views/search/qml/View_new.qml b/views/search/qml/View_new.qml
new file mode 100644
index 00000000..f814ba76
--- /dev/null
+++ b/views/search/qml/View_new.qml
@@ -0,0 +1,206 @@
1/*
2 * Copyright (C) 2018 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
19import QtQuick 2.7
20import QtQuick.Controls 2.2
21import QtQuick.Layouts 1.2
22
23import org.kube.framework 1.0 as Kube
24
25StackView {
26 id: stack
27
28 property var searchTerm: ""
29
30 initialItem: searchBar
31
32 Component {
33 id: searchBar
34
35 Rectangle {
36 color: Kube.Colors.backgroundColor
37
38 Row {
39 anchors.centerIn: parent
40
41 spacing: Kube.Units.smallSpacing
42
43 Kube.TextField {
44 id: searchField
45 width: Kube.Units.gridUnit * 30
46 }
47
48 Kube.PositiveButton {
49 text: qsTr("Search")
50 enabled: searchField.text != ""
51
52 onClicked: {
53 searchTerm = searchField.text
54 stack.push(searchResults)
55 }
56 }
57 }
58 }
59 }
60
61 Component {
62 id: searchResults
63
64 ColumnLayout {
65 anchors.fill: parent
66
67 spacing: 0
68
69 Rectangle {
70 id: toolbar
71
72 width: parent.width
73 height: Kube.Units.gridUnit + Kube.Units.largeSpacing
74
75 color: Kube.Colors.backgroundColor
76
77 Kube.IconButton {
78 anchors {
79 verticalCenter: parent.verticalCenter
80 left: parent.left
81 leftMargin: Kube.Units.smallSpacing
82 }
83 iconName: Kube.Icons.goBack
84 onClicked: stack.pop()
85 }
86
87 Kube.TextField {
88 id: searchBar
89
90 anchors.centerIn: parent
91
92 width: Kube.Units.gridUnit * 30
93
94 text: stack.searchTerm
95 placeholderText: qsTr("Search...")
96 }
97 }
98
99 Rectangle {
100 id: resultsArea
101
102 Layout.fillHeight: true
103 Layout.fillWidth: true
104
105 color: Kube.Colors.viewBackgroundColor
106
107 RowLayout {
108 anchors.fill: parent
109
110 Rectangle {
111 width: Kube.Units.gridUnit * 10
112 Layout.fillHeight: true
113 color: Kube.Colors.buttonColor
114 }
115
116 Kube.ListView {
117 Layout.fillHeight: true
118 Layout.fillWidth: true
119
120 model: 10
121
122 delegate: Item {
123 width: parent.width
124 height: Kube.Units.gridUnit * 5
125
126 Rectangle {
127 anchors.centerIn: parent
128
129 height: parent.height - Kube.Units.largeSpacing
130 width: parent.width - Kube.Units.largeSpacing * 2
131
132 border.width: 1
133 border.color: Kube.Colors.buttonColor
134
135 Rectangle {
136 height: parent.height
137 width: height
138 color: Kube.Colors.buttonColor
139 }
140
141 Kube.AbstractButton {
142 anchors.fill: parent
143
144 color: "transparent"
145
146 onClicked: {
147 stack.push(viewResult)
148 }
149 }
150 }
151 }
152 }
153 }
154
155 }
156 }
157 }
158
159 Component {
160 id: viewResult
161
162 ColumnLayout {
163 anchors.fill: parent
164
165 spacing: 0
166
167 Rectangle {
168 id: toolbar
169
170 width: parent.width
171 height: Kube.Units.gridUnit + Kube.Units.largeSpacing
172
173 color: Kube.Colors.backgroundColor
174
175 Kube.IconButton {
176 anchors {
177 verticalCenter: parent.verticalCenter
178 left: parent.left
179 leftMargin: Kube.Units.smallSpacing
180 }
181 iconName: Kube.Icons.goBack
182 onClicked: stack.pop()
183 }
184
185 Row {
186 anchors.centerIn: parent
187
188 spacing: Kube.Units.largeSpacing
189
190 Kube.Button {
191 text: "prev"
192 }
193
194 Kube.Button {
195 text: "next"
196 }
197 }
198 }
199
200 Rectangle {
201 Layout.fillWidth: true
202 Layout.fillHeight: true
203 }
204 }
205 }
206}