Blob Blame History Raw
From 56c6c6bc9a8cb7e6173be255af9a2a5204627270 Mon Sep 17 00:00:00 2001
From: "Lamarque V. Souza" <lamarque@kde.org>
Date: Fri, 2 Dec 2011 15:58:16 -0200
Subject: [PATCH 08/10] Fix wifi WPA2 edit dialog. (cherry picked from commit
 1fb0bdce94758cc144d894bc6e82dee54d0233fc)

---
 libs/ui/security/eapmethodstack.cpp |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/libs/ui/security/eapmethodstack.cpp b/libs/ui/security/eapmethodstack.cpp
index bca6ec0..14a15ae 100644
--- a/libs/ui/security/eapmethodstack.cpp
+++ b/libs/ui/security/eapmethodstack.cpp
@@ -79,9 +79,15 @@ void EapMethodStack::setCurrentEapMethod(int key)
 /* Triggered when the user changes the EAP method using the cboEapMethod combo box. */
 void EapMethodStack::setCurrentEapMethodInternal(int index)
 {
+    // Save old eap method's data into this connection's settings.
+    qobject_cast<EapMethod *>(eapMethods->currentWidget())->writeConfig();
+
+    // Change to the chosen epa method.
     eapMethods->setCurrentIndex(index);
-    readConfig();
-    readSecrets();
+
+    // Load this connection's setting into the chosen epa method.
+    qobject_cast<EapMethod *>(eapMethods->widget(index))->readConfig();
+    qobject_cast<EapMethod *>(eapMethods->widget(index))->readSecrets();
 }
 
 EapMethod * EapMethodStack::currentEapMethod() const
@@ -120,8 +126,8 @@ void EapMethodStack::readSecrets()
 
 void EapMethodStack::setShowPasswords(bool on)
 {
-    if (eapMethods->count()) {
-        qobject_cast<EapMethod *>( eapMethods->currentWidget())->setShowPasswords(on);
+    for (int i = 0; i < eapMethods->count(); ++i) {
+        qobject_cast<EapMethod *>( eapMethods->widget(i))->setShowPasswords(on);
     }
 }
 
-- 
1.7.7.4