mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
statusbar: fix hidden batteries from taking up space in the statusbar
I noticed at some point after updating my main phone, that non visible external device batteries started taking up extra space in the statusbar. This fixes the issue by filtering out external device batteries by using KSortFilterProxyModel.
Before (with external peripheral connected)
{width=399 height=28}
After
{width=399 height=28}
This commit is contained in:
parent
90fce61b40
commit
db98f2cd86
2 changed files with 11 additions and 3 deletions
|
|
@ -162,6 +162,7 @@ target_link_libraries(mobileshellplugin
|
|||
KF6::Service
|
||||
KF6::Package
|
||||
KF6::ConfigGui
|
||||
KF6::ItemModels
|
||||
LayerShellQt::Interface
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue