on xenial help sign in
Replaced onAdd/onRemove functions with SortFilterProxyModel-based binding to prevent potential race-conditions.
09f6ad6Mirco Müller
qml/Notifications/Notification.qml−12
@@ -37,18 +37,6 @@ 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−
52 fullscreen: false
40 fullscreen: false
53 objectName: "background"
41 objectName: "background"
54 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : contentColumn.height + contentColumn.spacing * 4) : 0
42 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : contentColumn.height + contentColumn.spacing * 4) : 0
qml/Notifications/Notifications.qml+11−3
@@ -16,6 +16,8 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19+import Unity.Notifications 1.0 as UnityNotifications
20+import Utils 0.1
19import "../Components"
21import "../Components"
20
22
21ListView {
23ListView {
@@ -26,10 +28,16 @@ ListView {
26
28
27 property real margin
29 property real margin
28 property bool useModal
30 property bool useModal
29− property int snapDecisionCount
30
31
31− snapDecisionCount: 0
32+ useModal: snapDecisionProxyModel.count > 0
32− useModal: snapDecisionCount > 0
33+
34+ SortFilterProxyModel {
35+ id: snapDecisionProxyModel
36+
37+ model: notificationList.model
38+ filterRole: UnityNotifications.Model.RoleType
39+ filterRegExp: RegExp(UnityNotifications.Notification.SnapDecision)
40+ }
33
41
34 delegate: Notification {
42 delegate: Notification {
35 objectName: "notification" + index
43 objectName: "notification" + index