Merge branch '0918' into 'yhkylin/v101'

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

See merge request kylinos-src/kylin-nm!270
This commit is contained in:
赵世旭 2023-09-18 03:37:56 +00:00
commit 923687cf41
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)