prevent duplicate scan triggers

This commit is contained in:
notiant
2026-03-22 23:10:01 +01:00
committed by GitHub
parent 849bf16388
commit a624421047
2 changed files with 10 additions and 18 deletions
+8 -7
View File
@@ -36,6 +36,7 @@ SmartPanel {
ethernetInfoExpanded = false; ethernetInfoExpanded = false;
if (NetworkService.wifiEnabled && !NetworkService.scanningActive) { if (NetworkService.wifiEnabled && !NetworkService.scanningActive) {
NetworkService.scan(); NetworkService.scan();
NetworkService.refreshActiveWifiDetails();
} }
} else { } else {
if (NetworkService.ethernetConnected) { if (NetworkService.ethernetConnected) {
@@ -50,11 +51,13 @@ SmartPanel {
onEffectivelyVisibleChanged: { onEffectivelyVisibleChanged: {
if (effectivelyVisible) { if (effectivelyVisible) {
SystemStatService.registerComponent("network-panel"); SystemStatService.registerComponent("network-panel");
NetworkService.scan(); if (NetworkService.wifiEnabled && !NetworkService.scanningActive) {
// Preload active WiFi details so Info shows instantly NetworkService.scan();
NetworkService.refreshActiveWifiDetails(); NetworkService.refreshActiveWifiDetails();
// Also fetch Ethernet details if connected }
NetworkService.refreshActiveEthernetDetails(); if (NetworkService.ethernetConnected) {
NetworkService.refreshActiveEthernetDetails();
}
} else { } else {
SystemStatService.unregisterComponent("network-panel"); SystemStatService.unregisterComponent("network-panel");
} }
@@ -178,14 +181,12 @@ SmartPanel {
text: I18n.tr("common.wifi") text: I18n.tr("common.wifi")
tabIndex: 0 tabIndex: 0
checked: modeTabBar.currentIndex === 0 checked: modeTabBar.currentIndex === 0
enabled: NetworkService.wifiAvailable
} }
NTabButton { NTabButton {
text: I18n.tr("common.ethernet") text: I18n.tr("common.ethernet")
tabIndex: 1 tabIndex: 1
checked: modeTabBar.currentIndex === 1 checked: modeTabBar.currentIndex === 1
enabled: NetworkService.ethernetAvailable
} }
} }
} }
@@ -75,26 +75,17 @@ Item {
onEffectivelyVisibleChanged: { onEffectivelyVisibleChanged: {
if (effectivelyVisible) { if (effectivelyVisible) {
SystemStatService.registerComponent("wifi-subtab"); SystemStatService.registerComponent("wifi-subtab");
if (NetworkService.wifiEnabled && !NetworkService.scanningActive) { if (NetworkService.wifiEnabled && !NetworkService.scanningActive && !showOnlyLists) {
NetworkService.scan(); NetworkService.scan();
NetworkService.refreshActiveWifiDetails();
} }
} else { } else {
SystemStatService.unregisterComponent("wifi-subtab"); SystemStatService.unregisterComponent("wifi-subtab");
NetworkService.scanningActive = false;
}
}
Component.onCompleted: {
if (effectivelyVisible) {
SystemStatService.registerComponent("wifi-subtab");
} }
} }
Component.onDestruction: { Component.onDestruction: {
SystemStatService.unregisterComponent("wifi-subtab"); SystemStatService.unregisterComponent("wifi-subtab");
if (effectivelyVisible) {
NetworkService.scanningActive = false;
}
} }
// Actions // Actions