Changeset View
Changeset View
Standalone View
Standalone View
vpn/strongswan/strongswanwidget.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 41 | { | |||
---|---|---|---|---|---|
44 | 44 | | |||
45 | d->setting = setting; | 45 | d->setting = setting; | ||
46 | 46 | | |||
47 | // Connect for setting check | 47 | // Connect for setting check | ||
48 | watchChangedSetting(); | 48 | watchChangedSetting(); | ||
49 | 49 | | |||
50 | // Connect for validity check | 50 | // Connect for validity check | ||
51 | connect(d->ui.leGateway, &QLineEdit::textChanged, this, &StrongswanSettingWidget::slotWidgetChanged); | 51 | connect(d->ui.leGateway, &QLineEdit::textChanged, this, &StrongswanSettingWidget::slotWidgetChanged); | ||
52 | connect(d->ui.proposal, &QGroupBox::toggled, this, &SettingWidget::settingChanged); | ||||
52 | 53 | | |||
53 | KAcceleratorManager::manage(this); | 54 | KAcceleratorManager::manage(this); | ||
54 | 55 | | |||
55 | if (d->setting && !d->setting->isNull()) { | 56 | if (d->setting && !d->setting->isNull()) { | ||
56 | loadConfig(d->setting); | 57 | loadConfig(d->setting); | ||
57 | } | 58 | } | ||
58 | } | 59 | } | ||
59 | 60 | | |||
Show All 32 Lines | 92 | } else if (method == QLatin1String(NM_STRONGSWAN_AUTH_EAP)) { | |||
92 | d->ui.cmbMethod->setCurrentIndex(StrongswanSettingWidgetPrivate::Eap); | 93 | d->ui.cmbMethod->setCurrentIndex(StrongswanSettingWidgetPrivate::Eap); | ||
93 | d->ui.leUserName->setText(dataMap[NM_STRONGSWAN_USER]); | 94 | d->ui.leUserName->setText(dataMap[NM_STRONGSWAN_USER]); | ||
94 | } | 95 | } | ||
95 | 96 | | |||
96 | // Settings | 97 | // Settings | ||
97 | d->ui.innerIP->setChecked(dataMap[NM_STRONGSWAN_INNERIP] == "yes"); | 98 | d->ui.innerIP->setChecked(dataMap[NM_STRONGSWAN_INNERIP] == "yes"); | ||
98 | d->ui.udpEncap->setChecked(dataMap[NM_STRONGSWAN_ENCAP] == "yes"); | 99 | d->ui.udpEncap->setChecked(dataMap[NM_STRONGSWAN_ENCAP] == "yes"); | ||
99 | d->ui.ipComp->setChecked(dataMap[NM_STRONGSWAN_IPCOMP] == "yes"); | 100 | d->ui.ipComp->setChecked(dataMap[NM_STRONGSWAN_IPCOMP] == "yes"); | ||
101 | d->ui.proposal->setChecked(dataMap[NM_STRONGSWAN_PROPOSAL] == "yes"); | ||||
102 | d->ui.ike->setText(dataMap[NM_STRONGSWAN_IKE]); | ||||
103 | d->ui.esp->setText(dataMap[NM_STRONGSWAN_ESP]); | ||||
100 | } | 104 | } | ||
101 | 105 | | |||
102 | void StrongswanSettingWidget::loadSecrets(const NetworkManager::Setting::Ptr &setting) | 106 | void StrongswanSettingWidget::loadSecrets(const NetworkManager::Setting::Ptr &setting) | ||
103 | { | 107 | { | ||
104 | Q_D(StrongswanSettingWidget); | 108 | Q_D(StrongswanSettingWidget); | ||
105 | Q_UNUSED(setting); | 109 | Q_UNUSED(setting); | ||
106 | } | 110 | } | ||
107 | 111 | | |||
Show All 35 Lines | 143 | case StrongswanSettingWidgetPrivate::Eap: | |||
143 | } | 147 | } | ||
144 | //StrongSwan-nm 1.2 does not appear to be able to save secrets, the must be entered through the auth dialog | 148 | //StrongSwan-nm 1.2 does not appear to be able to save secrets, the must be entered through the auth dialog | ||
145 | } | 149 | } | ||
146 | 150 | | |||
147 | //Options | 151 | //Options | ||
148 | data.insert(NM_STRONGSWAN_INNERIP, d->ui.innerIP->isChecked() ? "yes" : "no"); | 152 | data.insert(NM_STRONGSWAN_INNERIP, d->ui.innerIP->isChecked() ? "yes" : "no"); | ||
149 | data.insert(NM_STRONGSWAN_ENCAP, d->ui.udpEncap->isChecked() ? "yes" : "no"); | 153 | data.insert(NM_STRONGSWAN_ENCAP, d->ui.udpEncap->isChecked() ? "yes" : "no"); | ||
150 | data.insert(NM_STRONGSWAN_IPCOMP, d->ui.ipComp->isChecked() ? "yes" : "no"); | 154 | data.insert(NM_STRONGSWAN_IPCOMP, d->ui.ipComp->isChecked() ? "yes" : "no"); | ||
155 | if (d->ui.proposal->isChecked()) { | ||||
156 | data.insert(NM_STRONGSWAN_PROPOSAL, "yes"); | ||||
157 | data.insert(NM_STRONGSWAN_IKE, d->ui.ike->text()); | ||||
158 | data.insert(NM_STRONGSWAN_ESP, d->ui.esp->text()); | ||||
159 | } else | ||||
160 | data.insert(NM_STRONGSWAN_PROPOSAL, "no"); | ||||
151 | 161 | | |||
152 | // save it all | 162 | // save it all | ||
153 | setting.setData(data); | 163 | setting.setData(data); | ||
154 | setting.setSecrets(secretData); | 164 | setting.setSecrets(secretData); | ||
155 | 165 | | |||
156 | return setting.toMap(); | 166 | return setting.toMap(); | ||
157 | } | 167 | } | ||
158 | 168 | | |||
159 | bool StrongswanSettingWidget::isValid() const | 169 | bool StrongswanSettingWidget::isValid() const | ||
160 | { | 170 | { | ||
161 | Q_D(const StrongswanSettingWidget); | 171 | Q_D(const StrongswanSettingWidget); | ||
162 | return !d->ui.leGateway->text().isEmpty(); | 172 | return !d->ui.leGateway->text().isEmpty(); | ||
163 | } | 173 | } |