QTfrontend/gameuiconfig.cpp
changeset 8294 0e5782b0dd54
parent 8291 e4a0d980d1e2
child 8295 6ef114ea2298
--- a/QTfrontend/gameuiconfig.cpp	Tue Dec 11 15:45:20 2012 +0100
+++ b/QTfrontend/gameuiconfig.cpp	Wed Dec 12 15:57:01 2012 +0100
@@ -237,10 +237,9 @@
 	setValue("net/passwordhash", "");
         setValue("net/passwordlength", 0);
     }
-    else if (netPasswordIsValid() && Form->ui.pageOptions->CBSavePassword->isChecked())
-    {
-        setValue("net/passwordhash", netPasswordHash());
-        setValue("net/passwordlength", netPasswordLength());
+    else if (netPasswordIsValid() && Form->ui.pageOptions->CBSavePassword->isChecked()) {
+	setValue("net/passwordhash", "");
+	setValue("net/passwordlength", 0);
     }
 
     setValue("net/savepassword", Form->ui.pageOptions->CBSavePassword->isChecked());
@@ -482,6 +481,38 @@
     return (netPasswordLength() == 0 || Form->ui.pageOptions->editNetPassword->text() != QString(netPasswordLength(), '*'));
 }
 
+void GameUIConfig::clearPasswordHash() 
+{
+    setValue("net/passwordhash", QString());
+    setValue("net/passwordlength", 0);
+}
+
+void GameUIConfig::setPasswordHash(const QString & passwordhash)
+{
+    setValue("net/passwordhash", passwordhash);
+    setValue("net/passwordlength", passwordhash.size());
+    netPasswordLength();
+}
+
+QString GameUIConfig::passwordHash()
+{
+    return value("net/passwordhash").toString();
+}
+
+void GameUIConfig::clearTempHash() 
+{
+    setTempHash(QString());
+}
+
+void GameUIConfig::setTempHash(const QString & temphash)
+{
+    this->temphash = temphash;
+}
+
+QString GameUIConfig::tempHash() {
+    return this->temphash;
+}
+
 // When hedgewars launches, the password field is set with null characters. If the user tries to edit the field and there are such characters, then clear the field
 bool GameUIConfig::eventFilter(QObject *object, QEvent *event)
 {