D20930: Update WireGuard to match NetworkManager 1.16 interface
Jan Grulich
noreply at phabricator.kde.org
Fri May 10 13:19:23 BST 2019
jgrulich added inline comments.
INLINE COMMENTS
> kcm.cpp:527
> +
> + if (connection.isEmpty()) { // the "positive" part will arrive with connectionAdded
> + // TODO display success
if (!connection.isEmpty()) {
return;
}
> connectionicon.cpp:403
> }
> + } else if (type == 29) { // TODO change to WireGuard enum value once it is added
> + // WireGuard is a VPN but is not implemented
You can now use NetworkManager::Device::WireGuard.
> networkstatus.cpp:175
> + if (device && ((device->type() != NetworkManager::Device::Generic && device->type() <= NetworkManager::Device::Team)
> + || device->type() == 29)) { // TODO: Change to WireGuard enum value when it is added
> bool connecting = false;
You can use now NetworkManager::Device::WireGuard. It should be part of NMQT 5.58 so we can use it for Plasma 5.16.
> wireguardinterfacewidget.cpp:620
> + }
> + if (!havePrivateKey || !haveAllowedIps || !havePublicKey || !haveAllowedIps)
> + {
The "{" bracket should be on the same line with the "if"
> wireguardpeerwidget.cpp:52
> +
> +static WireGuardKeyValidator keyValidator(nullptr);
> +static SimpleIpListValidator allowedIPsValidator(nullptr, SimpleIpListValidator::WithCidr,
You can change all the validators to take all the necessary parameters as first and then have a default value for the parent object so you don't need to pass a nullptr.
E.g.
explicit SimpleIpV4AddressValidator(AddressStyle style = AddressStyle::Base, QObject *parent = nullptr);
I should have noticed this before. Can you change all the validators you use this way?
> wireguardpeerwidget.cpp:86
> +
> +WireGuardPeerWidget::WireGuardPeerWidget(const QVariantMap& peerData, QWidget* parent, Qt::WindowFlags f)
> + : QDialog(parent, f)
WireGuardPeerWidget::WireGuardPeerWidget(const QVariantMap &peerData, QWidget *parent, Qt::WindowFlags f)
> wireguardpeerwidget.h:34
> public:
> - explicit WireGuardAdvancedWidget(const NetworkManager::VpnSetting::Ptr &setting, QWidget *parent = nullptr);
> - ~WireGuardAdvancedWidget() override;
> - NetworkManager::VpnSetting::Ptr setting() const;
> + explicit WireGuardPeerWidget(const QVariantMap& peerData, QWidget* parent = nullptr, Qt::WindowFlags f = {});
> + ~WireGuardPeerWidget() override;
explicit WireGuardPeerWidget(const QVariantMap &peerData, QWidget *parent = nullptr, Qt::WindowFlags f = {});
> wireguardtabwidget.h:34
> public:
> - explicit WireGuardAdvancedWidget(const NetworkManager::VpnSetting::Ptr &setting, QWidget *parent = nullptr);
> - ~WireGuardAdvancedWidget() override;
> - NetworkManager::VpnSetting::Ptr setting() const;
> + explicit WireGuardTabWidget(const NMVariantMapList& peerData, QWidget* parent = nullptr, Qt::WindowFlags f = {});
> + ~WireGuardTabWidget() override;
explicit WireGuardTabWidget(const NMVariantMapList &peerData, QWidget *parent = nullptr, Qt::WindowFlags f = {});
Sorry for being so pedantic :)
> wireguardtabwidget.h:39
> +
> + void loadConfig(const NMVariantMapList& peerData);
> +
void loadConfig(const NMVariantMapList &peerData);
> wireguardtabwidget.h:44
> + void slotAddPeer();
> + void slotAddPeerWithData(QVariantMap peerData);
> + void slotRemovePeer();
void slotAddPeerWithData(const QVariantMap &peerData);
> networkmodelitem.cpp:480
> }
> -
> +// BAA Todo: add WireGuard
> if (m_type == NetworkManager::ConnectionSettings::Wired) {
There is already WireGuard device in NMQT with KF5 5.58 which you should be able to use.
REPOSITORY
R116 Plasma Network Management Applet
REVISION DETAIL
https://phabricator.kde.org/D20930
To: andersonbruce, jgrulich, #vdg, ngraham
Cc: ngraham, plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190510/5549d422/attachment-0001.html>
More information about the Plasma-devel
mailing list