|
|
|
@ -26,25 +26,22 @@ import org.kde.plasma.components 2.0 as Components |
|
|
|
import org.kde.plasma.workspace.components 2.0 |
|
|
|
import org.kde.plasma.workspace.components 2.0 |
|
|
|
import "plasmapackage:/code/logic.js" as Logic |
|
|
|
import "plasmapackage:/code/logic.js" as Logic |
|
|
|
|
|
|
|
|
|
|
|
//Should we consider turning this into a Flow item? |
|
|
|
MouseArea { |
|
|
|
Row { |
|
|
|
|
|
|
|
id: root |
|
|
|
id: root |
|
|
|
Layout.minimumWidth: isConstrained() ? units.iconSizes.medium : 24 // NOTE: Keep in sync with systray |
|
|
|
Layout.minimumWidth: isConstrained() ? units.iconSizes.medium : 24 // NOTE: Keep in sync with systray |
|
|
|
Layout.minimumHeight: isConstrained() ? units.iconSizes.medium * view.count : 24 |
|
|
|
Layout.minimumHeight: isConstrained() ? units.iconSizes.medium * view.count : 24 |
|
|
|
property real itemSize: Math.min(root.height, root.width/view.count) |
|
|
|
property real itemSize: Math.min(root.height, root.width/view.count) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onClicked: plasmoid.expanded = !plasmoid.expanded |
|
|
|
|
|
|
|
|
|
|
|
function isConstrained() { |
|
|
|
function isConstrained() { |
|
|
|
return (plasmoid.formFactor == PlasmaCore.Types.Vertical || plasmoid.formFactor == PlasmaCore.Types.Horizontal) |
|
|
|
return (plasmoid.formFactor == PlasmaCore.Types.Vertical || plasmoid.formFactor == PlasmaCore.Types.Horizontal) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MouseArea { |
|
|
|
//Should we consider turning this into a Flow item? |
|
|
|
anchors.fill: parent |
|
|
|
Row { |
|
|
|
onClicked: plasmoid.expanded = !plasmoid.expanded |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Repeater { |
|
|
|
Repeater { |
|
|
|
id: view |
|
|
|
id: view |
|
|
|
anchors.fill: parent |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
property bool hasBattery: pmSource.data["Battery"]["Has Battery"] |
|
|
|
property bool hasBattery: pmSource.data["Battery"]["Has Battery"] |
|
|
|
|
|
|
|
|
|
|
|
@ -55,12 +52,12 @@ Row { |
|
|
|
|
|
|
|
|
|
|
|
model: singleBattery ? 1 : batteries |
|
|
|
model: singleBattery ? 1 : batteries |
|
|
|
|
|
|
|
|
|
|
|
delegate: Item { |
|
|
|
Item { |
|
|
|
id: batteryContainer |
|
|
|
id: batteryContainer |
|
|
|
|
|
|
|
|
|
|
|
property bool hasBattery: view.singleBattery ? batteries.count : model["Plugged in"] |
|
|
|
property bool hasBattery: view.singleBattery ? batteries.count : model["Plugged in"] |
|
|
|
property int percent: view.singleBattery ? batteries.cumulativePercent : model["Percent"] |
|
|
|
property int percent: view.singleBattery ? batteries.cumulativePercent : model["Percent"] |
|
|
|
property bool pluggedIn: pmSource.data["AC Adapter"] != undefined && pmSource.data["AC Adapter"]["Plugged in"] && (view.singleBattery || model["Is Power Supply"]) |
|
|
|
property bool pluggedIn: view.singleBattery ? batteries.charging : (model["Is Power Supply"] && model["State"] != "Discharging") |
|
|
|
|
|
|
|
|
|
|
|
height: root.itemSize |
|
|
|
height: root.itemSize |
|
|
|
width: root.width/view.count |
|
|
|
width: root.width/view.count |
|
|
|
@ -92,4 +89,5 @@ Row { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|