diff --git a/plugins/mobilehotspot/mobilehotspotwidget.cpp b/plugins/mobilehotspot/mobilehotspotwidget.cpp index 450321a3..4ee4e6cb 100644 --- a/plugins/mobilehotspot/mobilehotspotwidget.cpp +++ b/plugins/mobilehotspot/mobilehotspotwidget.cpp @@ -147,7 +147,6 @@ bool MobileHotspotWidget::eventFilter(QObject *watched, QEvent *event) return true; } - if (watched == m_switchBtn) { if (event->type() == QEvent::MouseButtonRelease) { if (!m_interface->isValid()) { @@ -679,6 +678,11 @@ void MobileHotspotWidget::onDeviceNameChanged(QString oldName, QString newName, m_interfaceName = newName; } } + QTimer::singleShot(100, this, [=]() { + if (m_interfaceComboBox->currentText() == newName) { + updateBandCombox(); + } + }); } //热点断开 diff --git a/src/backend/dbus-interface/kylinnetworkdeviceresource.cpp b/src/backend/dbus-interface/kylinnetworkdeviceresource.cpp index bfaceade..ecc9c378 100644 --- a/src/backend/dbus-interface/kylinnetworkdeviceresource.cpp +++ b/src/backend/dbus-interface/kylinnetworkdeviceresource.cpp @@ -452,22 +452,27 @@ int KyNetworkDeviceResourse::getWirelessDeviceCapability(const QString deviceNam NetworkManager::WirelessDevice *wirelessDevicePtr = qobject_cast(connectDevice.data()); - int cap = 0; - if (wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::ApCap) { - cap = cap | 0x01; + int cap = 0x01; + if (!wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::AdhocCap) { + return cap; } - if (wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::Freq2Ghz) { - cap = cap | 0x02; - } - if (wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::Freq5Ghz) { - cap = cap | 0x04; + cap = cap | 0x02; + QDBusInterface dbusInterface("org.freedesktop.NetworkManager", + connectDevice->uni(), + "org.freedesktop.NetworkManager.Device.Wireless", + QDBusConnection::systemBus()); + + QDBusReply reply = dbusInterface.call("GetHotspotCapabilities"); + if (reply.isValid()) { + if (reply.value() == 1) { + cap = cap | 0x04; + } } return cap; } else { qWarning()<<"[KyNetworkDeviceResourse]"<