diff options
| author | ATMDA <atdma2600@gmail.com> | 2025-11-14 13:55:12 -0500 |
|---|---|---|
| committer | ATMDA <atdma2600@gmail.com> | 2025-11-14 13:55:12 -0500 |
| commit | f39c4b6e6c446bf503acaf1cb5468c3e98b46d52 (patch) | |
| tree | f4583254f58df2bfea732bb7c9f66513fec56e89 /modules/controlcenter | |
| parent | controlcenter: fix bug, couldn't select wifi network while ethernet interface... (diff) | |
| download | caelestia-shell-f39c4b6e6c446bf503acaf1cb5468c3e98b46d52.tar.gz caelestia-shell-f39c4b6e6c446bf503acaf1cb5468c3e98b46d52.tar.bz2 caelestia-shell-f39c4b6e6c446bf503acaf1cb5468c3e98b46d52.zip | |
controlcenter: fix bug, connection information update event
Diffstat (limited to 'modules/controlcenter')
| -rw-r--r-- | modules/controlcenter/network/WirelessDetails.qml | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/modules/controlcenter/network/WirelessDetails.qml b/modules/controlcenter/network/WirelessDetails.qml index ff86b8a..334c4b3 100644 --- a/modules/controlcenter/network/WirelessDetails.qml +++ b/modules/controlcenter/network/WirelessDetails.qml @@ -23,6 +23,11 @@ Item { } onNetworkChanged: { + // Restart timer when network changes + connectionUpdateTimer.stop(); + if (network && network.ssid) { + connectionUpdateTimer.start(); + } updateDeviceDetails(); checkSavedProfile(); } @@ -38,11 +43,56 @@ Item { function onActiveChanged() { updateDeviceDetails(); } + function onWirelessDeviceDetailsChanged() { + // When details are updated, check if we should stop the timer + if (network && network.ssid) { + const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid); + if (isActive && Nmcli.wirelessDeviceDetails && Nmcli.wirelessDeviceDetails !== null) { + // We have details for the active network, stop the timer + connectionUpdateTimer.stop(); + } + } + } + } + + Timer { + id: connectionUpdateTimer + interval: 500 + repeat: true + running: network && network.ssid + onTriggered: { + // Periodically check if network becomes active and update details + if (network) { + const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid); + if (isActive) { + // Network is active - check if we have details + if (!Nmcli.wirelessDeviceDetails || Nmcli.wirelessDeviceDetails === null) { + // Network is active but we don't have details yet, fetch them + Nmcli.getWirelessDeviceDetails("", () => { + // After fetching, check if we got details - if not, timer will try again + }); + } else { + // We have details, can stop the timer + connectionUpdateTimer.stop(); + } + } else { + // Network is not active, clear details + if (Nmcli.wirelessDeviceDetails !== null) { + Nmcli.wirelessDeviceDetails = null; + } + } + } + } } function updateDeviceDetails(): void { - if (network && Nmcli.active && Nmcli.active.ssid === network.ssid) { - Nmcli.getWirelessDeviceDetails("", () => {}); + if (network && network.ssid) { + const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid); + if (isActive) { + Nmcli.getWirelessDeviceDetails("", () => {}); + } else { + Nmcli.wirelessDeviceDetails = null; + } } else { Nmcli.wirelessDeviceDetails = null; } |