on xenial help sign in
Clear or Cancel also reset the navigation tag
commitdb7bb615ff36cc31dc7102f0d205ef6c4c5ef573 authorAlbert Astals Cid <albert.astals@canonical.com> dateTue 22 Sep 2015, 16:01 (11 years ago) parent726809c
3 files changed+15−5
qml/Dash/GenericScopeView.qml+7 qml/Dash/PageHeader.qml+5−5 tests/mocks/Unity/fake_scope.cpp+3
qml/Dash/GenericScopeView.qml+7
@@ -635,6 +635,13 @@ FocusScope {
635635 onSettingsClicked: subPageLoader.openSubPage("settings")
636636 onFavoriteClicked: scopeView.scope.favorite = !scopeView.scope.favorite
637637 onSearchTextFieldFocused: scopeView.showHeader()
638+ onClearSearch: {
639+ resetSearch(keepPanelOpen);
640+ scopeView.scope.resetPrimaryNavigationTag();
641+ if (keepPanelOpen) {
642+ openPopup();
643+ }
644+ }
638645 }
639646
640647 PageHeaderExtraPanel {
qml/Dash/PageHeader.qml+5−5
@@ -49,6 +49,7 @@ Item {
4949
5050 property var scopeStyle: null
5151
52+ signal clearSearch(bool keepPanelOpen)
5253 signal backClicked()
5354 signal storeClicked()
5455 signal settingsClicked()
@@ -205,14 +206,14 @@ Item {
205206 secondaryItem: AbstractButton {
206207 height: searchTextField.height
207208 width: height
208− enabled: searchTextField.text.length > 0
209+ enabled: searchTextField.text.length > 0 || root.navigationTag != ""
209210
210211 Image {
211212 objectName: "clearIcon"
212213 anchors.fill: parent
213214 anchors.margins: units.gu(.75)
214215 source: "image://theme/clear"
215− opacity: searchTextField.text.length > 0
216+ opacity: parent.enabled
216217 visible: opacity > 0
217218 Behavior on opacity {
218219 UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
@@ -220,8 +221,7 @@ Item {
220221 }
221222
222223 onClicked: {
223− root.resetSearch(true);
224− root.openPopup();
224+ root.clearSearch(true);
225225 }
226226 }
227227
@@ -252,7 +252,7 @@ Item {
252252 AbstractButton {
253253 anchors.fill: parent
254254 onClicked: {
255− root.resetSearch();
255+ root.clearSearch(false);
256256 headerContainer.showSearch = false;
257257 }
258258 }
tests/mocks/Unity/fake_scope.cpp+3
@@ -314,6 +314,9 @@ int Scope::activeFiltersCount() const
314314
315315void Scope::resetPrimaryNavigationTag()
316316{
317+ if (m_currentNavigationId != "root") {
318+ setNavigationState("root");
319+ }
317320}
318321
319322void Scope::performQuery(const QString& query)