File indexing completed on 2025-02-16 08:18:45
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_WIFI_SECURITY_H 0008 #define PLASMA_NM_WIFI_SECURITY_H 0009 0010 #include "plasmanm_editor_export.h" 0011 0012 #include <QWidget> 0013 0014 #include <NetworkManagerQt/Security8021xSetting> 0015 #include <NetworkManagerQt/WirelessSecuritySetting> 0016 0017 #include "security802-1x.h" 0018 #include "settingwidget.h" 0019 0020 namespace Ui 0021 { 0022 class WifiSecurity; 0023 } 0024 0025 class PLASMANM_EDITOR_EXPORT WifiSecurity : public SettingWidget 0026 { 0027 Q_OBJECT 0028 public: 0029 // Keep this in sync with NetworkManager::WirelessSecurityType from 0030 // NetworkManagerQt. 0031 enum SecurityTypeIndex { None = 0, WepHex, WepPassphrase, Leap, DynamicWep, WpaPsk, WpaEap, SAE, Wpa3SuiteB192 }; 0032 0033 explicit WifiSecurity(const NetworkManager::Setting::Ptr &setting = NetworkManager::Setting::Ptr(), 0034 const NetworkManager::Security8021xSetting::Ptr &setting8021x = NetworkManager::Security8021xSetting::Ptr(), 0035 QWidget *parent = nullptr, 0036 Qt::WindowFlags f = {}); 0037 ~WifiSecurity() override; 0038 void loadConfig(const NetworkManager::Setting::Ptr &setting) override; 0039 void loadSecrets(const NetworkManager::Setting::Ptr &setting) override; 0040 0041 QVariantMap setting() const override; 0042 QVariantMap setting8021x() const; 0043 0044 bool enabled() const; 0045 bool enabled8021x() const; 0046 0047 bool isValid() const override; 0048 0049 void setStoreSecretsSystemWide(bool system); 0050 0051 public Q_SLOTS: 0052 void onSsidChanged(const QString &ssid); 0053 0054 private Q_SLOTS: 0055 void securityChanged(int index); 0056 void setWepKey(int keyIndex); 0057 0058 private: 0059 Ui::WifiSecurity *const m_ui; 0060 Security8021x *m_8021xWidget = nullptr; 0061 Security8021x *m_WPA2Widget = nullptr; 0062 Security8021x *m_WPA3SuiteB192Widget = nullptr; 0063 NetworkManager::WirelessSecuritySetting::Ptr m_wifiSecurity; 0064 bool m_systemWideDefault = false; 0065 }; 0066 0067 #endif // PLASMA_NM_WIFI_SECURITY_H