Merge pull request #72 from mammonsama666/0204-dev
fix(wifi): Wifi can not be connected which security is changed to be psk from eap.
This commit is contained in:
commit
041616e259
|
@ -213,10 +213,10 @@ void BackThread::execConnLan(QString connName, QString ifname, QString connectTy
|
|||
KylinDBus objKyDbus;
|
||||
|
||||
//先断开当前网卡对应的已连接有线网
|
||||
QString uuid = objKyDbus.getConnLanNameByIfname(ifname);
|
||||
if (uuid != "--") {
|
||||
kylin_network_set_con_down(uuid.toUtf8().data());
|
||||
}
|
||||
// QString uuid = objKyDbus.getConnLanNameByIfname(ifname);
|
||||
// if (uuid != "--") {
|
||||
// kylin_network_set_con_down(uuid.toUtf8().data());
|
||||
// }
|
||||
|
||||
bool wiredCableState = objKyDbus.getWiredCableStateByIfname(ifname);
|
||||
|
||||
|
|
|
@ -2918,7 +2918,6 @@ void MainWindow::connLanDone(int connFlag)
|
|||
|
||||
if (connFlag == 1) {
|
||||
syslog(LOG_DEBUG, "without net line connect to computer.");
|
||||
is_stop_check_net_state = 0;
|
||||
|
||||
QString txt(tr("Without Lan Cable"));
|
||||
objKyDBus->showDesktopNotify(txt);
|
||||
|
@ -2977,6 +2976,7 @@ void MainWindow::connLanDone(int connFlag)
|
|||
}
|
||||
|
||||
this->stopLoading();
|
||||
this->is_stop_check_net_state = 0;
|
||||
}
|
||||
|
||||
void MainWindow::connWifiDone(int connFlag)
|
||||
|
|
|
@ -559,6 +559,26 @@ void OneConnForm::toConnectWirelessNetwork()
|
|||
}
|
||||
}
|
||||
|
||||
//有配置文件,需要判断一下当前配置文件wifi安全性是不是wpa-eap,若是,需要把原配置文件删除,重新配置
|
||||
QProcess * process = new QProcess(this);
|
||||
process->start(QString("nmcli -f 802-11-wireless-security.key-mgmt connection show %1").arg(lbNameText->text()));
|
||||
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
||||
process->deleteLater();
|
||||
});
|
||||
connect(process, &QProcess::readyReadStandardOutput, this, [ = ]() {
|
||||
QString str = process->readAllStandardOutput();
|
||||
key_mgmt = str.mid(str.lastIndexOf(" ") + 1, str.length() - str.lastIndexOf(" ") - 2);
|
||||
});
|
||||
process->waitForFinished();
|
||||
if (QString::compare(key_mgmt, "wpa-eap") == 0) {
|
||||
//原配置文件是企业wifi,删掉,请求输入新的密码
|
||||
QString cmdStr = "nmcli connection delete " + lbNameText->text();
|
||||
Utils::m_system(cmdStr.toUtf8().data());
|
||||
psk_flag = 0;
|
||||
slotConnWifiResult(2); //现在已无配置文件,申请输入密码
|
||||
return;
|
||||
}
|
||||
|
||||
if (isWifiConfExist(lbNameText->text())) {
|
||||
//有配置文件,获取密码存储策略
|
||||
QProcess * process = new QProcess(this);
|
||||
|
|
|
@ -141,6 +141,7 @@ private:
|
|||
QLabel * lbFreq = nullptr;
|
||||
QLabel * lbNameText = nullptr;
|
||||
QHBoxLayout * lbNameLyt = nullptr;
|
||||
QString key_mgmt;
|
||||
|
||||
signals:
|
||||
void selectedOneWifiForm(QString wifiName, int extendLength);
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "wpawifidialog.h"
|
||||
#include "ui_wpawifidialog.h"
|
||||
#include "kylin-network-interface.h"
|
||||
#include "backthread.h"
|
||||
#include "utils.h"
|
||||
#include "mainwindow.h"
|
||||
#include "wireless-security/kylinheadfile.h"
|
||||
|
@ -440,6 +439,24 @@ void WpaWifiDialog::slot_on_connectBtn_clicked() {
|
|||
QString cmdStr = "nmcli connection modify " + nameEditor->text() + " ipv4.method auto";
|
||||
int res = Utils::m_system(cmdStr.toUtf8().data());
|
||||
if (res == 0) {
|
||||
//有配置文件,需要判断一下当前配置文件wifi安全性是不是wpa-eap,若不是,需要把原配置文件删除,重新配置
|
||||
QProcess * process = new QProcess(this);
|
||||
process->start(QString("nmcli -f 802-11-wireless-security.key-mgmt connection show %1").arg(nameEditor->text()));
|
||||
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
||||
process->deleteLater();
|
||||
});
|
||||
connect(process, &QProcess::readyReadStandardOutput, this, [ = ]() {
|
||||
QString str = process->readAllStandardOutput();
|
||||
key_mgmt = str.mid(str.lastIndexOf(" ") + 1, str.length() - str.lastIndexOf(" ") - 2);
|
||||
});
|
||||
process->waitForFinished();
|
||||
if (QString::compare(key_mgmt, "wpa-eap")) {
|
||||
//原配置文件不是企业wifi,删掉重新创建
|
||||
QString cmdStr = "nmcli connection delete " + nameEditor->text();
|
||||
Utils::m_system(cmdStr.toUtf8().data());
|
||||
goto next;
|
||||
}
|
||||
process->waitForFinished();
|
||||
//有网络配置文件,接下来修改网络配置,然后激活连接
|
||||
qDebug()<<"qDebug: 有配置文件,修改配置后激活:"<<"\n"<<
|
||||
"qDebug: nmcli connection modify " + nameEditor->text() + " 802-1x.eap " + eapCombox->currentData().toString() + " 802-1x.phase2-auth "
|
||||
|
@ -452,6 +469,7 @@ void WpaWifiDialog::slot_on_connectBtn_clicked() {
|
|||
//激活连接
|
||||
activateConnection();
|
||||
} else {
|
||||
next:
|
||||
//无网络配置文件,需要新创建
|
||||
//获取网卡名称
|
||||
KylinDBus mkylindbus;
|
||||
|
|
|
@ -92,6 +92,7 @@ private:
|
|||
QStringList wifi_info;
|
||||
bool has_config;
|
||||
QStringList user_list;
|
||||
QString key_mgmt = "wpa-eap";
|
||||
|
||||
MainWindow *mw;
|
||||
|
||||
|
|
Loading…
Reference in New Issue