on xenial help sign in
introduce a boolean "expanded" property as a replacement for the removed
6576f2aLukáš Tinkl
qml/Notifications/Notification.qml+11−11
@@ -55,21 +55,21 @@ StyledItem {
55 name: "Ubuntu.Components.Themes.Ambiance"
55 name: "Ubuntu.Components.Themes.Ambiance"
56 }
56 }
57
57
58− state: {
58+ readonly property bool expanded: {
59− var result = "";
59+ var result = false;
60
60
61 if (type === Notification.SnapDecision) {
61 if (type === Notification.SnapDecision) {
62 if (ListView.view.currentIndex === index) {
62 if (ListView.view.currentIndex === index) {
63− result = "expanded";
63+ result = true;
64 } else {
64 } else {
65 if (ListView.view.count > 2) {
65 if (ListView.view.count > 2) {
66 if (ListView.view.currentIndex === -1 && index == 1) {
66 if (ListView.view.currentIndex === -1 && index == 1) {
67− result = "expanded";
67+ result = true;
68 } else {
68 } else {
69− result = "contracted";
69+ result = false;
70 }
70 }
71 } else {
71 } else {
72− result = "expanded";
72+ result = true;
73 }
73 }
74 }
74 }
75 }
75 }
@@ -325,12 +325,12 @@ StyledItem {
325 }
325 }
326
326
327 ListItem.ThinDivider {
327 ListItem.ThinDivider {
328− visible: type === Notification.SnapDecision && notification.state !== "contracted"
328+ visible: type === Notification.SnapDecision && notification.expanded
329 }
329 }
330
330
331 Icon {
331 Icon {
332 source: "arrow-down.png"
332 source: "arrow-down.png"
333− visible: type === Notification.SnapDecision && notification.state === "contracted"
333+ visible: type === Notification.SnapDecision && !notification.expanded
334 width: units.gu(2)
334 width: units.gu(2)
335 height: units.gu(0.6)
335 height: units.gu(0.6)
336 anchors.horizontalCenter: parent.horizontalCenter
336 anchors.horizontalCenter: parent.horizontalCenter
@@ -428,7 +428,7 @@ StyledItem {
428
428
429 spacing: notification.margins
429 spacing: notification.margins
430
430
431− visible: notification.type === Notification.SnapDecision && oneOverTwoRepeaterTop.count === 3 && notification.state === "expanded"
431+ visible: notification.type === Notification.SnapDecision && oneOverTwoRepeaterTop.count === 3 && notification.expanded
432
432
433 Repeater {
433 Repeater {
434 id: oneOverTwoRepeaterTop
434 id: oneOverTwoRepeaterTop
@@ -497,7 +497,7 @@ StyledItem {
497 left: parent.left
497 left: parent.left
498 right: parent.right
498 right: parent.right
499 }
499 }
500− visible: notification.type === Notification.SnapDecision && actionRepeater.count > 0 && !oneOverTwoCase.visible && notification.state === "expanded"
500+ visible: notification.type === Notification.SnapDecision && actionRepeater.count > 0 && !oneOverTwoCase.visible && notification.expanded
501 spacing: notification.margins
501 spacing: notification.margins
502 layoutDirection: Qt.RightToLeft
502 layoutDirection: Qt.RightToLeft
503
503
@@ -567,7 +567,7 @@ StyledItem {
567 right: parent.right
567 right: parent.right
568 }
568 }
569
569
570− visible: notification.type === Notification.SnapDecision && actionRepeater.count > 3 && !oneOverTwoCase.visible && notification.state === "expanded"
570+ visible: notification.type === Notification.SnapDecision && actionRepeater.count > 3 && !oneOverTwoCase.visible && notification.expanded
571 model: notification.actions
571 model: notification.actions
572 expanded: false
572 expanded: false
573 startIndex: 2
573 startIndex: 2
tests/qmltests/Notifications/tst_VisualSnapDecisionsQueue.qml+6−6
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014-2016 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -216,9 +216,9 @@ Row {
216 }
216 }
217
217
218 // check initial states once all five snap-decisions were appended to the model
218 // check initial states once all five snap-decisions were appended to the model
219− compare(snap_decision[0].state, "expanded", "state of first snap-decision is not expanded");
219+ compare(snap_decision[0].expanded, true, "state of first snap-decision is not expanded");
220 for (var index = 1; index < snap_decision.length; index++) {
220 for (var index = 1; index < snap_decision.length; index++) {
221− compare(snap_decision[index].state, "contracted", "state of "+ index + ".snap-decision is not contracted");
221+ compare(snap_decision[index].expanded, false, "state of "+ index + ".snap-decision is not contracted");
222 }
222 }
223
223
224 // click/tap on each snap-decision and verify only one is in expanded-state at any time
224 // click/tap on each snap-decision and verify only one is in expanded-state at any time
@@ -226,9 +226,9 @@ Row {
226 mouseClick(snap_decision[index])
226 mouseClick(snap_decision[index])
227 for (var kindex = 0; kindex < snap_decision.length; kindex++) {
227 for (var kindex = 0; kindex < snap_decision.length; kindex++) {
228 if (kindex == index) {
228 if (kindex == index) {
229− compare(snap_decision[kindex].state, "expanded", "state of "+ kindex + ".snap-decision is not expanded");
229+ compare(snap_decision[kindex].expanded, true, "state of "+ kindex + ".snap-decision is not expanded");
230 } else {
230 } else {
231− compare(snap_decision[kindex].state, "contracted", "state of "+ kindex + ".snap-decision is not contracted");
231+ compare(snap_decision[kindex].expanded, false, "state of "+ kindex + ".snap-decision is not contracted");
232 }
232 }
233 }
233 }
234 }
234 }
@@ -241,7 +241,7 @@ Row {
241
241
242 for (var index = 1; index < snap_decision.length; index++) {
242 for (var index = 1; index < snap_decision.length; index++) {
243 removeTopMostNotification();
243 removeTopMostNotification();
244− compare(snap_decision[index].state, "expanded", "state of " + index + ". snap-decision is not expanded");
244+ compare(snap_decision[index].expanded, true, "state of " + index + ". snap-decision is not expanded");
245 }
245 }
246 }
246 }
247 }
247 }