Bugfix: Disable username and password fields.
[speedfreak] / Client / settingsdialog.cpp
index fb5d7c0..d06ef3a 100644 (file)
@@ -27,8 +27,11 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
         this->username = uName;
         this->password = pWord;
 
+        // Set line edit
         ui->setUserPasswordLineEdit->setText(this->password);
         ui->setUserUsernameLineEdit->setText(this->username);
+        ui->setUserPasswordLineEdit->setDisabled(1); // Disable because user logged
+        ui->setUserUsernameLineEdit->setDisabled(1); // Disable because user logged
 
         // Already someone as user - change button text to "Change"
         ui->setUserPushButton->setText("Log out");
@@ -62,7 +65,15 @@ void SettingsDialog::on_registratePushButton_clicked()
     this->regPassword = ui->regPasswordLineEdit->text();
     this->regEmail = ui->regEMailLineEdit->text();
 
-    emit sendregistration();
+    if (this->regUsername.compare("") && this->regPassword.compare("") && this->regEmail.compare("") && this->regEmail.compare("@"))
+    {
+        emit sendregistration();
+
+    }
+    else
+    {
+        QMessageBox::about(this, "One or more of the fields is empty", "Set username (3-12 characters), password (at least 6 characters) and valid email address");
+    }
 
     //close();      //using close() hides popup-window which reports error from server
 }