You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kf5-networkmanager-qt/nm-qt-do-not-remove-existin...

43 lines
1.4 KiB

From fec3bfe050fbb5947b807bc889eed928cb7b22c6 Mon Sep 17 00:00:00 2001
From: Jan Grulich <jgrulich@redhat.com>
Date: Mon, 12 Jan 2015 11:16:43 +0100
Subject: [PATCH 4/9] Do not remove existing secrets when loading secrets from
string map
E.g. when loading secrets for openconnect from plasma-nm secret agent
we want to keep secrets we already have from NetworkManager and do not
overwrite them with those secrets which are stored in KWallet
---
src/settings/vpnsetting.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/settings/vpnsetting.cpp b/src/settings/vpnsetting.cpp
index 6dd8cb7..210093b 100644
--- a/src/settings/vpnsetting.cpp
+++ b/src/settings/vpnsetting.cpp
@@ -173,15 +173,19 @@ QVariantMap NetworkManager::VpnSetting::toMap() const
void NetworkManager::VpnSetting::secretsFromStringMap(const NMStringMap &map)
{
+ Q_D(VpnSetting);
+
if (map.contains(QLatin1String("VpnSecrets"))) {
const QStringList list = map.value(QLatin1String("VpnSecrets")).split("%SEP%");
NMStringMap map;
if (list.count() % 2 == 0) {
for (int i = 0; i < list.count(); i += 2) {
- map.insert(list[i], list[i + 1]);
+ if (d->secrets.contains(list[i])) {
+ d->secrets.remove(list[i]);
+ }
+ d->secrets.insert(list[i], list[i + 1]);
}
}
- setSecrets(map);
}
}
--
2.1.0