on xenial help sign in
Rename id-names and clean up code a bit.
4c8b4c8Mirco Müller
qml/Notifications/Notification.qml+19−78
@@ -327,38 +327,40 @@ Item {
327 }
327 }
328
328
329 ComboButton {
329 ComboButton {
330− id: localButton
330+ id: comboButton
331
331
332 width: parent.width
332 width: parent.width
333 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 4
333 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 4
334 gradient: darkgreyGradient
334 gradient: darkgreyGradient
335− onClicked: notification.notification.invokeAction(localRepeater.itemAt(2).actionId)
335+ onClicked: notification.notification.invokeAction(comboRepeater.itemAt(2).actionId)
336 expanded: false
336 expanded: false
337− expandedHeight: (localRepeater.count) * units.gu(5) + units.gu(.5)
337+ expandedHeight: (comboRepeater.count) * units.gu(5)
338 comboList: Column {
338 comboList: Column {
339 Repeater {
339 Repeater {
340− id: localRepeater
340+ id: comboRepeater
341
341
342 Component.onCompleted: {
342 Component.onCompleted: {
343 // an assignment is ok here, since this
343 // an assignment is ok here, since this
344 // label is static and does not change
344 // label is static and does not change
345− localButton.text = localRepeater.itemAt(2).actionLabel
345+ comboButton.text = comboRepeater.itemAt(2).actionLabel
346 }
346 }
347
347
348 model: notification.actions
348 model: notification.actions
349 delegate: Loader {
349 delegate: Loader {
350+ id: comboLoader
351+
352+ asynchronous: true
353+ visible: status == Loader.Ready
350 property string actionId: id
354 property string actionId: id
351 property string actionLabel: label
355 property string actionLabel: label
352 Component {
356 Component {
353− id: myEntry
357+ id: comboEntry
354
358
355 MouseArea {
359 MouseArea {
356− id: localInputArea
360+ id: comboInputArea
357
361
358− x: localIcon.x
359− y: localIcon.y
360− width: localButton.width
362+ width: comboButton.width
361− height: localIcon.height + units.gu(2)
363+ height: comboIcon.height + units.gu(2)
362
364
363 onClicked: {
365 onClicked: {
364 notification.notification.invokeAction(actionId)
366 notification.notification.invokeAction(actionId)
@@ -369,7 +371,7 @@ Item {
369 }
371 }
370
372
371 Icon {
373 Icon {
372− id: localIcon
374+ id: comboIcon
373
375
374 anchors {
376 anchors {
375 left: parent.left
377 left: parent.left
@@ -386,84 +388,23 @@ Item {
386 }
388 }
387
389
388 Label {
390 Label {
389− id: localLabel
391+ id: comboLabel
390
392
391− anchors.left: localIcon.right
393+ anchors.left: comboIcon.right
392 anchors.leftMargin: units.gu(1)
394 anchors.leftMargin: units.gu(1)
393− anchors.verticalCenter: localIcon.verticalCenter
395+ anchors.verticalCenter: comboIcon.verticalCenter
394 verticalAlignment: Text.AlignVCenter
396 verticalAlignment: Text.AlignVCenter
395− height: localIcon.height
397+ height: comboIcon.height
396 fontSize: "small"
398 fontSize: "small"
397 color: "white"
399 color: "white"
398 text: actionLabel
400 text: actionLabel
399 }
401 }
400 }
402 }
401 }
403 }
402− sourceComponent: (index > 2) ? myEntry : undefined
404+ sourceComponent: (index > 2) ? comboEntry : undefined
403 }
405 }
404 }
406 }
405 }
407 }
406− /*ListView {
407− id: myView
408−
409− width: parent.width
410− interactive: false
411−
412− model: notification.actions
413− delegate: Column {
414− id: myDelegate
415−
416− width: parent.width
417−
418− ListItem.ThinDivider {
419− visible: index != 0
420− }
421−
422− MouseArea {
423− id: localInputArea
424−
425− x: localIcon.x
426− y: localIcon.y
427− width: parent.width
428− height: localIcon.height + units.gu(2)
429−
430− onClicked: {
431− notification.notification.invokeAction(id)
432− }
433−
434− Icon {
435− id: localIcon
436−
437− anchors {
438− left: parent.left
439− leftMargin: units.gu(.5)
440− top: parent.top
441− topMargin: units.gu(1)
442− bottom: parent.bottom
443− bottomMargin: units.gu(1)
444− }
445− width: units.gu(2)
446− height: units.gu(2)
447− name: "messages"
448− color: "white"
449− }
450−
451− Label {
452− id: localLabel
453−
454− anchors.left: localIcon.right
455− anchors.leftMargin: units.gu(1)
456− anchors.verticalCenter: localIcon.verticalCenter
457− verticalAlignment: Text.AlignVCenter
458− height: localIcon.height
459− fontSize: "small"
460− color: "white"
461− text: label
462− }
463− }
464−
465− }
466− }*/
467 }
408 }
468 }
409 }
469 }
410 }