on xenial help sign in
Added search indicator.
1ddc0e4Nicolas d'Offay
Components/PageHeader.qml+29−1
@@ -18,6 +18,7 @@ import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19import Ubuntu.Components.Popups 0.1
19import Ubuntu.Components.Popups 0.1
20import Ubuntu.Components.ListItems 0.1 as ListItem
20import Ubuntu.Components.ListItems 0.1 as ListItem
21+import Unity 0.1
21
22
22Item {
23Item {
23 /*!
24 /*!
@@ -30,6 +31,8 @@ Item {
30 property bool searchEntryEnabled: false
31 property bool searchEntryEnabled: false
31 property alias searchQuery: searchField.text
32 property alias searchQuery: searchField.text
32 property ListModel searchHistory: SearchHistoryModel {}
33 property ListModel searchHistory: SearchHistoryModel {}
34+ property Scope scope
35+ property bool searchInProgress: false
33
36
34 height: units.gu(8.5)
37 height: units.gu(8.5)
35 implicitHeight: units.gu(8.5)
38 implicitHeight: units.gu(8.5)
@@ -46,6 +49,11 @@ Item {
46 searchField.focus = false;
49 searchField.focus = false;
47 }
50 }
48
51
52+ Connections {
53+ target: scope
54+ onSearchInProgressChanged: searchInProgress = scope.searchInProgress
55+ }
56+
49 Connections {
57 Connections {
50 target: greeter
58 target: greeter
51 onShownChanged: if (shown) resetSearch()
59 onShownChanged: if (shown) resetSearch()
@@ -148,7 +156,7 @@ Item {
148 hasClearButton: false
156 hasClearButton: false
149
157
150 primaryItem: AbstractButton {
158 primaryItem: AbstractButton {
151− enabled: searchField.text != ""
159+ enabled: searchField.text != "" && !searchIndicator.running
152 onClicked: {
160 onClicked: {
153 if (searchField.text != "") {
161 if (searchField.text != "") {
154 searchHistory.addQuery(searchField.text)
162 searchHistory.addQuery(searchField.text)
@@ -158,6 +166,22 @@ Item {
158 height: parent.height
166 height: parent.height
159 width: height
167 width: height
160
168
169+ ActivityIndicator {
170+ id: searchIndicator
171+ objectName: "searchIndicator"
172+
173+ anchors {
174+ verticalCenter: parent.verticalCenter
175+ left: parent.left
176+ leftMargin: units.gu(0.5)
177+ }
178+
179+ running: searchInProgress && searchField.text !== ""
180+ opacity: running ? 1 : 0
181+
182+ Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing.type: Easing.Linear } }
183+ }
184+
161 Image {
185 Image {
162 id: primaryImage
186 id: primaryImage
163 anchors {
187 anchors {
@@ -167,6 +191,10 @@ Item {
167 }
191 }
168 width: units.gu(3)
192 width: units.gu(3)
169 height: units.gu(3)
193 height: units.gu(3)
194+ visible: opacity > 0
195+ opacity: searchIndicator.running ? 0 : 1
196+
197+ Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration; easing.type: Easing.Linear } }
170 }
198 }
171
199
172 Item {
200 Item {
Dash/GenericScopeView.qml+1
@@ -176,6 +176,7 @@ ScopeView {
176 width: categoryView.width
176 width: categoryView.width
177 text: scopeView.scope.name
177 text: scopeView.scope.name
178 searchEntryEnabled: true
178 searchEntryEnabled: true
179+ scope: scopeView.scope
179 }
180 }
180 }
181 }
181
182