* fixing bug #156: Cancel button on password request works now.
authorsheepluva
Thu, 01 Apr 2010 23:37:28 +0000
changeset 3246 ab99a0f0b485
parent 3245 252be02536ab
child 3247 045a76b9f32f
* fixing bug #156: Cancel button on password request works now.
QTfrontend/newnetclient.cpp
--- a/QTfrontend/newnetclient.cpp	Thu Apr 01 21:57:03 2010 +0000
+++ b/QTfrontend/newnetclient.cpp	Thu Apr 01 23:37:28 2010 +0000
@@ -453,10 +453,17 @@
     }
 
     if (lst[0] == "ASKPASSWORD") {
+        bool ok = false;
         int passLength = config->value("net/passwordlength", 0).toInt();
         QString hash = config->value("net/passwordhash", "").toString();
-        QString password = QInputDialog::getText(0, tr("Password"), tr("Your nickname %1 is\nregistered on Hedgewars.org\nPlease provide your password\nor pick another nickname:").arg(mynick), QLineEdit::Password, passLength==0?NULL:QString(passLength,'\0'));
-
+        QString password = QInputDialog::getText(0, tr("Password"), tr("Your nickname %1 is\nregistered on Hedgewars.org\nPlease provide your password\nor pick another nickname:").arg(mynick), QLineEdit::Password, passLength==0?NULL:QString(passLength,'\0'), &ok);
+        
+        if (!ok) {
+            Disconnect();
+            emit Disconnected();
+            return;
+        }
+        
         if (!passLength || password!=QString(passLength, '\0')) {
             hash = QCryptographicHash::hash(password.toLatin1(), QCryptographicHash::Md5).toHex();
             config->setValue("net/passwordhash", hash);