From fa6310b01b966e5589f598d2438682ed1a1d3653 Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Fri, 18 Aug 2023 11:48:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=A4=96=E7=BD=AE=E6=97=A0=E7=BA=BF?= =?UTF-8?q?=E7=BD=91=E5=8D=A1):=20=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=97=A0=E7=BA=BF=E7=BD=91=E5=8D=A1=E7=9A=84=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6(bug#188247)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/mobilehotspot/mobilehotspotwidget.cpp | 4 ++++ plugins/wlanconnect/wlanconnect.cpp | 10 +++++++++- src/frontend/tab-pages/tabpage.cpp | 4 +--- src/frontend/tab-pages/wlanpage.cpp | 5 +++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/plugins/mobilehotspot/mobilehotspotwidget.cpp b/plugins/mobilehotspot/mobilehotspotwidget.cpp index ce9e3d14..450321a3 100644 --- a/plugins/mobilehotspot/mobilehotspotwidget.cpp +++ b/plugins/mobilehotspot/mobilehotspotwidget.cpp @@ -382,6 +382,10 @@ void MobileHotspotWidget::initInterfaceInfo() if(!m_interface->isValid()) { return; } + + if (m_interfaceComboBox->isVisible()) { + m_interfaceComboBox->hidePopup(); + } m_interfaceComboBox->clear(); QDBusReply > reply = m_interface->call("getDeviceListAndEnabled",WIRELESS); diff --git a/plugins/wlanconnect/wlanconnect.cpp b/plugins/wlanconnect/wlanconnect.cpp index 90c50ef4..7a05c009 100644 --- a/plugins/wlanconnect/wlanconnect.cpp +++ b/plugins/wlanconnect/wlanconnect.cpp @@ -702,7 +702,15 @@ void WlanConnect::getDeviceList(QStringList &list) auto dbusArg = result.arguments().at(0).value(); QMap map; dbusArg >> map; - list = map.keys(); + + //筛选已托管(managed)网卡 + QMap::iterator iters; + for (iters = map.begin(); iters != map.end(); ++iters) { + if (iters.value() == true) { + list << iters.key(); + } + } + } void WlanConnect::initSwtichState() diff --git a/src/frontend/tab-pages/tabpage.cpp b/src/frontend/tab-pages/tabpage.cpp index cf3c7e7f..fb1363ca 100644 --- a/src/frontend/tab-pages/tabpage.cpp +++ b/src/frontend/tab-pages/tabpage.cpp @@ -438,9 +438,7 @@ void getDeviceEnableState(int type, QMap &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)); } } } diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 3a504bfc..5d61416f 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -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());