summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-10-30 10:34:33 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-10-30 10:35:48 (GMT)
commit443b7759b8c59108b13ac55d20fdfe9d12ca4e79 (patch)
tree876841d4c57647634880c24af1542b9c1e569339
parent06e40dd580e43e11e519acbb2d30156c18081f79 (diff)
downloadswift-contrib-443b7759b8c59108b13ac55d20fdfe9d12ca4e79.zip
swift-contrib-443b7759b8c59108b13ac55d20fdfe9d12ca4e79.tar.bz2
Fix eagle mode asking to save password after signout
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index 87dd849..e339d79 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -285,71 +285,72 @@ void QtLoginWindow::addAvailableAccount(const std::string& defaultJID, const std
usernames_[index] = username;
passwords_[index] = P2QSTRING(defaultPassword);
certificateFiles_[index] = P2QSTRING(defaultCertificate);
}
}
void QtLoginWindow::handleUsernameTextChanged() {
QString username = username_->currentText();
for (int i = 0; i < usernames_.count(); i++) {
if (username_->currentText() == usernames_[i]) {
certificateFile_ = certificateFiles_[i];
password_->setText(passwords_[i]);
remember_->setChecked(password_->text() != "");
}
}
if (!certificateFile_.isEmpty()) {
certificateButton_->setChecked(true);
}
}
void QtLoginWindow::loggedOut() {
stack_->removeWidget(stack_->currentWidget());
stack_->addWidget(loginWidgetWrapper_);
stack_->setCurrentWidget(loginWidgetWrapper_);
setInitialMenus();
setIsLoggingIn(false);
}
void QtLoginWindow::setIsLoggingIn(bool loggingIn) {
/* Change the for loop as well if you add to this.*/
QWidget* widgets[5] = {username_, password_, remember_, loginAutomatically_, certificateButton_};
loginButton_->setText(loggingIn ? tr("Cancel") : tr("Connect"));
for (int i = 0; i < 5; i++) {
widgets[i]->setEnabled(!loggingIn);
}
-
+ remember_->setEnabled(!eagleMode_);
+ loginAutomatically_->setEnabled(!eagleMode_);
}
void QtLoginWindow::loginClicked() {
if (username_->isEnabled()) {
if (eagleMode_) {
QString clickThroughPath(P2QSTRING((Paths::getExecutablePath() / "eagle-banner.txt").string()));
QFile clickThroughFile(clickThroughPath);
if (clickThroughFile.exists() && clickThroughFile.open(QIODevice::ReadOnly)) {
QString banner;
while (!clickThroughFile.atEnd()) {
QByteArray line = clickThroughFile.readLine();
banner += line + "\n";
}
if (!banner.isEmpty()) {
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Confirm terms of use"));
msgBox.setText("");
msgBox.setInformativeText(banner);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
if (msgBox.exec() != QMessageBox::Yes) {
return;
}
}
}
}
onLoginRequest(Q2PSTRING(username_->currentText()), Q2PSTRING(password_->text()), Q2PSTRING(certificateFile_), remember_->isChecked(), loginAutomatically_->isChecked());
if (eagleMode_) { /* Mustn't remember logins */
username_->clearEditText();
password_->setText("");
}
} else {
onCancelLoginRequest();
}
}