Merge lp:~ubuntu-weather-dev/ubuntu-weather-app/reboot-finish-listitem-migration into lp:ubuntu-weather-app

Proposed by Victor Thompson on 2015-08-05
Status: Superseded
Proposed branch: lp:~ubuntu-weather-dev/ubuntu-weather-app/reboot-finish-listitem-migration
Merge into: lp:ubuntu-weather-app
Diff against target: 1214 lines (+96/-946)
12 files modified
app/components/CMakeLists.txt (+0/-2)
app/components/ListItemActions/CMakeLists.txt (+0/-5)
app/components/ListItemActions/CheckBox.qml (+0/-25)
app/components/ListItemActions/Remove.qml (+0/-27)
app/components/ListItemReorderComponent.qml (+0/-106)
app/components/ListItemWithActions.qml (+0/-496)
app/components/MultiSelectHeadState.qml (+0/-72)
app/components/MultiSelectListView.qml (+27/-8)
app/components/WeatherListItem.qml (+0/-138)
app/components/WeatherListView.qml (+1/-2)
app/ui/LocationsPage.qml (+63/-48)
po/com.ubuntu.weather.pot (+5/-17)
To merge this branch: bzr merge lp:~ubuntu-weather-dev/ubuntu-weather-app/reboot-finish-listitem-migration
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve on 2015-11-20
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-10-18
Andrew Hayzen 2015-08-05 Needs Fixing on 2015-08-13
Review via email: mp+266981@code.launchpad.net

This proposal has been superseded by a proposal from 2015-11-20.

Commit message

* Finish the migration to the new SDK list items
* Lock weather app in the Portrait orientation until we get some landscape designs
* Make the page with bottom edge animation less jarring when it reaches the top by adding a fake header (similar to what the clock app does)

Description of the change

* Finished the migration to the new SDK list items
* Locked weather app in the Portrait orientation until we get some landscape designs
* Made the page with bottom edge animation less jarring when it reaches the top by adding a fake header (similar to what the clock app does)
* Buy nik90 a beer for starting this effort

To post a comment you must log in.
Victor Thompson (vthompson) wrote :
Andrew Hayzen (ahayzen) wrote :

A few inline comments, visually ...
1) there appears to be a space between the detected location and the first selected location
2) if you multiselect, select an item, then select delete you are still in multiselect mode, this is weird if you remove the last item in the list as you have to hit back what feels like twice. I suggest when delete is pressed in the header that the multiselect mode is cancelled.

review: Needs Fixing
71. By Victor Thompson on 2015-08-14

Update for comments

Victor Thompson (vthompson) wrote :

> Should this have // CUSTOM as a note incase we do a pull of upstream and miss that we made changes?
Sure. I added a comment. I think eventually this will be folded into the SDK anyway. They already pulled in a hint component that we should make use of soonish.

> Why was this changed it looks the same just with { } around it?
No reason that I know of. I didn't like it either when I was resolving merge conflicts. Updated.

> Not A->Z
Fixed.

72. By Victor Thompson on 2015-08-14

Fix visual issues

73. By Victor Thompson on 2015-08-22

Merge and resolve conflicts

74. By Victor Thompson on 2015-09-01

Merge of trunk

75. By Victor Thompson on 2015-09-25

Merge and resolve conflicts.

76. By Victor Thompson on 2015-09-25

fix bad conflict resolution

Victor Thompson (vthompson) wrote :

I've been testing this branch a bit. I think many of the list item blockers have been fixed. To aide in testing, could we get a comprehensive list of bugs that we should verify have been fixed?

Andrew Hayzen (ahayzen) wrote :

Its the same set of bugs that are blocking the music one [0]

bug 1469471 (causes checkbox to not update in selectMode)
bug 1468100 (swiping can break selectMode)
bug 1486008 (swipe remove button is too small on mako)

IIRC it was only the last bug that was not fixed, which I think is now fixed in rc-proposed?

0 - https://code.launchpad.net/~ahayzen/music-app/refactor-use-sdk-listitems/+merge/261328

Victor Thompson (vthompson) wrote :

Agreed, bug 1486008 appears to be fixed in rc-proposed.

77. By Victor Thompson on 2015-10-18

Merge of trunk and resolve conflicts.

78. By Victor Thompson on 2015-10-18

Removed bad FakeHeader

79. By Victor Thompson on 2015-10-18

Fix pot file

Andrew Hayzen (ahayzen) wrote :

We will need to bump to uc1.3 for this as well, I'll make a branch that this can rebase onto.

review: Needs Fixing (continuous-integration)
80. By Victor Thompson on 2015-11-20

Merge of trunk

review: Approve (continuous-integration)
81. By Victor Thompson on 2015-11-20

rebase on UC1.3 branch

82. By Victor Thompson on 2015-12-10

Merge trunk, resolve conflicts, and add changelog entry

Unmerged revisions

82. By Victor Thompson on 2015-12-10

Merge trunk, resolve conflicts, and add changelog entry

81. By Victor Thompson on 2015-11-20

rebase on UC1.3 branch

80. By Victor Thompson on 2015-11-20

Merge of trunk

79. By Victor Thompson on 2015-10-18

Fix pot file

78. By Victor Thompson on 2015-10-18

Removed bad FakeHeader

77. By Victor Thompson on 2015-10-18

Merge of trunk and resolve conflicts.

76. By Victor Thompson on 2015-09-25

fix bad conflict resolution

75. By Victor Thompson on 2015-09-25

Merge and resolve conflicts.

74. By Victor Thompson on 2015-09-01

Merge of trunk

73. By Victor Thompson on 2015-08-22

Merge and resolve conflicts

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/components/CMakeLists.txt'
2--- app/components/CMakeLists.txt 2015-03-03 18:37:59 +0000
3+++ app/components/CMakeLists.txt 2015-11-20 19:29:18 +0000
4@@ -1,5 +1,3 @@
5-add_subdirectory(ListItemActions)
6-
7 file(GLOB COMPONENTS_QML_JS_FILES *.qml *.js)
8
9 add_custom_target(ubuntu-weather-app_components_QMlFiles ALL SOURCES ${COMPONENTS_QML_JS_FILES})
10
11=== removed directory 'app/components/ListItemActions'
12=== removed file 'app/components/ListItemActions/CMakeLists.txt'
13--- app/components/ListItemActions/CMakeLists.txt 2015-03-03 18:37:59 +0000
14+++ app/components/ListItemActions/CMakeLists.txt 1970-01-01 00:00:00 +0000
15@@ -1,5 +0,0 @@
16-file(GLOB LISTITEMACTIONS_QML_JS_FILES *.qml *.js)
17-
18-add_custom_target(ubuntu-weather-app_listitemactions_QMlFiles ALL SOURCES ${LISTITEMACTIONS_QML_JS_FILES})
19-
20-install(FILES ${LISTITEMACTIONS_QML_JS_FILES} DESTINATION ${UBUNTU-WEATHER_APP_DIR}/components/ListItemActions)
21
22=== removed file 'app/components/ListItemActions/CheckBox.qml'
23--- app/components/ListItemActions/CheckBox.qml 2015-06-18 01:45:57 +0000
24+++ app/components/ListItemActions/CheckBox.qml 1970-01-01 00:00:00 +0000
25@@ -1,25 +0,0 @@
26-/*
27- * Copyright (C) 2012-2014, 2015 Canonical, Ltd.
28- *
29- * This program is free software; you can redistribute it and/or modify
30- * it under the terms of the GNU General Public License as published by
31- * the Free Software Foundation; version 3.
32- *
33- * This program is distributed in the hope that it will be useful,
34- * but WITHOUT ANY WARRANTY; without even the implied warranty of
35- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36- * GNU General Public License for more details.
37- *
38- * You should have received a copy of the GNU General Public License
39- * along with this program. If not, see <http://www.gnu.org/licenses/>.
40- */
41-
42-import QtQuick 2.4
43-import Ubuntu.Components 1.2
44-
45-CheckBox {
46- checked: root.selected
47- width: implicitWidth
48- // disable item mouse area to avoid conflicts with parent mouse area
49- __mouseArea.enabled: false
50-}
51
52=== removed file 'app/components/ListItemActions/Remove.qml'
53--- app/components/ListItemActions/Remove.qml 2015-06-18 01:42:03 +0000
54+++ app/components/ListItemActions/Remove.qml 1970-01-01 00:00:00 +0000
55@@ -1,27 +0,0 @@
56-/*
57- * Copyright (C) 2014, 2015 Andrew Hayzen <ahayzen@gmail.com>
58- * Daniel Holm <d.holmen@gmail.com>
59- * Victor Thompson <victor.thompson@gmail.com>
60- *
61- * This program is free software; you can redistribute it and/or modify
62- * it under the terms of the GNU General Public License as published by
63- * the Free Software Foundation; version 3.
64- *
65- * This program is distributed in the hope that it will be useful,
66- * but WITHOUT ANY WARRANTY; without even the implied warranty of
67- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68- * GNU General Public License for more details.
69- *
70- * You should have received a copy of the GNU General Public License
71- * along with this program. If not, see <http://www.gnu.org/licenses/>.
72- */
73-
74-import QtQuick 2.4
75-import Ubuntu.Components 1.2
76-
77-Action {
78- id: removeAction
79- iconName: "delete"
80- objectName: "swipeDeleteAction"
81- text: i18n.tr("Remove")
82-}
83
84=== removed file 'app/components/ListItemReorderComponent.qml'
85--- app/components/ListItemReorderComponent.qml 2015-06-18 01:42:03 +0000
86+++ app/components/ListItemReorderComponent.qml 1970-01-01 00:00:00 +0000
87@@ -1,106 +0,0 @@
88-/*
89- * Copyright (C) 2013, 2014, 2015
90- * Andrew Hayzen <ahayzen@gmail.com>
91- * Nekhelesh Ramananthan <krnekhelesh@gmail.com>
92- * Victor Thompson <victor.thompson@gmail.com>
93- *
94- * This program is free software; you can redistribute it and/or modify
95- * it under the terms of the GNU General Public License as published by
96- * the Free Software Foundation; version 3.
97- *
98- * This program is distributed in the hope that it will be useful,
99- * but WITHOUT ANY WARRANTY; without even the implied warranty of
100- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
101- * GNU General Public License for more details.
102- *
103- * You should have received a copy of the GNU General Public License
104- * along with this program. If not, see <http://www.gnu.org/licenses/>.
105- */
106-
107-import QtQuick 2.4
108-import Ubuntu.Components 1.2
109-
110-
111-Item {
112- id: actionReorder
113- width: units.gu(4)
114-
115- Icon {
116- anchors {
117- horizontalCenter: parent.horizontalCenter
118- verticalCenter: parent.verticalCenter
119- }
120- name: "navigation-menu" // TODO: use proper image
121- height: width
122- width: units.gu(3)
123- }
124-
125- MouseArea {
126- id: actionReorderMouseArea
127- anchors {
128- fill: parent
129- }
130- property int startY: 0
131- property int startContentY: 0
132-
133- onPressed: {
134- root.parent.parent.interactive = false; // stop scrolling of listview
135- startY = root.y;
136- startContentY = root.parent.parent.contentY;
137- root.z += 10; // force ontop of other elements
138-
139- console.debug("Reorder listitem pressed", root.y)
140- }
141- onMouseYChanged: root.y += mouse.y - (root.height / 2);
142- onReleased: {
143- console.debug("Reorder diff by position", getDiff());
144-
145- var diff = getDiff();
146-
147- // Remove the height of the actual item if moved down
148- if (diff > 0) {
149- diff -= 1;
150- }
151-
152- root.parent.parent.interactive = true; // reenable scrolling
153-
154- if (diff === 0) {
155- // Nothing has changed so reset the item
156- // z index is restored after animation
157- resetListItemYAnimation.start();
158- }
159- else {
160- var newIndex = index + diff;
161-
162- if (newIndex < 0) {
163- newIndex = 0;
164- }
165- else if (newIndex > root.parent.parent.count - 1) {
166- newIndex = root.parent.parent.count - 1;
167- }
168-
169- root.z -= 10; // restore z index
170- reorder(index, newIndex)
171- }
172- }
173-
174- function getDiff() {
175- // Get the amount of items that have been passed over (by centre)
176- return Math.round((((root.y - startY) + (root.parent.parent.contentY - startContentY)) / root.height) + 0.5);
177- }
178- }
179-
180- SequentialAnimation {
181- id: resetListItemYAnimation
182- UbuntuNumberAnimation {
183- target: root;
184- property: "y";
185- to: actionReorderMouseArea.startY
186- }
187- ScriptAction {
188- script: {
189- root.z -= 10; // restore z index
190- }
191- }
192- }
193-}
194
195=== removed file 'app/components/ListItemWithActions.qml'
196--- app/components/ListItemWithActions.qml 2015-06-18 01:42:03 +0000
197+++ app/components/ListItemWithActions.qml 1970-01-01 00:00:00 +0000
198@@ -1,496 +0,0 @@
199-/*
200- * Copyright (C) 2012-2015 Canonical, Ltd.
201- *
202- * This program is free software; you can redistribute it and/or modify
203- * it under the terms of the GNU General Public License as published by
204- * the Free Software Foundation; version 3.
205- *
206- * This program is distributed in the hope that it will be useful,
207- * but WITHOUT ANY WARRANTY; without even the implied warranty of
208- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
209- * GNU General Public License for more details.
210- *
211- * You should have received a copy of the GNU General Public License
212- * along with this program. If not, see <http://www.gnu.org/licenses/>.
213- */
214-
215-import QtQuick 2.4
216-import Ubuntu.Components 1.2
217-import Ubuntu.Components.ListItems 1.0 as ListItem
218-
219-
220-Item {
221- id: root
222- width: parent.width
223-
224- property Action leftSideAction: null
225- property list<Action> rightSideActions
226- property double defaultHeight: units.gu(8)
227- property bool locked: false
228- property Action activeAction: null
229- property var activeItem: null
230- property bool triggerActionOnMouseRelease: false
231- property color color: Theme.palette.normal.background
232- property color selectedColor: "#E6E6E6"
233- property bool selected: false
234- property bool selectionMode: false
235- property alias internalAnchors: mainContents.anchors
236- default property alias contents: mainContents.children
237-
238- readonly property double actionWidth: units.gu(4)
239- readonly property double leftActionWidth: units.gu(10)
240- readonly property double actionThreshold: actionWidth * 0.4
241- readonly property double threshold: 0.4
242- readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft"
243- readonly property alias swipping: mainItemMoving.running
244- readonly property bool _showActions: mouseArea.pressed || swipeState != "Normal" || swipping
245-
246- property alias _main: main // CUSTOM
247- property alias pressed: mouseArea.pressed // CUSTOM
248-
249- /* internal */
250- property var _visibleRightSideActions: filterVisibleActions(rightSideActions)
251-
252- signal itemClicked(var mouse)
253- signal itemPressAndHold(var mouse)
254-
255- function returnToBoundsRTL(direction)
256- {
257- var actionFullWidth = actionWidth + units.gu(2)
258-
259- // go back to normal state if swipping reverse
260- if (direction === "LTR") {
261- updatePosition(0)
262- return
263- } else if (!triggerActionOnMouseRelease) {
264- updatePosition(-rightActionsView.width + units.gu(2))
265- return
266- }
267-
268- var xOffset = Math.abs(main.x)
269- var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length)
270- var newX = 0
271-
272- if (index === _visibleRightSideActions.length) {
273- newX = -(rightActionsView.width - units.gu(2))
274- } else if (index >= 1) {
275- newX = -(actionFullWidth * index)
276- }
277-
278- updatePosition(newX)
279- }
280-
281- function returnToBoundsLTR(direction)
282- {
283- var finalX = leftActionWidth
284- if ((direction === "RTL") || (main.x <= (finalX * root.threshold)))
285- finalX = 0
286- updatePosition(finalX)
287- }
288-
289- function returnToBounds(direction)
290- {
291- if (main.x < 0) {
292- returnToBoundsRTL(direction)
293- } else if (main.x > 0) {
294- returnToBoundsLTR(direction)
295- } else {
296- updatePosition(0)
297- }
298- }
299-
300- function contains(item, point, marginX)
301- {
302- var itemStartX = item.x - marginX
303- var itemEndX = item.x + item.width + marginX
304- return (point.x >= itemStartX) && (point.x <= itemEndX) &&
305- (point.y >= item.y) && (point.y <= (item.y + item.height));
306- }
307-
308- function getActionAt(point)
309- {
310- if (leftSideAction && contains(leftActionViewLoader.item, point, 0)) {
311- return leftSideAction
312- } else if (contains(rightActionsView, point, 0)) {
313- var newPoint = root.mapToItem(rightActionsView, point.x, point.y)
314- for (var i = 0; i < rightActionsRepeater.count; i++) {
315- var child = rightActionsRepeater.itemAt(i)
316- if (contains(child, newPoint, units.gu(1))) {
317- return i
318- }
319- }
320- }
321- return -1
322- }
323-
324- function updateActiveAction()
325- {
326- if (triggerActionOnMouseRelease &&
327- (main.x <= -(root.actionWidth + units.gu(2))) &&
328- (main.x > -(rightActionsView.width - units.gu(2)))) {
329- var actionFullWidth = actionWidth + units.gu(2)
330- var xOffset = Math.abs(main.x)
331- var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length)
332- index = index - 1
333- if (index > -1) {
334- root.activeItem = rightActionsRepeater.itemAt(index)
335- root.activeAction = root._visibleRightSideActions[index]
336- }
337- } else {
338- root.activeAction = null
339- }
340- }
341-
342- function resetSwipe()
343- {
344- updatePosition(0)
345- }
346-
347- function filterVisibleActions(actions)
348- {
349- var visibleActions = []
350- for(var i = 0; i < actions.length; i++) {
351- var action = actions[i]
352- if (action.visible) {
353- visibleActions.push(action)
354- }
355- }
356- return visibleActions
357- }
358-
359- function updatePosition(pos)
360- {
361- if (!root.triggerActionOnMouseRelease && (pos !== 0)) {
362- mouseArea.state = pos > 0 ? "RightToLeft" : "LeftToRight"
363- } else {
364- mouseArea.state = ""
365- }
366- main.x = pos
367- }
368-
369- // CUSTOM remove animation
370- SequentialAnimation {
371- id: removeAnimation
372-
373- property var action
374-
375- UbuntuNumberAnimation {
376- target: root
377- duration: UbuntuAnimation.BriskDuration
378- property: "height";
379- to: 0
380- }
381- ScriptAction {
382- script: removeAnimation.action.trigger()
383- }
384- }
385-
386- states: [
387- State {
388- name: "select"
389- when: selectionMode || selected
390- PropertyChanges {
391- target: selectionIcon
392- source: Qt.resolvedUrl("ListItemActions/CheckBox.qml")
393- anchors.leftMargin: units.gu(2)
394- }
395- PropertyChanges {
396- target: root
397- locked: true
398- }
399- PropertyChanges {
400- target: main
401- x: 0
402- }
403- }
404- ]
405-
406- height: defaultHeight
407- //clip: height !== defaultHeight // CUSTOM
408-
409- Loader { // CUSTOM
410- id: leftActionViewLoader
411- anchors {
412- top: parent.top
413- bottom: parent.bottom
414- right: main.left
415- }
416- asynchronous: true
417- sourceComponent: leftSideAction ? leftActionViewComponent : undefined
418- }
419-
420- Component { // CUSTOM
421- id: leftActionViewComponent
422-
423- Rectangle {
424- id: leftActionView
425- width: root.leftActionWidth + actionThreshold
426- color: UbuntuColors.red
427-
428- Icon {
429- id: leftActionIcon
430- anchors {
431- centerIn: parent
432- horizontalCenterOffset: actionThreshold / 2
433- }
434- objectName: "swipeDeleteAction" // CUSTOM
435- name: leftSideAction && _showActions ? leftSideAction.iconName : ""
436- color: Theme.palette.selected.field
437- height: units.gu(3)
438- width: units.gu(3)
439- }
440- }
441- }
442-
443- //Rectangle {
444- Item { // CUSTOM
445- id: rightActionsView
446-
447- anchors {
448- top: main.top
449- left: main.right
450- bottom: main.bottom
451- }
452- visible: _visibleRightSideActions.length > 0
453- width: rightActionsRepeater.count > 0 ? rightActionsRepeater.count * (root.actionWidth + units.gu(2)) + root.actionThreshold + units.gu(2) : 0
454- // color: "white" // CUSTOM
455-
456- Row {
457- anchors{
458- top: parent.top
459- left: parent.left
460- leftMargin: units.gu(2)
461- right: parent.right
462- rightMargin: units.gu(2)
463- bottom: parent.bottom
464- }
465- spacing: units.gu(2)
466- Repeater {
467- id: rightActionsRepeater
468-
469- model: _showActions ? _visibleRightSideActions : []
470- Item {
471- property alias image: img
472-
473- height: rightActionsView.height
474- width: root.actionWidth
475-
476- Icon {
477- id: img
478-
479- anchors.centerIn: parent
480- objectName: rightSideActions[index].objectName // CUSTOM
481- width: units.gu(3)
482- height: units.gu(3)
483- name: modelData.iconName
484- color: root.activeAction === modelData ? UbuntuColors.orange : UbuntuColors.coolGrey // CUSTOM
485- }
486- }
487- }
488- }
489- }
490-
491- Rectangle {
492- id: main
493- objectName: "mainItem"
494-
495- anchors {
496- top: parent.top
497- bottom: parent.bottom
498- }
499-
500- width: parent.width
501- color: root.selected ? root.selectedColor : root.color
502-
503- Loader {
504- id: selectionIcon
505-
506- anchors {
507- left: main.left
508- verticalCenter: main.verticalCenter
509- }
510- asynchronous: true // CUSTOM
511- width: (status === Loader.Ready) ? item.implicitWidth : 0
512- visible: (status === Loader.Ready) && (item.width === item.implicitWidth)
513-
514- Behavior on width {
515- NumberAnimation {
516- duration: UbuntuAnimation.SnapDuration
517- }
518- }
519- }
520-
521- Item {
522- id: mainContents
523-
524- anchors {
525- left: selectionIcon.right
526- //leftMargin: units.gu(2) // CUSTOM
527- top: parent.top
528- //topMargin: units.gu(1) // CUSTOM
529- right: parent.right
530- //rightMargin: units.gu(2) // CUSTOM
531- bottom: parent.bottom
532- //bottomMargin: units.gu(1) // CUSTOM
533- }
534- }
535-
536- Behavior on x {
537- UbuntuNumberAnimation {
538- id: mainItemMoving
539-
540- easing.type: Easing.OutElastic
541- duration: UbuntuAnimation.SlowDuration
542- }
543- }
544- }
545-
546- SequentialAnimation {
547- id: triggerAction
548-
549- property var currentItem: root.activeItem ? root.activeItem.image : null
550-
551- running: false
552- ParallelAnimation {
553- UbuntuNumberAnimation {
554- target: triggerAction.currentItem
555- property: "opacity"
556- from: 1.0
557- to: 0.0
558- duration: UbuntuAnimation.SlowDuration
559- easing {type: Easing.InOutBack; }
560- }
561- UbuntuNumberAnimation {
562- target: triggerAction.currentItem
563- properties: "width, height"
564- from: units.gu(3)
565- to: root.actionWidth
566- duration: UbuntuAnimation.SlowDuration
567- easing {type: Easing.InOutBack; }
568- }
569- }
570- PropertyAction {
571- target: triggerAction.currentItem
572- properties: "width, height"
573- value: units.gu(3)
574- }
575- PropertyAction {
576- target: triggerAction.currentItem
577- properties: "opacity"
578- value: 1.0
579- }
580- ScriptAction {
581- script: {
582- root.activeAction.triggered(root)
583- mouseArea.state = ""
584- }
585- }
586- PauseAnimation {
587- duration: 500
588- }
589- UbuntuNumberAnimation {
590- target: main
591- property: "x"
592- to: 0
593- }
594- }
595-
596- MouseArea {
597- id: mouseArea
598-
599- property bool locked: root.locked || ((root.leftSideAction === null) && (root._visibleRightSideActions.count === 0)) // CUSTOM
600- property bool manual: false
601- property string direction: "None"
602- property real lastX: -1
603-
604- anchors.fill: parent
605- drag {
606- target: locked ? null : main
607- axis: Drag.XAxis
608- minimumX: rightActionsView.visible ? -(rightActionsView.width) : 0
609- maximumX: leftSideAction ? leftActionViewLoader.item.width : 0
610- threshold: root.actionThreshold
611- }
612-
613- states: [
614- State {
615- name: "LeftToRight"
616- PropertyChanges {
617- target: mouseArea
618- drag.maximumX: 0
619- }
620- },
621- State {
622- name: "RightToLeft"
623- PropertyChanges {
624- target: mouseArea
625- drag.minimumX: 0
626- }
627- }
628- ]
629-
630- onMouseXChanged: {
631- var offset = (lastX - mouseX)
632- if (Math.abs(offset) <= root.actionThreshold) {
633- return
634- }
635- lastX = mouseX
636- direction = offset > 0 ? "RTL" : "LTR";
637- }
638-
639- onPressed: {
640- lastX = mouse.x
641- }
642-
643- onReleased: {
644- if (root.triggerActionOnMouseRelease && root.activeAction) {
645- triggerAction.start()
646- } else {
647- root.returnToBounds()
648- root.activeAction = null
649- }
650- lastX = -1
651- direction = "None"
652- }
653- onClicked: {
654- if (selectionMode) { // CUSTOM - selecting a listitem should toggle selection if in selectionMode
655- selected = !selected
656- return
657- } else if (main.x === 0) {
658- root.itemClicked(mouse)
659- } else if (main.x > 0) {
660- var action = getActionAt(Qt.point(mouse.x, mouse.y))
661- if (action && action !== -1) {
662- //action.triggered(root)
663- removeAnimation.action = action // CUSTOM - use our animation instead
664- removeAnimation.start() // CUSTOM
665- }
666- } else {
667- var actionIndex = getActionAt(Qt.point(mouse.x, mouse.y))
668-
669- if (actionIndex !== -1 && actionIndex !== leftSideAction) { // CUSTOM - can be leftAction
670- root.activeItem = rightActionsRepeater.itemAt(actionIndex)
671- root.activeAction = root.rightSideActions[actionIndex]
672- triggerAction.start()
673- return
674- }
675- }
676- root.resetSwipe()
677- }
678-
679- onPositionChanged: {
680- if (mouseArea.pressed) {
681- updateActiveAction()
682-
683- listItemSwiping(index) // CUSTOM - tells other listitems to dismiss any swipe
684- }
685- }
686- onPressAndHold: {
687- if (main.x === 0) {
688- root.itemPressAndHold(mouse)
689- }
690- }
691-
692- z: -1
693- }
694-}
695
696=== removed file 'app/components/MultiSelectHeadState.qml'
697--- app/components/MultiSelectHeadState.qml 2015-06-18 01:42:03 +0000
698+++ app/components/MultiSelectHeadState.qml 1970-01-01 00:00:00 +0000
699@@ -1,72 +0,0 @@
700-/*
701- * Copyright (C) 2015
702- * Andrew Hayzen <ahayzen@gmail.com>
703- * Victor Thompson <victor.thompson@gmail.com>
704- *
705- * This program is free software; you can redistribute it and/or modify
706- * it under the terms of the GNU General Public License as published by
707- * the Free Software Foundation; version 3.
708- *
709- * This program is distributed in the hope that it will be useful,
710- * but WITHOUT ANY WARRANTY; without even the implied warranty of
711- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
712- * GNU General Public License for more details.
713- *
714- * You should have received a copy of the GNU General Public License
715- * along with this program. If not, see <http://www.gnu.org/licenses/>.
716- */
717-
718-import QtQuick 2.4
719-import Ubuntu.Components 1.2
720-
721-PageHeadState {
722- id: selectionState
723- actions: [
724- Action {
725- iconName: "select"
726- text: i18n.tr("Select All")
727- onTriggered: {
728- if (listview.selectedItems.length === listview.model.count) {
729- listview.clearSelection()
730- } else {
731- listview.selectAll()
732- }
733- }
734- },
735- Action {
736- enabled: listview.selectedItems.length > 0
737- iconName: "delete"
738- text: i18n.tr("Delete")
739- visible: removable
740-
741- onTriggered: {
742- removed(listview.selectedItems)
743-
744- listview.closeSelection()
745- }
746- }
747-
748- ]
749- backAction: Action {
750- text: i18n.tr("Cancel selection")
751- iconName: "back"
752- onTriggered: {
753- listview.clearSelection()
754- listview.state = "normal"
755- }
756- }
757- head: thisPage.head
758- name: "selection"
759-
760- PropertyChanges {
761- target: thisPage.head
762- backAction: selectionState.backAction
763- actions: selectionState.actions
764- }
765-
766- property ListView listview
767- property bool removable: false
768- property Page thisPage
769-
770- signal removed(var selectedItems)
771-}
772
773=== modified file 'app/components/MultiSelectListView.qml'
774--- app/components/MultiSelectListView.qml 2015-06-18 01:42:03 +0000
775+++ app/components/MultiSelectListView.qml 2015-11-20 19:29:18 +0000
776@@ -20,21 +20,24 @@
777 import QtQuick 2.4
778 import Ubuntu.Components 1.2
779
780-
781 WeatherListView {
782- property var selectedItems: []
783-
784 signal clearSelection()
785 signal closeSelection()
786 signal selectAll()
787-
788- onClearSelection: selectedItems = []
789+ signal reorder(int from, int to)
790+
791+ onClearSelection: {
792+ ViewItems.selectedIndices = []
793+ }
794+
795 onCloseSelection: {
796 clearSelection()
797- state = "normal"
798+ ViewItems.selectMode = false
799+ ViewItems.dragMode = false
800 }
801+
802 onSelectAll: {
803- var tmp = selectedItems
804+ var tmp = []
805
806 for (var i=0; i < model.count; i++) {
807 if (tmp.indexOf(i) === -1) {
808@@ -42,11 +45,27 @@
809 }
810 }
811
812- selectedItems = tmp
813+ ViewItems.selectedIndices = tmp
814 }
815+
816 onVisibleChanged: {
817 if (!visible) {
818 closeSelection()
819 }
820 }
821+
822+ moveDisplaced: Transition {
823+ UbuntuNumberAnimation {
824+ property: "y"
825+ }
826+ }
827+
828+ ViewItems.onDragUpdated: {
829+ if (event.status === ListItemDrag.Moving) {
830+ event.accept = false
831+ } else if (event.status === ListItemDrag.Dropped) {
832+ model.move(event.from, event.to, 1)
833+ reorder(event.from, event.to)
834+ }
835+ }
836 }
837
838=== removed file 'app/components/WeatherListItem.qml'
839--- app/components/WeatherListItem.qml 2015-09-29 16:09:21 +0000
840+++ app/components/WeatherListItem.qml 1970-01-01 00:00:00 +0000
841@@ -1,138 +0,0 @@
842-/*
843- * Copyright (C) 2013, 2014, 2015
844- * Andrew Hayzen <ahayzen@gmail.com>
845- * Nekhelesh Ramananthan <krnekhelesh@gmail.com>
846- * Victor Thompson <victor.thompson@gmail.com>
847- *
848- * This program is free software; you can redistribute it and/or modify
849- * it under the terms of the GNU General Public License as published by
850- * the Free Software Foundation; version 3.
851- *
852- * This program is distributed in the hope that it will be useful,
853- * but WITHOUT ANY WARRANTY; without even the implied warranty of
854- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
855- * GNU General Public License for more details.
856- *
857- * You should have received a copy of the GNU General Public License
858- * along with this program. If not, see <http://www.gnu.org/licenses/>.
859- */
860-
861-import QtQuick 2.4
862-import Ubuntu.Components 1.2
863-
864-ListItemWithActions {
865- id: root
866- color: "transparent"
867-
868- property int listItemIndex: index
869- property bool multiselectable: false
870- property int previousListItemIndex: -1
871- property bool reorderable: false
872-
873- signal reorder(int from, int to)
874-
875- onItemPressAndHold: {
876- if (multiselectable) {
877- selectionMode = true
878- }
879- }
880-
881- onListItemIndexChanged: {
882- var i = parent.parent.selectedItems.lastIndexOf(previousListItemIndex)
883-
884- if (i !== -1) {
885- parent.parent.selectedItems[i] = listItemIndex
886- }
887-
888- previousListItemIndex = listItemIndex
889- }
890-
891- onSelectedChanged: {
892- if (selectionMode) {
893- var tmp = parent.parent.selectedItems
894-
895- if (selected) {
896- if (parent.parent.selectedItems.indexOf(listItemIndex) === -1) {
897- tmp.push(listItemIndex)
898- parent.parent.selectedItems = tmp
899- }
900- } else {
901- tmp.splice(parent.parent.selectedItems.indexOf(listItemIndex), 1)
902- parent.parent.selectedItems = tmp
903- }
904- }
905- }
906-
907- onSelectionModeChanged: {
908- if (reorderable && selectionMode) {
909- resetSwipe()
910- }
911-
912- for (var j=0; j < _main.children.length; j++) {
913- if (_main.children[j] !== actionReorderLoader) {
914- _main.children[j].anchors.rightMargin = reorderable && selectionMode ? actionReorderLoader.width + units.gu(2) : 0
915- }
916- }
917-
918- parent.parent.state = selectionMode ? "multiselectable" : "normal"
919-
920- if (!selectionMode) {
921- selected = false
922- }
923- }
924-
925- /* Highlight the listitem on press */
926- Rectangle {
927- id: listItemBrighten
928- color: root.pressed ? UbuntuColors.coolGrey : "transparent"
929- opacity: 0.1
930- height: root.height
931- x: root.x - parent.x // -parent.x due to selectionIcon in ListItemWithActions
932- width: root.width
933- }
934-
935- /* Reorder Component */
936- Loader {
937- id: actionReorderLoader
938- active: reorderable && selectionMode && root.parent.parent.selectedItems.length === 0
939- anchors {
940- bottom: parent.bottom
941- right: parent.right
942- rightMargin: units.gu(1)
943- top: parent.top
944- }
945- asynchronous: true
946- source: "ListItemReorderComponent.qml"
947- }
948-
949- Item {
950- Connections { // Only allow one ListItem to be swiping at any time
951- target: weatherApp
952- onListItemSwiping: {
953- if (i !== index) {
954- root.resetSwipe();
955- }
956- }
957- }
958-
959- Connections { // Connections from signals in the ListView
960- target: root.parent.parent
961- onClearSelection: selected = false
962- onFlickingChanged: {
963- if (root.parent.parent.flicking) {
964- root.resetSwipe()
965- }
966- }
967- onSelectAll: selected = true
968- onStateChanged: selectionMode = root.parent.parent.state === "multiselectable"
969- }
970- }
971-
972- Component.onCompleted: { // reload settings as delegates are destroyed
973- if (parent.parent.selectedItems.indexOf(index) !== -1) {
974- selected = true
975- }
976-
977- selectionMode = root.parent.parent.state === "multiselectable"
978- }
979-}
980
981=== modified file 'app/components/WeatherListView.qml'
982--- app/components/WeatherListView.qml 2015-06-18 01:42:03 +0000
983+++ app/components/WeatherListView.qml 2015-11-20 19:29:18 +0000
984@@ -20,8 +20,7 @@
985 import QtQuick 2.4
986 import Ubuntu.Components 1.2
987
988-
989-ListView {
990+UbuntuListView {
991 Component.onCompleted: {
992 // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition
993 // for Flickable.maximumFlickVelocity and Flickable.flickDeceleration
994
995=== modified file 'app/ui/LocationsPage.qml'
996--- app/ui/LocationsPage.qml 2015-10-22 12:49:35 +0000
997+++ app/ui/LocationsPage.qml 2015-11-20 19:29:18 +0000
998@@ -18,22 +18,19 @@
999
1000 import QtQuick 2.4
1001 import Ubuntu.Components 1.2
1002-import Ubuntu.Components.ListItems 0.1 as ListItem
1003+import Ubuntu.Components.ListItems 1.0 as ListItems
1004 import "../components"
1005-import "../components/ListItemActions"
1006-
1007
1008 Page {
1009 id: locationsPage
1010 objectName: "locationsPage"
1011 title: i18n.tr("Locations")
1012
1013- state: locationsListView.state === "multiselectable" ? "selection" : "default"
1014+ state: "default"
1015 states: [
1016 PageHeadState {
1017- id: defaultState
1018- head: locationsPage.head
1019 name: "default"
1020+ head: locationsPage.head
1021 actions: [
1022 Action {
1023 iconName: "add"
1024@@ -48,12 +45,28 @@
1025 }
1026 }
1027 },
1028- MultiSelectHeadState {
1029- listview: locationsListView
1030- removable: true
1031- thisPage: locationsPage
1032-
1033- onRemoved: storage.removeMultiLocations(selectedItems.slice());
1034+ PageHeadState {
1035+ name: "selection"
1036+ head: locationsPage.head
1037+ when: locationsListView.ViewItems.selectMode
1038+ backAction: Action {
1039+ iconName: "back"
1040+ onTriggered: {
1041+ locationsListView.closeSelection()
1042+ locationsPage.state = "default"
1043+ }
1044+ }
1045+ actions: [
1046+ Action {
1047+ iconName: "delete"
1048+ enabled: locationsListView.ViewItems.selectedIndices.length !== 0
1049+ onTriggered: {
1050+ storage.removeMultiLocations(locationsListView.ViewItems.selectedIndices)
1051+ locationsListView.closeSelection()
1052+ locationsPage.state = "default"
1053+ }
1054+ }
1055+ ]
1056 }
1057 ]
1058
1059@@ -73,17 +86,16 @@
1060 }
1061 header: MultiSelectListView {
1062 id: currentLocationListView
1063- anchors {
1064- left: parent.left
1065- right: parent.right
1066- }
1067- height: settings.addedCurrentLocation && settings.detectCurrentLocation ? units.gu(8) : units.gu(0)
1068+
1069+ height: settings.addedCurrentLocation && settings.detectCurrentLocation ? units.gu(7) : units.gu(0)
1070 interactive: false
1071 model: currentLocationModel
1072- delegate: WeatherListItem {
1073+ width: parent.width
1074+
1075+ delegate: ListItem {
1076 id: currentLocationListItem
1077
1078- onItemClicked: {
1079+ onClicked: {
1080 settings.current = index;
1081 pageStack.pop()
1082 }
1083@@ -154,39 +166,48 @@
1084 horizontalAlignment: Text.AlignRight
1085 text: temp + settings.tempScale
1086 }
1087+
1088+ ListItems.ThinDivider { anchors.bottom: parent.bottom }
1089 }
1090 }
1091
1092- delegate: WeatherListItem {
1093+ // Added a thindivider to the listview since by default the last listitem does not show
1094+ // a thindivider which does not follow design specs.
1095+ footer: ListItems.ThinDivider {
1096+ visible: locationsModel.count !== 0
1097+ }
1098+
1099+ onReorder: {
1100+ console.debug("Move: ", from, to);
1101+ storage.moveLocation(from, to);
1102+ }
1103+
1104+ delegate: ListItem {
1105 id: locationsListItem
1106 objectName: "location" + index
1107- leftSideAction: Remove {
1108- onTriggered: storage.removeLocation(index)
1109- }
1110- multiselectable: true
1111- reorderable: true
1112-
1113- onItemClicked: {
1114- if (settings.addedCurrentLocation && settings.detectCurrentLocation) {
1115+
1116+ leadingActions: ListItemActions {
1117+ actions: [
1118+ Action {
1119+ iconName: 'delete'
1120+ onTriggered: storage.removeLocation(index)
1121+ }
1122+ ]
1123+ }
1124+
1125+ onPressAndHold: {
1126+ ListView.view.ViewItems.selectMode = !ListView.view.ViewItems.selectMode
1127+ ListView.view.ViewItems.dragMode = !ListView.view.ViewItems.dragMode
1128+ }
1129+
1130+ onClicked: {
1131+ if (!selectMode) {
1132 settings.current = index + 1;
1133- } else {
1134- settings.current = index;
1135+ pageStack.pop()
1136 }
1137
1138 pageStack.pop()
1139 }
1140- onReorder: {
1141- console.debug("Move: ", from, to);
1142-
1143- storage.moveLocation(from, to);
1144- }
1145-
1146- ListItem.ThinDivider {
1147- anchors {
1148- top: parent.top
1149- }
1150- visible: index == 0
1151- }
1152
1153 Item {
1154 anchors {
1155@@ -252,12 +273,6 @@
1156 visible: locationsPage.state === "default"
1157 }
1158 }
1159-
1160- ListItem.ThinDivider {
1161- anchors {
1162- bottom: parent.bottom
1163- }
1164- }
1165 }
1166 }
1167
1168
1169=== modified file 'po/com.ubuntu.weather.pot'
1170--- po/com.ubuntu.weather.pot 2015-11-10 02:02:19 +0000
1171+++ po/com.ubuntu.weather.pot 2015-11-20 19:29:18 +0000
1172@@ -62,26 +62,10 @@
1173 msgid "Today"
1174 msgstr ""
1175
1176-#: ../app/components/ListItemActions/Remove.qml:26
1177-msgid "Remove"
1178-msgstr ""
1179-
1180 #: ../app/components/LocationsPageEmptyStateComponent.qml:36
1181 msgid "No locations found. Tap the plus icon to search for one."
1182 msgstr ""
1183
1184-#: ../app/components/MultiSelectHeadState.qml:27
1185-msgid "Select All"
1186-msgstr ""
1187-
1188-#: ../app/components/MultiSelectHeadState.qml:39
1189-msgid "Delete"
1190-msgstr ""
1191-
1192-#: ../app/components/MultiSelectHeadState.qml:51
1193-msgid "Cancel selection"
1194-msgstr ""
1195-
1196 #: ../app/components/NetworkErrorStateComponent.qml:48
1197 msgid "Network Error"
1198 msgstr ""
1199@@ -136,11 +120,15 @@
1200 msgid "OK"
1201 msgstr ""
1202
1203-#: ../app/ui/HomePage.qml:31 ../app/ui/LocationsPage.qml:29
1204+#: ../app/ui/HomePage.qml:31 ../app/ui/LocationsPage.qml:27
1205 msgid "Locations"
1206 msgstr ""
1207
1208+<<<<<<< TREE
1209+#: ../app/ui/LocationsPage.qml:121
1210+=======
1211 #: ../app/ui/LocationsPage.qml:109
1212+>>>>>>> MERGE-SOURCE
1213 msgid "Current Location"
1214 msgstr ""
1215

Subscribers

People subscribed via source and target branches