From 4aa2c24bdbfd7eb549d9381f1919de27a71798a4 Mon Sep 17 00:00:00 2001 From: jzxc95 <907297917@qq.com> Date: Mon, 8 May 2023 16:48:38 +0800 Subject: [PATCH] fix bug 170162 168706 169896 --- plugins/mobilehotspot/mobilehotspotwidget.cpp | 9 +++++++++ .../dbus-interface/kylinconnectresource.cpp | 8 ++++---- .../dbus-interface/kywirelessconnectoperation.h | 5 +++-- src/backend/dbus-interface/kywirelessnetitem.cpp | 6 +++++- src/frontend/list-items/wlanlistitem.cpp | 3 ++- src/frontend/mainwindow.cpp | 14 ++++++++++++++ src/frontend/mainwindow.h | 1 + src/frontend/netdetails/netdetail.cpp | 1 + 8 files changed, 39 insertions(+), 8 deletions(-) diff --git a/plugins/mobilehotspot/mobilehotspotwidget.cpp b/plugins/mobilehotspot/mobilehotspotwidget.cpp index 356b65df..df0b6985 100644 --- a/plugins/mobilehotspot/mobilehotspotwidget.cpp +++ b/plugins/mobilehotspot/mobilehotspotwidget.cpp @@ -463,6 +463,10 @@ void MobileHotspotWidget::getApInfo() setUiEnabled(false); m_uuid = apInfo.at(4); } + int i = m_freqBandComboBox->findText(apInfo.at(5)); + if (i >= 0) { + m_freqBandComboBox->setCurrentIndex(i); + } } else { qDebug() << LOG_HEAD << "no such interface " << apInfo.at(2); } @@ -801,6 +805,7 @@ void MobileHotspotWidget::setWidgetHidden(bool isHidden) void MobileHotspotWidget::updateBandCombox() { + QString tmp = m_freqBandComboBox->currentText(); m_freqBandComboBox->clear(); QDBusReply > capReply = m_interface->call("getWirelessDeviceCap"); if (!capReply.isValid()) { @@ -815,6 +820,10 @@ void MobileHotspotWidget::updateBandCombox() if (devCapMap[m_interfaceName] & 0x04) { m_freqBandComboBox->addItem("5GHz"); } + int index = m_freqBandComboBox->findText(tmp); + if (index >= 0) { + m_freqBandComboBox->setCurrentIndex(index); + } } QFrame* MobileHotspotWidget::myLine() diff --git a/src/backend/dbus-interface/kylinconnectresource.cpp b/src/backend/dbus-interface/kylinconnectresource.cpp index ca76e51b..68a25a28 100644 --- a/src/backend/dbus-interface/kylinconnectresource.cpp +++ b/src/backend/dbus-interface/kylinconnectresource.cpp @@ -28,8 +28,8 @@ #include #include -const QString str2GBand = "2.4Ghz"; -const QString str5GBand = "5Ghz"; +const QString str2GBand = "2.4GHz"; +const QString str5GBand = "5GHz"; static bool subLanListSort(const KyConnectItem* info1, const KyConnectItem* info2) { @@ -736,9 +736,9 @@ KyApConnectItem *KyConnectResourse::getApConnectItem(NetworkManager::Connection: apConnectItem->m_connectSsid = getSsidFromByteArray(rawSsid); apConnectItem->m_connectUuid = connectPtr->uuid(); if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::A) { - apConnectItem->m_band = str2GBand; - } else if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::Bg) { apConnectItem->m_band = str5GBand; + } else if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::Bg) { + apConnectItem->m_band = str2GBand; } apConnectItem->m_ifaceName = settingPtr->interfaceName(); apConnectItem->m_isActivated = m_networkResourceInstance->isActiveConnection(connectPtr->uuid()); diff --git a/src/backend/dbus-interface/kywirelessconnectoperation.h b/src/backend/dbus-interface/kywirelessconnectoperation.h index 94d91858..2ac4e021 100644 --- a/src/backend/dbus-interface/kywirelessconnectoperation.h +++ b/src/backend/dbus-interface/kywirelessconnectoperation.h @@ -33,14 +33,15 @@ const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch"; const QString WIRELESS_SWITCH = "wirelessswitch"; -const QString WIFI_BAND_2_4GHZ = "2.4Ghz"; -const QString WIFI_BAND_5GHZ = "5Ghz"; +const QString WIFI_BAND_2_4GHZ = "2.4GHz"; +const QString WIFI_BAND_5GHZ = "5GHz"; enum KySecuType { NONE = 0, WPA_AND_WPA2_PERSONAL, WPA_AND_WPA2_ENTERPRISE, WPA3_PERSONAL, + WPA_AND_WPA3, }; enum KyKeyMgmt { diff --git a/src/backend/dbus-interface/kywirelessnetitem.cpp b/src/backend/dbus-interface/kywirelessnetitem.cpp index 39e6dad2..8ca7ea0a 100644 --- a/src/backend/dbus-interface/kywirelessnetitem.cpp +++ b/src/backend/dbus-interface/kywirelessnetitem.cpp @@ -189,7 +189,11 @@ void KyWirelessNetItem::setKySecuType(QString strSecuType) if (strSecuType.indexOf(ENTERPRICE_TYPE) >= 0) { m_kySecuType = WPA_AND_WPA2_ENTERPRISE; } else if (strSecuType.indexOf(WPA3) >= 0) { - m_kySecuType = WPA3_PERSONAL; + if ( strSecuType.indexOf(WPA1_AND_WPA2) >= 0) { + m_kySecuType = WPA_AND_WPA3; + } else { + m_kySecuType = WPA3_PERSONAL; + } } else if ( strSecuType.indexOf(WPA1_AND_WPA2) >= 0) { m_kySecuType = WPA_AND_WPA2_PERSONAL; } else { diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index 4d78bf9a..0d139fe4 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -536,7 +536,8 @@ void WlanListItem::onNetButtonClicked() //qDebug() << "!!!!" << m_wirelessNetItem.m_kySecuType << kySecuType; //有配置或者无密码的wifi直接连接 if (m_wirelessNetItem.m_isConfigured) { - if (m_wirelessNetItem.m_kySecuType == kySecuType) { + if (m_wirelessNetItem.m_kySecuType == kySecuType || + (m_wirelessNetItem.m_kySecuType == WPA_AND_WPA3 && (kySecuType == WPA_AND_WPA2_PERSONAL || kySecuType == WPA3_PERSONAL))) { //安全类型不变直接连接 m_wirelessConnectOperation->activeWirelessConnect(m_wlanDevice, m_wirelessNetItem.m_connectUuid); qDebug()<<"[WlanListItem] Has configuration, will be activated. ssid = " diff --git a/src/frontend/mainwindow.cpp b/src/frontend/mainwindow.cpp index f4009183..cf28b531 100644 --- a/src/frontend/mainwindow.cpp +++ b/src/frontend/mainwindow.cpp @@ -373,6 +373,7 @@ void MainWindow::initDbusConnnect() connect(m_wlanWidget, &WlanPage::secuTypeChange, this, &MainWindow::secuTypeChange); connect(m_wlanWidget, &WlanPage::signalStrengthChange, this, &MainWindow::signalStrengthChange); connect(m_wlanWidget, &WlanPage::timeToUpdate , this, &MainWindow::timeToUpdate); + connect(m_wlanWidget, &WlanPage::timeToUpdate , this, &MainWindow::onTimeUpdateTrayIcon); connect(m_wlanWidget, &WlanPage::showMainWindow, this, &MainWindow::onShowMainWindow); connect(m_wlanWidget, &WlanPage::connectivityChanged, this, &MainWindow::onConnectivityChanged); @@ -807,6 +808,19 @@ void MainWindow::onConnectivityChanged(NetworkManager::Connectivity connectivity onRefreshTrayIcon(); } +void MainWindow::onTimeUpdateTrayIcon() +{ + if (!m_trayIcon) { + return; + } + + if (iconStatus == ACTIVATING || (iconStatus != WLAN_CONNECTED && iconStatus != WLAN_CONNECTED_LIMITED)) { + return; + } + + onRefreshTrayIcon(); +} + /** * @brief MainWindow::keyPressEvent 按esc键关闭主界面 * @param event diff --git a/src/frontend/mainwindow.h b/src/frontend/mainwindow.h index 9b77c79f..e165d6aa 100644 --- a/src/frontend/mainwindow.h +++ b/src/frontend/mainwindow.h @@ -215,6 +215,7 @@ private Q_SLOTS: void onLanConnectStatusToChangeTrayIcon(int state); void onWlanConnectStatusToChangeTrayIcon(int state); void onConnectivityChanged(NetworkManager::Connectivity connectivity); + void onTimeUpdateTrayIcon(); void onTabletModeChanged(bool mode); void onRefreshTrayIconTooltip(); }; diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index 151c8cf1..effaf391 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -714,6 +714,7 @@ void NetDetail::initSecuData() break; case WPA_AND_WPA2_PERSONAL: case WPA3_PERSONAL: + case WPA_AND_WPA3: if (!m_uuid.isEmpty()) { NetworkManager::Setting::SecretFlags flag; if (m_wirelessConnOpration->getConnSecretFlags(m_uuid, flag)) {