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
=== modified file 'modules/Ubuntu/Components/plugin/uclistitem.cpp'
--- modules/Ubuntu/Components/plugin/uclistitem.cpp 2014-09-11 12:07:09 +0000
+++ modules/Ubuntu/Components/plugin/uclistitem.cpp 2014-09-11 12:07:10 +0000
@@ -251,6 +251,7 @@
251 , xAxisMoveThresholdGU(1.5)251 , xAxisMoveThresholdGU(1.5)
252 , reboundAnimation(0)252 , reboundAnimation(0)
253 , flickableInteractive(0)253 , flickableInteractive(0)
254 , disabledOpacity(0)
254 , contentItem(new UCListItemContent)255 , contentItem(new UCListItemContent)
255 , divider(new UCListItemDivider)256 , divider(new UCListItemDivider)
256 , leadingOptions(0)257 , leadingOptions(0)
@@ -260,6 +261,7 @@
260UCListItemPrivate::~UCListItemPrivate()261UCListItemPrivate::~UCListItemPrivate()
261{262{
262 delete flickableInteractive;263 delete flickableInteractive;
264 delete disabledOpacity;
263}265}
264266
265void UCListItemPrivate::init()267void UCListItemPrivate::init()
@@ -282,6 +284,9 @@
282 QObject::connect(&UCUnits::instance(), SIGNAL(gridUnitChanged()), q, SLOT(_q_updateSize()));284 QObject::connect(&UCUnits::instance(), SIGNAL(gridUnitChanged()), q, SLOT(_q_updateSize()));
283 _q_updateSize();285 _q_updateSize();
284286
287 // watch enabledChanged()
288 QObject::connect(q, SIGNAL(enabledChanged()), q, SLOT(_q_dimmDisabled()), Qt::DirectConnection);
289
285 // create rebound animation290 // create rebound animation
286 UCUbuntuAnimation animationCodes;291 UCUbuntuAnimation animationCodes;
287 reboundAnimation = new QQuickPropertyAnimation(q);292 reboundAnimation = new QQuickPropertyAnimation(q);
@@ -300,6 +305,20 @@
300 q->setFiltersChildMouseEvents(true);305 q->setFiltersChildMouseEvents(true);
301}306}
302307
308void UCListItemPrivate::_q_dimmDisabled()
309{
310 Q_Q(UCListItem);
311 if (q->isEnabled()) {
312 PropertyChange::restore(disabledOpacity);
313 } else if (opacity() != 0.5) {
314 // this is the first time we need to create the property change
315 if (!disabledOpacity) {
316 disabledOpacity = new PropertyChange(q, "opacity");
317 }
318 PropertyChange::setValue(disabledOpacity, 0.5);
319 }
320}
321
303void UCListItemPrivate::_q_rebound()322void UCListItemPrivate::_q_rebound()
304{323{
305 setPressed(false);324 setPressed(false);
306325
=== modified file 'modules/Ubuntu/Components/plugin/uclistitem.h'
--- modules/Ubuntu/Components/plugin/uclistitem.h 2014-09-11 12:07:09 +0000
+++ modules/Ubuntu/Components/plugin/uclistitem.h 2014-09-11 12:07:10 +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-11 12:07:09 +0000
+++ modules/Ubuntu/Components/plugin/uclistitem_p.h 2014-09-11 12:07:10 +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-11 12:07:09 +0000
+++ tests/unit_x11/tst_components/tst_listitem.qml 2014-09-11 12:07:10 +0000
@@ -446,5 +446,34 @@
446 actionSpy.wait();446 actionSpy.wait();
447 compare(action.param, data.result, "Action parameter differs");447 compare(action.param, data.result, "Action parameter differs");
448 }448 }
449
450 SignalSpy {
451 id: panelItemSpy
452 signalName: "onXChanged"
453 }
454
455 function test_disabled_item_locked_data() {
456 var item0 = findChild(listView, "listItem0");
457 return [
458 // drag same amount as height is
459 {tag: "Simple item, leading", item: testItem, enabled: false, dx: testItem.height},
460 {tag: "Simple item, trailing", item: testItem, enabled: false, dx: -testItem.height},
461 {tag: "ListView item, leading", item: item0, enabled: false, dx: item0.height},
462 {tag: "ListView item, trailing", item: item0, enabled: false, dx: -item0.height},
463 ];
464 }
465 function test_disabled_item_locked(data) {
466 var oldEnabled = data.item.enabled;
467 panelItemSpy.clear();
468 panelItemSpy.target = data.item;
469 data.item.enabled = false;
470 // tug
471 flick(data.item.contentItem, centerOf(data.item.contentItem).x, centerOf(data.item.contentItem).y, data.dx, 0);
472 compare(panelItemSpy.count, 0, "Item had been tugged despite being disabled!");
473 // check opacity
474 fuzzyCompare(data.item.opacity, 0.5, 0.1, "Disabled item must be 50% transparent");
475 //cleanup
476 data.item.enabled = oldEnabled;
477 }
449 }478 }
450}479}

Subscribers

People subscribed via source and target branches