on xenial help sign in
Clear or Cancel also reset the navigation tag
db7bb61Albert Astals Cid
qml/Dash/GenericScopeView.qml+7
@@ -635,6 +635,13 @@ FocusScope {
635 onSettingsClicked: subPageLoader.openSubPage("settings")
635 onSettingsClicked: subPageLoader.openSubPage("settings")
636 onFavoriteClicked: scopeView.scope.favorite = !scopeView.scope.favorite
636 onFavoriteClicked: scopeView.scope.favorite = !scopeView.scope.favorite
637 onSearchTextFieldFocused: scopeView.showHeader()
637 onSearchTextFieldFocused: scopeView.showHeader()
638+ onClearSearch: {
639+ resetSearch(keepPanelOpen);
640+ scopeView.scope.resetPrimaryNavigationTag();
641+ if (keepPanelOpen) {
642+ openPopup();
643+ }
644+ }
638 }
645 }
639
646
640 PageHeaderExtraPanel {
647 PageHeaderExtraPanel {
qml/Dash/PageHeader.qml+5−5
@@ -49,6 +49,7 @@ Item {
49
49
50 property var scopeStyle: null
50 property var scopeStyle: null
51
51
52+ signal clearSearch(bool keepPanelOpen)
52 signal backClicked()
53 signal backClicked()
53 signal storeClicked()
54 signal storeClicked()
54 signal settingsClicked()
55 signal settingsClicked()
@@ -205,14 +206,14 @@ Item {
205 secondaryItem: AbstractButton {
206 secondaryItem: AbstractButton {
206 height: searchTextField.height
207 height: searchTextField.height
207 width: height
208 width: height
208− enabled: searchTextField.text.length > 0
209+ enabled: searchTextField.text.length > 0 || root.navigationTag != ""
209
210
210 Image {
211 Image {
211 objectName: "clearIcon"
212 objectName: "clearIcon"
212 anchors.fill: parent
213 anchors.fill: parent
213 anchors.margins: units.gu(.75)
214 anchors.margins: units.gu(.75)
214 source: "image://theme/clear"
215 source: "image://theme/clear"
215− opacity: searchTextField.text.length > 0
216+ opacity: parent.enabled
216 visible: opacity > 0
217 visible: opacity > 0
217 Behavior on opacity {
218 Behavior on opacity {
218 UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
219 UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
@@ -220,8 +221,7 @@ Item {
220 }
221 }
221
222
222 onClicked: {
223 onClicked: {
223− root.resetSearch(true);
224+ root.clearSearch(true);
224− root.openPopup();
225 }
225 }
226 }
226 }
227
227
@@ -252,7 +252,7 @@ Item {
252 AbstractButton {
252 AbstractButton {
253 anchors.fill: parent
253 anchors.fill: parent
254 onClicked: {
254 onClicked: {
255− root.resetSearch();
255+ root.clearSearch(false);
256 headerContainer.showSearch = false;
256 headerContainer.showSearch = false;
257 }
257 }
258 }
258 }
tests/mocks/Unity/fake_scope.cpp+3
@@ -314,6 +314,9 @@ int Scope::activeFiltersCount() const
314
314
315void Scope::resetPrimaryNavigationTag()
315void Scope::resetPrimaryNavigationTag()
316{
316{
317+ if (m_currentNavigationId != "root") {
318+ setNavigationState("root");
319+ }
317}
320}
318
321
319void Scope::performQuery(const QString& query)
322void Scope::performQuery(const QString& query)