Merge lp:~nik90/unav/uniform-search-pattern into lp:unav

Proposed by Nekhelesh Ramananthan
Status: Merged
Merged at revision: 38
Proposed branch: lp:~nik90/unav/uniform-search-pattern
Merge into: lp:unav
Diff against target: 488 lines (+244/-186)
1 file modified
qml/SearchPage.qml (+244/-186)
To merge this branch: bzr merge lp:~nik90/unav/uniform-search-pattern
Reviewer Review Type Date Requested Status
JkB Approve
costales Approve
Review via email: mp+291445@code.launchpad.net

Description of the change

Be consistent with the search pattern.

To post a comment you must log in.
Revision history for this message
costales (costales) wrote :

Could be possible to fix the vertical align? :)
http://s14.postimg.org/y5weho1bx/Screenshot_from_2016_04_10_10_50_32.png
Thanks in advance!

review: Needs Fixing
38. By Nekhelesh Ramananthan

merged lp:unav

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

> Could be possible to fix the vertical align? :)
> http://s14.postimg.org/y5weho1bx/Screenshot_from_2016_04_10_10_50_32.png
> Thanks in advance!

That is an upstream bug in the Ubuntu SDK and only happens in the desktop. It is an issue that is already present in trunk and cannot be fixed in the app.

Revision history for this message
costales (costales) wrote :

Approve then :)
@Joerg? :)

review: Approve
Revision history for this message
JkB (joergberroth) wrote :

Hey, fine so far, but:

I would like to see wrapMode set to the titles.

Best Joerg

review: Needs Fixing
39. By Nekhelesh Ramananthan

Set wrapmode of title

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

@Joerg, Done :)

Revision history for this message
JkB (joergberroth) wrote :

:-)

great work!

comment: I think it is uitk, but the search icon seems to be an old one...

review: Approve
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

Indeed...the designers reverted the search icon to the older one. I notice this in the unity 8 dash as well.

Revision history for this message
JkB (joergberroth) wrote :

Hey, just saw that the serach page header still is whit. Is that ment to be?

Am 2016-04-10 um 16:04 schrieb Nekhelesh Ramananthan:
> Indeed...the designers reverted the search icon to the older one. I notice this in the unity 8 dash as well.
>

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

That's because this branch came before the change header color branch.

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

In trunk everything looks good.

Revision history for this message
JkB (joergberroth) wrote :

Yeo,

sorry, was a rev conflict on my side :-)

perfect!

Am 2016-04-10 um 16:52 schrieb Nekhelesh Ramananthan:
> In trunk everything looks good.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/SearchPage.qml'
2--- qml/SearchPage.qml 2016-04-08 00:10:20 +0000
3+++ qml/SearchPage.qml 2016-04-10 13:48:57 +0000
4@@ -27,9 +27,13 @@
5 Page {
6 id: searchPage
7
8- header: PageHeader {
9+ header: standardHeader
10+
11+ PageHeader {
12+ id: standardHeader
13+
14 title: i18n.tr("Search")
15- flickable: statusLabel.visible ? resultsListView : historyListView
16+ visible: header === standardHeader
17
18 // #FIXME: This back button is only here to allow the user to press Escape keyboard key to go back.
19 // This feature will be implemented upstream by the SDK devs when they add keyboard shortcuts to pages,
20@@ -42,8 +46,29 @@
21 }
22 }
23
24+ trailingActionBar.actions: Action {
25+ iconName: "search"
26+ text: i18n.tr("Find location")
27+ onTriggered: {
28+ header = searchHeader
29+ searchField.forceActiveFocus()
30+ }
31+ }
32+ }
33+
34+ PageHeader {
35+ id: searchHeader
36+
37+ visible: header === searchHeader
38+
39 contents: TextField {
40 id: searchField
41+
42+ primaryItem: Icon {
43+ height: units.gu(2)
44+ name: "search"
45+ }
46+
47 width: parent.width
48 anchors.verticalCenter: parent.verticalCenter
49 inputMethodHints: Qt.ImhNoPredictiveText
50@@ -53,7 +78,6 @@
51 if (text.trim()) {
52 statusLabel.visible = true
53 statusLabel.text = i18n.tr("Searching…");
54- resultsListView.visible = false
55 xmlSearchModel.searchString = text;
56 xmlSearchModel.search();
57 } else {
58@@ -61,6 +85,34 @@
59 }
60 }
61 }
62+
63+ trailingActionBar {
64+ anchors.rightMargin: 0
65+ delegate: AbstractButton {
66+ id: button
67+ action: modelData
68+ width: headerButtonText.implicitWidth + units.gu(2)
69+ height: parent.height
70+
71+ Label {
72+ id: headerButtonText
73+ anchors.centerIn: parent
74+ text: action.text
75+ }
76+ }
77+
78+ actions: Action {
79+ text: i18n.tr("Cancel")
80+
81+ onTriggered: {
82+ // Clear the search
83+ searchField.text = ""
84+ searchPage.header = standardHeader
85+ xmlSearchModel.clear();
86+ sortedSearchModel.clear();
87+ }
88+ }
89+ }
90 }
91
92 Label {
93@@ -139,7 +191,6 @@
94 statusLabel.text = i18n.tr("Time out! Please try again");
95 statusLabel.visible = true;
96 historyIcon.visible = false;
97- resultsListView.visible = false;
98 }
99
100 else if (status === XmlListModel.Ready && count === 0) {
101@@ -147,7 +198,6 @@
102 statusLabel.text = i18n.tr("Sorry, no result for %1").arg(searchField.text)
103 statusLabel.visible = true;
104 historyIcon.visible = false;
105- resultsListView.visible = false;
106 }
107
108 else if (status === XmlListModel.Ready && count >> 0) {
109@@ -216,190 +266,198 @@
110 }
111 }
112 xmlSearchModel.clear();
113- historyListView.visible = false;
114- resultsListView.visible = true;
115- }
116- }
117- }
118-
119- ListView {
120- id: historyListView
121-
122- model: historyModel
123- visible: !statusLabel.visible
124- anchors.fill: parent
125-
126- section.property: "title"
127- section.criteria: ViewSection.FullString
128- section.delegate: ListItemHeader {
129- title: section
130- }
131-
132- delegate: ListItem {
133- height: historyDelegateLayout.height + divider.height
134- leadingActions: ListItemActions {
135- actions: [
136- Action {
137- iconName: "delete"
138- onTriggered: {
139- switch (model.title) {
140- case i18n.tr("Search history"):
141- UnavDB.removeHistorySearch(model.name);
142- break;
143- case i18n.tr("Nearby history"):
144- UnavDB.removeHistoryNearby(model.en_name);
145- break;
146- case i18n.tr("Favorite history"):
147- UnavDB.removeHistoryFavorite(model.name);
148- }
149- historyModel.initialize();
150- }
151- }
152- ]
153- }
154-
155- trailingActions: ListItemActions {
156- actions: [
157- Action {
158- iconName: "send"
159- visible: model.title !== i18n.tr("Nearby history")
160- onTriggered: {
161- mainPageStack.clear();
162- mainPageStack.center_onpos = 2;
163- mainPageStack.routeState = 'yes';
164- mainPageStack.executeJavaScript("calc2coord("+ model.lat + "," + model.lng + ");");
165- }
166- },
167- Action {
168- iconName: "share"
169- visible: model.title !== i18n.tr("Nearby history")
170- onTriggered: {
171- PopupUtils.open(Qt.resolvedUrl("./Share.qml"), navApp, {"lat": model.lat, "lon": model.lng});
172- }
173- }
174- ]
175- }
176-
177- ListItemLayout {
178- id: historyDelegateLayout
179-
180- title.text: model.name
181- title.maximumLineCount: 2
182- subtitle.text: QmlJs.formatDistance(QmlJs.calcPoiDistance(mainPageStack.currentLat, mainPageStack.currentLng, model.lat, model.lng, 10), navApp.settings.unit)
183- subtitle.visible: model.title !== i18n.tr("Nearby history") && mainPageStack.currentLat !== "null" && mainPageStack.currentLng !== "null"
184-
185- Icon {
186- id: resultTypeIcon
187- height: units.gu(2.5)
188- name: {
189- if (model.title === i18n.tr("Search history"))
190- return "history"
191- else if (model.title === i18n.tr("Favorite history"))
192- return "starred"
193- else
194- return "location"
195- }
196-
197- SlotsLayout.position: SlotsLayout.First
198- SlotsLayout.overrideVerticalPositioning: true
199- anchors.verticalCenter: parent.verticalCenter
200- }
201-
202- Icon {
203- id: progressionIcon
204- height: units.gu(2.5)
205- name: "next"
206- visible: model.title === i18n.tr("Nearby history")
207- SlotsLayout.position: SlotsLayout.Last
208- }
209-
210- }
211-
212- onClicked: {
213- if (model.title === i18n.tr("Nearby history")) {
214- mainPageStack.push(Qt.resolvedUrl("PoiListPage.qml"),
215- {
216- fromPage: searchPage,
217- lat: mainPageStack.currentLat,
218- lng: mainPageStack.currentLng,
219- poiType: model.name,
220- clause: model.clause,
221- geoDistFactor: 5
222- })
223- } else {
224+ }
225+ }
226+ }
227+
228+ Loader {
229+ id: listViewLoader
230+ anchors { top: searchPage.header.bottom; left: parent.left; right: parent.right; bottom: parent.bottom }
231+ sourceComponent: searchPage.header === standardHeader ? historyListViewComponent : resultsListViewComponent
232+ }
233+
234+ Component {
235+ id: historyListViewComponent
236+ ListView {
237+ id: historyListView
238+
239+ clip: true
240+ model: historyModel
241+
242+ section.property: "title"
243+ section.criteria: ViewSection.FullString
244+ section.delegate: ListItemHeader {
245+ title: section
246+ }
247+
248+ delegate: ListItem {
249+ height: historyDelegateLayout.height + divider.height
250+ leadingActions: ListItemActions {
251+ actions: [
252+ Action {
253+ iconName: "delete"
254+ onTriggered: {
255+ switch (model.title) {
256+ case i18n.tr("Search history"):
257+ UnavDB.removeHistorySearch(model.name);
258+ break;
259+ case i18n.tr("Nearby history"):
260+ UnavDB.removeHistoryNearby(model.en_name);
261+ break;
262+ case i18n.tr("Favorite history"):
263+ UnavDB.removeHistoryFavorite(model.name);
264+ }
265+ historyModel.initialize();
266+ }
267+ }
268+ ]
269+ }
270+
271+ trailingActions: ListItemActions {
272+ actions: [
273+ Action {
274+ iconName: "send"
275+ visible: model.title !== i18n.tr("Nearby history")
276+ onTriggered: {
277+ mainPageStack.clear();
278+ mainPageStack.center_onpos = 2;
279+ mainPageStack.routeState = 'yes';
280+ mainPageStack.executeJavaScript("calc2coord("+ model.lat + "," + model.lng + ");");
281+ }
282+ },
283+ Action {
284+ iconName: "share"
285+ visible: model.title !== i18n.tr("Nearby history")
286+ onTriggered: {
287+ PopupUtils.open(Qt.resolvedUrl("./Share.qml"), navApp, {"lat": model.lat, "lon": model.lng});
288+ }
289+ }
290+ ]
291+ }
292+
293+ ListItemLayout {
294+ id: historyDelegateLayout
295+
296+ title.text: model.name
297+ title.wrapMode: Text.WordWrap
298+ title.maximumLineCount: 2
299+ subtitle.text: QmlJs.formatDistance(QmlJs.calcPoiDistance(mainPageStack.currentLat, mainPageStack.currentLng, model.lat, model.lng, 10), navApp.settings.unit)
300+ subtitle.visible: model.title !== i18n.tr("Nearby history") && mainPageStack.currentLat !== "null" && mainPageStack.currentLng !== "null"
301+
302+ Icon {
303+ id: resultTypeIcon
304+ height: units.gu(2.5)
305+ name: {
306+ if (model.title === i18n.tr("Search history"))
307+ return "history"
308+ else if (model.title === i18n.tr("Favorite history"))
309+ return "starred"
310+ else
311+ return "location"
312+ }
313+
314+ SlotsLayout.position: SlotsLayout.First
315+ SlotsLayout.overrideVerticalPositioning: true
316+ anchors.verticalCenter: parent.verticalCenter
317+ }
318+
319+ Icon {
320+ id: progressionIcon
321+ height: units.gu(2.5)
322+ name: "next"
323+ visible: model.title === i18n.tr("Nearby history")
324+ SlotsLayout.position: SlotsLayout.Last
325+ }
326+
327+ }
328+
329+ onClicked: {
330+ if (model.title === i18n.tr("Nearby history")) {
331+ mainPageStack.push(Qt.resolvedUrl("PoiListPage.qml"),
332+ {
333+ fromPage: searchPage,
334+ lat: mainPageStack.currentLat,
335+ lng: mainPageStack.currentLng,
336+ poiType: model.name,
337+ clause: model.clause,
338+ geoDistFactor: 5
339+ })
340+ } else {
341+ mainPageStack.clear();
342+ mainPageStack.executeJavaScript("ui.markers_POI_set([{ title: \"" +
343+ model.name + "\", lat: " +
344+ model.lat + ", lng: " +
345+ model.lng + "}]);");
346+ }
347+ }
348+ }
349+ }
350+ }
351+
352+ Component {
353+ id: resultsListViewComponent
354+ ListView {
355+ id: resultsListView
356+
357+ clip: true
358+ model: sortedSearchModel
359+
360+ delegate: ListItem {
361+ height: resultsDelegateLayout.height + divider.height
362+ trailingActions: ListItemActions {
363+ actions: [
364+ Action {
365+ iconName: "send"
366+ onTriggered: {
367+ if (navApp.settings.saveHistory) {
368+ UnavDB.saveToSearchHistory(model.name, model.lat, model.lng)
369+ }
370+ mainPageStack.clear();
371+ mainPageStack.center_onpos = 2;
372+ mainPageStack.routeState = 'yes'
373+ mainPageStack.executeJavaScript("calc2coord(" + model.lat + "," + model.lng + ");")
374+ }
375+ },
376+ Action {
377+ iconName: "share"
378+ onTriggered: {
379+ PopupUtils.open(Qt.resolvedUrl("./Share.qml"), navApp, {"lat": model.lat, "lon": model.lng})
380+ }
381+ },
382+ Action {
383+ iconName: "non-starred"
384+ onTriggered: {
385+ mainPageStack.push(Qt.resolvedUrl("FavoritesPage.qml"), {isAddedFromPopup:true, lat: model.lat, lng: model.lng, favName: model.name})
386+ }
387+ }
388+ ]
389+ }
390+
391+ onClicked: {
392+ if (navApp.settings.saveHistory) {
393+ UnavDB.saveToSearchHistory(model.name, model.lat, model.lng);
394+ }
395 mainPageStack.clear();
396- mainPageStack.executeJavaScript("ui.markers_POI_set([{ title: \"" +
397- model.name + "\", lat: " +
398- model.lat + ", lng: " +
399- model.lng + "}]);");
400+ mainPageStack.executeJavaScript("ui.markers_POI_set([{title: \"" + model.name + "\", lat: " + model.lat + ", lng: " + model.lng + "}]);");
401 }
402- }
403- }
404- }
405-
406- ListView {
407- id: resultsListView
408-
409- anchors.fill: parent
410- anchors.topMargin: units.gu(6)
411- visible: false
412-
413- model: sortedSearchModel
414-
415- delegate: ListItem {
416- height: resultsDelegateLayout.height + divider.height
417- trailingActions: ListItemActions {
418- actions: [
419- Action {
420- iconName: "send"
421- onTriggered: {
422- if (navApp.settings.saveHistory) {
423- UnavDB.saveToSearchHistory(model.name, model.lat, model.lng)
424- }
425- mainPageStack.clear();
426- mainPageStack.center_onpos = 2;
427- mainPageStack.routeState = 'yes'
428- mainPageStack.executeJavaScript("calc2coord(" + model.lat + "," + model.lng + ");")
429- }
430- },
431- Action {
432- iconName: "share"
433- onTriggered: {
434- PopupUtils.open(Qt.resolvedUrl("./Share.qml"), navApp, {"lat": model.lat, "lon": model.lng})
435- }
436- },
437- Action {
438- iconName: "non-starred"
439- onTriggered: {
440- mainPageStack.push(Qt.resolvedUrl("FavoritesPage.qml"), {isAddedFromPopup:true, lat: model.lat, lng: model.lng, favName: model.name})
441- }
442+
443+ ListItemLayout {
444+ id: resultsDelegateLayout
445+
446+ title.text: model.name
447+ title.maximumLineCount: 2
448+ title.wrapMode: Text.WordWrap
449+ subtitle.text: QmlJs.formatDistance(model.distance, navApp.settings.unit)
450+ subtitle.visible: mainPageStack.currentLat !== "null" && mainPageStack.currentLng !== "null"
451+
452+ Icon {
453+ id: resIcon
454+ height: units.gu(2.5)
455+ width: height
456+ visible: model.icon !== ""
457+ source: model.icon
458+ SlotsLayout.position: SlotsLayout.Last
459 }
460- ]
461- }
462-
463- onClicked: {
464- if (navApp.settings.saveHistory) {
465- UnavDB.saveToSearchHistory(model.name, model.lat, model.lng);
466- }
467- mainPageStack.clear();
468- mainPageStack.executeJavaScript("ui.markers_POI_set([{title: \"" + model.name + "\", lat: " + model.lat + ", lng: " + model.lng + "}]);");
469- }
470-
471- ListItemLayout {
472- id: resultsDelegateLayout
473-
474- title.text: model.name
475- title.maximumLineCount: 2
476- subtitle.text: QmlJs.formatDistance(model.distance, navApp.settings.unit)
477- subtitle.visible: mainPageStack.currentLat !== "null" && mainPageStack.currentLng !== "null"
478-
479- Icon {
480- id: resIcon
481- height: units.gu(2.5)
482- width: height
483- visible: model.icon !== ""
484- source: model.icon
485- SlotsLayout.position: SlotsLayout.Last
486 }
487 }
488 }

Subscribers

People subscribed via source and target branches