18 import QtMultimedia 5.0
19 import Ubuntu.Components 0.1
20 import Unity.Notifications 1.0
27 property alias iconSource: icon.fileSource
28 property alias secondaryIconSource: secondaryIcon.source
29 property alias summary: summaryLabel.text
30 property alias body: bodyLabel.text
32 property var notificationId
35 property var notification
37 property bool fullscreen
38 property int maxHeight
42 objectName:
"background"
43 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : contentColumn.height + contentColumn.spacing * 2) : 0
45 color: Qt.rgba(0.132, 0.117, 0.109, 0.97)
51 if (type == Notification.SnapDecision) {
52 if (ListView.view.currentIndex == index) {
55 if (ListView.view.count > 2) {
56 if (ListView.view.currentIndex == -1 && index == 1) {
59 result =
"contracted";
73 source: hints[
"suppress-sound"] !=
"" ? hints[
"sound-file"] : undefined
77 if (opacity == 1.0 && hints[
"suppress-sound"] !=
"true" && sound.source) {
83 id: normalHeightBehavior
89 duration: UbuntuAnimation.SnapDuration
91 UbuntuNumberAnimation {
92 duration: UbuntuAnimation.SnapDuration
100 PropertyChanges {target: notification; height: units.gu(8)}
104 PropertyChanges {target: notification; height: implicitHeight}
108 clip: fullscreen ?
false :
true
110 visible: type != Notification.PlaceHolder
118 leftMargin: notification.margins
119 rightMargin: notification.margins
122 opacity: parent.opacity
132 opacity: parent.opacity
137 anchors.fill: fullscreen ? nonShapedBack : shapedBack
139 UnityMenuModelPaths {
142 source: hints[
"x-canonical-private-menu-model"]
144 busNameHint:
"busName"
145 actionsHint:
"actions"
146 menuObjectPathHint:
"menuPath"
152 busName: paths.busName
153 actions: paths.actions
154 menuObjectPath: paths.menuObjectPath
157 Behavior on implicitHeight {
161 UbuntuNumberAnimation {
162 duration: UbuntuAnimation.SnapDuration
167 onOpacityChanged:
if (opacity == 1) heightBehavior.enabled =
true
173 objectName:
"interactiveArea"
175 if (notification.type == Notification.Interactive) {
176 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
178 notificationList.currentIndex = index;
185 objectName:
"contentColumn"
191 margins: fullscreen ? 0 : spacing
199 spacing: contentColumn.spacing
211 shaped: notification.hints[
"x-canonical-non-shaped-icon"] ==
"true" ?
false :
true
212 visible: iconSource !== undefined && iconSource !=
""
218 objectName:
"secondaryIcon"
221 visible: source !== undefined && source !=
""
222 fillMode: Image.PreserveAspectCrop
227 width: parent.width - x
229 anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
234 objectName:
"summaryLabel"
241 color: Theme.palette.selected.backgroundText
242 elide: Text.ElideRight
248 objectName:
"bodyLabel"
255 color: Theme.palette.selected.backgroundText
257 wrapMode: Text.WordWrap
259 elide: Text.ElideRight
265 objectName:
"dialogListView"
270 anchors.left: parent.left; anchors.right: parent.right
271 anchors.top: fullscreen ? parent.top : undefined
272 anchors.bottom: fullscreen ? parent.bottom : undefined
275 model: unityMenuModel
277 NotificationMenuItemFactory {
280 anchors.left: parent.left; anchors.right: parent.right
282 menuModel: unityMenuModel
285 maxHeight: notification.maxHeight
288 notification.fullscreen = Qt.binding(
function() {
return fullscreen; });
297 objectName:
"buttonRow"
302 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
305 property real buttonWidth: (width - contentColumn.spacing) / 2
306 property
bool expanded
311 objectName:
"button1"
312 width: parent.expanded ? parent.width : parent.buttonWidth
315 bottom: parent.bottom
317 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel :
""
318 gradient: UbuntuColors.greyGradient
320 if (actionRepeater.count > 2) {
321 buttonRow.expanded = !buttonRow.expanded
323 notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
328 UbuntuNumberAnimation {
329 duration: UbuntuAnimation.SnapDuration
337 objectName:
"button0"
339 left: leftButton.right
340 leftMargin: contentColumn.spacing
343 text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel :
""
346 bottom: parent.bottom
348 gradient: notification.hints[
"x-canonical-private-button-tint"] ==
"true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
350 onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
355 objectName:
"buttonColumn"
356 spacing: contentColumn.spacing
363 y: buttonRow.y + buttonRow.height + contentColumn.spacing
365 visible: notification.type == Notification.SnapDecision && buttonRow.expanded
366 height: buttonRow.expanded ? implicitHeight : 0
371 model: notification.actions
375 property string actionId:
id
376 property string actionLabel: label
387 objectName:
"button" + index
393 text: loader.actionLabel
395 gradient: UbuntuColors.greyGradient
396 onClicked: notification.notification.invokeAction(loader.actionId)
399 sourceComponent: (index == 0 || index == 1) ? undefined : actionButton