Custom button added to main window class.
[speedfreak] / Client / settingsdialog.cpp
index ab584e9..8e96b2f 100644 (file)
@@ -62,7 +62,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
 }
@@ -199,5 +207,8 @@ void SettingsDialog::usernameOk(bool isOk)
         ui->setUserPushButton->setText("Log in");
         ui->setUserUsernameLineEdit->clear();
         ui->setUserPasswordLineEdit->clear();
+        this->username = ui->setUserUsernameLineEdit->text();
+        this->password = ui->setUserPasswordLineEdit->text();
+        saveLogin( this->username, this->password);
     }
 }