File indexing completed on 2024-07-21 07:58:06

0001 /*
0002     SPDX-FileCopyrightText: 2019 Bruce Anderson <banderson19com@san.rr.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef PLASMA_NM_WIREGUARD_INTERFACE_WIDGET_H
0008 #define PLASMA_NM_WIREGUARD_INTERFACE_WIDGET_H
0009 
0010 #include "plasmanm_editor_export.h"
0011 
0012 #include <QWidget>
0013 
0014 #include "settingwidget.h"
0015 #include "ui_wireguardinterfacewidget.h"
0016 #include <NetworkManagerQt/WireguardSetting>
0017 
0018 class PLASMANM_EDITOR_EXPORT WireGuardInterfaceWidget : public SettingWidget
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit WireGuardInterfaceWidget(const NetworkManager::Setting::Ptr &setting, QWidget *parent = nullptr, Qt::WindowFlags f = {});
0024     ~WireGuardInterfaceWidget() override;
0025 
0026     void loadConfig(const NetworkManager::Setting::Ptr &setting) override;
0027     void loadSecrets(const NetworkManager::Setting::Ptr &setting) override;
0028 
0029     QVariantMap setting() const override;
0030 
0031     bool isValid() const override;
0032     static QString supportedFileExtensions();
0033     static NMVariantMapMap importConnectionSettings(const QString &fileName);
0034 
0035 private Q_SLOTS:
0036     void showPeers();
0037 
0038 private:
0039     void setBackground(QWidget *w, bool result) const;
0040     void checkPrivateKeyValid();
0041     void checkFwmarkValid();
0042     void checkListenPortValid();
0043     class Private;
0044     Private *const d;
0045 };
0046 
0047 #endif // PLASMA_NM_WIREGUARD_INTERFACE_WIDGET_H