Linux distros that use NetworkManager: prefill WLAN PSK

Only supported when NetworkManager is used on the Linux distro
as wpa_supplicant itself does not support reading PSKs through
DBus, only setting them.

Closes #457
This commit is contained in:
Floris Bos 2022-07-31 13:17:08 +02:00
parent b1606dd1fb
commit ef4abc661f
5 changed files with 107 additions and 3 deletions

View file

@ -57,6 +57,11 @@
#include <QtPlatformHeaders/QEglFSFunctions>
#endif
#ifdef Q_OS_LINUX
#ifndef QT_NO_DBUS
#include "linux/networkmanagerapi.h"
#endif
#endif
ImageWriter::ImageWriter(QObject *parent)
: QObject(parent), _repo(QUrl(QString(OSLIST_URL))), _dlnow(0), _verifynow(0),
@ -990,11 +995,16 @@ QString ImageWriter::getPSK(const QString &ssid)
}
return psk;
#else
#ifndef QT_NO_DBUS
NetworkManagerApi nm;
return nm.getPSK();
#else
Q_UNUSED(ssid)
return QString();
#endif
#endif
#endif
}
bool ImageWriter::getBoolSetting(const QString &key)