[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [networkmanagement/nm09] libs/ui/security: Don't erase the input for the WEP key when it's not corre
From:       Jan Grulich <jgrulich () redhat ! com>
Date:       2013-03-08 14:06:05
Message-ID: 20130308140605.01486A604F () git ! kde ! org
[Download RAW message or body]

Git commit e6e6c492ad057b6cbaa1c3dfb942987abb1935f2 by Jan Grulich.
Committed on 08/03/2013 at 15:05.
Pushed by grulich into branch 'nm09'.

Don't erase the input for the WEP key when it's not correct

M  +6    -5    libs/ui/security/wepwidget.cpp

http://commits.kde.org/networkmanagement/e6e6c492ad057b6cbaa1c3dfb942987abb1935f2

diff --git a/libs/ui/security/wepwidget.cpp b/libs/ui/security/wepwidget.cpp
index a0939b1..f5b4228 100644
--- a/libs/ui/security/wepwidget.cpp
+++ b/libs/ui/security/wepwidget.cpp
@@ -101,12 +101,12 @@ void WepWidget::keyTypeChanged(int index)
         case 0: //passphrase
             d->ui.keyLabel->setText(i18n("&Passphrase:"));
             d->format = WepWidget::Passphrase;
-            d->ui.key->setValidator(0); // Clear the validator
+            d->ui.key->setMaxLength(64);
             break;
         case 1: //hex/ascii key
             d->ui.keyLabel->setText(i18n("&Key:"));
             d->format = WepWidget::Hex;
-            d->ui.key->setValidator(d->wepKeyValidator);
+            d->ui.key->setMaxLength(26);
             break;
     }
     // Ensure any existing key is validated too
@@ -139,9 +139,10 @@ bool WepWidget::validate() const
 {
     Q_D(const WepWidget);
     if (d->ui.keyType->currentIndex() == 1) {   // Hex/ASCII key
-        return d->ui.key->hasAcceptableInput();
-    }
-    else {  // Passphrase
+        QString key = d->ui.key->text();
+        int keyLength = key.length();
+        return (d->wepKeyValidator->validate(key, keyLength) == QValidator::Acceptable);
+    } else {  // Passphrase
         return (!d->ui.key->text().isEmpty() && d->ui.key->text().length() <= 64);
     }
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic