Sync state with kubuntu-installer-prompt, add open WiFi support

ubuntu/noble ubuntu/24.04.2
Aaron Rainbolt 10 months ago
parent 352376a8d9
commit 0174e9622b

10
debian/changelog vendored

@ -1,3 +1,13 @@
lubuntu-installer-prompt (24.04.2) noble; urgency=medium
* Remove a spurious d/source/options file resulting in the whole Git repo
being uploaded with the source package.
* Don't start the prompt using sudo, it's unnecessary and results in odd
permissions issues.
* Add support for open WiFi networks. (LP: #2056603)
-- Aaron Rainbolt <arraybolt3@ubuntu.com> Fri, 08 Mar 2024 23:49:22 +0000
lubuntu-installer-prompt (24.04.1) noble; urgency=medium lubuntu-installer-prompt (24.04.1) noble; urgency=medium
* Switch to native packaging. * Switch to native packaging.

@ -1 +0,0 @@
tar-ignore=.gitignore

@ -12,7 +12,7 @@ export QT_QPA_PLATFORMTHEME="lxqt"
openbox & openbox &
picom & picom &
sudo -E lubuntu-installer-prompt # This is intentionally *not* backgrounded. lubuntu-installer-prompt # This is intentionally *not* backgrounded.
# If it exits... # If it exits...
killall picom killall picom
killall openbox killall openbox

@ -190,9 +190,21 @@ void InstallerPrompt::onNetworkSelected(int index)
} }
} else { // this is a Wifi connection } else { // this is a Wifi connection
wifiSsid = networkId.right(networkId.length() - 4); wifiSsid = networkId.right(networkId.length() - 4);
bool isPasswordProtected = true;
for (const auto &network : wifiDevice->networks()) {
if (network->ssid() == wifiSsid) {
NetworkManager::AccessPoint::Ptr ap = network->referenceAccessPoint();
if (!ap->capabilities().testFlag(NetworkManager::AccessPoint::Privacy)) {
isPasswordProtected = false;
}
}
}
QDBusPendingReply reply = wifiDevice->disconnectInterface(); QDBusPendingReply reply = wifiDevice->disconnectInterface();
reply.waitForFinished(); reply.waitForFinished();
NetworkManager::Connection::Ptr targetConnection; NetworkManager::Connection::Ptr targetConnection;
foreach (const NetworkManager::Connection::Ptr &connection, NetworkManager::listConnections()) { foreach (const NetworkManager::Connection::Ptr &connection, NetworkManager::listConnections()) {
if (connection->settings()->connectionType() == NetworkManager::ConnectionSettings::Wireless) { if (connection->settings()->connectionType() == NetworkManager::ConnectionSettings::Wireless) {
auto wirelessSetting = connection->settings()->setting(NetworkManager::Setting::Wireless).dynamicCast<NetworkManager::WirelessSetting>(); auto wirelessSetting = connection->settings()->setting(NetworkManager::Setting::Wireless).dynamicCast<NetworkManager::WirelessSetting>();
@ -201,17 +213,11 @@ void InstallerPrompt::onNetworkSelected(int index)
} }
} }
} }
if (targetConnection) { if (targetConnection) {
NetworkManager::activateConnection(targetConnection->path(), wifiDevice->uni(), QString()); NetworkManager::activateConnection(targetConnection->path(), wifiDevice->uni(), QString());
cpd->setNetworkName(wifiSsid); cpd->setNetworkName(wifiSsid);
} else { } else {
WifiPasswordDialog wpd(wifiSsid);
wpd.exec();
QString password = wpd.getPassword();
if (password.isEmpty()) {
return;
}
NMVariantMapMap wifiSettings; NMVariantMapMap wifiSettings;
if (!wifiDevice) { if (!wifiDevice) {
qWarning() << "WiFi device not found. Unable to set interface name."; qWarning() << "WiFi device not found. Unable to set interface name.";
@ -230,10 +236,18 @@ void InstallerPrompt::onNetworkSelected(int index)
wifiSettings.insert(key, value.toMap()); wifiSettings.insert(key, value.toMap());
} }
if (isPasswordProtected) {
WifiPasswordDialog wpd(wifiSsid);
wpd.exec();
QString password = wpd.getPassword();
if (password.isEmpty()) {
return;
}
QVariantMap wirelessSecurity; QVariantMap wirelessSecurity;
wirelessSecurity["key-mgmt"] = "wpa-psk"; wirelessSecurity["key-mgmt"] = "wpa-psk";
wirelessSecurity["psk"] = password; wirelessSecurity["psk"] = password;
wifiSettings["802-11-wireless-security"] = wirelessSecurity; wifiSettings["802-11-wireless-security"] = wirelessSecurity;
}
QDBusPendingReply<QDBusObjectPath> reply = NetworkManager::addConnection(wifiSettings); QDBusPendingReply<QDBusObjectPath> reply = NetworkManager::addConnection(wifiSettings);
reply.waitForFinished(); reply.waitForFinished();

Loading…
Cancel
Save