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

0001 /*
0002     SPDX-FileCopyrightText: 2013 Lukas Tinkl <ltinkl@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_BRIDGE_WIDGET_H
0008 #define PLASMA_NM_BRIDGE_WIDGET_H
0009 
0010 #include "plasmanm_editor_export.h"
0011 
0012 #include <QDBusPendingCallWatcher>
0013 #include <QListWidgetItem>
0014 #include <QMenu>
0015 #include <QWidget>
0016 
0017 #include <NetworkManagerQt/BridgeSetting>
0018 
0019 #include "settingwidget.h"
0020 
0021 namespace Ui
0022 {
0023 class BridgeWidget;
0024 }
0025 
0026 class PLASMANM_EDITOR_EXPORT BridgeWidget : public SettingWidget
0027 {
0028     Q_OBJECT
0029 public:
0030     explicit BridgeWidget(const QString &masterUuid,
0031                           const QString &masterId,
0032                           const NetworkManager::Setting::Ptr &setting = NetworkManager::Setting::Ptr(),
0033                           QWidget *parent = nullptr,
0034                           Qt::WindowFlags f = {});
0035     ~BridgeWidget() override;
0036 
0037     void loadConfig(const NetworkManager::Setting::Ptr &setting) override;
0038 
0039     QVariantMap setting() const override;
0040 
0041     bool isValid() const override;
0042 
0043 private Q_SLOTS:
0044     void addBridge(QAction *action);
0045     void currentBridgeChanged(QListWidgetItem *current, QListWidgetItem *previous);
0046     void bridgeAddComplete(QDBusPendingCallWatcher *watcher);
0047 
0048     void editBridge();
0049     void deleteBridge();
0050 
0051     void populateBridges();
0052 
0053 private:
0054     QString m_uuid;
0055     QString m_id;
0056     Ui::BridgeWidget *const m_ui;
0057     QMenu *const m_menu;
0058 };
0059 
0060 #endif // PLASMA_NM_BRIDGE_WIDGET_H