summaryrefslogtreecommitdiff
path: root/modules/controlcenter/network
diff options
context:
space:
mode:
authorATMDA <atdma2600@gmail.com>2025-11-12 22:31:11 -0500
committerATMDA <atdma2600@gmail.com>2025-11-12 22:31:11 -0500
commit6ae1313b6b61c965ccc5f2d9d61458d7a5ed21b8 (patch)
treeb08ec89e8c44db6ff0e31f7254e1a010487e981d /modules/controlcenter/network
parentcontrolcenter: wireless panel refactoring (diff)
downloadcaelestia-shell-6ae1313b6b61c965ccc5f2d9d61458d7a5ed21b8.tar.gz
caelestia-shell-6ae1313b6b61c965ccc5f2d9d61458d7a5ed21b8.tar.bz2
caelestia-shell-6ae1313b6b61c965ccc5f2d9d61458d7a5ed21b8.zip
controlcenter: wireless panel refactoring
Diffstat (limited to 'modules/controlcenter/network')
-rw-r--r--modules/controlcenter/network/WirelessDetails.qml24
-rw-r--r--modules/controlcenter/network/WirelessList.qml18
-rw-r--r--modules/controlcenter/network/WirelessPasswordDialog.qml53
3 files changed, 75 insertions, 20 deletions
diff --git a/modules/controlcenter/network/WirelessDetails.qml b/modules/controlcenter/network/WirelessDetails.qml
index 418c463..3e48b55 100644
--- a/modules/controlcenter/network/WirelessDetails.qml
+++ b/modules/controlcenter/network/WirelessDetails.qml
@@ -19,10 +19,22 @@ Item {
Component.onCompleted: {
updateDeviceDetails();
+ checkSavedProfile();
}
onNetworkChanged: {
updateDeviceDetails();
+ checkSavedProfile();
+ }
+
+ function checkSavedProfile(): void {
+ // Refresh saved connections list to ensure it's up to date
+ // This ensures the "Forget Network" button visibility is accurate
+ if (network && network.ssid) {
+ // Always refresh to ensure we have the latest saved connections
+ // This is important when networks are selected or changed
+ Network.listConnectionsProc.running = true;
+ }
}
Connections {
@@ -80,7 +92,13 @@ Item {
SimpleButton {
Layout.fillWidth: true
Layout.topMargin: Appearance.spacing.normal
- visible: root.network && root.network.ssid && Network.savedConnections.includes(root.network.ssid)
+ visible: {
+ if (!root.network || !root.network.ssid) {
+ return false;
+ }
+ // Check if profile exists - this will update reactively when savedConnectionSsids changes
+ return Network.hasSavedProfile(root.network.ssid);
+ }
color: Colours.palette.m3errorContainer
onColor: Colours.palette.m3onErrorContainer
text: qsTr("Forget Network")
@@ -164,8 +182,8 @@ Item {
function connectToNetwork(): void {
if (root.network.isSecure) {
- // Check if we have a saved connection profile for this network
- const hasSavedProfile = Network.savedConnections.includes(root.network.ssid);
+ // Check if we have a saved connection profile for this network (by SSID)
+ const hasSavedProfile = Network.hasSavedProfile(root.network.ssid);
if (hasSavedProfile) {
// Try connecting with saved password - don't show dialog if it fails
diff --git a/modules/controlcenter/network/WirelessList.qml b/modules/controlcenter/network/WirelessList.qml
index c64c4be..aabfc4b 100644
--- a/modules/controlcenter/network/WirelessList.qml
+++ b/modules/controlcenter/network/WirelessList.qml
@@ -117,6 +117,10 @@ ColumnLayout {
StateLayer {
function onClicked(): void {
root.session.network.active = modelData;
+ // Check if we need to refresh saved connections when selecting a network
+ if (modelData && modelData.ssid) {
+ root.checkSavedProfileForNetwork(modelData.ssid);
+ }
}
}
@@ -200,6 +204,16 @@ ColumnLayout {
}
}
+ function checkSavedProfileForNetwork(ssid: string): void {
+ // Refresh saved connections list to ensure it's up to date
+ // This ensures accurate profile detection when selecting networks
+ if (ssid && ssid.length > 0) {
+ // Always refresh to ensure we have the latest saved connections
+ // This is important when a network is selected from the list
+ Network.listConnectionsProc.running = true;
+ }
+ }
+
function handleConnect(network): void {
// If already connected to a different network, disconnect first
if (Network.active && Network.active.ssid !== network.ssid) {
@@ -214,8 +228,8 @@ ColumnLayout {
function connectToNetwork(network): void {
if (network.isSecure) {
- // Check if we have a saved connection profile for this network
- const hasSavedProfile = Network.savedConnections.includes(network.ssid);
+ // Check if we have a saved connection profile for this network (by SSID)
+ const hasSavedProfile = Network.hasSavedProfile(network.ssid);
if (hasSavedProfile) {
// Try connecting with saved password - don't show dialog if it fails
diff --git a/modules/controlcenter/network/WirelessPasswordDialog.qml b/modules/controlcenter/network/WirelessPasswordDialog.qml
index df8a8cf..5bcf33c 100644
--- a/modules/controlcenter/network/WirelessPasswordDialog.qml
+++ b/modules/controlcenter/network/WirelessPasswordDialog.qml
@@ -248,24 +248,47 @@ Item {
return;
}
- // Check if we're connected to the target network
- if (root.network && Network.active && Network.active.ssid === root.network.ssid) {
- // Successfully connected
- connectionMonitor.stop();
- connectButton.connecting = false;
- connectButton.text = qsTr("Connect");
- closeDialog();
+ // Check connection status message for success indicators
+ const status = Network.connectionStatus;
+ const statusLower = status.toLowerCase();
+
+ // Check for success indicators in status message
+ const hasSuccessIndicator = statusLower.includes("connection activated") ||
+ statusLower.includes("successfully") ||
+ statusLower.includes("connected successfully") ||
+ (statusLower.includes("connected") && !statusLower.includes("error") && !statusLower.includes("failed"));
+
+ // Check if we're connected to the target network (case-insensitive SSID comparison)
+ const isConnected = root.network && Network.active && Network.active.ssid &&
+ Network.active.ssid.toLowerCase().trim() === root.network.ssid.toLowerCase().trim();
+
+ if (isConnected || hasSuccessIndicator) {
+ // Successfully connected - give it a moment for network list to update
+ Qt.callLater(() => {
+ // Double-check connection is still active
+ if (root.visible && Network.active && Network.active.ssid) {
+ const stillConnected = Network.active.ssid.toLowerCase().trim() === root.network.ssid.toLowerCase().trim();
+ if (stillConnected || hasSuccessIndicator) {
+ connectionMonitor.stop();
+ connectButton.connecting = false;
+ connectButton.text = qsTr("Connect");
+ closeDialog();
+ }
+ }
+ }, 500);
return;
}
- // Check for connection errors
- const status = Network.connectionStatus;
- if (status.includes("Error") || status.includes("error") || status.includes("failed")) {
- // Connection failed
- connectionMonitor.stop();
- connectButton.connecting = false;
- connectButton.enabled = true;
- connectButton.text = qsTr("Connect");
+ // Check for connection errors (but not warnings about duplicate names)
+ if (status.includes("Error") || (status.includes("error") && !status.includes("Warning"))) {
+ // Only treat as error if it's not just a warning about duplicate names
+ if (!status.includes("another connection with the name") && !status.includes("Reference the connection by its uuid")) {
+ // Connection failed
+ connectionMonitor.stop();
+ connectButton.connecting = false;
+ connectButton.enabled = true;
+ connectButton.text = qsTr("Connect");
+ }
}
}