/*****************************************************************************************
 * 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
void CoreConnection::onLoginSuccessful(const CoreAccount &account)
{
    updateProgress(0, 0);

    // save current account data
    accountModel()->createOrUpdateAccount(account);
    accountModel()->save();

    _reconnectTimer.stop();

    setProgressText(tr("Receiving session state"));
    setState(Synchronizing);
    emit connectionMsg(tr("Synchronizing to %1...").arg(account.accountName()));
}