on xenial help sign in
Added two JavaScript-functions that extract icon-name and label from additional actions meant to populate the ComboButton.
e15b84fMirco Müller
qml/Notifications/Notification.qml+16−2
@@ -368,6 +368,16 @@ Item {
368 width: comboButton.width
368 width: comboButton.width
369 height: comboIcon.height + units.gu(2)
369 height: comboIcon.height + units.gu(2)
370
370
371+ function getComboIcon (str) {
372+ var result = str.split(":")
373+ return result[0]
374+ }
375+
376+ function getComboLabel (str) {
377+ var result = str.split(":")
378+ return result[1]
379+ }
380+
371 onClicked: {
381 onClicked: {
372 notification.notification.invokeAction(actionId)
382 notification.notification.invokeAction(actionId)
373 }
383 }
@@ -376,6 +386,10 @@ Item {
376 visible: index > 3
386 visible: index > 3
377 }
387 }
378
388
389+ Component.onCompleted: {
390+ comboIcon.name = getComboIcon(actionLabel)
391+ }
392+
379 Icon {
393 Icon {
380 id: comboIcon
394 id: comboIcon
381
395
@@ -389,7 +403,7 @@ Item {
389 }
403 }
390 width: units.gu(2)
404 width: units.gu(2)
391 height: units.gu(2)
405 height: units.gu(2)
392− name: "messages"
406+ //name: getComboIcon(actionLabel)
393 color: "white"
407 color: "white"
394 }
408 }
395
409
@@ -403,7 +417,7 @@ Item {
403 height: comboIcon.height
417 height: comboIcon.height
404 fontSize: "small"
418 fontSize: "small"
405 color: "white"
419 color: "white"
406− text: actionLabel
420+ text: getComboLabel(actionLabel)
407 }
421 }
408 }
422 }
409 }
423 }