on xenial help sign in
Replaced onAdd/onRemove functions with SortFilterProxyModel-based binding to prevent potential race-conditions.
commit09f6ad6667780e8f15cfbe675fb014ca3c32b211 authorMirco Müller <mirco.mueller@ubuntu.com> dateMon 24 Mar 2014, 18:12 (13 years ago) parent08a89bd
2 files changed+11−15
qml/Notifications/Notification.qml−12 qml/Notifications/Notifications.qml+11−3
qml/Notifications/Notification.qml−12
@@ -37,18 +37,6 @@ Item {
3737 property int maxHeight
3838 property int margins
3939
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−
5240 fullscreen: false
5341 objectName: "background"
5442 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : contentColumn.height + contentColumn.spacing * 4) : 0
qml/Notifications/Notifications.qml+11−3
@@ -16,6 +16,8 @@
1616
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
19+import Unity.Notifications 1.0 as UnityNotifications
20+import Utils 0.1
1921import "../Components"
2022
2123ListView {
@@ -26,10 +28,16 @@ ListView {
2628
2729 property real margin
2830 property bool useModal
29− property int snapDecisionCount
3031
31− snapDecisionCount: 0
32− useModal: snapDecisionCount > 0
32+ useModal: snapDecisionProxyModel.count > 0
33+
34+ SortFilterProxyModel {
35+ id: snapDecisionProxyModel
36+
37+ model: notificationList.model
38+ filterRole: UnityNotifications.Model.RoleType
39+ filterRegExp: RegExp(UnityNotifications.Notification.SnapDecision)
40+ }
3341
3442 delegate: Notification {
3543 objectName: "notification" + index