Networking: Only refresh when visible (#21445)

* only refresh when visible

* catch other case
old-commit-hash: 4000d4a8d2bdcf127a323d788064e0fd43138321
This commit is contained in:
sshane
2021-06-30 17:24:44 -07:00
committed by GitHub
parent 237c861b20
commit 90e49777ec

View File

@@ -112,7 +112,6 @@ void WifiManager::refreshNetworks() {
seen_ssids.push_back(network.ssid);
seen_networks.push_back(network);
}
}
QString WifiManager::get_ipv4_address() {
@@ -375,8 +374,10 @@ void WifiManager::stateChange(unsigned int new_state, unsigned int previous_stat
emit wrongPassword(connecting_to_network);
} else if (new_state == state_connected) {
connecting_to_network = "";
refreshNetworks();
emit refreshSignal();
if (this->isVisible()) {
refreshNetworks();
emit refreshSignal();
}
}
}
@@ -386,8 +387,10 @@ void WifiManager::propertyChange(const QString &interface, const QVariantMap &pr
if (knownConnections.isEmpty()) {
knownConnections = listConnections();
}
refreshNetworks(); // TODO: only refresh on first scan, then use AccessPointAdded and Removed signals
emit refreshSignal();
if (this->isVisible()) {
refreshNetworks(); // TODO: only refresh on first scan, then use AccessPointAdded and Removed signals
emit refreshSignal();
}
}
}