Merge branch '2309bug-0818' into 'yhkylin/v101'

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

See merge request kylinos-src/kylin-nm!247
This commit is contained in:
赵世旭 2023-08-21 01:33:35 +00:00
commit ce044ab6c5
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());