summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/MainController.cpp2
-rw-r--r--Swift/Controllers/UIInterfaces/LoginWindow.h1
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp9
-rw-r--r--Swift/QtUI/QtLoginWindow.h1
4 files changed, 13 insertions, 0 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 0705eb4..39c63dd 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -82,6 +82,7 @@ MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowF
loginWindow_->addAvailableAccount(profileSettings->getStringSetting("jid"), profileSettings->getStringSetting("pass"), profileSettings->getStringSetting("certificate"));
delete profileSettings;
}
+ loginWindow_->selectUser(settings_->getStringSetting("lastLoginJID"));
loginWindow_->onLoginRequest.connect(boost::bind(&MainController::handleLoginRequest, this, _1, _2, _3, _4));
loginWindow_->onCancelLoginRequest.connect(boost::bind(&MainController::handleCancelLoginRequest, this));
@@ -258,6 +259,7 @@ void MainController::handleLoginRequest(const String &username, const String &pa
profileSettings->storeString("jid", username);
profileSettings->storeString("certificate", certificateFile);
profileSettings->storeString("pass", remember ? password : "");
+ settings_->storeString("lastLoginJID", username);
loginWindow_->addAvailableAccount(profileSettings->getStringSetting("jid"), profileSettings->getStringSetting("pass"), profileSettings->getStringSetting("certificate"));
delete profileSettings;
jid_ = JID(username);
diff --git a/Swift/Controllers/UIInterfaces/LoginWindow.h b/Swift/Controllers/UIInterfaces/LoginWindow.h
index cfa20c7..d165125 100644
--- a/Swift/Controllers/UIInterfaces/LoginWindow.h
+++ b/Swift/Controllers/UIInterfaces/LoginWindow.h
@@ -11,6 +11,7 @@ namespace Swift {
class LoginWindow {
public:
virtual ~LoginWindow() {};
+ virtual void selectUser(const String&) = 0;
virtual void morphInto(MainWindow *mainWindow) = 0;
virtual void loggedOut() = 0;
virtual void setMessage(const String&) = 0;
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index 2fd27c6..a222e8e 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -133,6 +133,15 @@ void QtLoginWindow::setGentleGeometry(const QRect& rect) {
move(rect.topLeft());
}
+void QtLoginWindow::selectUser(const String& username) {
+ for (int i = 0; i < usernames_.count(); i++) {
+ if (P2QSTRING(username) == usernames_[i]) {
+ username_->setCurrentIndex(i);
+ break;
+ }
+ }
+}
+
QRect QtLoginWindow::defaultPosition() {
QDesktopWidget desktop;
int windowWidth = 200;
diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h
index 491521b..38852ce 100644
--- a/Swift/QtUI/QtLoginWindow.h
+++ b/Swift/QtUI/QtLoginWindow.h
@@ -30,6 +30,7 @@ namespace Swift {
virtual void addAvailableAccount(const String& defaultJID, const String& defaultPassword, const String& defaultCertificate);
static QRect defaultPosition();
void setGentleGeometry(const QRect&);
+ void selectUser(const String& user);
signals:
void geometryChanged();