From 2bb5bbd283bd13dc155dba74d884631bce82f918 Mon Sep 17 00:00:00 2001 From: jzxc95 <907297917@qq.com> Date: Wed, 10 Nov 2021 09:59:29 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E5=AE=89?= =?UTF-8?q?=E5=85=A8=E7=B1=BB=E5=9E=8B=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/netdetails/netdetail.cpp | 74 +++++++++++++++++++++------ 1 file changed, 58 insertions(+), 16 deletions(-) diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index bbe3fa25..19825846 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -429,6 +429,7 @@ void NetDetail::getBaseInfo(ConInfo &conInfo) conInfo.strChan = QString::number(item.m_channel); //无线特有 conInfo.strSecType = item.m_secuType; + qDebug() << "[NetDetail] strSecType = " << conInfo.strSecType; if (conInfo.strSecType.isEmpty()) { conInfo.strSecType = "None"; } @@ -723,6 +724,28 @@ bool NetDetail::createWiredConnect() bool NetDetail::createWirelessConnect() { KyWirelessConnectSetting connetSetting; + KySecuType secuType; + 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")); + return false; + } + //基本信息 QString ssid; if (m_name.isEmpty()) { @@ -766,9 +789,6 @@ bool NetDetail::createWirelessConnect() } } //wifi安全性 - KySecuType secuType; - KyEapMethodType enterpriseType; - securityPage->getSecuType(secuType, enterpriseType); if (secuType == WPA_AND_WPA2_ENTERPRISE) { connetSetting.m_type = WpaEap; if (enterpriseType == TLS) { @@ -817,8 +837,37 @@ bool NetDetail::updateConnect() { KyConnectResourse *kyConnectResourse = new KyConnectResourse(this); KyConnectSetting connetSetting; + KySecuType secuType; + KyEapMethodType enterpriseType; kyConnectResourse->getConnectionSetting(m_uuid,connetSetting); + bool securityChange = false; + if (isWlan) { + 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(!m_uuid.isEmpty() && detailPage->checkIsChanged(m_info)) { m_wirelessConnOpration->setWirelessAutoConnect(m_uuid, !m_info.isAutoConnect); } @@ -849,19 +898,12 @@ bool NetDetail::updateConnect() m_wiredConnOperation->updateWiredConnect(m_uuid, connetSetting); } - bool securityChange = false; - if (isWlan) { - securityChange = securityPage->checkIsChanged(m_info); - qDebug() << "securityChange" << securityChange; - if (securityChange) { - KySecuType secuType; - KyEapMethodType enterpriseType; - securityPage->getSecuType(secuType, enterpriseType); - if (secuType == WPA_AND_WPA2_ENTERPRISE) { - updateWirelessEnterPriseConnect(enterpriseType); - } else { - updateWirelessPersonalConnect(); - } + qDebug() << "securityChange" << securityChange; + if (securityChange) { + if (secuType == WPA_AND_WPA2_ENTERPRISE) { + updateWirelessEnterPriseConnect(enterpriseType); + } else { + updateWirelessPersonalConnect(); } } From aafe56dfa09f183f6540b114ad74388774a8f695 Mon Sep 17 00:00:00 2001 From: jzxc95 <907297917@qq.com> Date: Wed, 10 Nov 2021 10:34:11 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8A=BD=E6=88=90=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/netdetails/netdetail.cpp | 59 ++++++++++++--------------- src/frontend/netdetails/netdetail.h | 2 + 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index 19825846..513c5c2a 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -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; + } + } +} diff --git a/src/frontend/netdetails/netdetail.h b/src/frontend/netdetails/netdetail.h index 396788a8..7e0b59e7 100644 --- a/src/frontend/netdetails/netdetail.h +++ b/src/frontend/netdetails/netdetail.h @@ -72,6 +72,8 @@ private: bool createWirelessConnect(); bool updateConnect(); + bool checkWirelessSecurity(KySecuType secuType); + void showDesktopNotify(const QString &message); private: KyNetworkDeviceResourse *m_netDeviceResource = nullptr; From 218399639e0352ebf3aa33cc074207c8bafc9d9e Mon Sep 17 00:00:00 2001 From: jzxc95 <907297917@qq.com> Date: Wed, 10 Nov 2021 10:35:35 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E8=BF=94=E5=9B=9Etrue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/netdetails/netdetail.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index 513c5c2a..0f93e781 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -911,4 +911,5 @@ bool NetDetail::checkWirelessSecurity(KySecuType secuType) return false; } } + return true; } From 40b354305924256430d6b28362e8c50ad5014530 Mon Sep 17 00:00:00 2001 From: jzxc95 <907297917@qq.com> Date: Wed, 10 Nov 2021 10:43:20 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=BD=93=E5=AE=89=E5=85=A8=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=B8=BA=E7=A9=BA=EF=BC=8C=E9=BB=98=E8=AE=A4=E4=B8=BA?= =?UTF-8?q?None?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/netdetails/netdetail.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index 0f93e781..78037122 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -429,15 +429,17 @@ void NetDetail::getBaseInfo(ConInfo &conInfo) conInfo.strChan = QString::number(item.m_channel); //无线特有 conInfo.strSecType = item.m_secuType; - qDebug() << "[NetDetail] strSecType = " << conInfo.strSecType; if (conInfo.strSecType.isEmpty()) { - conInfo.strSecType = "None"; + conInfo.strSecType = tr("None"); } } } else { uint iHz,iChan; QString strMac; m_netDeviceResource->getDeviceActiveAPInfo(m_deviceName, strMac, iHz, iChan, conInfo.strSecType); + if (conInfo.strSecType.isEmpty()) { + conInfo.strSecType = tr("None"); + } conInfo.strHz = QString::number(iHz); conInfo.strChan = QString::number(iChan);