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

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_IPV4_WIDGET_H
0008 #define PLASMA_NM_IPV4_WIDGET_H
0009 
0010 #include "plasmanm_editor_export.h"
0011 
0012 #include <NetworkManagerQt/Ipv4Setting>
0013 #include <QWidget>
0014 
0015 #include "ipv4routeswidget.h"
0016 #include "settingwidget.h"
0017 
0018 namespace Ui
0019 {
0020 class IPv4Widget;
0021 }
0022 
0023 class PLASMANM_EDITOR_EXPORT IPv4Widget : public SettingWidget
0024 {
0025     Q_OBJECT
0026 public:
0027     enum MethodIndex { Automatic = 0, AutomaticOnlyIP, LinkLocal, Manual, Shared, Disabled };
0028 
0029     explicit IPv4Widget(const NetworkManager::Setting::Ptr &setting = NetworkManager::Setting::Ptr(), QWidget *parent = nullptr, Qt::WindowFlags f = {});
0030     ~IPv4Widget() override;
0031 
0032     void loadConfig(const NetworkManager::Setting::Ptr &setting) override;
0033 
0034     QVariantMap setting() const override;
0035 
0036     bool isValid() const override;
0037 
0038 private Q_SLOTS:
0039     void slotModeComboChanged(int index);
0040     void slotRoutesDialog();
0041     void slotAdvancedDialog();
0042 
0043     void slotDnsServers();
0044     void slotDnsDomains();
0045 
0046     void slotAddIPAddress();
0047     void slotRemoveIPAddress();
0048 
0049     void selectionChanged(const QItemSelection &selected);
0050     void tableViewItemChanged(QStandardItem *item);
0051 
0052 private:
0053     Ui::IPv4Widget *const m_ui;
0054     NetworkManager::Ipv4Setting m_tmpIpv4Setting;
0055 
0056     class Private;
0057     Private *const d;
0058 };
0059 
0060 #endif // PLASMA_NM_IPV4_WIDGET_H