on xenial help sign in
Number with the active filters
42f822dAlbert Astals Cid
qml/Dash/GenericScopeView.qml+1
@@ -623,6 +623,7 @@ FocusScope {
623 searchHistory: SearchHistoryModel
623 searchHistory: SearchHistoryModel
624 searchHint: scopeView.scope && scopeView.scope.searchHint || i18n.ctr("Label: Hint for dash search line edit", "Search")
624 searchHint: scopeView.scope && scopeView.scope.searchHint || i18n.ctr("Label: Hint for dash search line edit", "Search")
625 scopeHasFilters: scopeView.scope.filters != null
625 scopeHasFilters: scopeView.scope.filters != null
626+ activeFiltersCount: scopeView.scope.activeFiltersCount
626 showBackButton: scopeView.hasBackAction
627 showBackButton: scopeView.hasBackAction
627 searchEntryEnabled: true
628 searchEntryEnabled: true
628 settingsEnabled: scopeView.scope && scopeView.scope.settings && scopeView.scope.settings.count > 0 || false
629 settingsEnabled: scopeView.scope && scopeView.scope.settings && scopeView.scope.settings.count > 0 || false
qml/Dash/PageHeader.qml+32−20
@@ -26,6 +26,7 @@ Item {
26 implicitHeight: headerContainer.height + bottomContainer.height + signatureLineHeight
26 implicitHeight: headerContainer.height + bottomContainer.height + signatureLineHeight
27 readonly property real signatureLineHeight: showSignatureLine ? units.gu(2) : 0
27 readonly property real signatureLineHeight: showSignatureLine ? units.gu(2) : 0
28
28
29+ property int activeFiltersCount: 0
29 property bool scopeHasFilters: false
30 property bool scopeHasFilters: false
30 property bool showBackButton: false
31 property bool showBackButton: false
31 property bool backIsClose: false
32 property bool backIsClose: false
@@ -206,31 +207,42 @@ Item {
206 text: root.navigationTag
207 text: root.navigationTag
207 }
208 }
208
209
209− secondaryItem: AbstractButton {
210+ secondaryItem: Row {
210− id: clearOrSettingsButton
211 height: searchTextField.height
211 height: searchTextField.height
212+
213+ AbstractButton {
214+ id: clearOrSettingsButton
215+ height: parent.height
212− width: height
216+ width: height
213− enabled: searchTextField.text.length > 0 || root.navigationTag != ""
217+ enabled: searchTextField.text.length > 0 || root.navigationTag != ""
214−
218+
215− Image {
219+ Image {
216− objectName: "clearIcon"
220+ objectName: "clearIcon"
217− anchors.fill: parent
221+ anchors.fill: parent
218− anchors.margins: units.gu(.75)
222+ anchors.margins: units.gu(.75)
219− source: searchTextField.clearIsSettings ? "image://theme/settings" : "image://theme/clear"
223+ source: searchTextField.clearIsSettings ? "image://theme/settings" : "image://theme/clear"
220− opacity: parent.enabled
224+ opacity: parent.enabled
221− visible: opacity > 0
225+ visible: opacity > 0
222− Behavior on opacity {
226+ Behavior on opacity {
223− UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
227+ UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
228+ }
224 }
229 }
225− }
226
230
227− onClicked: {
231+ onClicked: {
228− if (searchTextField.clearIsSettings) {
232+ if (searchTextField.clearIsSettings) {
229− root.showFiltersPopup(clearOrSettingsButton);
233+ root.showFiltersPopup(clearOrSettingsButton);
230− } else {
234+ } else {
231− root.clearSearch(true);
235+ root.clearSearch(true);
236+ }
232 }
237 }
233 }
238 }
239+
240+ Label {
241+ visible: searchTextField.clearIsSettings && root.activeFiltersCount > 0
242+ height: parent.height
243+ text: root.activeFiltersCount
244+ verticalAlignment: Text.AlignVCenter
245+ }
234 }
246 }
235
247
236 onActiveFocusChanged: {
248 onActiveFocusChanged: {
tests/mocks/Unity/fake_optionselectoroptions.cpp+1−4
@@ -53,7 +53,6 @@ QVariant FakeOptionSelectorOptions::data(const QModelIndex &index, int role) con
53
53
54void FakeOptionSelectorOptions::setChecked(int row, bool checked)
54void FakeOptionSelectorOptions::setChecked(int row, bool checked)
55{
55{
56− const bool wasChecked = anyChecked();
57 if (checked) {
56 if (checked) {
58 if (!static_cast<FakeOptionSelectorFilter*>(parent())->multiSelect()) {
57 if (!static_cast<FakeOptionSelectorFilter*>(parent())->multiSelect()) {
59 if (!m_checkedIndexes.isEmpty()) {
58 if (!m_checkedIndexes.isEmpty()) {
@@ -67,9 +66,7 @@ void FakeOptionSelectorOptions::setChecked(int row, bool checked)
67 }
66 }
68 const QModelIndex idx = index(row, 0);
67 const QModelIndex idx = index(row, 0);
69 Q_EMIT dataChanged(idx, idx, QVector<int>() << RoleOptionChecked);
68 Q_EMIT dataChanged(idx, idx, QVector<int>() << RoleOptionChecked);
70− if (wasChecked != anyChecked()) {
71− Q_EMIT anyCheckedChanged();
69+ Q_EMIT anyCheckedChanged();
72− }
73}
70}
74
71
75bool FakeOptionSelectorOptions::anyChecked() const
72bool FakeOptionSelectorOptions::anyChecked() const