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

0001 /*
0002     SPDX-FileCopyrightText: 2011 Ilia Kats <ilia-kats@gmx.net>
0003     SPDX-FileCopyrightText: 2013 Lukáš Tinkl <ltinkl@redhat.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #include "pptpauth.h"
0009 #include "ui_pptpauth.h"
0010 
0011 #include "nm-pptp-service.h"
0012 
0013 class PptpAuthWidgetPrivate
0014 {
0015 public:
0016     NetworkManager::VpnSetting::Ptr setting;
0017     Ui_PptpAuthenticationWidget ui;
0018 };
0019 
0020 PptpAuthWidget::PptpAuthWidget(const NetworkManager::VpnSetting::Ptr &setting, const QStringList &hints, QWidget *parent)
0021     : SettingWidget(setting, hints, parent)
0022     , d_ptr(new PptpAuthWidgetPrivate)
0023 {
0024     Q_D(PptpAuthWidget);
0025     d->setting = setting;
0026     d->ui.setupUi(this);
0027 
0028     KAcceleratorManager::manage(this);
0029 }
0030 
0031 PptpAuthWidget::~PptpAuthWidget()
0032 {
0033     delete d_ptr;
0034 }
0035 
0036 QVariantMap PptpAuthWidget::setting() const
0037 {
0038     Q_D(const PptpAuthWidget);
0039 
0040     NMStringMap secrets;
0041     QVariantMap secretData;
0042 
0043     if (!d->ui.lePassword->text().isEmpty()) {
0044         secrets.insert(QLatin1String(NM_PPTP_KEY_PASSWORD), d->ui.lePassword->text());
0045     }
0046 
0047     secretData.insert("secrets", QVariant::fromValue<NMStringMap>(secrets));
0048     return secretData;
0049 }