mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
[battery]: port battery info to new model
This change ports BatteryInfo away from dataengines to the new battery model that is also used for Plasma Desktop. Signed-off-by: Sebastian Kügler <sebas@kde.org>
This commit is contained in:
parent
3353d45249
commit
ab957a84f9
1 changed files with 10 additions and 10 deletions
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Sebastian Kügler <sebas@kde.org>
|
||||
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
|
||||
* SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org>
|
||||
*
|
||||
|
|
@ -8,18 +9,17 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.plasma.plasma5support as P5Support
|
||||
import org.kde.plasma.workspace.components as PW
|
||||
import org.kde.plasma.private.battery
|
||||
|
||||
QtObject {
|
||||
property bool isVisible: pmSource.data["Battery"]["Has Cumulative"]
|
||||
property int percent: pmSource.data["Battery"]["Percent"]
|
||||
property bool pluggedIn: pmSource.data["AC Adapter"] ? pmSource.data["AC Adapter"]["Plugged in"] : false
|
||||
Item {
|
||||
|
||||
property P5Support.DataSource pmSource: P5Support.DataSource {
|
||||
engine: "powermanagement"
|
||||
connectedSources: ["Battery", "AC Adapter"]
|
||||
BatteryControlModel {
|
||||
id: batteryControl
|
||||
}
|
||||
|
||||
property bool isVisible: batteryControl.hasInternalBatteries
|
||||
property int percent: batteryControl.percent
|
||||
property bool pluggedIn: batteryControl.pluggedIn
|
||||
property alias batteries: batteryControl
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue