Fix Wi-Fi interface bug when no networks are found

This commit is contained in:
Nicolas Mailloux 2022-04-18 14:29:54 -04:00
parent 5838ff1833
commit 8ad06262e9
2 changed files with 5 additions and 4 deletions

View file

@ -83,8 +83,7 @@ void toast::exitSlot(int exitCode) {
toast::close(); toast::close();
} }
else { else {
ui->messageLabel->setText("No networks found"); emit showToast("No networks found");
QTimer::singleShot(global::toast::delay, this, SLOT(close()));
} }
} }

View file

@ -52,12 +52,14 @@ void wifiDialog::checkWifiNetworks() {
} }
void wifiDialog::printWifiNetworks() { void wifiDialog::printWifiNetworks() {
string_checkconfig_ro("/run/wifi_networks_list"); if(readFile("/run/wifi_networks_list").isEmpty()) {
if(checkconfig_str_val == "") { log("Wi-Fi networks list empty", className);
QFile::remove("/run/wifi_networks_list");
emit quit(1); emit quit(1);
wifiDialog::close(); wifiDialog::close();
} }
else { else {
log("Parsing Wi-Fi networks list", className);
QFile wifiNetworksListFile("/run/wifi_networks_list"); QFile wifiNetworksListFile("/run/wifi_networks_list");
wifiNetworksListFile.open(QIODevice::ReadWrite); wifiNetworksListFile.open(QIODevice::ReadWrite);
QTextStream in (&wifiNetworksListFile); QTextStream in (&wifiNetworksListFile);