on xenial help sign in
Only trigger use of SwipeToAct-widget if notification uses special hint... otherwise use regular buttons.
d78c63dMirco Müller
qml/Notifications/Notification.qml+20−20
@@ -405,10 +405,26 @@ Item {
405 spacing: units.gu(2)
405 spacing: units.gu(2)
406 layoutDirection: Qt.RightToLeft
406 layoutDirection: Qt.RightToLeft
407
407
408+ SwipeToAct {
409+ objectName: "notify_swipe_button"
410+ visible: notification.hints["x-canonical-snap-decisions-swipe"] === "true"
411+ leftIconName: "call-end"
412+ rightIconName: "call-start"
413+ width: buttonRow.width
414+
415+ onLeftTriggered: {
416+ notification.notification.invokeAction(notification.actions.data(0, ActionModel.RoleActionId))
417+ }
418+
419+ onRightTriggered: {
420+ notification.notification.invokeAction(notification.actions.data(1, ActionModel.RoleActionId))
421+ }
422+ }
423+
408 Repeater {
424 Repeater {
409 id: actionRepeater
425 id: actionRepeater
410−
411 model: notification.actions
426 model: notification.actions
427+ visible: notification.hints["x-canonical-snap-decisions-swipe"] !== "true"
412 delegate: Loader {
428 delegate: Loader {
413 id: loader
429 id: loader
414
430
@@ -418,9 +434,9 @@ Item {
418 Component {
434 Component {
419 id: actionButton
435 id: actionButton
420
436
421− /*Button {
437+ Button {
422 objectName: "notify_button" + index
438 objectName: "notify_button" + index
423− width: buttonRow.width / 2 - spacing*2
439+ width: buttonRow.width / 2 - spacing * 2
424 text: loader.actionLabel
440 text: loader.actionLabel
425 color: {
441 color: {
426 var result = sdDarkGrey;
442 var result = sdDarkGrey;
@@ -433,25 +449,9 @@ Item {
433 return result;
449 return result;
434 }
450 }
435 onClicked: notification.notification.invokeAction(loader.actionId)
451 onClicked: notification.notification.invokeAction(loader.actionId)
436− }*/
437−
438− SwipeToAct {
439− objectName: "notify_button" + index
440−
441− leftIconName: "call-end"
442− rightIconName: "call-start"
443− width: buttonRow.width
444−
445− onLeftTriggered: {
446− notification.notification.invokeAction(loader.actionId)
447− }
448−
449− onRightTriggered: {
450− notification.notification.invokeAction(loader.actionId)
451− }
452 }
452 }
453 }
453 }
454− sourceComponent: (index == 0) ? actionButton : undefined
454+ sourceComponent: (index == 0 || index == 1) ? actionButton : undefined
455 }
455 }
456 }
456 }
457 }
457 }