Merge branch '0508' into 'yhkylin/v101'

fix bug 170162 168706 169896

See merge request kylinos-src/kylin-nm!168
This commit is contained in:
赵世旭 2023-05-08 09:12:27 +00:00
commit cc9d4139c6
8 changed files with 39 additions and 8 deletions

View File

@ -463,6 +463,10 @@ void MobileHotspotWidget::getApInfo()
setUiEnabled(false); setUiEnabled(false);
m_uuid = apInfo.at(4); m_uuid = apInfo.at(4);
} }
int i = m_freqBandComboBox->findText(apInfo.at(5));
if (i >= 0) {
m_freqBandComboBox->setCurrentIndex(i);
}
} else { } else {
qDebug() << LOG_HEAD << "no such interface " << apInfo.at(2); qDebug() << LOG_HEAD << "no such interface " << apInfo.at(2);
} }
@ -801,6 +805,7 @@ void MobileHotspotWidget::setWidgetHidden(bool isHidden)
void MobileHotspotWidget::updateBandCombox() void MobileHotspotWidget::updateBandCombox()
{ {
QString tmp = m_freqBandComboBox->currentText();
m_freqBandComboBox->clear(); m_freqBandComboBox->clear();
QDBusReply<QMap<QString, int> > capReply = m_interface->call("getWirelessDeviceCap"); QDBusReply<QMap<QString, int> > capReply = m_interface->call("getWirelessDeviceCap");
if (!capReply.isValid()) { if (!capReply.isValid()) {
@ -815,6 +820,10 @@ void MobileHotspotWidget::updateBandCombox()
if (devCapMap[m_interfaceName] & 0x04) { if (devCapMap[m_interfaceName] & 0x04) {
m_freqBandComboBox->addItem("5GHz"); m_freqBandComboBox->addItem("5GHz");
} }
int index = m_freqBandComboBox->findText(tmp);
if (index >= 0) {
m_freqBandComboBox->setCurrentIndex(index);
}
} }
QFrame* MobileHotspotWidget::myLine() QFrame* MobileHotspotWidget::myLine()

View File

@ -28,8 +28,8 @@
#include <NetworkManagerQt/VpnPlugin> #include <NetworkManagerQt/VpnPlugin>
#include <NetworkManagerQt/VpnSetting> #include <NetworkManagerQt/VpnSetting>
const QString str2GBand = "2.4Ghz"; const QString str2GBand = "2.4GHz";
const QString str5GBand = "5Ghz"; const QString str5GBand = "5GHz";
static bool subLanListSort(const KyConnectItem* info1, const KyConnectItem* info2) 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_connectSsid = getSsidFromByteArray(rawSsid);
apConnectItem->m_connectUuid = connectPtr->uuid(); apConnectItem->m_connectUuid = connectPtr->uuid();
if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::A) { if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::A) {
apConnectItem->m_band = str2GBand;
} else if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::Bg) {
apConnectItem->m_band = str5GBand; apConnectItem->m_band = str5GBand;
} else if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::Bg) {
apConnectItem->m_band = str2GBand;
} }
apConnectItem->m_ifaceName = settingPtr->interfaceName(); apConnectItem->m_ifaceName = settingPtr->interfaceName();
apConnectItem->m_isActivated = m_networkResourceInstance->isActiveConnection(connectPtr->uuid()); apConnectItem->m_isActivated = m_networkResourceInstance->isActiveConnection(connectPtr->uuid());

View File

@ -33,14 +33,15 @@
const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch"; const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch";
const QString WIRELESS_SWITCH = "wirelessswitch"; const QString WIRELESS_SWITCH = "wirelessswitch";
const QString WIFI_BAND_2_4GHZ = "2.4Ghz"; const QString WIFI_BAND_2_4GHZ = "2.4GHz";
const QString WIFI_BAND_5GHZ = "5Ghz"; const QString WIFI_BAND_5GHZ = "5GHz";
enum KySecuType { enum KySecuType {
NONE = 0, NONE = 0,
WPA_AND_WPA2_PERSONAL, WPA_AND_WPA2_PERSONAL,
WPA_AND_WPA2_ENTERPRISE, WPA_AND_WPA2_ENTERPRISE,
WPA3_PERSONAL, WPA3_PERSONAL,
WPA_AND_WPA3,
}; };
enum KyKeyMgmt { enum KyKeyMgmt {

View File

@ -189,7 +189,11 @@ void KyWirelessNetItem::setKySecuType(QString strSecuType)
if (strSecuType.indexOf(ENTERPRICE_TYPE) >= 0) { if (strSecuType.indexOf(ENTERPRICE_TYPE) >= 0) {
m_kySecuType = WPA_AND_WPA2_ENTERPRISE; m_kySecuType = WPA_AND_WPA2_ENTERPRISE;
} else if (strSecuType.indexOf(WPA3) >= 0) { } 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) { } else if ( strSecuType.indexOf(WPA1_AND_WPA2) >= 0) {
m_kySecuType = WPA_AND_WPA2_PERSONAL; m_kySecuType = WPA_AND_WPA2_PERSONAL;
} else { } else {

View File

@ -536,7 +536,8 @@ void WlanListItem::onNetButtonClicked()
//qDebug() << "!!!!" << m_wirelessNetItem.m_kySecuType << kySecuType; //qDebug() << "!!!!" << m_wirelessNetItem.m_kySecuType << kySecuType;
//有配置或者无密码的wifi直接连接 //有配置或者无密码的wifi直接连接
if (m_wirelessNetItem.m_isConfigured) { 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); m_wirelessConnectOperation->activeWirelessConnect(m_wlanDevice, m_wirelessNetItem.m_connectUuid);
qDebug()<<"[WlanListItem] Has configuration, will be activated. ssid = " qDebug()<<"[WlanListItem] Has configuration, will be activated. ssid = "

View File

@ -373,6 +373,7 @@ void MainWindow::initDbusConnnect()
connect(m_wlanWidget, &WlanPage::secuTypeChange, this, &MainWindow::secuTypeChange); connect(m_wlanWidget, &WlanPage::secuTypeChange, this, &MainWindow::secuTypeChange);
connect(m_wlanWidget, &WlanPage::signalStrengthChange, this, &MainWindow::signalStrengthChange); connect(m_wlanWidget, &WlanPage::signalStrengthChange, this, &MainWindow::signalStrengthChange);
connect(m_wlanWidget, &WlanPage::timeToUpdate , this, &MainWindow::timeToUpdate); 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::showMainWindow, this, &MainWindow::onShowMainWindow);
connect(m_wlanWidget, &WlanPage::connectivityChanged, this, &MainWindow::onConnectivityChanged); connect(m_wlanWidget, &WlanPage::connectivityChanged, this, &MainWindow::onConnectivityChanged);
@ -807,6 +808,19 @@ void MainWindow::onConnectivityChanged(NetworkManager::Connectivity connectivity
onRefreshTrayIcon(); onRefreshTrayIcon();
} }
void MainWindow::onTimeUpdateTrayIcon()
{
if (!m_trayIcon) {
return;
}
if (iconStatus == ACTIVATING || (iconStatus != WLAN_CONNECTED && iconStatus != WLAN_CONNECTED_LIMITED)) {
return;
}
onRefreshTrayIcon();
}
/** /**
* @brief MainWindow::keyPressEvent esc键关闭主界面 * @brief MainWindow::keyPressEvent esc键关闭主界面
* @param event * @param event

View File

@ -215,6 +215,7 @@ private Q_SLOTS:
void onLanConnectStatusToChangeTrayIcon(int state); void onLanConnectStatusToChangeTrayIcon(int state);
void onWlanConnectStatusToChangeTrayIcon(int state); void onWlanConnectStatusToChangeTrayIcon(int state);
void onConnectivityChanged(NetworkManager::Connectivity connectivity); void onConnectivityChanged(NetworkManager::Connectivity connectivity);
void onTimeUpdateTrayIcon();
void onTabletModeChanged(bool mode); void onTabletModeChanged(bool mode);
void onRefreshTrayIconTooltip(); void onRefreshTrayIconTooltip();
}; };

View File

@ -714,6 +714,7 @@ void NetDetail::initSecuData()
break; break;
case WPA_AND_WPA2_PERSONAL: case WPA_AND_WPA2_PERSONAL:
case WPA3_PERSONAL: case WPA3_PERSONAL:
case WPA_AND_WPA3:
if (!m_uuid.isEmpty()) { if (!m_uuid.isEmpty()) {
NetworkManager::Setting::SecretFlags flag; NetworkManager::Setting::SecretFlags flag;
if (m_wirelessConnOpration->getConnSecretFlags(m_uuid, flag)) { if (m_wirelessConnOpration->getConnSecretFlags(m_uuid, flag)) {