X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fcoreconnectdlg.cpp;fp=src%2Fqtui%2Fcoreconnectdlg.cpp;h=9cc342773303d2d3e26c02e3ef0fcd8d47e26dcb;hp=d3ebb7ac5aa9bc21d9587b9e526e662c14e3d3d6;hb=694f9bfbf7f1af19108461c7e00d133e55082bce;hpb=61c8d84d1c849373e0f115dc748ed45cff95287d diff --git a/src/qtui/coreconnectdlg.cpp b/src/qtui/coreconnectdlg.cpp index d3ebb7ac..9cc34277 100644 --- a/src/qtui/coreconnectdlg.cpp +++ b/src/qtui/coreconnectdlg.cpp @@ -27,71 +27,81 @@ #include "clientsettings.h" #include "coreaccountsettingspage.h" -CoreConnectDlg::CoreConnectDlg(QWidget *parent) : QDialog(parent) { - _settingsPage = new CoreAccountSettingsPage(this); - _settingsPage->setStandAlone(true); - _settingsPage->load(); +CoreConnectDlg::CoreConnectDlg(QWidget *parent) : QDialog(parent) +{ + _settingsPage = new CoreAccountSettingsPage(this); + _settingsPage->setStandAlone(true); + _settingsPage->load(); - CoreAccountSettings s; - AccountId lastAccount = s.lastAccount(); - if(lastAccount.isValid()) - _settingsPage->setSelectedAccount(lastAccount); + CoreAccountSettings s; + AccountId lastAccount = s.lastAccount(); + if (lastAccount.isValid()) + _settingsPage->setSelectedAccount(lastAccount); - setWindowTitle(tr("Connect to Core")); - setWindowIcon(SmallIcon("network-disconnect")); + setWindowTitle(tr("Connect to Core")); + setWindowIcon(SmallIcon("network-disconnect")); - QVBoxLayout *layout = new QVBoxLayout(this); - layout->addWidget(_settingsPage); + QVBoxLayout *layout = new QVBoxLayout(this); + layout->addWidget(_settingsPage); - QDialogButtonBox *buttonBox = new QDialogButtonBox(this); - buttonBox->setStandardButtons(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); - layout->addWidget(buttonBox); + QDialogButtonBox *buttonBox = new QDialogButtonBox(this); + buttonBox->setStandardButtons(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); + layout->addWidget(buttonBox); - connect(_settingsPage, SIGNAL(connectToCore(AccountId)), SLOT(accept())); - connect(buttonBox, SIGNAL(accepted()), SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), SLOT(reject())); + connect(_settingsPage, SIGNAL(connectToCore(AccountId)), SLOT(accept())); + connect(buttonBox, SIGNAL(accepted()), SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), SLOT(reject())); } -AccountId CoreConnectDlg::selectedAccount() const { - return _settingsPage->selectedAccount(); + +AccountId CoreConnectDlg::selectedAccount() const +{ + return _settingsPage->selectedAccount(); } -void CoreConnectDlg::accept() { - _settingsPage->save(); - QDialog::accept(); + +void CoreConnectDlg::accept() +{ + _settingsPage->save(); + QDialog::accept(); } + /******** CoreConnectAuthDlg ****************************************************************/ CoreConnectAuthDlg::CoreConnectAuthDlg(CoreAccount *account, QWidget *parent) - : QDialog(parent), - _account(account) + : QDialog(parent), + _account(account) { - ui.setupUi(this); + ui.setupUi(this); - connect(ui.user, SIGNAL(textChanged(QString)), SLOT(setButtonStates())); - connect(ui.password, SIGNAL(textChanged(QString)), SLOT(setButtonStates())); + connect(ui.user, SIGNAL(textChanged(QString)), SLOT(setButtonStates())); + connect(ui.password, SIGNAL(textChanged(QString)), SLOT(setButtonStates())); - ui.label->setText(tr("Please enter your credentials for %1:").arg(account->accountName())); - ui.user->setText(account->user()); - ui.password->setText(account->password()); - ui.rememberPasswd->setChecked(account->storePassword()); + ui.label->setText(tr("Please enter your credentials for %1:").arg(account->accountName())); + ui.user->setText(account->user()); + ui.password->setText(account->password()); + ui.rememberPasswd->setChecked(account->storePassword()); - if(ui.user->text().isEmpty()) - ui.user->setFocus(); - else - ui.password->setFocus(); + if (ui.user->text().isEmpty()) + ui.user->setFocus(); + else + ui.password->setFocus(); } -void CoreConnectAuthDlg::accept() { - _account->setUser(ui.user->text()); - _account->setPassword(ui.password->text()); - _account->setStorePassword(ui.rememberPasswd->isChecked()); - QDialog::accept(); +void CoreConnectAuthDlg::accept() +{ + _account->setUser(ui.user->text()); + _account->setPassword(ui.password->text()); + _account->setStorePassword(ui.rememberPasswd->isChecked()); + + QDialog::accept(); } -void CoreConnectAuthDlg::setButtonStates() { - bool valid = !(ui.user->text().isEmpty() || ui.password->text().isEmpty()); - ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid); + +void CoreConnectAuthDlg::setButtonStates() +{ + bool valid = !(ui.user->text().isEmpty() || ui.password->text().isEmpty()); + ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid); }