summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2026-01-28 19:21:44 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2026-01-28 19:21:44 +1100
commit9d7f0c48cebec02aaf2ca780b89a763ce91f8624 (patch)
tree2345921b670f730268203020e754465503707ed3 /services
parentcontrolcenter: remove qt5compat dep (diff)
downloadcaelestia-shell-9d7f0c48cebec02aaf2ca780b89a763ce91f8624.tar.gz
caelestia-shell-9d7f0c48cebec02aaf2ca780b89a763ce91f8624.tar.bz2
caelestia-shell-9d7f0c48cebec02aaf2ca780b89a763ce91f8624.zip
internal: format
Diffstat (limited to 'services')
-rw-r--r--services/Audio.qml3
-rw-r--r--services/Network.qml80
-rw-r--r--services/VPN.qml6
3 files changed, 49 insertions, 40 deletions
diff --git a/services/Audio.qml b/services/Audio.qml
index 20d9cc8..908d156 100644
--- a/services/Audio.qml
+++ b/services/Audio.qml
@@ -106,7 +106,8 @@ Singleton {
}
function getStreamName(stream: PwNode): string {
- if (!stream) return qsTr("Unknown");
+ if (!stream)
+ return qsTr("Unknown");
// Try application name first, then description, then name
return stream.applicationName || stream.description || stream.name || qsTr("Unknown Application");
}
diff --git a/services/Network.qml b/services/Network.qml
index fc16915..f3dfc3e 100644
--- a/services/Network.qml
+++ b/services/Network.qml
@@ -19,7 +19,7 @@ Singleton {
root.savedConnectionSsids = Nmcli.savedConnectionSsids;
});
// Get initial WiFi status
- Nmcli.getWifiStatus((enabled) => {
+ Nmcli.getWifiStatus(enabled => {
root.wifiEnabled = enabled;
});
// Sync networks from Nmcli on startup
@@ -41,7 +41,7 @@ Singleton {
property var wirelessDeviceDetails: null
function enableWifi(enabled: bool): void {
- Nmcli.enableWifi(enabled, (result) => {
+ Nmcli.enableWifi(enabled, result => {
if (result.success) {
root.getWifiStatus();
Nmcli.getNetworks(() => {
@@ -52,7 +52,7 @@ Singleton {
}
function toggleWifi(): void {
- Nmcli.toggleWifi((result) => {
+ Nmcli.toggleWifi(result => {
if (result.success) {
root.getWifiStatus();
Nmcli.getNetworks(() => {
@@ -73,23 +73,30 @@ Singleton {
// Set up pending connection tracking if callback provided
if (callback) {
const hasBssid = bssid !== undefined && bssid !== null && bssid.length > 0;
- root.pendingConnection = { ssid: ssid, bssid: hasBssid ? bssid : "", callback: callback };
+ root.pendingConnection = {
+ ssid: ssid,
+ bssid: hasBssid ? bssid : "",
+ callback: callback
+ };
}
-
- Nmcli.connectToNetwork(ssid, password, bssid, (result) => {
+
+ Nmcli.connectToNetwork(ssid, password, bssid, result => {
if (result && result.success) {
// Connection successful
- if (callback) callback(result);
+ if (callback)
+ callback(result);
root.pendingConnection = null;
} else if (result && result.needsPassword) {
// Password needed - callback will handle showing dialog
- if (callback) callback(result);
+ if (callback)
+ callback(result);
} else {
// Connection failed
if (result && result.error) {
root.connectionFailed(ssid);
}
- if (callback) callback(result);
+ if (callback)
+ callback(result);
root.pendingConnection = null;
}
});
@@ -98,22 +105,29 @@ Singleton {
function connectToNetworkWithPasswordCheck(ssid: string, isSecure: bool, callback: var, bssid: string): void {
// Set up pending connection tracking
const hasBssid = bssid !== undefined && bssid !== null && bssid.length > 0;
- root.pendingConnection = { ssid: ssid, bssid: hasBssid ? bssid : "", callback: callback };
-
- Nmcli.connectToNetworkWithPasswordCheck(ssid, isSecure, (result) => {
+ root.pendingConnection = {
+ ssid: ssid,
+ bssid: hasBssid ? bssid : "",
+ callback: callback
+ };
+
+ Nmcli.connectToNetworkWithPasswordCheck(ssid, isSecure, result => {
if (result && result.success) {
// Connection successful
- if (callback) callback(result);
+ if (callback)
+ callback(result);
root.pendingConnection = null;
} else if (result && result.needsPassword) {
// Password needed - callback will handle showing dialog
- if (callback) callback(result);
+ if (callback)
+ callback(result);
} else {
// Connection failed
if (result && result.error) {
root.connectionFailed(ssid);
}
- if (callback) callback(result);
+ if (callback)
+ callback(result);
root.pendingConnection = null;
}
}, bssid);
@@ -133,7 +147,7 @@ Singleton {
function forgetNetwork(ssid: string): void {
// Delete the connection profile for this network
// This will remove the saved password and connection settings
- Nmcli.forgetNetwork(ssid, (result) => {
+ Nmcli.forgetNetwork(ssid, result => {
if (result.success) {
// Refresh network list after deletion
Qt.callLater(() => {
@@ -145,7 +159,6 @@ Singleton {
});
}
-
property list<string> savedConnections: []
property list<string> savedConnectionSsids: []
@@ -163,21 +176,21 @@ Singleton {
function syncNetworksFromNmcli(): void {
const rNetworks = root.networks;
const nNetworks = Nmcli.networks;
-
+
// Build a map of existing networks by key
const existingMap = new Map();
for (const rn of rNetworks) {
const key = `${rn.frequency}:${rn.ssid}:${rn.bssid}`;
existingMap.set(key, rn);
}
-
+
// Build a map of new networks by key
const newMap = new Map();
for (const nn of nNetworks) {
const key = `${nn.frequency}:${nn.ssid}:${nn.bssid}`;
newMap.set(key, nn);
}
-
+
// Remove networks that no longer exist
for (const [key, network] of existingMap) {
if (!newMap.has(key)) {
@@ -188,7 +201,7 @@ Singleton {
}
}
}
-
+
// Add or update networks from Nmcli
for (const [key, nNetwork] of newMap) {
const existing = existingMap.get(key);
@@ -226,28 +239,29 @@ Singleton {
}
function getWifiStatus(): void {
- Nmcli.getWifiStatus((enabled) => {
+ Nmcli.getWifiStatus(enabled => {
root.wifiEnabled = enabled;
});
}
function getEthernetDevices(): void {
root.ethernetProcessRunning = true;
- Nmcli.getEthernetInterfaces((interfaces) => {
+ Nmcli.getEthernetInterfaces(interfaces => {
root.ethernetDevices = Nmcli.ethernetDevices;
root.ethernetDeviceCount = Nmcli.ethernetDevices.length;
root.ethernetProcessRunning = false;
});
}
-
function connectEthernet(connectionName: string, interfaceName: string): void {
- Nmcli.connectEthernet(connectionName, interfaceName, (result) => {
+ Nmcli.connectEthernet(connectionName, interfaceName, result => {
if (result.success) {
getEthernetDevices();
// Refresh device details after connection
Qt.callLater(() => {
- const activeDevice = root.ethernetDevices.find(function(d) { return d.connected; });
+ const activeDevice = root.ethernetDevices.find(function (d) {
+ return d.connected;
+ });
if (activeDevice && activeDevice.interface) {
updateEthernetDeviceDetails(activeDevice.interface);
}
@@ -257,7 +271,7 @@ Singleton {
}
function disconnectEthernet(connectionName: string): void {
- Nmcli.disconnectEthernet(connectionName, (result) => {
+ Nmcli.disconnectEthernet(connectionName, result => {
if (result.success) {
getEthernetDevices();
// Clear device details after disconnection
@@ -269,7 +283,7 @@ Singleton {
}
function updateEthernetDeviceDetails(interfaceName: string): void {
- Nmcli.getEthernetDeviceDetails(interfaceName, (details) => {
+ Nmcli.getEthernetDeviceDetails(interfaceName, details => {
root.ethernetDeviceDetails = details;
});
}
@@ -277,7 +291,7 @@ Singleton {
function updateWirelessDeviceDetails(): void {
// Find the wireless interface by looking for wifi devices
// Pass empty string to let Nmcli find the active interface automatically
- Nmcli.getWirelessDeviceDetails("", (details) => {
+ Nmcli.getWirelessDeviceDetails("", details => {
root.wirelessDeviceDetails = details;
});
}
@@ -290,12 +304,7 @@ Singleton {
}
const mask = (0xffffffff << (32 - cidrNum)) >>> 0;
- const octets = [
- (mask >>> 24) & 0xff,
- (mask >>> 16) & 0xff,
- (mask >>> 8) & 0xff,
- mask & 0xff
- ];
+ const octets = [(mask >>> 24) & 0xff, (mask >>> 16) & 0xff, (mask >>> 8) & 0xff, mask & 0xff];
return octets.join(".");
}
@@ -312,5 +321,4 @@ Singleton {
}
}
}
-
}
diff --git a/services/VPN.qml b/services/VPN.qml
index 431c8ec..2d08631 100644
--- a/services/VPN.qml
+++ b/services/VPN.qml
@@ -129,9 +129,9 @@ Singleton {
command: ["ip", "link", "show"]
environment: ({
- LANG: "C.UTF-8",
- LC_ALL: "C.UTF-8"
- })
+ LANG: "C.UTF-8",
+ LC_ALL: "C.UTF-8"
+ })
stdout: StdioCollector {
onStreamFinished: {
const iface = root.currentConfig ? root.currentConfig.interface : "";