From ae6937ab81245ed9893029ab1f7399fc53b2f0df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 8 Apr 2013 18:21:43 +0200 Subject: [PATCH] Focus password text box if there's an account saved by default. Save settings! --- gui/logindialog.cpp | 7 +++++++ libsettings/src/inisettingsobject.cpp | 1 + 2 files changed, 8 insertions(+) diff --git a/gui/logindialog.cpp b/gui/logindialog.cpp index 842a45414..31220e749 100644 --- a/gui/logindialog.cpp +++ b/gui/logindialog.cpp @@ -43,6 +43,13 @@ LoginDialog::LoginDialog(QWidget *parent, const QString& loginErrMsg) : QStringList accounts = k->getStoredAccounts("minecraft"); ui->usernameTextBox->addItems(accounts); + // TODO: restore last selected account here, if applicable + + int index = ui->usernameTextBox->currentIndex(); + if(index != -1) + { + ui->passwordTextBox->setFocus(Qt::OtherFocusReason); + } } LoginDialog::~LoginDialog() diff --git a/libsettings/src/inisettingsobject.cpp b/libsettings/src/inisettingsobject.cpp index 8c4cc89de..17b132a35 100644 --- a/libsettings/src/inisettingsobject.cpp +++ b/libsettings/src/inisettingsobject.cpp @@ -36,6 +36,7 @@ void INISettingsObject::changeSetting(const Setting &setting, QVariant value) m_ini.set(setting.configKey(), value); else m_ini.remove(setting.configKey()); + m_ini.saveFile(m_filePath); } }