Merge pull request #62 from mammonsama666/1231-dev

fix(Wifi): Wifilist display incorrectly.
This commit is contained in:
chenlelin 2021-01-03 10:32:56 +08:00 committed by GitHub
commit c3893eed0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 7 deletions

View File

@ -96,12 +96,13 @@ IFace* BackThread::execGetIface()
if (istateStr == "unmanaged" || istateStr == "unavailable") {
iface->wstate = 2; //switch of wireless device is off
}
if (istateStr == "disconnected") {
} else if (istateStr == "disconnected") {
iface->wstate = 1; //wireless network is disconnected
}
if (istateStr == "connected") {
} else if (istateStr == "connected") {
iface->wstate = 0; //wireless network is connected
} else {
//连接中,正在配置
iface->wstate = 3;
}
}
}

View File

@ -1101,7 +1101,6 @@ void MainWindow::onBtnWifiClicked(int flag)
if (checkWlOn()) {
if (flag != 4) { //以防第二张无线网卡插入时断网
is_stop_check_net_state = 1;
qDebug() << "aaa111";
objKyDBus->setWifiSwitchState(false);
lbTopWifiList->hide();
btnAddNet->hide();
@ -1287,6 +1286,29 @@ void MainWindow::on_btnWifiList_clicked()
this->startLoading();
this->ksnm->execGetWifiList();
} else if (iface->wstate == 3) { //连接中正在配置wifi设备
btnWireless->setSwitchStatus(true);
lbTopWifiList->show();
btnAddNet->show();
QList<OneConnForm*> topwifis = topWifiListWidget->findChildren<OneConnForm*>();
foreach(OneConnForm* topwifi, topwifis)
{
delete topwifi;
topwifi = NULL;
}
// 当前连接的wifi
OneConnForm *ccf = new OneConnForm(topWifiListWidget, this, confForm, ksnm);
ccf->setName(tr("Not connected"));//"当前未连接任何 Wifi"
ccf->setSignal("0", "--");
ccf->setRate("0");
ccf->setConnedString(1, tr("Disconnected"), "");//"未连接"
ccf->isConnected = false;
ccf->setTopItem(false);
ccf->setAct(true);
ccf->move(L_VERTICAL_LINE_TO_ITEM, 0);
ccf->show();
} else {
qDebug()<<"debug: WiFi的开关已经关闭";
btnWireless->setSwitchStatus(false);

View File

@ -339,7 +339,8 @@ void WpaWifiDialog::slot_on_connectBtn_clicked() {
appendWifiInfo(nameEditor->text(), eapCombox->currentData().toString(), innerCombox->currentData().toString(), userEditor->text(), askPwdBtn->isChecked());
has_config = true;
}
QString cmdStr = "nmcli connection modify " + nameEditor->text() + " 802-1x.password " + pwdEditor->text();
// QString cmdStr = "nmcli connection modify " + nameEditor->text() + " 802-1x.password " + pwdEditor->text();
QString cmdStr = "nmcli connection modify " + nameEditor->text() + " ipv4.method auto";
int res = Utils::m_system(cmdStr.toUtf8().data());
if (res == 0) {
//有网络配置文件,密码已修改,接下来修改用户名和其他配置,然后激活连接
@ -414,7 +415,7 @@ void WpaWifiDialog::activateConnection() {
Utils::m_system(cmdStr_2.toUtf8().data());
syslog(LOG_DEBUG, "execute 'nmcli connection up' in function 'activateConnection' time out");
qDebug() << "qDebug: activate time out!";
qDebug() << "qDebug: 连接超时(12秒超时时间)";
qDebug() << "qDebug: 连接超时(30秒超时时间)";
});
//设置超时时间
timeout->start(30 * 1000);