diff --git a/components/mobileshell/CMakeLists.txt b/components/mobileshell/CMakeLists.txt index e60c45c8..c66c2ad6 100644 --- a/components/mobileshell/CMakeLists.txt +++ b/components/mobileshell/CMakeLists.txt @@ -162,6 +162,7 @@ target_link_libraries(mobileshellplugin KF6::Service KF6::Package KF6::ConfigGui + KF6::ItemModels LayerShellQt::Interface ) diff --git a/components/mobileshell/qml/statusbar/indicators/BatteryIndicator.qml b/components/mobileshell/qml/statusbar/indicators/BatteryIndicator.qml index 5eaa6517..fb26fdbb 100644 --- a/components/mobileshell/qml/statusbar/indicators/BatteryIndicator.qml +++ b/components/mobileshell/qml/statusbar/indicators/BatteryIndicator.qml @@ -10,6 +10,7 @@ import QtQuick 2.6 import QtQuick.Layouts 1.4 import org.kde.kirigami 2.20 as Kirigami +import org.kde.kitemmodels import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.workspace.components 2.0 as PW @@ -26,7 +27,7 @@ RowLayout { id: batteryRepeater spacing: 0 - model: MobileShell.BatteryInfo.batteries + model: filterModel orientation: ListView.Horizontal Layout.alignment: Qt.AlignVCenter @@ -34,6 +35,14 @@ RowLayout { Layout.fillHeight: true Layout.fillWidth: false + KSortFilterProxyModel { + id: filterModel + sourceModel: MobileShell.BatteryInfo.batteries + + filterRoleName: "Type" + filterString: "Battery" // only show internal batteries + } + delegate: RowLayout { id: batteryBase @@ -42,8 +51,6 @@ RowLayout { height: batteryRepeater.height - visible: Type === "Battery" // only show the internal battery - PW.BatteryIcon { id: battery