on xenial help sign in
Restrict use of modal tinted background to snap-decision notifications.
4e20d86Mirco Müller
qml/Notifications/Notification.qml+12
@@ -37,6 +37,18 @@ Item {
37 property int maxHeight
37 property int maxHeight
38 property int margins
38 property int margins
39
39
40+ Component.onCompleted: {
41+ if (type == Notification.SnapDecision) {
42+ notificationList.snapDecisionCount++;
43+ }
44+ }
45+
46+ Component.onDestruction: {
47+ if (type == Notification.SnapDecision) {
48+ notificationList.snapDecisionCount--;
49+ }
50+ }
51+
40 fullscreen: false
52 fullscreen: false
41 objectName: "background"
53 objectName: "background"
42 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : contentColumn.height + contentColumn.spacing * 4) : 0
54 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : contentColumn.height + contentColumn.spacing * 4) : 0
qml/Notifications/Notifications.qml+3−13
@@ -26,8 +26,10 @@ ListView {
26
26
27 property real margin
27 property real margin
28 property bool useModal
28 property bool useModal
29+ property int snapDecisionCount
29
30
31+ snapDecisionCount: 0
30− useModal: false
32+ useModal: snapDecisionCount > 0
31
33
32 delegate: Notification {
34 delegate: Notification {
33 objectName: "notification" + index
35 objectName: "notification" + index
@@ -47,18 +49,6 @@ ListView {
47 maxHeight: notificationList.height
49 maxHeight: notificationList.height
48 margins: notificationList.margin
50 margins: notificationList.margin
49
51
50− ListView.onAdd: {
51− if (notificationList.count > 1) {
52− notificationList.useModal = true;
53− }
54− }
55−
56− ListView.onRemove: {
57− if (notificationList.count <= 1) {
58− notificationList.useModal = false;
59− }
60− }
61−
62 // make sure there's no opacity-difference between the several
52 // make sure there's no opacity-difference between the several
63 // elements in a notification
53 // elements in a notification
64 layer.enabled: add.running || remove.running || populate.running
54 layer.enabled: add.running || remove.running || populate.running