File indexing completed on 2025-05-18 08:33:13
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 SETTING_WIDGET_H 0008 #define SETTING_WIDGET_H 0009 0010 #include "plasmanm_editor_export.h" 0011 0012 #include <NetworkManagerQt/Setting> 0013 #include <QWidget> 0014 0015 #include <KAcceleratorManager> 0016 0017 class PLASMANM_EDITOR_EXPORT SettingWidget : public QWidget 0018 { 0019 Q_OBJECT 0020 public: 0021 class EnumPasswordStorageType 0022 { 0023 public: 0024 enum PasswordStorageType { Store = 0, AlwaysAsk, NotRequired }; 0025 }; 0026 0027 explicit SettingWidget(const NetworkManager::Setting::Ptr &setting = NetworkManager::Setting::Ptr(), QWidget *parent = nullptr, Qt::WindowFlags f = {}); 0028 explicit SettingWidget(const NetworkManager::Setting::Ptr &setting, const QStringList &hints, QWidget *parent = nullptr, Qt::WindowFlags f = {}); 0029 0030 ~SettingWidget() override; 0031 0032 virtual void loadConfig(const NetworkManager::Setting::Ptr &setting); 0033 virtual void loadSecrets(const NetworkManager::Setting::Ptr &setting); 0034 0035 virtual QVariantMap setting() const = 0; 0036 0037 // Do not forget to call this function in the inherited class once initialized 0038 void watchChangedSetting(); 0039 0040 QString type() const; 0041 0042 virtual bool isValid() const 0043 { 0044 return true; 0045 } 0046 0047 protected Q_SLOTS: 0048 void slotWidgetChanged(); 0049 0050 Q_SIGNALS: 0051 void validChanged(bool isValid); 0052 void settingChanged(); 0053 0054 protected: 0055 QStringList m_hints; 0056 0057 private: 0058 QString m_type; 0059 }; 0060 0061 #endif // SETTING_WIDGET_H