File indexing completed on 2024-04-28 16:52:52

0001 /*
0002     SPDX-FileCopyrightText: 2015 Jan Grulich <jgrulich@redhat.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #include "sstpauth.h"
0008 #include "ui_sstpauth.h"
0009 
0010 #include "nm-sstp-service.h"
0011 
0012 class SstpAuthWidgetPrivate
0013 {
0014 public:
0015     NetworkManager::VpnSetting::Ptr setting;
0016     Ui_SstpAuth ui;
0017 };
0018 
0019 SstpAuthWidget::SstpAuthWidget(const NetworkManager::VpnSetting::Ptr &setting, const QStringList &hints, QWidget *parent)
0020     : SettingWidget(setting, hints, parent)
0021     , d_ptr(new SstpAuthWidgetPrivate)
0022 {
0023     Q_D(SstpAuthWidget);
0024     d->setting = setting;
0025     d->ui.setupUi(this);
0026 
0027     KAcceleratorManager::manage(this);
0028 }
0029 
0030 SstpAuthWidget::~SstpAuthWidget()
0031 {
0032     delete d_ptr;
0033 }
0034 
0035 QVariantMap SstpAuthWidget::setting() const
0036 {
0037     Q_D(const SstpAuthWidget);
0038 
0039     NMStringMap secrets;
0040     QVariantMap secretData;
0041 
0042     if (!d->ui.le_password->text().isEmpty()) {
0043         secrets.insert(QLatin1String(NM_SSTP_KEY_PASSWORD), d->ui.le_password->text());
0044     }
0045 
0046     secretData.insert("secrets", QVariant::fromValue<NMStringMap>(secrets));
0047     return secretData;
0048 }