Merge branch '1110' into 'dbus-interface'
详情页安全类型判断 See merge request kylin-desktop/kylin-nm!395
This commit is contained in:
commit
cbbe33a665
|
@ -430,13 +430,16 @@ void NetDetail::getBaseInfo(ConInfo &conInfo)
|
||||||
//无线特有
|
//无线特有
|
||||||
conInfo.strSecType = item.m_secuType;
|
conInfo.strSecType = item.m_secuType;
|
||||||
if (conInfo.strSecType.isEmpty()) {
|
if (conInfo.strSecType.isEmpty()) {
|
||||||
conInfo.strSecType = "None";
|
conInfo.strSecType = tr("None");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uint iHz,iChan;
|
uint iHz,iChan;
|
||||||
QString strMac;
|
QString strMac;
|
||||||
m_netDeviceResource->getDeviceActiveAPInfo(m_deviceName, strMac, iHz, iChan, conInfo.strSecType);
|
m_netDeviceResource->getDeviceActiveAPInfo(m_deviceName, strMac, iHz, iChan, conInfo.strSecType);
|
||||||
|
if (conInfo.strSecType.isEmpty()) {
|
||||||
|
conInfo.strSecType = tr("None");
|
||||||
|
}
|
||||||
conInfo.strHz = QString::number(iHz);
|
conInfo.strHz = QString::number(iHz);
|
||||||
conInfo.strChan = QString::number(iChan);
|
conInfo.strChan = QString::number(iChan);
|
||||||
|
|
||||||
|
@ -723,6 +726,14 @@ bool NetDetail::createWiredConnect()
|
||||||
bool NetDetail::createWirelessConnect()
|
bool NetDetail::createWirelessConnect()
|
||||||
{
|
{
|
||||||
KyWirelessConnectSetting connetSetting;
|
KyWirelessConnectSetting connetSetting;
|
||||||
|
KySecuType secuType;
|
||||||
|
KyEapMethodType enterpriseType;
|
||||||
|
securityPage->getSecuType(secuType, enterpriseType);
|
||||||
|
//类型判断
|
||||||
|
if (!checkWirelessSecurity(secuType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//基本信息
|
//基本信息
|
||||||
QString ssid;
|
QString ssid;
|
||||||
if (m_name.isEmpty()) {
|
if (m_name.isEmpty()) {
|
||||||
|
@ -766,9 +777,6 @@ bool NetDetail::createWirelessConnect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//wifi安全性
|
//wifi安全性
|
||||||
KySecuType secuType;
|
|
||||||
KyEapMethodType enterpriseType;
|
|
||||||
securityPage->getSecuType(secuType, enterpriseType);
|
|
||||||
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
||||||
connetSetting.m_type = WpaEap;
|
connetSetting.m_type = WpaEap;
|
||||||
if (enterpriseType == TLS) {
|
if (enterpriseType == TLS) {
|
||||||
|
@ -817,8 +825,21 @@ bool NetDetail::updateConnect()
|
||||||
{
|
{
|
||||||
KyConnectResourse *kyConnectResourse = new KyConnectResourse(this);
|
KyConnectResourse *kyConnectResourse = new KyConnectResourse(this);
|
||||||
KyConnectSetting connetSetting;
|
KyConnectSetting connetSetting;
|
||||||
|
KySecuType secuType;
|
||||||
|
KyEapMethodType enterpriseType;
|
||||||
kyConnectResourse->getConnectionSetting(m_uuid,connetSetting);
|
kyConnectResourse->getConnectionSetting(m_uuid,connetSetting);
|
||||||
|
|
||||||
|
bool securityChange = false;
|
||||||
|
if (isWlan) {
|
||||||
|
securityChange = securityPage->checkIsChanged(m_info);
|
||||||
|
if(securityChange) {
|
||||||
|
securityPage->getSecuType(secuType, enterpriseType);
|
||||||
|
if (!checkWirelessSecurity(secuType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!m_uuid.isEmpty() && detailPage->checkIsChanged(m_info)) {
|
if(!m_uuid.isEmpty() && detailPage->checkIsChanged(m_info)) {
|
||||||
m_wirelessConnOpration->setWirelessAutoConnect(m_uuid, !m_info.isAutoConnect);
|
m_wirelessConnOpration->setWirelessAutoConnect(m_uuid, !m_info.isAutoConnect);
|
||||||
}
|
}
|
||||||
|
@ -849,21 +870,14 @@ bool NetDetail::updateConnect()
|
||||||
m_wiredConnOperation->updateWiredConnect(m_uuid, connetSetting);
|
m_wiredConnOperation->updateWiredConnect(m_uuid, connetSetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool securityChange = false;
|
|
||||||
if (isWlan) {
|
|
||||||
securityChange = securityPage->checkIsChanged(m_info);
|
|
||||||
qDebug() << "securityChange" << securityChange;
|
qDebug() << "securityChange" << securityChange;
|
||||||
if (securityChange) {
|
if (securityChange) {
|
||||||
KySecuType secuType;
|
|
||||||
KyEapMethodType enterpriseType;
|
|
||||||
securityPage->getSecuType(secuType, enterpriseType);
|
|
||||||
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
||||||
updateWirelessEnterPriseConnect(enterpriseType);
|
updateWirelessEnterPriseConnect(enterpriseType);
|
||||||
} else {
|
} else {
|
||||||
updateWirelessPersonalConnect();
|
updateWirelessPersonalConnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (ipv4Change || ipv6Change || securityChange) {
|
if (ipv4Change || ipv6Change || securityChange) {
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
|
@ -877,3 +891,27 @@ bool NetDetail::updateConnect()
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NetDetail::checkWirelessSecurity(KySecuType secuType)
|
||||||
|
{
|
||||||
|
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
||||||
|
if(m_info.strSecType.indexOf("802.1X") < 0) {
|
||||||
|
showDesktopNotify(tr("this wifi no support enterprise type"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (secuType == NONE && m_info.strSecType != "None") {
|
||||||
|
showDesktopNotify(tr("this wifi no support None type"));
|
||||||
|
return false;
|
||||||
|
} else if (secuType == WPA_AND_WPA2_PERSONAL
|
||||||
|
&& (m_info.strSecType.indexOf("WPA1") < 0 ||
|
||||||
|
m_info.strSecType.indexOf("WPA2") < 0)) {
|
||||||
|
showDesktopNotify(tr("this wifi no support WPA2 type"));
|
||||||
|
return false;
|
||||||
|
} else if (secuType == WPA3_PERSONAL && m_info.strSecType.indexOf("WPA3") < 0) {
|
||||||
|
showDesktopNotify(tr("this wifi no support WPA3 type"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -72,6 +72,8 @@ private:
|
||||||
bool createWirelessConnect();
|
bool createWirelessConnect();
|
||||||
bool updateConnect();
|
bool updateConnect();
|
||||||
|
|
||||||
|
bool checkWirelessSecurity(KySecuType secuType);
|
||||||
|
|
||||||
void showDesktopNotify(const QString &message);
|
void showDesktopNotify(const QString &message);
|
||||||
private:
|
private:
|
||||||
KyNetworkDeviceResourse *m_netDeviceResource = nullptr;
|
KyNetworkDeviceResourse *m_netDeviceResource = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue