Merge lp:~zsombi/ubuntu-ui-toolkit/67-fix-disabled-listitem into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Superseded
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/67-fix-disabled-listitem
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~zsombi/ubuntu-ui-toolkit/65-last-divider-invisible
Diff against target: 121 lines (+51/-0)
4 files modified
modules/Ubuntu/Components/plugin/uclistitem.cpp (+19/-0)
modules/Ubuntu/Components/plugin/uclistitem.h (+1/-0)
modules/Ubuntu/Components/plugin/uclistitem_p.h (+2/-0)
tests/unit_x11/tst_components/tst_listitem.qml (+29/-0)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/67-fix-disabled-listitem
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu SDK team Pending
Review via email: mp+233668@code.launchpad.net

Commit message

ListItem dimmed when disabled.

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

fix provided

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1244. By Zsombor Egri

prereq

1245. By Zsombor Egri

fixing test count

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
1246. By Zsombor Egri

prereq

1247. By Zsombor Egri

prereq

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1248. By Zsombor Egri

prereq

1249. By Zsombor Egri

prereq

1250. By Zsombor Egri

prereq

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1251. By Zsombor Egri

prereq

1252. By Zsombor Egri

prereq

1253. By Zsombor Egri

prereq

1254. By Zsombor Egri

prereq

1255. By Zsombor Egri

prereq

1256. By Zsombor Egri

prereq

1257. By Zsombor Egri

prereq

1258. By Zsombor Egri

prereq

1259. By Zsombor Egri

prereq

1260. By Zsombor Egri

prereq

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

prereq sync

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

prereq sync

1274. By Zsombor Egri

prereq sync

1275. By Zsombor Egri

disabled action shown dimmed

1276. By Zsombor Egri

prereq sync

1277. By Zsombor Egri

property assignment duplicity fixed

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

removed connection restored

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

prereq sync

1289. By Zsombor Egri

prereq sync

1290. By Zsombor Egri

prereq sync

1291. By Zsombor Egri

prereq sync

1292. By Zsombor Egri

prereq sync

1293. By Zsombor Egri

prereq sync

1294. By Zsombor Egri

prereq sync

1295. By Zsombor Egri

prereq sync

1296. By Zsombor Egri

rebind when swiped over the actions panel

1297. By Zsombor Egri

remove wrong commit

1298. By Zsombor Egri

prereq sync

1299. By Zsombor Egri

typo fix

1300. By Zsombor Egri

opacity handling removed

1301. By Zsombor Egri

some leftovers removed

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/plugin/uclistitem.cpp'
2--- modules/Ubuntu/Components/plugin/uclistitem.cpp 2014-09-11 12:07:09 +0000
3+++ modules/Ubuntu/Components/plugin/uclistitem.cpp 2014-09-11 12:07:10 +0000
4@@ -251,6 +251,7 @@
5 , xAxisMoveThresholdGU(1.5)
6 , reboundAnimation(0)
7 , flickableInteractive(0)
8+ , disabledOpacity(0)
9 , contentItem(new UCListItemContent)
10 , divider(new UCListItemDivider)
11 , leadingOptions(0)
12@@ -260,6 +261,7 @@
13 UCListItemPrivate::~UCListItemPrivate()
14 {
15 delete flickableInteractive;
16+ delete disabledOpacity;
17 }
18
19 void UCListItemPrivate::init()
20@@ -282,6 +284,9 @@
21 QObject::connect(&UCUnits::instance(), SIGNAL(gridUnitChanged()), q, SLOT(_q_updateSize()));
22 _q_updateSize();
23
24+ // watch enabledChanged()
25+ QObject::connect(q, SIGNAL(enabledChanged()), q, SLOT(_q_dimmDisabled()), Qt::DirectConnection);
26+
27 // create rebound animation
28 UCUbuntuAnimation animationCodes;
29 reboundAnimation = new QQuickPropertyAnimation(q);
30@@ -300,6 +305,20 @@
31 q->setFiltersChildMouseEvents(true);
32 }
33
34+void UCListItemPrivate::_q_dimmDisabled()
35+{
36+ Q_Q(UCListItem);
37+ if (q->isEnabled()) {
38+ PropertyChange::restore(disabledOpacity);
39+ } else if (opacity() != 0.5) {
40+ // this is the first time we need to create the property change
41+ if (!disabledOpacity) {
42+ disabledOpacity = new PropertyChange(q, "opacity");
43+ }
44+ PropertyChange::setValue(disabledOpacity, 0.5);
45+ }
46+}
47+
48 void UCListItemPrivate::_q_rebound()
49 {
50 setPressed(false);
51
52=== modified file 'modules/Ubuntu/Components/plugin/uclistitem.h'
53--- modules/Ubuntu/Components/plugin/uclistitem.h 2014-09-11 12:07:09 +0000
54+++ modules/Ubuntu/Components/plugin/uclistitem.h 2014-09-11 12:07:10 +0000
55@@ -71,6 +71,7 @@
56 Q_DECLARE_PRIVATE(UCListItem)
57 QQmlListProperty<QObject> data();
58 QQmlListProperty<QQuickItem> children();
59+ Q_PRIVATE_SLOT(d_func(), void _q_dimmDisabled())
60 Q_PRIVATE_SLOT(d_func(), void _q_rebound())
61 Q_PRIVATE_SLOT(d_func(), void _q_updateSize())
62 Q_PRIVATE_SLOT(d_func(), void _q_completeRebinding())
63
64=== modified file 'modules/Ubuntu/Components/plugin/uclistitem_p.h'
65--- modules/Ubuntu/Components/plugin/uclistitem_p.h 2014-09-11 12:07:09 +0000
66+++ modules/Ubuntu/Components/plugin/uclistitem_p.h 2014-09-11 12:07:10 +0000
67@@ -45,6 +45,7 @@
68 // override setFocusable()
69 void setFocusable();
70
71+ void _q_dimmDisabled();
72 void _q_rebound();
73 void _q_updateSize();
74 void _q_completeRebinding();
75@@ -70,6 +71,7 @@
76 QPointer<QQuickFlickable> flickable;
77 QQuickPropertyAnimation *reboundAnimation;
78 PropertyChange *flickableInteractive;
79+ PropertyChange *disabledOpacity;
80 UCListItemContent *contentItem;
81 UCListItemDivider *divider;
82 UCListItemOptions *leadingOptions;
83
84=== modified file 'tests/unit_x11/tst_components/tst_listitem.qml'
85--- tests/unit_x11/tst_components/tst_listitem.qml 2014-09-11 12:07:09 +0000
86+++ tests/unit_x11/tst_components/tst_listitem.qml 2014-09-11 12:07:10 +0000
87@@ -446,5 +446,34 @@
88 actionSpy.wait();
89 compare(action.param, data.result, "Action parameter differs");
90 }
91+
92+ SignalSpy {
93+ id: panelItemSpy
94+ signalName: "onXChanged"
95+ }
96+
97+ function test_disabled_item_locked_data() {
98+ var item0 = findChild(listView, "listItem0");
99+ return [
100+ // drag same amount as height is
101+ {tag: "Simple item, leading", item: testItem, enabled: false, dx: testItem.height},
102+ {tag: "Simple item, trailing", item: testItem, enabled: false, dx: -testItem.height},
103+ {tag: "ListView item, leading", item: item0, enabled: false, dx: item0.height},
104+ {tag: "ListView item, trailing", item: item0, enabled: false, dx: -item0.height},
105+ ];
106+ }
107+ function test_disabled_item_locked(data) {
108+ var oldEnabled = data.item.enabled;
109+ panelItemSpy.clear();
110+ panelItemSpy.target = data.item;
111+ data.item.enabled = false;
112+ // tug
113+ flick(data.item.contentItem, centerOf(data.item.contentItem).x, centerOf(data.item.contentItem).y, data.dx, 0);
114+ compare(panelItemSpy.count, 0, "Item had been tugged despite being disabled!");
115+ // check opacity
116+ fuzzyCompare(data.item.opacity, 0.5, 0.1, "Disabled item must be 50% transparent");
117+ //cleanup
118+ data.item.enabled = oldEnabled;
119+ }
120 }
121 }

Subscribers

People subscribed via source and target branches