Fix bug wifi user interface can not refresh after connect hidden wifi

This commit is contained in:
chenlelin 2021-05-08 09:28:33 +08:00
parent 135fce413f
commit d2ef240613
4 changed files with 15 additions and 2 deletions

View File

@ -332,7 +332,7 @@ void BackThread::execConnHiddenWifiWPA(QString wifiName, QString wifiPassword)
QString tmpPath = "/tmp/kylin-nm-btoutput-" + QDir::home().dirName();
QString cmd = "nmcli device wifi connect '" + wifiName + "' password '" + wifiPassword + "' hidden yes > " + tmpPath + " 2>&1";
// qDebug() << Q_FUNC_INFO << cmd << tmpPath;
qDebug() << Q_FUNC_INFO << cmd << tmpPath;
int status = Utils::m_system(cmd.toUtf8().data());
if (status != 0) {
syslog(LOG_ERR, "execute 'nmcli device wifi connect' in function 'on_btnConnect_clicked' failed");
@ -350,7 +350,7 @@ void BackThread::execConnHiddenWifiWPA(QString wifiName, QString wifiPassword)
x = 1;
sleep(10);//nm扫描冷却为10s
} else {
emit connDone(0);
emit connDone(6);
x = 0;
}
// qDebug() << Q_FUNC_INFO << x << text;

View File

@ -693,6 +693,8 @@ void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason)
if (is_btnLanList_clicked == 1&& is_stop_check_net_state==0) {
onBtnNetListClicked(0);
}
qDebug() << "00000000000000000 " <<is_connect_hide_wifi;
if (!is_init_wifi_list && !is_connect_hide_wifi && is_stop_check_net_state==0) {
is_stop_check_net_state = 1;
if (is_btnWifiList_clicked == 1) {
@ -3686,6 +3688,7 @@ void MainWindow::connWifiDone(int connFlag)
} else if (connFlag == 1) {
// is_stop_check_net_state = 0;
is_connect_net_failed = 1;
is_connect_hide_wifi = 0;
QString txt(tr("Confirm your Wi-Fi password or usable of wireless card"));
objKyDBus->showDesktopNotify(txt);
} else if (connFlag == 3) {
@ -3698,7 +3701,12 @@ void MainWindow::connWifiDone(int connFlag)
is_connect_net_failed = 1;
QString txt(tr("Selected Wifi has not been scanned."));
objKyDBus->showDesktopNotify(txt);
} else if (connFlag == 6) {
this->ksnm->execGetWifiList(this->wcardname);
QString txt(tr("Connect Hidden Wifi Success"));
objKyDBus->showDesktopNotify(txt);
}
this->stopLoading();
is_stop_check_net_state = 0;
}

Binary file not shown.

View File

@ -1546,6 +1546,11 @@
<source>Selected Wifi has not been scanned.</source>
<translation type="unfinished">wifi</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="3705"/>
<source>Connect Hidden Wifi Success</source>
<translation type="unfinished">Wifi成功</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="230"/>
<source>Ethernet Networks</source>