summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtLoginWindow.cpp')
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp17
1 files changed, 14 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) {