kcms/wifi: Fix toggle not updating the first time

Fixes https://invent.kde.org/plasma/plasma-mobile/-/issues/363
This commit is contained in:
Devin Lin 2024-06-27 22:53:29 -04:00
parent 8f9db42e8f
commit 1dfcda39d3

View file

@ -3,7 +3,7 @@
// SPDX-License-Identifier: LGPL-2.0-or-later
import QtQuick
import QtQuick.Layouts
import QtQuick.Layouts
import QtQuick.Controls as Controls
import org.kde.plasma.networkmanagement as PlasmaNM
@ -86,7 +86,7 @@ SimpleKCM {
id: wifiSwitch
text: i18n("Wi-Fi")
checked: enabledConnections.wirelessEnabled
onClicked: {
onCheckedChanged: {
handler.enableWireless(checked);
checked = Qt.binding(() => enabledConnections.wirelessEnabled);
}
@ -119,11 +119,11 @@ SimpleKCM {
model: mobileProxyModel
delegate: ConnectionItemDelegate {
editMode: root.editMode
// 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: shouldDisplay
}
@ -159,7 +159,7 @@ SimpleKCM {
property bool shouldDisplay: !((Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated)
onShouldDisplayChanged: availableCard.updateCount()
visible: shouldDisplay
}
}