diff --git a/src/backthread.cpp b/src/backthread.cpp index 15877374..1617c9d8 100644 --- a/src/backthread.cpp +++ b/src/backthread.cpp @@ -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; } } } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7a62e78d..94467ddb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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 topwifis = topWifiListWidget->findChildren(); + 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); diff --git a/src/wpawifidialog.cpp b/src/wpawifidialog.cpp index d989206e..652d4504 100644 --- a/src/wpawifidialog.cpp +++ b/src/wpawifidialog.cpp @@ -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);