mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
kcms/wifi: Only show saved networks section when there is an entry
This commit is contained in:
parent
fc10a6fe10
commit
975443045b
1 changed files with 18 additions and 1 deletions
|
|
@ -99,14 +99,31 @@ SimpleKCM {
|
||||||
|
|
||||||
FormCard.FormCard {
|
FormCard.FormCard {
|
||||||
id: savedCard
|
id: savedCard
|
||||||
visible: enabledConnections.wirelessEnabled && connectedRepeater.count > 0
|
visible: enabledConnections.wirelessEnabled && count > 0
|
||||||
|
|
||||||
|
// number of visible entries
|
||||||
|
property int count: 0
|
||||||
|
function updateCount() {
|
||||||
|
count = 0;
|
||||||
|
for (let i = 0; i < connectedRepeater.count; i++) {
|
||||||
|
let item = connectedRepeater.itemAt(i);
|
||||||
|
if (item && item.shouldDisplay) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: connectedRepeater
|
id: connectedRepeater
|
||||||
model: mobileProxyModel
|
model: mobileProxyModel
|
||||||
delegate: ConnectionItemDelegate {
|
delegate: ConnectionItemDelegate {
|
||||||
editMode: root.editMode
|
editMode: root.editMode
|
||||||
|
|
||||||
// connected or saved
|
// connected or saved
|
||||||
|
property bool shouldDisplay: (Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated
|
||||||
|
onShouldDisplayChanged: savedCard.updateCount()
|
||||||
|
|
||||||
|
// separate property for visible since visible is false when the whole card is not visible
|
||||||
visible: (Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated
|
visible: (Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue