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