抽成函数

This commit is contained in:
jzxc95 2021-11-10 10:34:11 +08:00
parent 2bb5bbd283
commit aafe56dfa0
2 changed files with 28 additions and 33 deletions

View File

@ -728,21 +728,7 @@ bool NetDetail::createWirelessConnect()
KyEapMethodType enterpriseType;
securityPage->getSecuType(secuType, enterpriseType);
//类型判断
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 WPA1 WPA2 type"));
return false;
} else if (secuType == WPA3_PERSONAL && m_info.strSecType.indexOf("WPA3") < 0) {
showDesktopNotify(tr("this wifi no support WPA3 type"));
if (!checkWirelessSecurity(secuType)) {
return false;
}
@ -846,24 +832,8 @@ bool NetDetail::updateConnect()
securityChange = securityPage->checkIsChanged(m_info);
if(securityChange) {
securityPage->getSecuType(secuType, enterpriseType);
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;
}
if (!checkWirelessSecurity(secuType)) {
return false;
}
}
}
@ -919,3 +889,26 @@ bool NetDetail::updateConnect()
}
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;
}
}
}

View File

@ -72,6 +72,8 @@ private:
bool createWirelessConnect();
bool updateConnect();
bool checkWirelessSecurity(KySecuType secuType);
void showDesktopNotify(const QString &message);
private:
KyNetworkDeviceResourse *m_netDeviceResource = nullptr;