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
* BUG号

View File

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

View File

@ -26,6 +26,32 @@
#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::getInstance()
@ -778,37 +804,46 @@ void KyNetworkResourceManager::onWifiNetworkUpdate(NetworkManager::WirelessNetwo
return;
}
bool bFlag = false;
QString devIface;
NetworkManager::Device::Ptr dev = findDeviceUni(net->device());
if(dev.isNull()) {
qDebug()<< LOG_FLAG << "device invalid";
bFlag = true;
} else {
devIface = dev->interfaceName();
}
if(bFlag) {
//device invalid
qDebug() << LOG_FLAG << "wifiNetworkDeviceDisappear";
Q_EMIT wifiNetworkDeviceDisappear();
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;
QString devIface;
NetworkManager::Device::Ptr dev = findDeviceUni(net->device());
if(dev.isNull()) {
qDebug()<< LOG_FLAG << "device invalid";
bFlag = true;
} else {
devIface = dev->interfaceName();
}
//remove
auto pos = index - m_wifiNets.cbegin();
removeWifiNetwork(pos);
if(bFlag) {
//device invalid
qDebug() << LOG_FLAG << "wifiNetworkDeviceDisappear";
Q_EMIT wifiNetworkDeviceDisappear();
} else {
qDebug()<< LOG_FLAG << "wifiNetwork disappear" << net << net->ssid();
NetworkManager::AccessPoint::Ptr accessPoitPtr = net->referenceAccessPoint();
QByteArray rawSsid = accessPoitPtr->rawSsid();
QString wifiSsid = getSsidFromByteArray(rawSsid);
Q_EMIT wifiNetworkRemoved(devIface, wifiSsid);
}
qDebug()<< LOG_FLAG << "wifiNetwork disappear" << net << net->ssid();
NetworkManager::AccessPoint::Ptr accessPoitPtr = net->referenceAccessPoint();
QByteArray rawSsid = accessPoitPtr->rawSsid();
QString wifiSsid = getSsidFromByteArray(rawSsid);
Q_EMIT wifiNetworkRemoved(devIface, wifiSsid);
} else {
qDebug()<< LOG_FLAG << "wifiNetworkPropertyChange " << net << net->ssid();
Q_EMIT wifiNetworkPropertyChange(net);
NetworkManager::AccessPoint::Ptr accessPointPtr = net->referenceAccessPoint();
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 <QMetaEnum>
QString enumToQstring(NetworkManager::AccessPoint::Capabilities cap, NetworkManager::AccessPoint::WpaFlags wpa_flags,NetworkManager::AccessPoint::WpaFlags rsn_flags);
class KyNetworkResourceManager : public QObject
{
Q_OBJECT
@ -122,7 +124,7 @@ Q_SIGNALS:
//to KyWirelessNetResource
void wifiNetworkRemoved(QString, QString);
void wifiNetworkAdded(QString, QString);
void wifiNetworkPropertyChange(NetworkManager::WirelessNetwork * net);
void wifiNetworkPropertyChange(QString, QString, int, QString, QString);
void wifiNetworkSecuChange(NetworkManager::AccessPoint *);
void wifiNetworkDeviceDisappear();
void wifiEnabledChanged(bool);

View File

@ -27,31 +27,6 @@ const QString WPA3 = "WPA3";
#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)
{
m_networkResourceInstance = KyNetworkResourceManager::getInstance();

View File

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

View File

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

View File

@ -63,7 +63,7 @@ private:
public Q_SLOTS:
void onWifiNetworkAdded(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 onWifiNetworkDeviceDisappear();

View File

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

View File

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