[applets/batterymonitor] PowerManagement: Use qualified property access

Speaking of context properties, let's also get rid of magic lookups
within file's context.
wilder-5.25
ivan tkachenko 4 years ago
parent 035e2233c4
commit 5eab1b8bdc
No known key found for this signature in database
GPG Key ID: 4D197017E61437CF
  1. 28
      applets/batterymonitor/package/contents/ui/PowerManagementItem.qml

@ -68,27 +68,27 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
// Don't need to show the inhibitions when power management // Don't need to show the inhibitions when power management
// isn't enabled anyway // isn't enabled anyway
visible: inhibitions.length > 1 && !root.disabled visible: root.inhibitions.length > 1 && !root.disabled
font: PlasmaCore.Theme.smallestFont font: PlasmaCore.Theme.smallestFont
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 3 maximumLineCount: 3
text: i18np("%1 application is currently blocking sleep and screen locking:", text: i18np("%1 application is currently blocking sleep and screen locking:",
"%1 applications are currently blocking sleep and screen locking:", "%1 applications are currently blocking sleep and screen locking:",
inhibitions.length) root.inhibitions.length)
} }
Repeater { Repeater {
visible: inhibitions.length > 1 && !root.disabled visible: root.inhibitions.length > 1 && !root.disabled
model: visible ? inhibitions.length : null model: visible ? root.inhibitions.length : null
InhibitionHint { InhibitionHint {
Layout.fillWidth: true Layout.fillWidth: true
iconSource: inhibitions[index].Icon || "" iconSource: root.inhibitions[index].Icon || ""
text: inhibitions[index].Reason text: root.inhibitions[index].Reason
? i18nc("Application name: reason for preventing sleep and screen locking", "%1: %2", inhibitions[index].Name, inhibitions[index].Reason) ? i18nc("Application name: reason for preventing sleep and screen locking", "%1: %2", root.inhibitions[index].Name, root.inhibitions[index].Reason)
: i18nc("Application name: reason for preventing sleep and screen locking", "%1: unknown reason", inhibitions[index].Name) : i18nc("Application name: reason for preventing sleep and screen locking", "%1: unknown reason", root.inhibitions[index].Name)
} }
} }
@ -97,13 +97,13 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
// Don't need to show the inhibitions when power management // Don't need to show the inhibitions when power management
// is manually disabled anyway // is manually disabled anyway
visible: inhibitions.length === 1 && !root.disabled visible: root.inhibitions.length === 1 && !root.disabled
iconSource: (inhibitions.length === 1) ? inhibitions[0].Icon : "" iconSource: (root.inhibitions.length === 1) ? root.inhibitions[0].Icon : ""
text: (inhibitions.length === 1) ? text: (root.inhibitions.length === 1) ?
inhibitions[0].Reason ? root.inhibitions[0].Reason ?
i18n("%1 is currently blocking sleep and screen locking (%2)", inhibitions[0].Name, inhibitions[0].Reason) i18n("%1 is currently blocking sleep and screen locking (%2)", root.inhibitions[0].Name, root.inhibitions[0].Reason)
: :
i18n("%1 is currently blocking sleep and screen locking (unknown reason)", inhibitions[0].Name) i18n("%1 is currently blocking sleep and screen locking (unknown reason)", root.inhibitions[0].Name)
: :
"" ""
} }

Loading…
Cancel
Save