on xenial help sign in
Implemented special 1over2 buttons layout-case in snap-decisions for design-requirement of e.g. event-reminder notification.
commit2a3e96c4994ec8e0ee2eaf3a692ffb3277ce10f3 authorMirco Müller <mirco.mueller@canonical.com> dateFri 25 Jul 2014, 12:36 (12 years ago) parent7a9d7e0
1 file changed+70−2
qml/Notifications/Notification.qml+70−2
qml/Notifications/Notification.qml+70−2
@@ -317,6 +317,74 @@ Item {
317317 }
318318 }
319319
320+ Column {
321+ id: oneOverTwoCase
322+
323+ anchors {
324+ left: parent.left
325+ right: parent.right
326+ margins: contentSpacing
327+ }
328+
329+ spacing: contentSpacing
330+
331+ visible: notification.type == Notification.SnapDecision && oneOverTwoRepeaterTop.count == 3
332+
333+ Repeater {
334+ id: oneOverTwoRepeaterTop
335+
336+ model: notification.actions
337+ delegate: Loader {
338+ id: oneOverTwoLoaderTop
339+
340+ property string actionId: id
341+ property string actionLabel: label
342+
343+ Component {
344+ id: oneOverTwoButtonTop
345+
346+ Button {
347+ objectName: "button" + index
348+ width: oneOverTwoCase.width
349+ text: oneOverTwoLoaderTop.actionLabel
350+ color: notification.hints["x-canonical-private-affirmative-tint"] == "true" ? green : sdDarkGrey
351+ onClicked: notification.notification.invokeAction(oneOverTwoLoaderTop.actionId)
352+ }
353+ }
354+ sourceComponent: index == 0 ? oneOverTwoButtonTop : undefined
355+ }
356+ }
357+
358+ Row {
359+ spacing: contentSpacing
360+
361+ Repeater {
362+ id: oneOverTwoRepeaterBottom
363+
364+ model: notification.actions
365+ delegate: Loader {
366+ id: oneOverTwoLoaderBottom
367+
368+ property string actionId: id
369+ property string actionLabel: label
370+
371+ Component {
372+ id: oneOverTwoButtonBottom
373+
374+ Button {
375+ objectName: "button" + index
376+ width: oneOverTwoCase.width / 2 - spacing * 2
377+ text: oneOverTwoLoaderBottom.actionLabel
378+ color: index == 1 && notification.hints["x-canonical-private-rejection-tint"] == "true" ? red : sdDarkGrey
379+ onClicked: notification.notification.invokeAction(oneOverTwoLoaderBottom.actionId)
380+ }
381+ }
382+ sourceComponent: (index == 1 || index == 2) ? oneOverTwoButtonBottom : undefined
383+ }
384+ }
385+ }
386+ }
387+
320388 Row {
321389 id: buttonRow
322390
@@ -326,7 +394,7 @@ Item {
326394 right: parent.right
327395 margins: contentSpacing
328396 }
329− visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
397+ visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0 && !oneOverTwoCase.visible
330398 spacing: units.gu(2)
331399 layoutDirection: Qt.RightToLeft
332400
@@ -376,7 +444,7 @@ Item {
376444 margins: contentSpacing
377445 }
378446
379− visible: notification.type == Notification.SnapDecision && actionRepeater.count > 3
447+ visible: notification.type == Notification.SnapDecision && actionRepeater.count > 3 && !oneOverTwoCase.visible
380448 color: sdDarkGrey
381449 onClicked: notification.notification.invokeAction(comboRepeater.itemAt(2).actionId)
382450 expanded: false