X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;ds=sidebyside;f=Client%2Fsettingsdialog.cpp;h=b61957625c3ac39ed1db7150d1ad82e3a1195079;hb=e1fb08eb319b50ddae0c5ce9a23a1ddfc6cc15d3;hp=b62335bad6eda11a17d46e0c71910f65e439efd2;hpb=9de94ffc9dac2ad13fda5703e58553737e1a0d42;p=speedfreak diff --git a/Client/settingsdialog.cpp b/Client/settingsdialog.cpp index b62335b..b619576 100644 --- a/Client/settingsdialog.cpp +++ b/Client/settingsdialog.cpp @@ -1,5 +1,14 @@ +/* + * SettingsDialog class + * + * @author Olavi Pulkkinen + * @copyright (c) 2010 Speed Freak team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + */ + #include "settingsdialog.h" #include "ui_settingsdialog.h" +#include "usersettings.h" SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), @@ -9,6 +18,21 @@ SettingsDialog::SettingsDialog(QWidget *parent) : this->setWindowTitle("Settings"); this->ui->regEMailLineEdit->setText("@"); instructionsDialog = new InstructionsDialog; + + if (loginSaved()) + { + QString uName, pWord; + + getLoginInfo( &uName, &pWord); + this->username = uName; + this->password = pWord; + + ui->setUserPasswordLineEdit->setText(this->password); + ui->setUserUsernameLineEdit->setText(this->username); + + // Already someone as user - change button text to "Change" + ui->setUserPushButton->setText("Change user"); + } } SettingsDialog::~SettingsDialog() @@ -91,6 +115,19 @@ void SettingsDialog::on_setUserPushButton_clicked() this->username = ui->setUserUsernameLineEdit->text(); this->password = ui->setUserPasswordLineEdit->text(); + // Save these also to usersettings + saveLogin( this->username, this->password); + + // Set "Set/Change User" button text + if (this->username.length() > 0) + { + ui->setUserPushButton->setText("Change user"); + } + else + { // Username "cleared" + ui->setUserPushButton->setText("Set user"); + } + emit userNameChanged(); //close(); //using close() hides popup-window which reports error from server