X-Git-Url: http://git.maemo.org/git/?p=speedfreak;a=blobdiff_plain;f=Client%2Fsettingsdialog.cpp;h=b61957625c3ac39ed1db7150d1ad82e3a1195079;hp=e44580db1e696fbf581e0fbfade433f0dab99a71;hb=674c387dc5c82ed543e1e32cec87e9e78d00748d;hpb=1ce63a09f942b9fa7e410251c4355baa56cfef59 diff --git a/Client/settingsdialog.cpp b/Client/settingsdialog.cpp index e44580d..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), @@ -7,7 +16,23 @@ SettingsDialog::SettingsDialog(QWidget *parent) : { ui->setupUi(this); 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() @@ -45,9 +70,9 @@ void SettingsDialog::on_registratePushButton_clicked() this->regPassword = ui->regPasswordLineEdit->text(); this->regEmail = ui->regEMailLineEdit->text(); - //emit sendregistration(); + emit sendregistration(); - close(); + //close(); //using close() hides popup-window which reports error from server } // Next 6 functions can be removed if Settingsdialog is implemented without @@ -90,8 +115,22 @@ void SettingsDialog::on_setUserPushButton_clicked() this->username = ui->setUserUsernameLineEdit->text(); this->password = ui->setUserPasswordLineEdit->text(); - //emit userNameChanged(); - close(); + // 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 } // Next 4 functions can be removed if Settingsdialog is implemented without @@ -116,3 +155,7 @@ QString SettingsDialog::getPassword() return this->password; } +void SettingsDialog::setLabelInfoToUser(QString infoText) +{ + this->ui->labelInfoToUser->setText(infoText); +}