set scannerEnabled when popout is visible + remove scan button
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 18s
Python / lint-format (pull_request) Successful in 20s
Python / test (pull_request) Successful in 47s
C++ / build (pull_request) Successful in 3m9s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m15s
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 18s
Python / lint-format (pull_request) Successful in 20s
Python / test (pull_request) Successful in 47s
C++ / build (pull_request) Successful in 3m9s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m15s
This commit is contained in:
+13
-54
@@ -8,10 +8,21 @@ Singleton {
|
||||
id: root
|
||||
|
||||
readonly property list<NetworkDevice> devices: Networking.devices.values
|
||||
readonly property list<Network> networks: initialBuildNetworks()
|
||||
readonly property list<Network> networks: {
|
||||
const list = []
|
||||
for (const d of wifiDevices)
|
||||
list.push(...d.networks.values)
|
||||
return list;
|
||||
}
|
||||
property bool scanning: false
|
||||
readonly property list<WifiDevice> wifiDevices: devices.filter(d => wifiDevice(d))
|
||||
readonly property bool wifiEnabled: Networking.wifiEnabled
|
||||
property bool active: false
|
||||
|
||||
onActiveChanged: {
|
||||
for (const d of wifiDevices)
|
||||
d.scannerEnabled = active;
|
||||
}
|
||||
|
||||
// Original code
|
||||
|
||||
@@ -53,37 +64,8 @@ Singleton {
|
||||
}
|
||||
//
|
||||
|
||||
function initialBuildNetworks(): void {
|
||||
const init = [];
|
||||
for (const d of wifiDevices) {
|
||||
d.scannerEnabled = true;
|
||||
init.push(...d.networks.values);
|
||||
d.scannerEnabled = false;
|
||||
}
|
||||
|
||||
networks = init;
|
||||
}
|
||||
|
||||
function isSecure(security): bool {
|
||||
return !(security === WifiSecurityType.Open);
|
||||
}
|
||||
|
||||
function rebuildNetworks(): void {
|
||||
if (!scanning)
|
||||
return;
|
||||
|
||||
const next = [];
|
||||
for (const d of wifiDevices) {
|
||||
next.push(...d.networks.values);
|
||||
}
|
||||
|
||||
networks = next;
|
||||
}
|
||||
|
||||
function rescanWifi(): void {
|
||||
scanning = true;
|
||||
setScan(true);
|
||||
scanTimer.restart();
|
||||
return (security === WifiSecurityType.WpaPsk || security === WifiSecurityType.Wpa2Psk || security === WifiSecurityType.Sae);
|
||||
}
|
||||
|
||||
function setScan(value: bool): void {
|
||||
@@ -99,27 +81,4 @@ Singleton {
|
||||
function wifiDevice(dev): bool {
|
||||
return dev.type === DeviceType.Wifi;
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: scanTimer
|
||||
|
||||
interval: 5000
|
||||
repeat: false
|
||||
|
||||
onTriggered: {
|
||||
root.rebuildNetworks();
|
||||
root.setScan(false);
|
||||
root.scanning = false;
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 500
|
||||
repeat: true
|
||||
running: root.scanning
|
||||
|
||||
onTriggered: {
|
||||
root.rebuildNetworks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user