summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp17
-rw-r--r--Swift/QtUI/QtLoginWindow.h1
2 files changed, 15 insertions, 3 deletions
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index 1796b0e..655e3b9 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -240,15 +240,26 @@ void QtLoginWindow::loggedOut() {
stack_->removeWidget(current);
}
setInitialMenus();
- setEnabled(true);
+ setIsLoggingIn(false);
}
void QtLoginWindow::setIsLoggingIn(bool loggingIn) {
- setEnabled(!loggingIn);
+ /* Change the for loop as well if you add to this.*/
+ QWidget* widgets[4] = {username_, password_, remember_, loginAutomatically_};
+ loginButton_->setText(loggingIn ? "Cancel" : "Connect");
+ for (int i = 0; i < 4; i++) {
+ widgets[i]->setEnabled(!loggingIn);
+ }
+
}
void QtLoginWindow::loginClicked() {
- onLoginRequest(Q2PSTRING(username_->currentText()), Q2PSTRING(password_->text()), Q2PSTRING(certificateFile_), remember_->isChecked(), loginAutomatically_->isChecked());
+ if (username_->isEnabled()) {
+ onLoginRequest(Q2PSTRING(username_->currentText()), Q2PSTRING(password_->text()), Q2PSTRING(certificateFile_), remember_->isChecked(), loginAutomatically_->isChecked());
+ } else {
+ qDebug() << "Cancelling login";
+ onCancelLoginRequest();
+ }
}
void QtLoginWindow::setLoginAutomatically(bool loginAutomatically) {
diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h
index c7b35c7..c84033a 100644
--- a/Swift/QtUI/QtLoginWindow.h
+++ b/Swift/QtUI/QtLoginWindow.h
@@ -63,6 +63,7 @@ namespace Swift {
QComboBox* username_;
QLineEdit* password_;
QPushButton* loginButton_;
+ /* If you add a widget here, change setLoggingIn as well.*/
QCheckBox* remember_;
QCheckBox* loginAutomatically_;
QStackedWidget* stack_;