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

Proposed by Zsombor Egri
Status: Superseded
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/67-fix-disabled-listitem
Merge into: lp:~bzoltan/ubuntu-ui-toolkit/new_list_item
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 Pending
Ubuntu SDK team Pending
Review via email: mp+234641@code.launchpad.net

Commit message

ListItem dimmed when disabled.

To post a comment you must log in.
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

1301. By Zsombor Egri

some leftovers removed

1300. By Zsombor Egri

opacity handling removed

1299. By Zsombor Egri

typo fix

1298. By Zsombor Egri

prereq sync

1297. By Zsombor Egri

remove wrong commit

1296. By Zsombor Egri

rebind when swiped over the actions panel

1295. By Zsombor Egri

prereq sync

1294. By Zsombor Egri

prereq sync

1293. By Zsombor Egri

prereq sync

1292. By Zsombor Egri

prereq sync

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'modules/Ubuntu/Components/plugin/uclistitem.cpp'
--- modules/Ubuntu/Components/plugin/uclistitem.cpp 2014-09-15 08:46:20 +0000
+++ modules/Ubuntu/Components/plugin/uclistitem.cpp 2014-09-15 08:46:21 +0000
@@ -285,6 +285,7 @@
285 , xAxisMoveThresholdGU(1.5)285 , xAxisMoveThresholdGU(1.5)
286 , reboundAnimation(0)286 , reboundAnimation(0)
287 , flickableInteractive(0)287 , flickableInteractive(0)
288 , disabledOpacity(0)
288 , contentItem(new UCListItemContent)289 , contentItem(new UCListItemContent)
289 , divider(new UCListItemDivider)290 , divider(new UCListItemDivider)
290 , leadingOptions(0)291 , leadingOptions(0)
@@ -294,6 +295,7 @@
294UCListItemPrivate::~UCListItemPrivate()295UCListItemPrivate::~UCListItemPrivate()
295{296{
296 delete flickableInteractive;297 delete flickableInteractive;
298 delete disabledOpacity;
297}299}
298300
299void UCListItemPrivate::init()301void UCListItemPrivate::init()
@@ -316,6 +318,9 @@
316 QObject::connect(&UCUnits::instance(), SIGNAL(gridUnitChanged()), q, SLOT(_q_updateSize()));318 QObject::connect(&UCUnits::instance(), SIGNAL(gridUnitChanged()), q, SLOT(_q_updateSize()));
317 _q_updateSize();319 _q_updateSize();
318320
321 // watch enabledChanged()
322 QObject::connect(q, SIGNAL(enabledChanged()), q, SLOT(_q_dimmDisabled()), Qt::DirectConnection);
323
319 // create rebound animation324 // create rebound animation
320 UCUbuntuAnimation animationCodes;325 UCUbuntuAnimation animationCodes;
321 reboundAnimation = new QQuickPropertyAnimation(q);326 reboundAnimation = new QQuickPropertyAnimation(q);
@@ -334,6 +339,20 @@
334 q->setFiltersChildMouseEvents(true);339 q->setFiltersChildMouseEvents(true);
335}340}
336341
342void UCListItemPrivate::_q_dimmDisabled()
343{
344 Q_Q(UCListItem);
345 if (q->isEnabled()) {
346 PropertyChange::restore(disabledOpacity);
347 } else if (opacity() != 0.5) {
348 // this is the first time we need to create the property change
349 if (!disabledOpacity) {
350 disabledOpacity = new PropertyChange(q, "opacity");
351 }
352 PropertyChange::setValue(disabledOpacity, 0.5);
353 }
354}
355
337void UCListItemPrivate::_q_rebound()356void UCListItemPrivate::_q_rebound()
338{357{
339 setPressed(false);358 setPressed(false);
340359
=== modified file 'modules/Ubuntu/Components/plugin/uclistitem.h'
--- modules/Ubuntu/Components/plugin/uclistitem.h 2014-09-15 08:46:20 +0000
+++ modules/Ubuntu/Components/plugin/uclistitem.h 2014-09-15 08:46:21 +0000
@@ -71,6 +71,7 @@
71 Q_DECLARE_PRIVATE(UCListItem)71 Q_DECLARE_PRIVATE(UCListItem)
72 QQmlListProperty<QObject> data();72 QQmlListProperty<QObject> data();
73 QQmlListProperty<QQuickItem> children();73 QQmlListProperty<QQuickItem> children();
74 Q_PRIVATE_SLOT(d_func(), void _q_dimmDisabled())
74 Q_PRIVATE_SLOT(d_func(), void _q_rebound())75 Q_PRIVATE_SLOT(d_func(), void _q_rebound())
75 Q_PRIVATE_SLOT(d_func(), void _q_updateSize())76 Q_PRIVATE_SLOT(d_func(), void _q_updateSize())
76 Q_PRIVATE_SLOT(d_func(), void _q_completeRebinding())77 Q_PRIVATE_SLOT(d_func(), void _q_completeRebinding())
7778
=== modified file 'modules/Ubuntu/Components/plugin/uclistitem_p.h'
--- modules/Ubuntu/Components/plugin/uclistitem_p.h 2014-09-15 08:46:20 +0000
+++ modules/Ubuntu/Components/plugin/uclistitem_p.h 2014-09-15 08:46:21 +0000
@@ -45,6 +45,7 @@
45 // override setFocusable()45 // override setFocusable()
46 void setFocusable();46 void setFocusable();
4747
48 void _q_dimmDisabled();
48 void _q_rebound();49 void _q_rebound();
49 void _q_updateSize();50 void _q_updateSize();
50 void _q_completeRebinding();51 void _q_completeRebinding();
@@ -70,6 +71,7 @@
70 QPointer<QQuickFlickable> flickable;71 QPointer<QQuickFlickable> flickable;
71 QQuickPropertyAnimation *reboundAnimation;72 QQuickPropertyAnimation *reboundAnimation;
72 PropertyChange *flickableInteractive;73 PropertyChange *flickableInteractive;
74 PropertyChange *disabledOpacity;
73 UCListItemContent *contentItem;75 UCListItemContent *contentItem;
74 UCListItemDivider *divider;76 UCListItemDivider *divider;
75 UCListItemOptions *leadingOptions;77 UCListItemOptions *leadingOptions;
7678
=== modified file 'tests/unit_x11/tst_components/tst_listitem.qml'
--- tests/unit_x11/tst_components/tst_listitem.qml 2014-09-15 08:46:20 +0000
+++ tests/unit_x11/tst_components/tst_listitem.qml 2014-09-15 08:46:21 +0000
@@ -450,5 +450,34 @@
450 actionSpy.wait();450 actionSpy.wait();
451 compare(action.param, data.result, "Action parameter differs");451 compare(action.param, data.result, "Action parameter differs");
452 }452 }
453
454 SignalSpy {
455 id: panelItemSpy
456 signalName: "onXChanged"
457 }
458
459 function test_disabled_item_locked_data() {
460 var item0 = findChild(listView, "listItem0");
461 return [
462 // drag same amount as height is
463 {tag: "Simple item, leading", item: testItem, enabled: false, dx: testItem.height},
464 {tag: "Simple item, trailing", item: testItem, enabled: false, dx: -testItem.height},
465 {tag: "ListView item, leading", item: item0, enabled: false, dx: item0.height},
466 {tag: "ListView item, trailing", item: item0, enabled: false, dx: -item0.height},
467 ];
468 }
469 function test_disabled_item_locked(data) {
470 var oldEnabled = data.item.enabled;
471 panelItemSpy.clear();
472 panelItemSpy.target = data.item;
473 data.item.enabled = false;
474 // tug
475 flick(data.item.contentItem, centerOf(data.item.contentItem).x, centerOf(data.item.contentItem).y, data.dx, 0);
476 compare(panelItemSpy.count, 0, "Item had been tugged despite being disabled!");
477 // check opacity
478 fuzzyCompare(data.item.opacity, 0.5, 0.1, "Disabled item must be 50% transparent");
479 //cleanup
480 data.item.enabled = oldEnabled;
481 }
453 }482 }
454}483}

Subscribers

People subscribed via source and target branches

to all changes: