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

0001 /*
0002     SPDX-FileCopyrightText: 2014 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_TEAM_WIDGET_H
0008 #define PLASMA_NM_TEAM_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 "settingwidget.h"
0018 
0019 #include <NetworkManagerQt/TeamSetting>
0020 
0021 namespace Ui
0022 {
0023 class TeamWidget;
0024 }
0025 
0026 class PLASMANM_EDITOR_EXPORT TeamWidget : public SettingWidget
0027 {
0028     Q_OBJECT
0029 public:
0030     explicit TeamWidget(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     ~TeamWidget() 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 addTeam(QAction *action);
0045     void currentTeamChanged(QListWidgetItem *current, QListWidgetItem *previous);
0046     void teamAddComplete(QDBusPendingCallWatcher *watcher);
0047 
0048     void editTeam();
0049     void deleteTeam();
0050 
0051     void populateTeams();
0052 
0053     void importConfig();
0054 
0055 private:
0056     QString m_uuid;
0057     QString m_id;
0058     Ui::TeamWidget *const m_ui;
0059     QMenu *const m_menu;
0060 };
0061 
0062 #endif // PLASMA_NM_TEAM_WIDGET_H