#include "FederatedLogin.h" #include "DomainValidator.h" #include FederatedLogin::FederatedLogin(QWidget *parent):QDialog(parent),_layout(this) { int y = 0; _message = new QLabel(this); setMessage(""); _layout.addWidget(_message, y, 0, 1, 2); _domainLbl = new QLabel(tr("&Domain:"), this); _layout.addWidget(_domainLbl, ++y, 0); _domain = new QLineEdit(app->settings().value("domain").toString(), this); _domain->setValidator(new DomainValidator(_domain)); _domainLbl->setBuddy(_domain); _layout.addWidget(_domain, y, 1); _userLbl = new QLabel(tr("&User/Email:"), this); _layout.addWidget(_userLbl, ++y, 0); _user = new QLineEdit(app->settings().value("user").toString(), this); _userLbl->setBuddy(_user); _layout.addWidget(_user, y, 1); _passwordLbl = new QLabel(tr("&Password:"), this); _layout.addWidget(_passwordLbl, ++y, 0); _password = new QLineEdit(app->settings().value("password").toString(), this); _password->setEchoMode(QLineEdit::Password); _passwordLbl->setBuddy(_password); _layout.addWidget(_password, y, 1); _storeLogin = new QCheckBox(tr("&Store authentication information for next login"), this); _layout.addWidget(_storeLogin, ++y, 0, 1, 2); _buttons = new ButtonRow(this); _layout.addWidget(_buttons, ++y, 0, 1, 2); _ok = new QPushButton(tr("&OK"), _buttons); _ok->setDefault(true); _buttons->add(_ok); _cancel = new QPushButton(tr("&Cancel"), _buttons); _buttons->add(_cancel); connect(_ok, &QPushButton::clicked, this, &FederatedLogin::storeLogin); connect(_ok, &QPushButton::clicked, this, &QDialog::accept); connect(_cancel, &QPushButton::clicked, this, &QDialog::reject); } void FederatedLogin::setMessage(QString const &m) { _message->setText(m); _message->setHidden(m.isEmpty()); } void FederatedLogin::storeLogin() { if(_storeLogin->isChecked()) { app->settings().setValue("domain", _domain->text()); app->settings().setValue("user", _user->text()); app->settings().setValue("password", _password->text()); } }