on xenial help sign in
Enable notifications
c916fbeMirco Müller
Notifications/Notification.qml+13−4
@@ -16,6 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19+import Notification 0.1
19
20
20UbuntuShape {
21UbuntuShape {
21 id: notification
22 id: notification
@@ -26,6 +27,9 @@ UbuntuShape {
26 property alias summary: summaryLabel.text
27 property alias summary: summaryLabel.text
27 property alias body: bodyLabel.text
28 property alias body: bodyLabel.text
28 property var actions
29 property var actions
30+ property var notificationId
31+ property var type
32+ property var notification
29
33
30 signal actionInvoked(string buttonId)
34 signal actionInvoked(string buttonId)
31
35
@@ -36,10 +40,15 @@ UbuntuShape {
36 MouseArea {
40 MouseArea {
37 id: interactiveArea
41 id: interactiveArea
38
42
43+ Repeater {
44+ id: actionRepeater
45+ model: actions
46+ }
47+
39 anchors.fill: contentColumn
48 anchors.fill: contentColumn
40 objectName: "interactiveArea"
49 objectName: "interactiveArea"
41− enabled: notification.type == "Notifications.Type.Interactive"
50+ enabled: notification.type == Notification.Interactive
42− onClicked: notification.actionInvoked(actions.get(0).id)
51+ onClicked: notificationRenderer.model.triggerAction(notificationId, actionRepeater.model.actionId(0))
43 }
52 }
44
53
45 Column {
54 Column {
@@ -130,7 +139,7 @@ UbuntuShape {
130 objectName: "buttonRow"
139 objectName: "buttonRow"
131 spacing: contentColumn.spacing
140 spacing: contentColumn.spacing
132 layoutDirection: Qt.RightToLeft
141 layoutDirection: Qt.RightToLeft
133− visible: notification.type == "Notifications.Type.SnapDecision"
142+ visible: notification.type == Notification.SnapDecision
134 anchors {
143 anchors {
135 left: parent.left
144 left: parent.left
136 right: parent.right
145 right: parent.right
@@ -145,7 +154,7 @@ UbuntuShape {
145 width: (buttonRow.width - buttonRow.spacing) / 2
154 width: (buttonRow.width - buttonRow.spacing) / 2
146 height: units.gu(4)
155 height: units.gu(4)
147 text: label
156 text: label
148− onClicked: notification.actionInvoked(id)
157+ onClicked: notificationRenderer.model.triggerAction(notificationId, id)
149 }
158 }
150 }
159 }
151 }
160 }
Notifications/Notifications.qml+2
@@ -38,6 +38,8 @@ ListView {
38 summary: model.summary
38 summary: model.summary
39 body: model.body
39 body: model.body
40 actions: model.actions
40 actions: model.actions
41+ notificationId: model.id
42+ notification: model.notification
41 }
43 }
42
44
43 populate: Transition {
45 populate: Transition {
Shell.qml+14
@@ -27,6 +27,8 @@ import "Components"
27import "Components/Math.js" as MathLocal
27import "Components/Math.js" as MathLocal
28import "Bottombar"
28import "Bottombar"
29import "SideStage"
29import "SideStage"
30+import "Notifications"
31+import NotificationsBackend 1.0
30
32
31FocusScope {
33FocusScope {
32 id: shell
34 id: shell
@@ -171,6 +173,18 @@ FocusScope {
171 // greeterRevealer.animatedProgress are not animated
173 // greeterRevealer.animatedProgress are not animated
172 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
174 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
173 }
175 }
176+
177+ Notifications {
178+ id: notifications
179+
180+ model: notificationmodel
181+ anchors {
182+ fill: parent
183+ leftMargin: units.gu(1)
184+ rightMargin: units.gu(1)
185+ topMargin: panel.panelHeight + units.gu(1)
186+ }
187+ }
174 }
188 }
175
189
176
190