From ab957a84f99aa85670b46e8cf31c311c4fb5ea0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 3 Oct 2024 17:23:11 +0200 Subject: [PATCH] [battery]: port battery info to new model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../qml/dataproviders/BatteryInfo.qml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/components/mobileshell/qml/dataproviders/BatteryInfo.qml b/components/mobileshell/qml/dataproviders/BatteryInfo.qml index 96b4f573..97c01c83 100644 --- a/components/mobileshell/qml/dataproviders/BatteryInfo.qml +++ b/components/mobileshell/qml/dataproviders/BatteryInfo.qml @@ -1,4 +1,5 @@ /* + * SPDX-FileCopyrightText: 2024 Sebastian Kügler * SPDX-FileCopyrightText: 2021 Devin Lin * SPDX-FileCopyrightText: 2019 Marco Martin * @@ -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 }