2 * Copyright (C) 2013-2016 Canonical, Ltd.
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
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 import Ubuntu.Components 1.3
19 import Unity.Notifications 1.0 as UnityNotifications
21 import "../Components"
26 objectName: "notificationList"
29 readonly property bool hasNotification: count > 1 // placeholder is index 0
31 property bool hasMouse
32 property url background: ""
34 readonly property bool useModal: snapDecisionProxyModel.count > 0
36 UnitySortFilterProxyModel {
37 id: snapDecisionProxyModel
38 objectName: "snapDecisionProxyModel"
40 model: notificationList.model ? notificationList.model : null
41 filterRole: UnityNotifications.ModelInterface != undefined ? UnityNotifications.ModelInterface.RoleType : 0
42 filterRegExp: RegExp(UnityNotifications.Notification.SnapDecision)
45 readonly property bool topmostIsFullscreen: fullscreenIndex != -1
46 spacing: topmostIsFullscreen ? 0 : units.gu(1)
48 currentIndex: count > 1 ? 1 : -1
50 property int fullscreenIndex: -1
51 onFullscreenIndexChanged: {
52 if (fullscreenIndex != -1) {
53 positionViewAtIndex(fullscreenIndex, ListView.Beginning);
57 delegate: Notification {
58 objectName: "notification" + index
62 iconSource: model.icon
63 secondaryIconSource: model.secondaryIcon ? model.secondaryIcon : ""
64 summary: model.summary
66 value: model.value ? model.value : -1
67 actions: model.actions
68 notificationId: model.id
69 notification: notificationList.model.getRaw(notificationId)
70 maxHeight: notificationList.height
71 margins: notificationList.margin
72 hasMouse: notificationList.hasMouse
73 background: notificationList.background
75 // make sure there's no opacity-difference between the several
76 // elements in a notification
77 // FIXME: disabled all transitions because of LP: #1354406 workaround
78 //layer.enabled: add.running || remove.running || populate.running
80 onFullscreenChanged: updateListTopMostIsFullscreen();
82 function updateListTopMostIsFullscreen() {
84 fullscreenIndex = index;
89 if (fullscreenIndex == index) {
91 notificationList.positionViewAtBeginning();
96 // FIXME: disabled all transitions because of LP: #1354406 workaround
97 /*populate: Transition {
98 UbuntuNumberAnimation {
101 duration: UbuntuAnimation.SnapDuration
106 UbuntuNumberAnimation {
109 duration: UbuntuAnimation.SnapDuration
114 UbuntuNumberAnimation {
120 displaced: Transition {
121 UbuntuNumberAnimation {
123 duration: UbuntuAnimation.SnapDuration