From 5d7151e79e04d8a6073ecb4ea4a14c5c9bdcfc52 Mon Sep 17 00:00:00 2001 From: ATMDA Date: Sun, 9 Nov 2025 17:54:16 -0500 Subject: controlcenter: network and audio panels --- services/Network.qml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'services') diff --git a/services/Network.qml b/services/Network.qml index 2c31065..f2c403e 100644 --- a/services/Network.qml +++ b/services/Network.qml @@ -27,13 +27,20 @@ Singleton { } function connectToNetwork(ssid: string, password: string): void { - // TODO: Implement password - connectProc.exec(["nmcli", "conn", "up", ssid]); + // First try to connect to an existing connection + // If that fails, create a new connection + if (password && password.length > 0) { + connectProc.exec(["nmcli", "device", "wifi", "connect", ssid, "password", password]); + } else { + // Try to connect to existing connection first + connectProc.exec(["nmcli", "device", "wifi", "connect", ssid]); + } } function disconnectFromNetwork(): void { if (active) { - disconnectProc.exec(["nmcli", "connection", "down", active.ssid]); + // Find the device name first, then disconnect + disconnectProc.exec(["nmcli", "device", "disconnect", "wifi"]); } } @@ -86,6 +93,10 @@ Singleton { Process { id: connectProc + onExited: { + // Refresh network list after connection attempt + getNetworks.running = true; + } stdout: SplitParser { onRead: getNetworks.running = true } @@ -97,6 +108,10 @@ Singleton { Process { id: disconnectProc + onExited: { + // Refresh network list after disconnection + getNetworks.running = true; + } stdout: SplitParser { onRead: getNetworks.running = true } -- cgit v1.2.3-freya