File indexing completed on 2024-11-03 13:45:32

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