@@ -16,11 +16,13 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtMultimedia 5.0
18import QtMultimedia 5.0
19−import Ubuntu.Components 0.1
19+import Ubuntu.Components 1.1
20import Unity.Notifications 1.0
20import Unity.Notifications 1.0
21import QMenuModel 0.1
21import QMenuModel 0.1
22import Utils 0.1
22import Utils 0.1
24+import Ubuntu.Components.ListItems 0.1 as ListItem
25 id: notification
27 id: notification
@@ -37,6 +39,14 @@ Item {
37 property bool fullscreen
39 property bool fullscreen
38 property int maxHeight
40 property int maxHeight
39 property int margins
41 property int margins
42+ property Gradient greenGradient : Gradient {
43+ GradientStop { position: 0.0; color: "#3fb24f" }
44+ GradientStop { position: 1.0; color: "#3fb24f" }
46+ property Gradient darkgreyGradient: Gradient {
47+ GradientStop { position: 0.0; color: "#4d4745" }
48+ GradientStop { position: 1.0; color: "#4d4745" }
41 fullscreen: false
51 fullscreen: false
42 objectName: "background"
52 objectName: "background"
@@ -291,7 +301,7 @@ Item {
295 id: buttonRow
305 id: buttonRow
297 objectName: "buttonRow"
307 objectName: "buttonRow"
@@ -300,70 +310,8 @@ Item {
300 right: parent.right
310 right: parent.right
302 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
312 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
303− height: units.gu(5)
313+ spacing: units.gu(1)
304−
314+ layoutDirection: Qt.RightToLeft
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
362− // calculate initial position before Column takes over
363− y: buttonRow.y + buttonRow.height + contentColumn.spacing
365− visible: notification.type == Notification.SnapDecision && buttonRow.expanded
366− height: buttonRow.expanded ? implicitHeight : 0
368 Repeater {
316 Repeater {
369 id: actionRepeater
317 id: actionRepeater
@@ -375,28 +323,105 @@ Item {
375 property string actionId: id
323 property string actionId: id
376 property string actionLabel: label
324 property string actionLabel: label
383 Component {
326 Component {
384 id: actionButton
327 id: actionButton
387 objectName: "button" + index
330 objectName: "button" + index
388− anchors {
331+ width: buttonRow.width / 2 - spacing
393 text: loader.actionLabel
332 text: loader.actionLabel
394− height: units.gu(5)
333+ gradient: notification.hints["x-canonical-private-button-tint"] == "true" && index == 0 ? greenGradient : darkgreyGradient
395− gradient: UbuntuColors.greyGradient
396 onClicked: notification.notification.invokeAction(loader.actionId)
334 onClicked: notification.notification.invokeAction(loader.actionId)
399− sourceComponent: (index == 0 || index == 1) ? undefined : actionButton
337+ sourceComponent: (index == 0 || index == 1) ? actionButton : undefined
345+ objectName: "button2"
347+ visible: notification.type == Notification.SnapDecision && actionRepeater.count > 3
348+ gradient: darkgreyGradient
349+ onClicked: notification.notification.invokeAction(comboRepeater.itemAt(2).actionId)
351+ expandedHeight: (comboRepeater.count - 2) * units.gu(4) + units.gu(.5)
352+ comboList: Flickable {
353+ // this has to be wrapped inside a flickable
354+ // to work around a feature/bug? of the
355+ // ComboButton SDK-element, making a regular
356+ // unwrapped Column item flickable
364+ comboButton.text = comboRepeater.itemAt(2).actionLabel
367+ model: notification.actions
372+ visible: status == Loader.Ready
373+ property string actionId: id
374+ property string actionLabel: label
375+ readonly property var splitLabel: actionLabel.match(/(^([-a-z0-9]+):)?(.*)$/)
382+ objectName: "button" + index
383+ width: comboButton.width
384+ height: comboIcon.height + units.gu(2)
387+ notification.notification.invokeAction(actionId)
390+ ListItem.ThinDivider {
399+ leftMargin: units.gu(.5)
400+ verticalCenter: parent.verticalCenter
412+ left: comboIcon.right
413+ leftMargin: units.gu(1)
414+ verticalCenter: comboIcon.verticalCenter
422+ sourceComponent: (index > 2) ? comboEntry : undefined