fix(hotspot):修正判断是否支持开放5G热点的接口(#188540 #185863)

This commit is contained in:
jzxc95 2023-08-23 16:59:44 +08:00
parent 67286b44cc
commit d6cab4f3d2
2 changed files with 20 additions and 11 deletions

View File

@ -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();
}
});
}
//热点断开

View File

@ -452,22 +452,27 @@ int KyNetworkDeviceResourse::getWirelessDeviceCapability(const QString deviceNam
NetworkManager::WirelessDevice *wirelessDevicePtr =
qobject_cast<NetworkManager::WirelessDevice *>(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<uint> reply = dbusInterface.call("GetHotspotCapabilities");
if (reply.isValid()) {
if (reply.value() == 1) {
cap = cap | 0x04;
}
}
return cap;
} else {
qWarning()<<"[KyNetworkDeviceResourse]"<<deviceName<<" is not valid or not wireless.";
}
return 0;
return 0x01;
}
void KyNetworkDeviceResourse::onDeviceAdd(QString deviceName, QString uni, NetworkManager::Device::Type deviceType)