fix(device switch):单网卡开关改为后端新提供的SetStatusDevice接口(#186655)

This commit is contained in:
jzxc95 2023-09-18 11:30:46 +08:00
parent c42e1cea6c
commit 25c1ca9692
1 changed files with 18 additions and 1 deletions

View File

@ -546,7 +546,24 @@ void KyNetworkDeviceResourse::setDeviceManaged(QString devName, bool managed)
qWarning()<<"[KyNetworkDeviceResourse] can not find device " << devName;
return;
}
QDBusInterface dbusInterface("org.freedesktop.NetworkManager",
dbusPath,
"org.freedesktop.NetworkManager.Device",
QDBusConnection::systemBus());
if (!dbusInterface.isValid()) {
qWarning() << dbusPath << "invalid";
setDeviceManagedByGDbus(dbusPath, managed);
return;
}
QDBusReply<void> reply = dbusInterface.call("SetStateDevice", "", managed);
if (!reply.isValid()) {
qWarning() << "SetStateDevice error" << reply.error().message();
setDeviceManagedByGDbus(dbusPath, managed);
return;
}
}
bool KyNetworkDeviceResourse::getDeviceManaged(QString deviceName)