Fix bug can not refresh wifi user interface if connect hidden wifi which be connected before

This commit is contained in:
chenlelin 2021-05-08 15:12:21 +08:00
parent d2ef240613
commit f6aae7d58c
2 changed files with 6 additions and 4 deletions

View File

@ -364,8 +364,7 @@ void BackThread::execConnRememberedHiddenWifi(QString wifiName)
QProcess shellProcess; QProcess shellProcess;
shellProcess.start("nmcli -f ssid device wifi"); shellProcess.start("nmcli -f ssid device wifi");
shellProcess.waitForFinished(3000); // 等待最多3s shellProcess.waitForFinished(3000); // 等待最多3s
if (shellProcess.exitCode() == 0) if (shellProcess.exitCode() == 0) {
{
QString shellOutput = shellProcess.readAllStandardOutput(); QString shellOutput = shellProcess.readAllStandardOutput();
QStringList wlist = shellOutput.split("\n"); QStringList wlist = shellOutput.split("\n");
bool is_hidden = true; bool is_hidden = true;
@ -377,7 +376,11 @@ void BackThread::execConnRememberedHiddenWifi(QString wifiName)
if (! is_hidden) { if (! is_hidden) {
QString cmd = "nmcli connection up '" + wifiName + "'"; QString cmd = "nmcli connection up '" + wifiName + "'";
int res = Utils::m_system(cmd.toUtf8().data()); int res = Utils::m_system(cmd.toUtf8().data());
emit connDone(res); if (res == 0) {
emit connDone(6);
} else {
emit connDone(res);
}
} else { } else {
//已保存的wifi没有在wifi列表找到隐藏wifi保存后也会出现在wifi列表则当前区域无法连接此wifi //已保存的wifi没有在wifi列表找到隐藏wifi保存后也会出现在wifi列表则当前区域无法连接此wifi
syslog(LOG_DEBUG, "Choosen wifi can not be sacnned in finishedProcess() in dlghidewifiwpa.cpp 377."); syslog(LOG_DEBUG, "Choosen wifi can not be sacnned in finishedProcess() in dlghidewifiwpa.cpp 377.");

View File

@ -694,7 +694,6 @@ void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason)
onBtnNetListClicked(0); onBtnNetListClicked(0);
} }
qDebug() << "00000000000000000 " <<is_connect_hide_wifi;
if (!is_init_wifi_list && !is_connect_hide_wifi && is_stop_check_net_state==0) { if (!is_init_wifi_list && !is_connect_hide_wifi && is_stop_check_net_state==0) {
is_stop_check_net_state = 1; is_stop_check_net_state = 1;
if (is_btnWifiList_clicked == 1) { if (is_btnWifiList_clicked == 1) {