File indexing completed on 2024-12-01 08:10:01

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_BOND_WIDGET_H
0008 #define PLASMA_NM_BOND_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/BondSetting>
0018 
0019 #include "settingwidget.h"
0020 
0021 namespace Ui
0022 {
0023 class BondWidget;
0024 }
0025 
0026 class PLASMANM_EDITOR_EXPORT BondWidget : public SettingWidget
0027 {
0028     Q_OBJECT
0029 public:
0030     explicit BondWidget(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     ~BondWidget() 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 addBond(QAction *action);
0045     void currentBondChanged(QListWidgetItem *current, QListWidgetItem *previous);
0046     void bondAddComplete(QDBusPendingCallWatcher *watcher);
0047 
0048     void editBond();
0049     void deleteBond();
0050 
0051     void populateBonds();
0052 
0053 private:
0054     QString m_uuid;
0055     QString m_id;
0056     Ui::BondWidget *const m_ui;
0057     QMenu *const m_menu;
0058 };
0059 
0060 #endif // PLASMA_NM_BOND_WIDGET_H