File indexing completed on 2025-04-27 14:24:09
0001 /* 0002 SPDX-FileCopyrightText: 2019 Bruce Anderson <banderson19com@san.rr.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_WIREGUARD_PEER_WIDGET_H 0008 #define PLASMA_NM_WIREGUARD_PEER_WIDGET_H 0009 0010 #include <QDialog> 0011 0012 #include "settingwidget.h" 0013 #include <NetworkManagerQt/WireguardSetting> 0014 0015 class Q_DECL_EXPORT WireGuardPeerWidget : public QDialog 0016 { 0017 Q_OBJECT 0018 0019 public: 0020 explicit WireGuardPeerWidget(const QVariantMap &peerData, QWidget *parent = nullptr, Qt::WindowFlags f = {}); 0021 ~WireGuardPeerWidget() override; 0022 0023 QVariantMap setting() const; 0024 bool isValid(); 0025 enum EndPointValid { BothValid, AddressValid, PortValid, BothInvalid }; 0026 static WireGuardPeerWidget::EndPointValid isEndpointValid(QString &, QString &); 0027 0028 Q_SIGNALS: 0029 void notifyValid(); 0030 0031 private: 0032 void setBackground(QWidget *w, bool result) const; 0033 void checkPublicKeyValid(); 0034 void checkPresharedKeyValid(); 0035 void checkAllowedIpsValid(); 0036 void checkEndpointValid(); 0037 void updatePeerWidgets(); 0038 void saveKeepAlive(); 0039 void saveKeyFlags(); 0040 void slotWidgetChanged(); 0041 0042 class Private; 0043 Private *const d; 0044 }; 0045 0046 #endif // PLASMA_NM_WIREGUARD_PEER_WIDGET_H