Merge lp:~renatofilho/ubuntu-ui-toolkit/fix-1213046 into lp:ubuntu-ui-toolkit

Proposed by Renato Araujo Oliveira Filho on 2013-09-18
Status: Merged
Approved by: Bill Filler on 2013-09-30
Approved revision: 761
Merged at revision: 772
Proposed branch: lp:~renatofilho/ubuntu-ui-toolkit/fix-1213046
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 225 lines (+91/-5)
4 files modified
CHANGES (+1/-0)
components.api (+1/-0)
examples/ubuntu-ui-toolkit-gallery/ListItems.qml (+1/-0)
modules/Ubuntu/Components/ListItems/Empty.qml (+88/-5)
To merge this branch: bzr merge lp:~renatofilho/ubuntu-ui-toolkit/fix-1213046
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2013-09-30
Bill Filler (community) Approve on 2013-09-30
Gustavo Pichorim Boiko (community) 2013-09-18 Needs Fixing on 2013-09-23
Review via email: mp+186223@code.launchpad.net

Commit message

Added "confirmRemoval" in ListItem.Empty

This will ask for confirmation before remove the item.

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Gustavo Pichorim Boiko (boiko) wrote :

32 + Defines if the item need confirmation before remove by swiping

I'm no native English speaker, but I think this should read:

Defines if the item needs confirmation before removing by swiping

review: Needs Fixing
Francis Ginther (fginther) wrote :

It looks like changes introduced by the following MP may have broken this:
https://code.launchpad.net/~zsombi/ubuntu-ui-toolkit/alarm-status/+merge/186285

That MP was merged into trunk just before the build failures started for ubuntu-ui-toolkit-ci/738. It also appears to change the 'alarm' feature which is also implicated by the failure message seen in all the builds:

QQmlComponent: Component is not ready
WARNING: default alarm manager not installed, using "memory" manager.
This manager may not provide all the needed features.

756. By Renato Araujo Oliveira Filho on 2013-09-24

Merged mainline.

757. By Renato Araujo Oliveira Filho on 2013-09-26

Merged mainline.

Christian Dywan (kalikiana) wrote :

You need to update components.api.

758. By Renato Araujo Oliveira Filho on 2013-09-27

Fixed components.api.

759. By Renato Araujo Oliveira Filho on 2013-09-27

Updated components.api.

760. By Renato Araujo Oliveira Filho on 2013-09-27

Updated documentation.

761. By Renato Araujo Oliveira Filho on 2013-09-30

Merged mainline.

Bill Filler (bfiller) wrote :

approve

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGES'
2--- CHANGES 2013-09-12 13:56:14 +0000
3+++ CHANGES 2013-09-30 12:01:05 +0000
4@@ -9,6 +9,7 @@
5
6 API Changes
7 ***********
8+* ADDED IN: ListItem.Empty: property bool confirmRemoval
9 * ADDED IN: OptionSelectorDelegate: property bool constrainImage
10 * ADDED IN: Empty: property alias divider
11 * ADDED IN: ListItems/OptionSelector: signal delegateSelected()
12
13=== modified file 'components.api'
14--- components.api 2013-09-27 21:17:50 +0000
15+++ components.api 2013-09-30 12:01:05 +0000
16@@ -401,6 +401,7 @@
17 property bool selected
18 property bool highlightWhenPressed
19 property bool removable
20+ property bool confirmRemoval
21 readonly property string swipingState
22 signal itemRemoved
23 property int __height
24
25=== modified file 'examples/ubuntu-ui-toolkit-gallery/ListItems.qml'
26--- examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2013-09-03 10:12:39 +0000
27+++ examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2013-09-30 12:01:05 +0000
28@@ -142,6 +142,7 @@
29 delegate: ListItem.Standard {
30 text: i18n.tr("Slide to remove")
31 removable: true
32+ confirmRemoval: (index % 2)
33 backgroundIndicator: Rectangle {
34 anchors.fill: parent
35 color: Theme.palette.normal.base
36
37=== modified file 'modules/Ubuntu/Components/ListItems/Empty.qml'
38--- modules/Ubuntu/Components/ListItems/Empty.qml 2013-09-18 02:26:23 +0000
39+++ modules/Ubuntu/Components/ListItems/Empty.qml 2013-09-30 12:01:05 +0000
40@@ -97,6 +97,13 @@
41
42 /*!
43 \preliminary
44+ Defines if the item needs confirmation before removing by swiping.
45+ \qmlproperty bool confirmRemoval
46+ */
47+ property alias confirmRemoval: confirmRemovalDialog.visible
48+
49+ /*!
50+ \preliminary
51 \qmlproperty string swipingState
52 The current swiping state ("SwipingLeft", "SwipingRight", "")
53 */
54@@ -174,7 +181,7 @@
55 /*! \internal
56 Defines the offset limit to consider the item removed
57 */
58- readonly property int itemMoveOffset: width * 0.3
59+ readonly property int itemMoveOffset: confirmRemoval ? width * 0.5 : width * 0.3
60
61 /*! \internal
62 Defines the inital pressed possition
63@@ -211,10 +218,13 @@
64 Resets the item dragging state
65 */
66 function resetDrag() {
67+ body.x = 0
68 pressedPosition = -1
69 __mouseArea.drag.target = null
70 held = false
71 removeItem = false
72+ backgroundIndicator.opacity = 0.0
73+ backgroundIndicator.visible = false
74 backgroundIndicator.state = ""
75 }
76
77@@ -223,7 +233,9 @@
78 */
79 function commitDrag() {
80 if (removeItem) {
81- removeItemAnimation.start()
82+ if (!confirmRemoval) {
83+ removeItemAnimation.start()
84+ }
85 } else {
86 resetDrag()
87 }
88@@ -244,10 +256,14 @@
89 } else if (held == true) {
90 held = false
91 removeItem = true
92+ var finalX = body.width
93+ if (emptyListItem.confirmRemoval) {
94+ finalX = itemMoveOffset
95+ }
96 if (body.x > 0) {
97- body.x = body.width
98+ body.x = finalX
99 } else {
100- body.x = body.width * -1
101+ body.x = -finalX
102 }
103 }
104 }
105@@ -307,6 +323,7 @@
106 id: backgroundIndicator
107
108 opacity: 0.0
109+ visible: false
110 anchors {
111 left: parent.left
112 right: parent.right
113@@ -314,18 +331,73 @@
114 bottom: parent.bottom
115 }
116
117+ Item {
118+ id: confirmRemovalDialog
119+
120+ width: units.gu(15)
121+ anchors {
122+ top: parent.top
123+ bottom: parent.bottom
124+ }
125+
126+ Row {
127+ anchors {
128+ top: parent.top
129+ bottom: parent.bottom
130+ left: parent.left
131+ right: parent.right
132+ leftMargin: units.gu(2)
133+ rightMargin: units.gu(2)
134+ }
135+
136+ spacing: units.gu(2)
137+ Image {
138+ source: "artwork/delete.png"
139+ fillMode: Image.Pad
140+ anchors {
141+ top: parent.top
142+ bottom: parent.bottom
143+ }
144+ width: units.gu(5)
145+ }
146+ Label {
147+ text: i18n.tr("Delete")
148+ verticalAlignment: Text.AlignVCenter
149+ anchors {
150+ top: parent.top
151+ bottom: parent.bottom
152+ }
153+ width: units.gu(7)
154+ fontSize: "medium"
155+ }
156+ }
157+
158+ MouseArea {
159+ anchors.fill: parent
160+ onClicked: removeItemAnimation.start()
161+ }
162+ }
163+
164+
165 states: [
166 State {
167 name: "SwipingRight"
168+
169 AnchorChanges {
170 target: backgroundIndicator
171 anchors.left: parent.left
172 anchors.right: body.left
173 }
174+
175 PropertyChanges {
176 target: backgroundIndicator
177 opacity: 1.0
178 }
179+
180+ PropertyChanges {
181+ target: confirmRemovalDialog
182+ x: body.x - confirmRemovalDialog.width - units.gu(2)
183+ }
184 },
185 State {
186 name: "SwipingLeft"
187@@ -334,10 +406,16 @@
188 anchors.left: body.right
189 anchors.right: parent.right
190 }
191+
192 PropertyChanges {
193 target: backgroundIndicator
194 opacity: 1.0
195 }
196+
197+ PropertyChanges {
198+ target: confirmRemovalDialog
199+ x: units.gu(2)
200+ }
201 }
202 ]
203 }
204@@ -375,12 +453,17 @@
205 }
206 }
207
208+ onClicked: {
209+ if (body.x != 0) {
210+ priv.resetDrag()
211+ }
212+ }
213+
214 onReleased: {
215 priv.endDrag();
216 }
217
218 onCanceled: {
219-
220 priv.endDrag();
221 }
222 }
223
224=== added file 'modules/Ubuntu/Components/ListItems/artwork/delete@8.png'
225Binary files modules/Ubuntu/Components/ListItems/artwork/delete@8.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/ListItems/artwork/delete@8.png 2013-09-30 12:01:05 +0000 differ

Subscribers

People subscribed via source and target branches

to status/vote changes: