From 8ad06262e9bd765eb40bba9019024d405180459e Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Mon, 18 Apr 2022 14:29:54 -0400 Subject: [PATCH] Fix Wi-Fi interface bug when no networks are found --- toast.cpp | 3 +-- wifidialog.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/toast.cpp b/toast.cpp index 9a88e2f..305d4f8 100644 --- a/toast.cpp +++ b/toast.cpp @@ -83,8 +83,7 @@ void toast::exitSlot(int exitCode) { toast::close(); } else { - ui->messageLabel->setText("No networks found"); - QTimer::singleShot(global::toast::delay, this, SLOT(close())); + emit showToast("No networks found"); } } diff --git a/wifidialog.cpp b/wifidialog.cpp index f1a176d..34e3f6c 100644 --- a/wifidialog.cpp +++ b/wifidialog.cpp @@ -52,12 +52,14 @@ void wifiDialog::checkWifiNetworks() { } void wifiDialog::printWifiNetworks() { - string_checkconfig_ro("/run/wifi_networks_list"); - if(checkconfig_str_val == "") { + if(readFile("/run/wifi_networks_list").isEmpty()) { + log("Wi-Fi networks list empty", className); + QFile::remove("/run/wifi_networks_list"); emit quit(1); wifiDialog::close(); } else { + log("Parsing Wi-Fi networks list", className); QFile wifiNetworksListFile("/run/wifi_networks_list"); wifiNetworksListFile.open(QIODevice::ReadWrite); QTextStream in (&wifiNetworksListFile);