X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fgui%2Fsettingsdialog.cpp;h=11f06495b435fcfda9655402744d83f88941be6d;hb=4a9690bd6f3d972d36976863607f9353a5d62301;hp=9b9ed109a0f00dfac10859472d6931c17e0b9aff;hpb=965820801f5cdbd68f25702195f42433ed249d77;p=jenirok diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index 9b9ed10..11f0649 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -41,7 +42,8 @@ autostartSelector_(0) DB::connect(); - QVBoxLayout* left = new QVBoxLayout; + QVBoxLayout* general = new QVBoxLayout; + QVBoxLayout* daemon = new QVBoxLayout; QHBoxLayout* mainLayout = new QHBoxLayout; QHBoxLayout* username = new QHBoxLayout; QHBoxLayout* password = new QHBoxLayout; @@ -52,7 +54,7 @@ autostartSelector_(0) QLabel* passwordLabel = new QLabel(tr("Eniro password")); passwordInput_ = new QLineEdit(Settings::instance()->get("eniro_password")); - passwordInput_->setEchoMode(QLineEdit::Password); + passwordInput_->setEchoMode(QLineEdit::PasswordEchoOnEdit); QLabel* cacheLabel = new QLabel(tr("Cache size (numbers)")); cacheInput_ = new QLineEdit(Settings::instance()->get("cache_size")); @@ -106,6 +108,10 @@ autostartSelector_(0) autostartSelector_->addItem(tr("Disabled"), "0"); autostartSelector_->setCurrentIndex(autostart == "1" ? 0 : 1); + connectionSelector_ = new ConnectionSelector(tr("Connect automatically on"), this); + QString selectedConnection = Settings::instance()->get("connection"); + connectionSelector_->selectByValue(selectedConnection); + QPushButton* submitButton = new QPushButton(tr("Save"), this); connect(submitButton, SIGNAL(pressed()), this, SLOT(saveSettings())); @@ -116,17 +122,30 @@ autostartSelector_(0) cache->addWidget(cacheLabel); cache->addWidget(cacheInput_); cache->addWidget(cacheResetButton); - left->addLayout(username); - left->addLayout(password); - left->addLayout(cache); - left->addWidget(siteSelector_); - left->addWidget(autostartSelector_); + general->addLayout(username); + general->addLayout(password); + general->addLayout(cache); + general->addWidget(siteSelector_); + + daemon->addWidget(autostartSelector_); + daemon->addWidget(connectionSelector_); QDialogButtonBox* buttons = new QDialogButtonBox; buttons->setCenterButtons(false); buttons->addButton(submitButton, QDialogButtonBox::AcceptRole); - mainLayout->addLayout(left); + QTabWidget* tabs = new QTabWidget; + + QWidget* generalTab = new QWidget; + generalTab->setLayout(general); + + QWidget* daemonTab = new QWidget; + daemonTab->setLayout(daemon); + + tabs->addTab(generalTab, tr("General")); + tabs->addTab(daemonTab, tr("Daemon")); + + mainLayout->addWidget(tabs); mainLayout->addWidget(buttons); setLayout(mainLayout); @@ -136,6 +155,8 @@ autostartSelector_(0) void SettingsDialog::saveSettings() { + hide(); + DB::connect(); Settings::instance()->set("eniro_username", usernameInput_->text()); @@ -145,11 +166,12 @@ void SettingsDialog::saveSettings() Settings::instance()->set("site", site); QString autostart = autostartSelector_->value().toString(); Settings::instance()->set("autostart", autostart); + QString connection = connectionSelector_->value().toString(); + Settings::instance()->set("connection", connection); + Settings::instance()->set("connection_name", connectionSelector_->text()); DB::disconnect(); - hide(); - if(site != currentSite_ && Daemon::isRunning()) { QMaemo5InformationBox::information(this, tr("Restarting daemon...")); @@ -166,6 +188,7 @@ void SettingsDialog::setVisible(bool visible) if(visible) { currentSite_ = siteSelector_->value().toString(); + currentConnection_ = connectionSelector_->value().toString(); } }