From 0174e9622b9fe58cf1eeeac86a480530f352daa9 Mon Sep 17 00:00:00 2001 From: Aaron Rainbolt Date: Fri, 8 Mar 2024 17:54:13 -0600 Subject: [PATCH] Sync state with kubuntu-installer-prompt, add open WiFi support --- debian/changelog | 10 ++++++++++ debian/source/options | 1 - scripts/start-lubuntu-live-env | 2 +- src/installerprompt.cpp | 36 +++++++++++++++++++++++----------- 4 files changed, 36 insertions(+), 13 deletions(-) delete mode 100644 debian/source/options diff --git a/debian/changelog b/debian/changelog index a75dcca..8867605 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Fri, 08 Mar 2024 23:49:22 +0000 + lubuntu-installer-prompt (24.04.1) noble; urgency=medium * Switch to native packaging. diff --git a/debian/source/options b/debian/source/options deleted file mode 100644 index 112dfc8..0000000 --- a/debian/source/options +++ /dev/null @@ -1 +0,0 @@ -tar-ignore=.gitignore diff --git a/scripts/start-lubuntu-live-env b/scripts/start-lubuntu-live-env index 873e3ab..fa2b586 100755 --- a/scripts/start-lubuntu-live-env +++ b/scripts/start-lubuntu-live-env @@ -12,7 +12,7 @@ export QT_QPA_PLATFORMTHEME="lxqt" openbox & picom & -sudo -E lubuntu-installer-prompt # This is intentionally *not* backgrounded. +lubuntu-installer-prompt # This is intentionally *not* backgrounded. # If it exits... killall picom killall openbox diff --git a/src/installerprompt.cpp b/src/installerprompt.cpp index 388c6a8..c90faf1 100644 --- a/src/installerprompt.cpp +++ b/src/installerprompt.cpp @@ -190,9 +190,21 @@ void InstallerPrompt::onNetworkSelected(int index) } } else { // this is a Wifi connection 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(); reply.waitForFinished(); NetworkManager::Connection::Ptr targetConnection; + foreach (const NetworkManager::Connection::Ptr &connection, NetworkManager::listConnections()) { if (connection->settings()->connectionType() == NetworkManager::ConnectionSettings::Wireless) { auto wirelessSetting = connection->settings()->setting(NetworkManager::Setting::Wireless).dynamicCast(); @@ -201,17 +213,11 @@ void InstallerPrompt::onNetworkSelected(int index) } } } + if (targetConnection) { NetworkManager::activateConnection(targetConnection->path(), wifiDevice->uni(), QString()); cpd->setNetworkName(wifiSsid); } else { - WifiPasswordDialog wpd(wifiSsid); - wpd.exec(); - QString password = wpd.getPassword(); - if (password.isEmpty()) { - return; - } - NMVariantMapMap wifiSettings; if (!wifiDevice) { qWarning() << "WiFi device not found. Unable to set interface name."; @@ -230,10 +236,18 @@ void InstallerPrompt::onNetworkSelected(int index) wifiSettings.insert(key, value.toMap()); } - QVariantMap wirelessSecurity; - wirelessSecurity["key-mgmt"] = "wpa-psk"; - wirelessSecurity["psk"] = password; - wifiSettings["802-11-wireless-security"] = wirelessSecurity; + if (isPasswordProtected) { + WifiPasswordDialog wpd(wifiSsid); + wpd.exec(); + QString password = wpd.getPassword(); + if (password.isEmpty()) { + return; + } + QVariantMap wirelessSecurity; + wirelessSecurity["key-mgmt"] = "wpa-psk"; + wirelessSecurity["psk"] = password; + wifiSettings["802-11-wireless-security"] = wirelessSecurity; + } QDBusPendingReply reply = NetworkManager::addConnection(wifiSettings); reply.waitForFinished();