on xenial help sign in
invert logic for unfocusField to simplify argument handling
98793b8Michael Zanetti
qml/Components/PageHeader.qml+4−8
@@ -42,15 +42,11 @@ Item {
42 if (searchEntryEnabled) searchTextField.forceActiveFocus()
42 if (searchEntryEnabled) searchTextField.forceActiveFocus()
43 }
43 }
44
44
45− function resetSearch(unfocusField) {
45+ function resetSearch(keepFocus) {
46− if (unfocusField == undefined) {
47− unfocusField = true;
48− }
49−
50 if (searchHistory) {
46 if (searchHistory) {
51 searchHistory.addQuery(searchTextField.text);
47 searchHistory.addQuery(searchTextField.text);
52 }
48 }
53− if (unfocusField) {
49+ if (!keepFocus) {
54 unfocus();
50 unfocus();
55 }
51 }
56 searchTextField.text = "";
52 searchTextField.text = "";
@@ -129,7 +125,7 @@ Item {
129 backAction: Action {
125 backAction: Action {
130 iconName: "back"
126 iconName: "back"
131 onTriggered: {
127 onTriggered: {
132− root.resetSearch(true)
128+ root.resetSearch()
133 headerContainer.showSearch = false
129 headerContainer.showSearch = false
134 }
130 }
135 }
131 }
@@ -171,7 +167,7 @@ Item {
171 }
167 }
172
168
173 onClicked: {
169 onClicked: {
174− root.resetSearch(false)
170+ root.resetSearch(true)
175 root.openSearchHistory()
171 root.openSearchHistory()
176 }
172 }
177 }
173 }
qml/Dash/DashContent.qml+1−1
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18−import Ubuntu.Components 1.1
18+import Ubuntu.Components 0.1
19import Unity 0.2
19import Unity 0.2
20import Utils 0.1
20import Utils 0.1
21import "../Components"
21import "../Components"