Merge branch 'bug-191241' into 'yhkylin/v101'

fix(kylin-nm):获取企业网密码增加超时时间500ms(#191241)

See merge request kylinos-src/kylin-nm!265
This commit is contained in:
赵世旭 2023-09-12 06:01:53 +00:00
commit 468503dfab
1 changed files with 22 additions and 4 deletions

View File

@ -455,8 +455,15 @@ QString KyWirelessConnectOperation::getPrivateKeyPassword(const QString &connect
qWarning()<<errorMessage; qWarning()<<errorMessage;
return ""; return "";
} }
QDBusPendingReply<NMVariantMapMap> reply = connectPtr->secrets(PRIVATE_PSK_SETTING_NAME); QDBusInterface dbusInterface("org.freedesktop.NetworkManager",
QMap<QString,QVariantMap> map(reply.value()); connectPtr->path(),
"org.freedesktop.NetworkManager.Settings.Connection",
QDBusConnection::systemBus());
dbusInterface.setTimeout(500);
QDBusMessage result = dbusInterface.call("GetSecrets", PRIVATE_PSK_SETTING_NAME);
const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value<QDBusArgument>();
QMap<QString,QVariantMap> map;
dbusArg1st >> map;
if (map.contains("802-1x") if (map.contains("802-1x")
&& map.value("802-1x").contains("private-key-password")) { && map.value("802-1x").contains("private-key-password")) {
QString psk = map.value("802-1x").value("private-key-password").toString(); QString psk = map.value("802-1x").value("private-key-password").toString();
@ -475,8 +482,19 @@ QString KyWirelessConnectOperation::get8021xPassword(const QString &connectUuid)
qWarning()<<errorMessage; qWarning()<<errorMessage;
return ""; return "";
} }
QDBusPendingReply<NMVariantMapMap> reply = connectPtr->secrets(PRIVATE_PSK_SETTING_NAME);
QMap<QString,QVariantMap> map(reply.value()); QDBusInterface dbusInterface("org.freedesktop.NetworkManager",
connectPtr->path(),
"org.freedesktop.NetworkManager.Settings.Connection",
QDBusConnection::systemBus());
dbusInterface.setTimeout(500);
QDBusMessage result = dbusInterface.call("GetSecrets", PRIVATE_PSK_SETTING_NAME);
const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value<QDBusArgument>();
QMap<QString,QVariantMap> map;
dbusArg1st >> map;
// QDBusPendingReply<NMVariantMapMap> reply = connectPtr->secrets(PRIVATE_PSK_SETTING_NAME);
// QMap<QString,QVariantMap> map(reply.value());
if (map.contains("802-1x") && map.value("802-1x").contains("password")) if (map.contains("802-1x") && map.value("802-1x").contains("password"))
{ {
QString psk = map.value("802-1x").value("password").toString(); QString psk = map.value("802-1x").value("password").toString();