mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix: 任务栏网络图标的tooltips显示空白
问题1:原来用于存储已连接设备的QMap只在网卡设备列表发生变化时才去移除处于未连接状态的设备信息,导致这个QMap其实存的是之前连过网的网卡设备列表(其中可能有的已经断开连接了) 后面做判断时又以为这个列表存储的是当前已连接网的设备列表,就会导致在这个设备列表里遍历时,碰到未连接网的设备发现找不到"Ip4"字段,就返回了个空值,直接break跳出循环了 如果这个未连接网络的设备信息比较靠前,即便是后面有已连接的设备,也无法遍历到,这是问题2。 问题1的改进:在网卡设备不是已连接状态时,同步在QMap中移除这个设备信息。 问题2的改进:在遍历存储已连接设备列表时,如果没找到对应的字段,不是跳出循环,而是继续遍历剩下的所有设备。确保总能找到一个正确的信息显示出来。 Log: 修复任务栏网络图标不显示IP的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-50062.html Bug: https://pms.uniontech.com/zentao/bug-view-51758.html Bug: https://pms.uniontech.com/zentao/bug-view-50443.html Change-Id: Ib3ac8fb2949344c7209a52012a93a5e12ace0fa7 Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/8526 Reviewed-by: <mailman@uniontech.com> Reviewed-by: fanpengcheng <fanpengcheng@uniontech.com> Tested-by: <mailman@uniontech.com>
This commit is contained in:
parent
b8810b8d77
commit
bb37fa35e5
@ -519,6 +519,8 @@ void NetworkItem::getPluginState()
|
||||
state |= temp;
|
||||
if ((temp & WirelessItem::Connected) >> 18) {
|
||||
m_connectedWirelessDevice.insert(iwireless.key(), wirelessItem);
|
||||
} else {
|
||||
m_connectedWirelessDevice.remove(iwireless.key());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -564,6 +566,8 @@ void NetworkItem::getPluginState()
|
||||
state |= temp;
|
||||
if ((temp & WiredItem::Connected) >> 2) {
|
||||
m_connectedWiredDevice.insert(iwired.key(), wiredItem);
|
||||
} else {
|
||||
m_connectedWiredDevice.remove(iwired.key());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1171,10 +1175,10 @@ void NetworkItem::refreshTips()
|
||||
if (wirelessItem) {
|
||||
auto info = wirelessItem->getActiveWirelessConnectionInfo();
|
||||
if (!info.contains("Ip4"))
|
||||
break;
|
||||
continue;
|
||||
const QJsonObject ipv4 = info.value("Ip4").toObject();
|
||||
if (!ipv4.contains("Address"))
|
||||
break;
|
||||
continue;
|
||||
if (m_connectedWirelessDevice.size() == 1) {
|
||||
strTips = tr("Wireless connection: %1").arg(ipv4.value("Address").toString()) + '\n';
|
||||
} else {
|
||||
@ -1188,10 +1192,10 @@ void NetworkItem::refreshTips()
|
||||
if (wiredItem) {
|
||||
auto info = wiredItem->getActiveWiredConnectionInfo();
|
||||
if (!info.contains("Ip4"))
|
||||
break;
|
||||
continue;
|
||||
const QJsonObject ipv4 = info.value("Ip4").toObject();
|
||||
if (!ipv4.contains("Address"))
|
||||
break;
|
||||
continue;
|
||||
if (m_connectedWiredDevice.size() == 1) {
|
||||
strTips = tr("Wired connection: %1").arg(ipv4.value("Address").toString()) + '\n';
|
||||
} else {
|
||||
@ -1212,10 +1216,10 @@ void NetworkItem::refreshTips()
|
||||
if (wirelessItem) {
|
||||
auto info = wirelessItem->getActiveWirelessConnectionInfo();
|
||||
if (!info.contains("Ip4"))
|
||||
break;
|
||||
continue;
|
||||
const QJsonObject ipv4 = info.value("Ip4").toObject();
|
||||
if (!ipv4.contains("Address"))
|
||||
break;
|
||||
continue;
|
||||
if (m_connectedWiredDevice.size() == 1) {
|
||||
strTips = tr("Wireless connection: %1").arg(ipv4.value("Address").toString()) + '\n';
|
||||
} else {
|
||||
@ -1236,10 +1240,10 @@ void NetworkItem::refreshTips()
|
||||
if (wiredItem) {
|
||||
auto info = wiredItem->getActiveWiredConnectionInfo();
|
||||
if (!info.contains("Ip4"))
|
||||
break;
|
||||
continue;
|
||||
const QJsonObject ipv4 = info.value("Ip4").toObject();
|
||||
if (!ipv4.contains("Address"))
|
||||
break;
|
||||
continue;
|
||||
if (m_connectedWiredDevice.size() == 1) {
|
||||
strTips = tr("Wired connection: %1").arg(ipv4.value("Address").toString()) + '\n';
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user