mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-01 01:07:33 +00:00
kcms/wifi: Don't show available card if there are no connections
This commit is contained in:
parent
a41d567743
commit
6b067b4a97
2 changed files with 22 additions and 4 deletions
|
|
@ -13,7 +13,7 @@ import org.kde.ksvg as KSvg
|
||||||
import org.kde.kirigamiaddons.formcard 1 as FormCard
|
import org.kde.kirigamiaddons.formcard 1 as FormCard
|
||||||
|
|
||||||
FormCard.AbstractFormDelegate {
|
FormCard.AbstractFormDelegate {
|
||||||
id: delegate
|
id: root
|
||||||
|
|
||||||
property bool editMode
|
property bool editMode
|
||||||
property var map : []
|
property var map : []
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ SimpleKCM {
|
||||||
onShouldDisplayChanged: savedCard.updateCount()
|
onShouldDisplayChanged: savedCard.updateCount()
|
||||||
|
|
||||||
// separate property for visible since visible is false when the whole card is not visible
|
// separate property for visible since visible is false when the whole card is not visible
|
||||||
visible: (Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated
|
visible: shouldDisplay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -135,13 +135,31 @@ SimpleKCM {
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormCard {
|
FormCard.FormCard {
|
||||||
visible: enabledConnections.wirelessEnabled
|
id: availableCard
|
||||||
|
visible: enabledConnections.wirelessEnabled && count > 0
|
||||||
|
|
||||||
|
// number of visible entries
|
||||||
|
property int count: 0
|
||||||
|
function updateCount() {
|
||||||
|
count = 0;
|
||||||
|
for (let i = 0; i < availableRepeater.count; i++) {
|
||||||
|
let item = availableRepeater.itemAt(i);
|
||||||
|
if (item && item.shouldDisplay) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
|
id: availableRepeater
|
||||||
model: mobileProxyModel
|
model: mobileProxyModel
|
||||||
delegate: ConnectionItemDelegate {
|
delegate: ConnectionItemDelegate {
|
||||||
editMode: root.editMode
|
editMode: root.editMode
|
||||||
visible: !((Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated)
|
|
||||||
|
property bool shouldDisplay: !((Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated)
|
||||||
|
onShouldDisplayChanged: availableCard.updateCount()
|
||||||
|
|
||||||
|
visible: shouldDisplay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue