on xenial help sign in
Move the settings button out of the search line edit
commit15dd92e3c4c311fde1fd90f77cdbce851558796c authorAlbert Astals Cid <albert.astals@canonical.com> dateThu 4 Feb 2016, 17:53 (11 years ago) parentf5cffab
1 file changed+37−40
qml/Dash/DashPageHeader.qml+37−40
qml/Dash/DashPageHeader.qml+37−40
@@ -200,12 +200,10 @@ Item {
200200 left: parent.left
201201 bottom: parent.bottom
202202 bottomMargin: units.gu(1)
203− right: cancelLabel.left
204− rightMargin: units.gu(2)
203+ right: settingsButton.left
204+ rightMargin: settingsButton.visible ? 0 : units.gu(2)
205205 }
206206
207− readonly property bool clearIsSettings: !searchTextField.focus && root.scopeHasFilters
208−
209207 primaryItem: Rectangle {
210208 color: "#F5F4F5"
211209 width: root.navigationTag != "" ? tagLabel.width + units.gu(2) : 0
@@ -220,49 +218,25 @@ Item {
220218 }
221219
222220 secondaryItem: AbstractButton {
223− id: clearOrSettingsButton
224−
221+ id: clearButton
225222 height: searchTextField.height
226− width: row.width
227−
223+ width: height
228224 enabled: searchTextField.text.length > 0 || root.navigationTag != ""
229225
230− Row {
231− id: row
232− height: parent.height
233−
234− Item {
235− height: parent.height
236− width: height
237−
238− Image {
239− anchors.fill: parent
240− anchors.margins: units.gu(1)
241−
242− objectName: "clearIcon"
243− source: searchTextField.clearIsSettings ? "image://theme/filters" : "image://theme/clear"
244− opacity: parent.enabled
245− visible: opacity > 0
246− Behavior on opacity {
247− UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
248− }
249− }
250− }
251−
252− Label {
253− visible: searchTextField.clearIsSettings && root.activeFiltersCount > 0
254− height: parent.height
255− text: "(" + root.activeFiltersCount + ")"
256− verticalAlignment: Text.AlignVCenter
226+ Image {
227+ objectName: "clearIcon"
228+ anchors.fill: parent
229+ anchors.margins: units.gu(1)
230+ source: "image://theme/clear"
231+ opacity: parent.enabled
232+ visible: opacity > 0
233+ Behavior on opacity {
234+ UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
257235 }
258236 }
259237
260238 onClicked: {
261− if (searchTextField.clearIsSettings) {
262− root.showFiltersPopup(clearOrSettingsButton);
263− } else {
264− root.clearSearch(true);
265− }
239+ root.clearSearch(true);
266240 }
267241 }
268242
@@ -280,6 +254,29 @@ Item {
280254 }
281255 }
282256
257+ AbstractButton {
258+ id: settingsButton
259+
260+ width: root.scopeHasFilters && clearButton.enabled ? height : 0
261+ visible: width > 0
262+ anchors {
263+ top: parent.top
264+ right: cancelLabel.left
265+ bottom: parent.bottom
266+ }
267+
268+ Icon {
269+ anchors.fill: parent
270+ anchors.margins: units.gu(2)
271+ name: "filters"
272+ color: root.activeFiltersCount > 0 ? UbuntuColors.orange : Qt.rgba(0.0, 0.0, 0.0, 0.0)
273+ }
274+
275+ onClicked: {
276+ root.showFiltersPopup(settingsButton);
277+ }
278+ }
279+
283280 Label {
284281 id: cancelLabel
285282 text: i18n.tr("Cancel")