fix(托盘): 开启热点后 WiFi列表内容未移除问题(bug181187)
This commit is contained in:
parent
c5d757d832
commit
fedae105cf
|
@ -457,8 +457,8 @@ NetworkManager::Connection::Ptr KyNetworkResourceManager::getConnect(const QStri
|
|||
int index = 0;
|
||||
NetworkManager::Connection::Ptr connectPtr = nullptr;
|
||||
|
||||
qDebug() <<"[KyNetworkResourceManager]" << "get connect with uuid" << connectUuid;
|
||||
if (connectUuid.isEmpty()) {
|
||||
qWarning() << "[KyNetworkResourceManager]" << "get connect with uuid is empty";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -473,7 +473,7 @@ NetworkManager::Connection::Ptr KyNetworkResourceManager::getConnect(const QStri
|
|||
}
|
||||
}
|
||||
|
||||
qWarning()<<"[KyNetworkResourceManager]"<<"it can not find connect with uuid"<<connectUuid;
|
||||
qWarning() << "[KyNetworkResourceManager]" << "it can not find connect with uuid" << connectUuid;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -416,18 +416,20 @@ void KyWirelessNetResource::onWifiNetworkAdded(QString devIfaceName, QString ssi
|
|||
|
||||
void KyWirelessNetResource::onWifiNetworkRemoved(QString devIfaceName, QString ssid)
|
||||
{
|
||||
if (m_WifiNetworkList.contains(devIfaceName)) {
|
||||
int index = 0;
|
||||
for ( ; index < m_WifiNetworkList.value(devIfaceName).size(); index++) {
|
||||
if ( m_WifiNetworkList[devIfaceName].at(index).m_NetSsid == ssid) {
|
||||
m_WifiNetworkList[devIfaceName].removeAt(index);
|
||||
if (!m_WifiNetworkList.contains(devIfaceName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int index = 0; index < m_WifiNetworkList.value(devIfaceName).size(); ++index) {
|
||||
if (m_WifiNetworkList[devIfaceName].at(index).m_NetSsid == ssid) {
|
||||
m_WifiNetworkList[devIfaceName].removeAt(index);
|
||||
//remove后为空则删除
|
||||
if (m_WifiNetworkList.value(devIfaceName).isEmpty()) {
|
||||
m_WifiNetworkList.remove(devIfaceName);
|
||||
}
|
||||
Q_EMIT wifiNetworkRemove(devIfaceName,ssid);
|
||||
break;
|
||||
}
|
||||
//remove后为空则删除
|
||||
if (m_WifiNetworkList.value(devIfaceName).isEmpty()) {
|
||||
m_WifiNetworkList.remove(devIfaceName);
|
||||
}
|
||||
Q_EMIT wifiNetworkRemove(devIfaceName,ssid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -846,8 +848,31 @@ void KyWirelessNetResource::onConnectionUpdate(QString uuid)
|
|||
return;
|
||||
}
|
||||
|
||||
m_WifiNetworkList.clear();
|
||||
kyWirelessNetItemListInit();
|
||||
|
||||
QString ssid, dev;
|
||||
getSsidByUuid(uuid, ssid);
|
||||
getDeviceByUuid(uuid, dev);
|
||||
|
||||
NetworkManager::Device::Ptr devicePtr = m_networkResourceInstance->findDeviceInterface(dev);
|
||||
if (devicePtr.isNull() || !m_WifiNetworkList.contains(dev)) {
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkManager::WirelessNetwork::Ptr netPtr = m_networkResourceInstance->findWifiNetwork(ssid, devicePtr->uni());
|
||||
if (netPtr.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QList<KyWirelessNetItem> list = m_WifiNetworkList.value(dev);
|
||||
for (int i = 0; i < list.count(); ++i) {
|
||||
if (uuid == list.at(i).m_connectUuid) {
|
||||
list.removeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
list.append(KyWirelessNetItem(netPtr));
|
||||
m_WifiNetworkList.insert(dev, list);
|
||||
|
||||
Q_EMIT wifiNetworkUpdate();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue