Esempio n. 1
0
void L2tpWidget::loadSecrets(const NetworkManager::Setting::Ptr &setting)
{
    NetworkManager::VpnSetting::Ptr vpnSetting = setting.staticCast<NetworkManager::VpnSetting>();

    if (vpnSetting) {
        const NMStringMap secrets = vpnSetting->secrets();
        const QString userPassword = secrets.value(NM_L2TP_KEY_PASSWORD);
        if (!userPassword.isEmpty()) {
            m_ui->password->setText(userPassword);
        }
    }
}
VpnProxySection::VpnProxySection(NetworkManager::VpnSetting::Ptr vpnSetting, QFrame *parent)
    : AbstractSection(tr("VPN Proxy"), parent),
      m_vpnSetting(vpnSetting),
    m_proxyTypeChooser(new ComboBoxWidget(this)),
    m_server(new LineEditWidget(this)),
    m_port(new SpinBoxWidget(this)),
    m_retry(new SwitchWidget(this)),
    m_userName(new LineEditWidget(this)),
    m_password(new PasswdEditWidget(this))
{
    m_dataMap = vpnSetting->data();
    m_secretMap = vpnSetting->secrets();

    initStrMaps();
    initUI();
    initConnection();

    onProxyTypeChanged(m_currentProxyType);
}