diff --git a/src/backend/dbus-interface/kylinactiveconnectresource.cpp b/src/backend/dbus-interface/kylinactiveconnectresource.cpp index 07b13d09..e6301c7d 100644 --- a/src/backend/dbus-interface/kylinactiveconnectresource.cpp +++ b/src/backend/dbus-interface/kylinactiveconnectresource.cpp @@ -660,7 +660,7 @@ bool KyActiveConnectResourse::connectionIsVirtual(QString uuid) return false; } - return !m_networkdevice->deviceIsWired(devicePtr->interfaceName()); + return !m_networkdevice->checkDeviceType(devicePtr->interfaceName(), NetworkManager::Device::Type::Ethernet); } bool KyActiveConnectResourse::wiredConnectIsActived() diff --git a/src/backend/dbus-interface/kylinnetworkdeviceresource.cpp b/src/backend/dbus-interface/kylinnetworkdeviceresource.cpp index fb7f8a62..211e5f8c 100644 --- a/src/backend/dbus-interface/kylinnetworkdeviceresource.cpp +++ b/src/backend/dbus-interface/kylinnetworkdeviceresource.cpp @@ -385,7 +385,7 @@ bool KyNetworkDeviceResourse::wirelessDeviceIsExist(const QString devName) return list.contains(devName); } -bool KyNetworkDeviceResourse::deviceIsWired(QString deviceName) +bool KyNetworkDeviceResourse::checkDeviceType(QString deviceName, NetworkManager::Device::Type deviceType) { NetworkManager::Device::Ptr devicePtr = m_networkResourceInstance->findDeviceInterface(deviceName); @@ -395,9 +395,14 @@ bool KyNetworkDeviceResourse::deviceIsWired(QString deviceName) return false; } - if (NetworkManager::Device::Type::Ethernet == devicePtr->type() - && !devicePtr->udi().startsWith(VIRTURAL_DEVICE_PATH)) { - return true; + if (deviceType == devicePtr->type()) { + if (NetworkManager::Device::Type::Ethernet == deviceType) { + if (!devicePtr->udi().startsWith(VIRTURAL_DEVICE_PATH)) { + return true; + } + } else { + return true; + } } return false; diff --git a/src/backend/dbus-interface/kylinnetworkdeviceresource.h b/src/backend/dbus-interface/kylinnetworkdeviceresource.h index 4ad5881a..e16df4cf 100644 --- a/src/backend/dbus-interface/kylinnetworkdeviceresource.h +++ b/src/backend/dbus-interface/kylinnetworkdeviceresource.h @@ -62,7 +62,7 @@ public: bool wiredDeviceIsCarriered(QString deviceName); bool wirelessDeviceIsExist(const QString devName); - bool deviceIsWired(QString deviceName); + bool checkDeviceType(QString deviceName, NetworkManager::Device::Type deviceType); void setDeviceRefreshRate(QString deviceName, int ms); diff --git a/src/frontend/tab-pages/lanpage.cpp b/src/frontend/tab-pages/lanpage.cpp index 8d6a1a68..7ca88f6a 100644 --- a/src/frontend/tab-pages/lanpage.cpp +++ b/src/frontend/tab-pages/lanpage.cpp @@ -524,7 +524,8 @@ void LanPage::addDeviceForCombox(QString deviceName) void LanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType) { - if (!m_deviceResource->deviceIsWired(deviceName)) { + Q_UNUSED(deviceType) + if (!m_deviceResource->checkDeviceType(deviceName, NetworkManager::Device::Type::Ethernet)) { return; } diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 1aaa4175..f3c61771 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -870,6 +870,10 @@ void WlanPage::onWlanStateChanged(NetworkManager::Device::State newstate, Networ void WlanPage::onDeviceManagedChanged(QString deviceName, bool managed) { + if (!m_netDeviceResource->checkDeviceType(deviceName, NetworkManager::Device::Type::Wifi)) { + return; + } + if (managed && !m_devList.contains(deviceName)) { //添加新增托管网卡 onDeviceAdd(deviceName, NetworkManager::Device::Type::Wifi);