Merge lp:~zsombi/ubuntu-ui-toolkit/45-selected-option-rebinds into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Superseded
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/45-selected-option-rebinds
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~zsombi/ubuntu-ui-toolkit/40-visualize-options
Diff against target: 81 lines (+36/-0)
3 files modified
modules/Ubuntu/Components/ListItemPanel.qml (+6/-0)
modules/Ubuntu/Components/plugin/uclistitemoptions.cpp (+3/-0)
tests/unit_x11/tst_components/tst_listitem.qml (+27/-0)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/45-selected-option-rebinds
Reviewer Review Type Date Requested Status
Ubuntu SDK team Pending
Review via email: mp+232513@code.launchpad.net

Commit message

Rebind ListItem contents when option is selected.

To post a comment you must log in.
1227. By Zsombor Egri

prereq merge

1228. By Zsombor Egri

code added

1229. By Zsombor Egri

prereq merge

1230. By Zsombor Egri

prereq merge

1231. By Zsombor Egri

fix signal connects

1232. By Zsombor Egri

prereq merge

1233. By Zsombor Egri

prereq merge

1234. By Zsombor Egri

test fixed

1235. By Zsombor Egri

prereq merge

1236. By Zsombor Egri

prereq merge

1237. By Zsombor Egri

prereq

1238. By Zsombor Egri

prereq

1239. By Zsombor Egri

prereq

1240. By Zsombor Egri

prereq

1241. By Zsombor Egri

prereq

1242. By Zsombor Egri

prereq

1243. By Zsombor Egri

prereq

1244. By Zsombor Egri

prereq

1245. By Zsombor Egri

prereq

1246. By Zsombor Egri

prereq

1247. By Zsombor Egri

prereq

1248. By Zsombor Egri

prereq

1249. By Zsombor Egri

prereq

1250. By Zsombor Egri

prereq

1251. By Zsombor Egri

prereq sync

1252. By Zsombor Egri

prereq sync

1253. By Zsombor Egri

prereq sync

1254. By Zsombor Egri

prereq sync

1255. By Zsombor Egri

fixing test cases

1256. By Zsombor Egri

tests fixed

1257. By Zsombor Egri

naming fix

1258. By Zsombor Egri

prereq sync

1259. By Zsombor Egri

prereq sync

1260. By Zsombor Egri

prereq sync

1261. By Zsombor Egri

prereq sync

1262. By Zsombor Egri

prereq sync

1263. By Zsombor Egri

prereq sync

1264. By Zsombor Egri

prereq sync

1265. By Zsombor Egri

prereq sync

1266. By Zsombor Egri

prereq sync

1267. By Zsombor Egri

prereq sync

1268. By Zsombor Egri

test fixed

1269. By Zsombor Egri

prereq sync

1270. By Zsombor Egri

prereq sync

1271. By Zsombor Egri

prereq sync

1272. By Zsombor Egri

prereq sync

1273. By Zsombor Egri

test fix ongoing

1274. By Zsombor Egri

based on Flickable's thinking, rename data and children properties to listItemData/listItemChildren to not to interfere with the original properties. This affects testing as well, as by using the original property names the QML children or data lookup cannot find the panelItem anymore.

1275. By Zsombor Egri

API updated

1276. By Zsombor Egri

prereq sync

1277. By Zsombor Egri

prereq sync

1278. By Zsombor Egri

prereq sync

1279. By Zsombor Egri

prereq sync

1280. By Zsombor Egri

prereq sync

1281. By Zsombor Egri

prereq sync

1282. By Zsombor Egri

prereq sync

1283. By Zsombor Egri

prereq sync

1284. By Zsombor Egri

prereq sync

1285. By Zsombor Egri

prereq sync

1286. By Zsombor Egri

prereq sync

1287. By Zsombor Egri

prereq sync

1288. By Zsombor Egri

options renamed to actions

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/ListItemPanel.qml'
2--- modules/Ubuntu/Components/ListItemPanel.qml 2014-09-11 11:53:54 +0000
3+++ modules/Ubuntu/Components/ListItemPanel.qml 2014-09-11 11:53:54 +0000
4@@ -39,6 +39,11 @@
5 */
6 property var optionList
7
8+ /*
9+ Emitted when action is triggered
10+ */
11+ signal selected()
12+
13 anchors {
14 left: contentItem ? (leadingPanel ? undefined : contentItem.right) : undefined
15 right: contentItem ? (leadingPanel ? contentItem.left : undefined) : undefined
16@@ -73,6 +78,7 @@
17 top: parent.top
18 bottom: parent.bottom
19 }
20+ onTriggered: panel.selected()
21
22 Loader {
23 id: delegateLoader
24
25=== modified file 'modules/Ubuntu/Components/plugin/uclistitemoptions.cpp'
26--- modules/Ubuntu/Components/plugin/uclistitemoptions.cpp 2014-09-11 11:53:54 +0000
27+++ modules/Ubuntu/Components/plugin/uclistitemoptions.cpp 2014-09-11 11:53:54 +0000
28@@ -86,6 +86,7 @@
29 _this->leading = leading;
30 _this->panelItem->setProperty("leadingPanel", leading);
31 _this->panelItem->setParentItem(listItem);
32+ QObject::connect(_this->panelItem, SIGNAL(selected()), _this->panelItem->parentItem(), SLOT(_q_rebound()));
33 _this->connected = true;
34 return true;
35 }
36@@ -96,6 +97,8 @@
37 if (!_this || !_this->panelItem || !_this->panelItem->parentItem()) {
38 return;
39 }
40+
41+ QObject::disconnect(_this->panelItem, SIGNAL(selected()), _this->panelItem->parentItem(), SLOT(_q_rebound()));
42 _this->panelItem->setParentItem(0);
43 _this->connected = false;
44 _this->leading = false;
45
46=== modified file 'tests/unit_x11/tst_components/tst_listitem.qml'
47--- tests/unit_x11/tst_components/tst_listitem.qml 2014-09-11 11:53:54 +0000
48+++ tests/unit_x11/tst_components/tst_listitem.qml 2014-09-11 11:53:54 +0000
49@@ -315,5 +315,32 @@
50 waitForRendering(data.item, 400);
51 tryCompareFunction(function(){ return listView.interactive; }, true, 1000);
52 }
53+
54+ function test_selecting_option_rebounds_data() {
55+ var item0 = findChild(listView, "listItem0");
56+ return [
57+ {tag: "With mouse", item: item0, pos: centerOf(item0), dx: units.gu(20), options: item0.leadingOptions, select: "list_option_0", mouse: true},
58+ {tag: "With touch", item: item0, pos: centerOf(item0), dx: units.gu(20), options: item0.leadingOptions, select: "list_option_0", mouse: false},
59+ ]
60+ }
61+ function test_selecting_option_rebounds(data) {
62+ listView.positionViewAtBeginning();
63+ if (data.mouse) {
64+ flick(data.item, data.pos.x, data.pos.y, data.dx, 0);
65+ } else {
66+ TestExtras.touchDrag(0, data.item, data.pos, Qt.point(data.dx, 0));
67+ }
68+ waitForRendering(data.item, 800);
69+ var selectedOption = findChild(data.options.panelItem, data.select);
70+ verify(selectedOption, "Cannot select option " + data.select);
71+ // dismiss
72+ if (data.mouse) {
73+ mouseClick(selectedOption, centerOf(selectedOption).x, centerOf(selectedOption).y);
74+ } else {
75+ TestExtras.touchClick(0, selectedOption, centerOf(selectedOption));
76+ }
77+ waitForRendering(data.item, 400);
78+ tryCompareFunction(function(){ return data.item.contentItem.x; }, 0, 1000);
79+ }
80 }
81 }

Subscribers

People subscribed via source and target branches