/*****************************************************************************************
 * CoreAccountEditDlg
 *****************************************************************************************/
CoreAccountEditDlg::CoreAccountEditDlg(const CoreAccount &acct, QWidget *parent)
    : QDialog(parent)
{
    ui.setupUi(this);

    _account = acct;

    ui.hostName->setText(acct.hostName());
    ui.port->setValue(acct.port());
    ui.accountName->setText(acct.accountName());
    ui.user->setText(acct.user());
    ui.password->setText(acct.password());
    ui.rememberPassword->setChecked(acct.storePassword());
    ui.useProxy->setChecked(acct.useProxy());
    ui.proxyHostName->setText(acct.proxyHostName());
    ui.proxyPort->setValue(acct.proxyPort());
    ui.proxyType->setCurrentIndex(acct.proxyType() == QNetworkProxy::Socks5Proxy ? 0 : 1);
    ui.proxyUser->setText(acct.proxyUser());
    ui.proxyPassword->setText(acct.proxyPassword());

    if (acct.accountId().isValid())
        setWindowTitle(tr("Edit Core Account"));
    else
        setWindowTitle(tr("Add Core Account"));
}
Esempio n. 2
0
/*****************************************************************************************
 * CoreAccountEditDlg
 *****************************************************************************************/
CoreAccountEditDlg::CoreAccountEditDlg(const CoreAccount &acct, QWidget *parent)
    : QDialog(parent)
{
    ui.setupUi(this);

    _account = acct;

    ui.hostName->setText(acct.hostName());
    ui.port->setValue(acct.port());
    ui.accountName->setText(acct.accountName());
    ui.user->setText(acct.user());
    ui.password->setText(acct.password());
    ui.rememberPassword->setChecked(acct.storePassword());

    ui.buttonGroupProxyType->setId(ui.radioButtonNoProxy, 0);
    ui.buttonGroupProxyType->setId(ui.radioButtonSystemProxy, 1);
    ui.buttonGroupProxyType->setId(ui.radioButtonManualProxy, 2);

    bool manualProxy = false;
    switch (acct.proxyType()) {
    case QNetworkProxy::NoProxy:
        ui.buttonGroupProxyType->button(0)->setChecked(true);
        break;
    case QNetworkProxy::DefaultProxy:
        ui.buttonGroupProxyType->button(1)->setChecked(true);
        break;
    case QNetworkProxy::Socks5Proxy:
        ui.buttonGroupProxyType->button(2)->setChecked(true);
        ui.proxyType->setCurrentIndex(0);
        manualProxy = true;
        break;
    case QNetworkProxy::HttpProxy:
        ui.buttonGroupProxyType->button(2)->setChecked(true);
        ui.proxyType->setCurrentIndex(1);
        manualProxy = true;
        break;
    default:
        break;
    }

    if (manualProxy) {
        ui.proxyHostName->setText(acct.proxyHostName());
        ui.proxyPort->setValue(acct.proxyPort());
        ui.proxyType->setEnabled(true);
        ui.proxyUser->setText(acct.proxyUser());
        ui.proxyPassword->setText(acct.proxyPassword());
    }

    if (acct.accountId().isValid())
        setWindowTitle(tr("Edit Core Account"));
    else
        setWindowTitle(tr("Add Core Account"));
}
Esempio n. 3
0
PasswordChangeDlg::PasswordChangeDlg(QWidget* parent)
    : QDialog(parent)
{
    ui.setupUi(this);

    CoreAccount account = Client::currentCoreAccount();
    ui.infoLabel->setText(tr("This changes the password for your username <b>%1</b> "
                             "on the Quassel Core running at <b>%2</b>.")
                              .arg(account.user(), account.hostName()));

    connect(ui.oldPasswordEdit, &QLineEdit::textChanged, this, &PasswordChangeDlg::inputChanged);
    connect(ui.newPasswordEdit, &QLineEdit::textChanged, this, &PasswordChangeDlg::inputChanged);
    connect(ui.confirmPasswordEdit, &QLineEdit::textChanged, this, &PasswordChangeDlg::inputChanged);
    connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &PasswordChangeDlg::changePassword);

    connect(Client::instance(), &Client::passwordChanged, this, &PasswordChangeDlg::passwordChanged);

    ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
}