@@ -15,11 +15,13 @@
1515 */
1616
1717import QtQuick 2.0
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.1
1919import Unity.Notifications 1.0
2020import QMenuModel 0.1
2121import Utils 0.1
2222
23+import Ubuntu.Components.ListItems 0.1 as ListItem
24+
2325Item {
2426 id: notification
2527
@@ -36,6 +38,14 @@ Item {
3638 property bool fullscreen
3739 property int maxHeight
3840 property int margins
41+ property Gradient greenGradient : Gradient {
42+ GradientStop { position: 0.0; color: "#39b44a" }
43+ GradientStop { position: 1.0; color: "#50be61" }
44+ }
45+ property Gradient darkgreyGradient: Gradient {
46+ GradientStop { position: 0.0; color: "#534e4b" }
47+ GradientStop { position: 1.0; color: "#5d5856" }
48+ }
3949
4050 fullscreen: false
4151 objectName: "background"
@@ -278,7 +288,7 @@ Item {
278288 }
279289 }
280290
281− Item {
291+ Row {
282292 id: buttonRow
283293
284294 objectName: "buttonRow"
@@ -287,70 +297,8 @@ Item {
287297 right: parent.right
288298 }
289299 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
290− height: units.gu(5)
291−
292− property real buttonWidth: (width - contentColumn.spacing) / 2
293− property bool expanded
294−
295− Button {
296− id: leftButton
297−
298− objectName: "button1"
299− width: parent.expanded ? parent.width : parent.buttonWidth
300− anchors {
301− top: parent.top
302− bottom: parent.bottom
303− }
304− text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel : ""
305− gradient: UbuntuColors.greyGradient
306− onClicked: {
307− if (actionRepeater.count > 2) {
308− buttonRow.expanded = !buttonRow.expanded
309− } else {
310− notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
311− }
312− }
313−
314− Behavior on width {
315− UbuntuNumberAnimation {
316− duration: UbuntuAnimation.SnapDuration
317− }
318− }
319− }
320−
321− Button {
322− id: rightButton
323−
324− objectName: "button0"
325− anchors {
326− left: leftButton.right
327− leftMargin: contentColumn.spacing
328− right: parent.right
329− }
330− text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel : ""
331− anchors {
332− top: parent.top
333− bottom: parent.bottom
334− }
335− gradient: notification.hints["x-canonical-private-button-tint"] == "true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
336− visible: width > 0
337− onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
338− }
339− }
340−
341− Column {
342− objectName: "buttonColumn"
343− spacing: contentColumn.spacing
344− anchors {
345− left: parent.left
346− right: parent.right
347− }
348−
349− // calculate initial position before Column takes over
350− y: buttonRow.y + buttonRow.height + contentColumn.spacing
351−
352− visible: notification.type == Notification.SnapDecision && buttonRow.expanded
353− height: buttonRow.expanded ? implicitHeight : 0
300+ spacing: units.gu(1)
301+ layoutDirection: Qt.RightToLeft
354302
355303 Repeater {
356304 id: actionRepeater
@@ -362,28 +310,85 @@ Item {
362310 property string actionId: id
363311 property string actionLabel: label
364312
365− anchors {
366− left: parent.left
367− right: parent.right
368− }
369−
370313 Component {
371314 id: actionButton
372315
373316 Button {
374317 objectName: "button" + index
375− anchors {
376− left: parent.left
377− right: parent.right
378− }
379−
318+ width: buttonRow.width / 2 - spacing
380319 text: loader.actionLabel
381− height: units.gu(5)
382− gradient: UbuntuColors.greyGradient
320+ gradient: notification.hints["x-canonical-private-button-tint"] == "true" && index == 0 ? greenGradient : darkgreyGradient
383321 onClicked: notification.notification.invokeAction(loader.actionId)
384322 }
385323 }
386− sourceComponent: (index == 0 || index == 1) ? undefined : actionButton
324+ sourceComponent: (index == 0 || index == 1) ? actionButton : undefined
325+ }
326+ }
327+ }
328+
329+ ComboButton {
330+ width: parent.width
331+ text: "Decline"
332+ visible: notification.type == Notification.SnapDecision && actionRepeater.count > 2
333+ gradient: darkgreyGradient
334+ onClicked: print ("Clicked on " + text)
335+ expanded: false
336+ expandedHeight: (actionRepeater.count - 2) * units.gu(4) + units.gu(4.5)
337+ comboList: ListView {
338+ id: myView
339+
340+ width: parent.width
341+ interactive: false
342+
343+ model: notification.actions
344+ delegate: Column {
345+ id: myDelegate
346+
347+ width: parent.width
348+
349+ ListItem.ThinDivider {
350+ visible: index != 0
351+ }
352+
353+ MouseArea {
354+ x: delegateRow.x
355+ y: delegateRow.y
356+ width: delegateRow.width
357+ height: delegateRow.height
358+
359+ onClicked: {
360+ print ("Clicked on: " + label)
361+ }
362+
363+ Row {
364+ id: delegateRow
365+ /*Rectangle {
366+ id: frame
367+
368+ color: Qt.rgba(0.0, 0.0, 0.0, 0.0)
369+ width: myDelegate.height
370+ height: width
371+
372+ Icon {
373+ anchors.fill: parent
374+ anchors.margins: units.gu(1)
375+ width: units.gu(3)
376+ height: units.gu(3)
377+ name: icon
378+ color: "white"
379+ }
380+ }*/
381+
382+ Label {
383+ //height: frame.height
384+ height: units.gu(3)
385+ verticalAlignment: Text.AlignVCenter
386+ fontSize: "small"
387+ color: "white"
388+ text: label
389+ }
390+ }
391+ }
387392 }
388393 }
389394 }