controlcenter: fix bug, connection information update event
This commit is contained in:
parent
c30022b75e
commit
f39c4b6e6c
1 changed files with 52 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue