Wi-Fi connect dialog: Remove Wi-Fi modules if 'Cancel' button clicked

This commit is contained in:
Nicolas Mailloux 2022-04-02 12:30:03 -04:00
parent e4a21f5c85
commit dc93feed17
2 changed files with 11 additions and 0 deletions

View file

@ -911,20 +911,24 @@ void MainWindow::updateWifiIcon(int mode) {
* mode 3: connected
*/
if(mode == 0) {
lastWifiState = 0;
QTimer *wifiIconTimer = new QTimer(this);
wifiIconTimer->setInterval(10000);
connect(wifiIconTimer, SIGNAL(timeout()), this, SLOT(setWifiIcon()));
wifiIconTimer->start();
}
if(mode == 1) {
lastWifiState = 1;
ui->wifiBtn->setIcon(QIcon(":/resources/wifi-off.png"));
ui->wifiBtn->setIconSize(QSize(wifiIconWidth, wifiIconHeight));
}
if(mode == 2) {
lastWifiState = 2;
ui->wifiBtn->setIcon(QIcon(":/resources/wifi-standby.png"));
ui->wifiBtn->setIconSize(QSize(wifiIconWidth, wifiIconHeight));
}
if(mode == 3) {
lastWifiState = 3;
ui->wifiBtn->setIcon(QIcon(":/resources/wifi-connected.png"));
ui->wifiBtn->setIconSize(QSize(wifiIconWidth, wifiIconHeight));
}

View file

@ -89,6 +89,13 @@ void wifiDialog::centerDialog() {
void wifiDialog::on_cancelBtn_clicked()
{
string_writeconfig("/opt/ibxd", "toggle_wifi_off\n");
while(true) {
if(QFile::exists("/run/toggle_wifi_off_done")) {
QFile::remove("/run/toggle_wifi_off_done");
break;
}
}
emit quit(0);
wifiDialog::close();
}