Merge branch '0117' into 'yhkylin/v101'

崩溃问题

See merge request kylinos-src/kylin-nm!94
This commit is contained in:
赵世旭 2023-02-09 09:55:54 +00:00
commit 457aa871a0
10 changed files with 108 additions and 106 deletions

10
debian/changelog vendored
View File

@ -1,3 +1,13 @@
kylin-nm (3.20.1.17-0k0.7) v101; urgency=medium
* BUG号
- #153983 【整机生态-SP1-2209-第二阶段】【特殊机型】【T323】跑reboot过程中出现任务栏网络图标丢失的情况
* 需求号:无
* 其他改动:
* 影响域:无
-- zhaoshixu <zhaoshixu@kylinos.cn> Thu, 09 Feb 2023 17:52:00 +0800
kylin-nm (3.20.1.17-0k0.6) v101; urgency=medium kylin-nm (3.20.1.17-0k0.6) v101; urgency=medium
* BUG号 * BUG号

View File

@ -36,14 +36,14 @@ KyNetworkDeviceResourse::KyNetworkDeviceResourse(QObject *parent) : QObject(pare
initDeviceMap(); initDeviceMap();
connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceAdd, connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceAdd,
this, &KyNetworkDeviceResourse::onDeviceAdd, Qt::ConnectionType::DirectConnection); this, &KyNetworkDeviceResourse::onDeviceAdd/*, Qt::ConnectionType::DirectConnection*/);
connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceRemove, connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceRemove,
this, &KyNetworkDeviceResourse::onDeviceRemove, Qt::ConnectionType::DirectConnection); this, &KyNetworkDeviceResourse::onDeviceRemove/*, Qt::ConnectionType::DirectConnection*/);
connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceUpdate, connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceUpdate,
this, &KyNetworkDeviceResourse::onDeviceUpdate, Qt::ConnectionType::DirectConnection); this, &KyNetworkDeviceResourse::onDeviceUpdate/*, Qt::ConnectionType::DirectConnection*/);
connect(m_networkResourceInstance, &KyNetworkResourceManager::stateChanged, connect(m_networkResourceInstance, &KyNetworkResourceManager::stateChanged,
this, &KyNetworkDeviceResourse::stateChanged, Qt::ConnectionType::DirectConnection); this, &KyNetworkDeviceResourse::stateChanged/*, Qt::ConnectionType::DirectConnection*/);
connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceCarrierChanage, connect(m_networkResourceInstance, &KyNetworkResourceManager::deviceCarrierChanage,
this, &KyNetworkDeviceResourse::carrierChanage); this, &KyNetworkDeviceResourse::carrierChanage);

View File

@ -26,6 +26,32 @@
#define LOG_FLAG "[KyNetworkResourceManager]" #define LOG_FLAG "[KyNetworkResourceManager]"
QString enumToQstring(NetworkManager::AccessPoint::Capabilities cap, NetworkManager::AccessPoint::WpaFlags wpa_flags,NetworkManager::AccessPoint::WpaFlags rsn_flags)
{
QString out;
if ( (cap & NM_802_11_AP_FLAGS_PRIVACY)
&& (wpa_flags == NM_802_11_AP_SEC_NONE)
&& (rsn_flags == NM_802_11_AP_SEC_NONE)) {
out += "WEP ";
}
if (wpa_flags != NM_802_11_AP_SEC_NONE) {
out += "WPA1 ";
}
if ((rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK)
|| (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
out += "WPA2 ";
}
if (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_SAE) {
out += "WPA3 ";
}
if ( (wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)
|| (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
out += "802.1X ";
}
return out;
}
KyNetworkResourceManager* KyNetworkResourceManager::m_pInstance = nullptr; KyNetworkResourceManager* KyNetworkResourceManager::m_pInstance = nullptr;
KyNetworkResourceManager* KyNetworkResourceManager::getInstance() KyNetworkResourceManager* KyNetworkResourceManager::getInstance()
@ -778,10 +804,6 @@ void KyNetworkResourceManager::onWifiNetworkUpdate(NetworkManager::WirelessNetwo
return; return;
} }
auto index = std::find(m_wifiNets.cbegin(), m_wifiNets.cend(), net);
if (m_wifiNets.cend() != index) {
if (net->accessPoints().isEmpty()) {
//Q_EMIT
bool bFlag = false; bool bFlag = false;
QString devIface; QString devIface;
NetworkManager::Device::Ptr dev = findDeviceUni(net->device()); NetworkManager::Device::Ptr dev = findDeviceUni(net->device());
@ -791,24 +813,37 @@ void KyNetworkResourceManager::onWifiNetworkUpdate(NetworkManager::WirelessNetwo
} else { } else {
devIface = dev->interfaceName(); devIface = dev->interfaceName();
} }
//remove
auto pos = index - m_wifiNets.cbegin();
removeWifiNetwork(pos);
if(bFlag) { if(bFlag) {
//device invalid //device invalid
qDebug() << LOG_FLAG << "wifiNetworkDeviceDisappear"; qDebug() << LOG_FLAG << "wifiNetworkDeviceDisappear";
Q_EMIT wifiNetworkDeviceDisappear(); Q_EMIT wifiNetworkDeviceDisappear();
} else { return;
}
auto index = std::find(m_wifiNets.cbegin(), m_wifiNets.cend(), net);
if (m_wifiNets.cend() != index) {
if (net->accessPoints().isEmpty()) {
//remove
auto pos = index - m_wifiNets.cbegin();
removeWifiNetwork(pos);
qDebug()<< LOG_FLAG << "wifiNetwork disappear" << net << net->ssid(); qDebug()<< LOG_FLAG << "wifiNetwork disappear" << net << net->ssid();
NetworkManager::AccessPoint::Ptr accessPoitPtr = net->referenceAccessPoint(); NetworkManager::AccessPoint::Ptr accessPoitPtr = net->referenceAccessPoint();
QByteArray rawSsid = accessPoitPtr->rawSsid(); QByteArray rawSsid = accessPoitPtr->rawSsid();
QString wifiSsid = getSsidFromByteArray(rawSsid); QString wifiSsid = getSsidFromByteArray(rawSsid);
Q_EMIT wifiNetworkRemoved(devIface, wifiSsid); Q_EMIT wifiNetworkRemoved(devIface, wifiSsid);
}
} else { } else {
qDebug()<< LOG_FLAG << "wifiNetworkPropertyChange " << net << net->ssid(); NetworkManager::AccessPoint::Ptr accessPointPtr = net->referenceAccessPoint();
Q_EMIT wifiNetworkPropertyChange(net); if (accessPointPtr.isNull()) {
return;
}
QByteArray rawSsid = accessPointPtr->rawSsid();
QString wifiSsid = getSsidFromByteArray(rawSsid);
QString bssid = accessPointPtr->hardwareAddress();
QString secuType = enumToQstring(accessPointPtr->capabilities(),
accessPointPtr->wpaFlags(),
accessPointPtr->rsnFlags());
Q_EMIT wifiNetworkPropertyChange(devIface, wifiSsid, net->signalStrength(), bssid, secuType);
} }
} }

View File

@ -45,6 +45,8 @@
#include <QInputDialog> #include <QInputDialog>
#include <QMetaEnum> #include <QMetaEnum>
QString enumToQstring(NetworkManager::AccessPoint::Capabilities cap, NetworkManager::AccessPoint::WpaFlags wpa_flags,NetworkManager::AccessPoint::WpaFlags rsn_flags);
class KyNetworkResourceManager : public QObject class KyNetworkResourceManager : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -122,7 +124,7 @@ Q_SIGNALS:
//to KyWirelessNetResource //to KyWirelessNetResource
void wifiNetworkRemoved(QString, QString); void wifiNetworkRemoved(QString, QString);
void wifiNetworkAdded(QString, QString); void wifiNetworkAdded(QString, QString);
void wifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net); void wifiNetworkPropertyChange(QString, QString, int, QString, QString);
void wifiNetworkSecuChange(NetworkManager::AccessPoint *); void wifiNetworkSecuChange(NetworkManager::AccessPoint *);
void wifiNetworkDeviceDisappear(); void wifiNetworkDeviceDisappear();
void wifiEnabledChanged(bool); void wifiEnabledChanged(bool);

View File

@ -27,31 +27,6 @@ const QString WPA3 = "WPA3";
#define FREQ_5GHZ 5000 #define FREQ_5GHZ 5000
QString enumToQstring(NetworkManager::AccessPoint::Capabilities cap, NetworkManager::AccessPoint::WpaFlags wpa_flags,NetworkManager::AccessPoint::WpaFlags rsn_flags)
{
QString out;
if ( (cap & NM_802_11_AP_FLAGS_PRIVACY)
&& (wpa_flags == NM_802_11_AP_SEC_NONE)
&& (rsn_flags == NM_802_11_AP_SEC_NONE)) {
out += "WEP ";
}
if (wpa_flags != NM_802_11_AP_SEC_NONE) {
out += "WPA1 ";
}
if ((rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK)
|| (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
out += "WPA2 ";
}
if (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_SAE) {
out += "WPA3 ";
}
if ( (wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)
|| (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
out += "802.1X ";
}
return out;
}
KyWirelessNetItem::KyWirelessNetItem(NetworkManager::WirelessNetwork::Ptr net) KyWirelessNetItem::KyWirelessNetItem(NetworkManager::WirelessNetwork::Ptr net)
{ {
m_networkResourceInstance = KyNetworkResourceManager::getInstance(); m_networkResourceInstance = KyNetworkResourceManager::getInstance();

View File

@ -25,8 +25,6 @@
#include "kylinnetworkresourcemanager.h" #include "kylinnetworkresourcemanager.h"
#include "kywirelessconnectoperation.h" #include "kywirelessconnectoperation.h"
QString enumToQstring(NetworkManager::AccessPoint::Capabilities, NetworkManager::AccessPoint::WpaFlags, NetworkManager::AccessPoint::WpaFlags);
class KyWirelessNetItem class KyWirelessNetItem
{ {
public: public:

View File

@ -61,15 +61,15 @@ KyWirelessNetResource::KyWirelessNetResource(QObject *parent)
//TODO:connect device signal //TODO:connect device signal
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkAdded, connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkAdded,
this, &KyWirelessNetResource::onWifiNetworkAdded, Qt::ConnectionType::DirectConnection); this, &KyWirelessNetResource::onWifiNetworkAdded/*, Qt::ConnectionType::DirectConnection*/);
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkRemoved, connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkRemoved,
this, &KyWirelessNetResource::onWifiNetworkRemoved, Qt::ConnectionType::DirectConnection); this, &KyWirelessNetResource::onWifiNetworkRemoved/*, Qt::ConnectionType::DirectConnection*/);
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkPropertyChange, connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkPropertyChange,
this, &KyWirelessNetResource::onWifiNetworkPropertyChange, Qt::ConnectionType::DirectConnection); this, &KyWirelessNetResource::onWifiNetworkPropertyChange/*, Qt::ConnectionType::DirectConnection*/);
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkSecuChange, connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkSecuChange,
this, &KyWirelessNetResource::onWifiNetworkSecuChange, Qt::ConnectionType::DirectConnection); this, &KyWirelessNetResource::onWifiNetworkSecuChange/*, Qt::ConnectionType::DirectConnection*/);
connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkDeviceDisappear, connect(m_networkResourceInstance, &KyNetworkResourceManager::wifiNetworkDeviceDisappear,
this, &KyWirelessNetResource::onWifiNetworkDeviceDisappear, Qt::ConnectionType::DirectConnection); this, &KyWirelessNetResource::onWifiNetworkDeviceDisappear/*, Qt::ConnectionType::DirectConnection*/);
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionAdd, connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionAdd,
this, &KyWirelessNetResource::onConnectionAdd); this, &KyWirelessNetResource::onConnectionAdd);
@ -457,48 +457,34 @@ void KyWirelessNetResource::onWifiNetworkSecuChange(NetworkManager::AccessPoint
} }
void KyWirelessNetResource::onWifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net) void KyWirelessNetResource::onWifiNetworkPropertyChange(QString interface, QString ssid, int signal, QString bssid, QString sec)
{ {
if (nullptr == net) {
return;
}
qDebug() << "onWifiNetworkPropertyChange" << net->ssid(); if (m_WifiNetworkList.contains(interface)) {
NetworkManager::AccessPoint::Ptr accessPointPtr = net->referenceAccessPoint(); QList<KyWirelessNetItem>::iterator iter = m_WifiNetworkList[interface].begin();
QByteArray rawSsid = accessPointPtr->rawSsid(); while (iter != m_WifiNetworkList[interface].end()) {
QString wifiSsid = getSsidFromByteArray(rawSsid); qDebug() << iter->m_NetSsid;
if (iter->m_NetSsid == ssid) {
if (net->device().isEmpty()) {
return;
}
QString devIface = m_networkResourceInstance->findDeviceUni(net->device())->interfaceName();
if (m_WifiNetworkList.contains(devIface)) {
QList<KyWirelessNetItem>::iterator iter = m_WifiNetworkList[devIface].begin();
while (iter != m_WifiNetworkList[devIface].end()) {
if (iter->m_NetSsid == wifiSsid) {
// qDebug()<< LOG_FLAG <<"recive properity changed signal, sender is" << iter->m_NetSsid; // qDebug()<< LOG_FLAG <<"recive properity changed signal, sender is" << iter->m_NetSsid;
if (iter->m_signalStrength != net->signalStrength()) { if (iter->m_signalStrength != signal) {
iter->m_signalStrength = net->signalStrength(); iter->m_signalStrength = signal;
Q_EMIT signalStrengthChange(devIface, wifiSsid, iter->m_signalStrength); Q_EMIT signalStrengthChange(interface, ssid, iter->m_signalStrength);
} }
if (iter->m_bssid != accessPointPtr->hardwareAddress()) { if (iter->m_bssid != bssid) {
iter->m_bssid = accessPointPtr->hardwareAddress(); qDebug() << "bssid";
Q_EMIT bssidChange(devIface, wifiSsid, iter->m_bssid); iter->m_bssid = bssid;
Q_EMIT bssidChange(interface, ssid, iter->m_bssid);
} }
QString secuType = enumToQstring(accessPointPtr->capabilities(), if (iter->m_secuType != sec) {
accessPointPtr->wpaFlags(), iter->setKySecuType(sec);
accessPointPtr->rsnFlags()); Q_EMIT secuTypeChange(interface, ssid, sec);
if (iter->m_secuType != secuType) {
//qDebug() << "!!!!secuTypeChange" << wifiSsid << iter->m_secuType << "change to " << secuType;
iter->setKySecuType(secuType);
Q_EMIT secuTypeChange(devIface, wifiSsid, secuType);
} }
break; break;
} }
iter++; iter++;
} }
} }

View File

@ -63,7 +63,7 @@ private:
public Q_SLOTS: public Q_SLOTS:
void onWifiNetworkAdded(QString, QString); void onWifiNetworkAdded(QString, QString);
void onWifiNetworkRemoved(QString, QString); void onWifiNetworkRemoved(QString, QString);
void onWifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net); void onWifiNetworkPropertyChange(QString interface, QString ssid, int signal, QString bssid, QString sec);
void onWifiNetworkSecuChange(NetworkManager::AccessPoint *accessPointPtr); void onWifiNetworkSecuChange(NetworkManager::AccessPoint *accessPointPtr);
void onWifiNetworkDeviceDisappear(); void onWifiNetworkDeviceDisappear();

View File

@ -276,8 +276,8 @@ void ListItem::initUI()
m_lbLoadDown->setFont(font); m_lbLoadDown->setFont(font);
m_lbLoadUp->setText("0KB/s"); m_lbLoadUp->setText("0KB/s");
m_lbLoadDown->setText("0KB/s"); m_lbLoadDown->setText("0KB/s");
m_lbLoadDownImg->setPixmap(QPixmap(":/res/x/load-down.png")); m_lbLoadDownImg->setPixmap(QPixmap(QLatin1String(":/res/x/load-down.png")));
m_lbLoadUpImg->setPixmap(QPixmap(":/res/x/load-up.png")); m_lbLoadUpImg->setPixmap(QPixmap(QLatin1String(":/res/x/load-up.png")));
m_hItemLayout->addWidget(m_netButton); m_hItemLayout->addWidget(m_netButton);
m_hItemLayout->addWidget(m_nameLabel); m_hItemLayout->addWidget(m_nameLabel);

View File

@ -387,10 +387,8 @@ void WlanPage::clearWirelessNetItemMap(QMap<QString, QListWidgetItem*> &wireless
wirelessListWidget->removeItemWidget(p_listWidgetItem); wirelessListWidget->removeItemWidget(p_listWidgetItem);
delete p_wlanItem; delete p_wlanItem;
p_wlanItem = nullptr;
delete p_listWidgetItem; delete p_listWidgetItem;
p_listWidgetItem = nullptr;
iter = wirelessNetItem.erase(iter); iter = wirelessNetItem.erase(iter);
} }
@ -418,10 +416,8 @@ void WlanPage::deleteWirelessItemFormMap(QMap<QString, QListWidgetItem*> &wirele
wirelessListWidget->takeItem(wirelessListWidget->row(p_listWidgetItem)); wirelessListWidget->takeItem(wirelessListWidget->row(p_listWidgetItem));
delete p_wlanItem; delete p_wlanItem;
p_wlanItem = nullptr;
delete p_listWidgetItem; delete p_listWidgetItem;
p_listWidgetItem = nullptr;
if (m_inactivatedNetListWidget->count() <= MAX_ITEMS) { if (m_inactivatedNetListWidget->count() <= MAX_ITEMS) {
m_inactivatedNetListWidget->setFixedWidth(MIN_WIDTH); m_inactivatedNetListWidget->setFixedWidth(MIN_WIDTH);