fix(外置无线网卡): 修改添加无线网卡的判断条件(bug#188247)

This commit is contained in:
zhangyuanyuan1 2023-08-18 11:48:24 +08:00
parent c4b274a76d
commit fa6310b01b
4 changed files with 19 additions and 4 deletions

View File

@ -382,6 +382,10 @@ void MobileHotspotWidget::initInterfaceInfo()
if(!m_interface->isValid()) {
return;
}
if (m_interfaceComboBox->isVisible()) {
m_interfaceComboBox->hidePopup();
}
m_interfaceComboBox->clear();
QDBusReply<QMap<QString, bool> > reply = m_interface->call("getDeviceListAndEnabled",WIRELESS);

View File

@ -702,7 +702,15 @@ void WlanConnect::getDeviceList(QStringList &list)
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString,bool> map;
dbusArg >> map;
list = map.keys();
//筛选已托管(managed)网卡
QMap<QString, bool>::iterator iters;
for (iters = map.begin(); iters != map.end(); ++iters) {
if (iters.value() == true) {
list << iters.key();
}
}
}
void WlanConnect::initSwtichState()

View File

@ -438,9 +438,7 @@ void getDeviceEnableState(int type, QMap<QString, bool> &map)
if (!wirelessDevList.isEmpty()) {
for (int i = 0; i < wirelessDevList.size(); ++i) {
QString devName = wirelessDevList.at(i);
if (kdr->getDeviceManaged(devName)) {
map.insert(devName, kdr->getDeviceManaged(devName));
}
map.insert(devName, kdr->getDeviceManaged(devName));
}
}
}

View File

@ -747,6 +747,11 @@ void WlanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type devi
return;
}
if (!m_netDeviceResource->getDeviceManaged(deviceName)) {
qWarning() << LOG_FLAG << "couldn not add device" << deviceName << ", it is unmanaged";
return;
}
m_devList << deviceName;
setSwitchBtnEnable(true);
setSwitchBtnState(getWirelessDevieceUseable());