File indexing completed on 2024-07-14 09:00:18

0001 /*
0002     SPDX-FileCopyrightText: 2013 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 #ifndef PLASMA_NM_CONNECTION_WIDGET_H
0008 #define PLASMA_NM_CONNECTION_WIDGET_H
0009 
0010 #include <QWidget>
0011 
0012 #include <NetworkManagerQt/ConnectionSettings>
0013 
0014 namespace Ui
0015 {
0016 class ConnectionWidget;
0017 }
0018 
0019 class ConnectionWidget : public QWidget
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     explicit ConnectionWidget(const NetworkManager::ConnectionSettings::Ptr &settings = NetworkManager::ConnectionSettings::Ptr(),
0025                               QWidget *parent = nullptr,
0026                               Qt::WindowFlags f = {});
0027     ~ConnectionWidget() override;
0028 
0029     void loadConfig(const NetworkManager::ConnectionSettings::Ptr &settings);
0030 
0031     NMVariantMapMap setting() const;
0032 
0033     bool allUsers() const;
0034 
0035 private Q_SLOTS:
0036     void autoVpnToggled(bool on);
0037     void openAdvancedPermissions();
0038 
0039 Q_SIGNALS:
0040     void settingChanged();
0041     void allUsersChanged();
0042 
0043 private:
0044     // list of VPN: UUID, name
0045     NMStringMap vpnConnections() const;
0046     // list of firewalld zones
0047     QStringList firewallZones() const;
0048 
0049     void populateVpnConnections();
0050     Ui::ConnectionWidget *const m_widget;
0051     NetworkManager::ConnectionSettings m_tmpSetting;
0052     NetworkManager::ConnectionSettings::ConnectionType m_type;
0053     QString m_masterUuid;
0054     QString m_slaveType;
0055 };
0056 
0057 #endif // PLASMA_NM_CONNECTION_WIDGET_H