summaryrefslogtreecommitdiff
path: root/modules/controlcenter/network
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-11-15 17:15:02 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-11-15 17:15:34 +1100
commit6a92f985d8739ef2c397714f79e18b74f48fb705 (patch)
treee9fdf8c9bf07bc84b3e02f9a73de8545f1e29e9a /modules/controlcenter/network
parentcontrolcenter: removed signal strength percentage from network list (diff)
downloadcaelestia-shell-6a92f985d8739ef2c397714f79e18b74f48fb705.tar.gz
caelestia-shell-6a92f985d8739ef2c397714f79e18b74f48fb705.tar.bz2
caelestia-shell-6a92f985d8739ef2c397714f79e18b74f48fb705.zip
internal: use existing button controls
Instead of SimpleButton
Diffstat (limited to 'modules/controlcenter/network')
-rw-r--r--modules/controlcenter/network/SimpleButton.qml50
-rw-r--r--modules/controlcenter/network/WirelessDetails.qml44
-rw-r--r--modules/controlcenter/network/WirelessPasswordDialog.qml54
3 files changed, 43 insertions, 105 deletions
diff --git a/modules/controlcenter/network/SimpleButton.qml b/modules/controlcenter/network/SimpleButton.qml
deleted file mode 100644
index a73f751..0000000
--- a/modules/controlcenter/network/SimpleButton.qml
+++ /dev/null
@@ -1,50 +0,0 @@
-import qs.components
-import qs.components.controls
-import qs.components.effects
-import qs.config
-import QtQuick
-import QtQuick.Layouts
-
-StyledRect {
- id: root
-
- property color onColor: Colours.palette.m3onSurface
- property alias disabled: stateLayer.disabled
- property alias text: label.text
- property alias enabled: stateLayer.enabled
- property string icon: ""
-
- implicitWidth: rowLayout.implicitWidth + Appearance.padding.normal * 2
- implicitHeight: rowLayout.implicitHeight + Appearance.padding.small * 2
- radius: Appearance.rounding.normal
-
- StateLayer {
- id: stateLayer
- color: parent.onColor
- function onClicked(): void {
- if (parent.enabled !== false) {
- parent.clicked();
- }
- }
- }
-
- RowLayout {
- id: rowLayout
- anchors.centerIn: parent
- spacing: Appearance.spacing.small
-
- MaterialIcon {
- id: iconItem
- visible: root.icon.length > 0
- text: root.icon
- color: root.onColor
- }
-
- StyledText {
- id: label
- color: parent.parent.onColor
- }
- }
-
- signal clicked
-} \ No newline at end of file
diff --git a/modules/controlcenter/network/WirelessDetails.qml b/modules/controlcenter/network/WirelessDetails.qml
index 5b4f541..651f1fb 100644
--- a/modules/controlcenter/network/WirelessDetails.qml
+++ b/modules/controlcenter/network/WirelessDetails.qml
@@ -69,7 +69,7 @@ Item {
if (!Nmcli.wirelessDeviceDetails || Nmcli.wirelessDeviceDetails === null) {
// Network is active but we don't have details yet, fetch them
Nmcli.getWirelessDeviceDetails("", () => {
- // After fetching, check if we got details - if not, timer will try again
+ // After fetching, check if we got details - if not, timer will try again
});
} else {
// We have details, can stop the timer
@@ -89,7 +89,7 @@ Item {
if (network && network.ssid) {
const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid);
if (isActive) {
- Nmcli.getWirelessDeviceDetails("", () => {});
+ Nmcli.getWirelessDeviceDetails("");
} else {
Nmcli.wirelessDeviceDetails = null;
}
@@ -134,14 +134,14 @@ Item {
checked: root.network?.active ?? false
toggle.onToggled: {
if (checked) {
- handleConnect();
+ root.handleConnect();
} else {
Nmcli.disconnectFromNetwork();
}
}
}
- SimpleButton {
+ TextButton {
Layout.fillWidth: true
Layout.topMargin: Appearance.spacing.normal
Layout.minimumHeight: Appearance.font.size.normal + Appearance.padding.normal * 2
@@ -151,8 +151,8 @@ Item {
}
return Nmcli.hasSavedProfile(root.network.ssid);
}
- color: Colours.palette.m3errorContainer
- onColor: Colours.palette.m3onErrorContainer
+ inactiveColour: Colours.palette.m3errorContainer
+ inactiveOnColour: Colours.palette.m3onErrorContainer
text: qsTr("Forget Network")
onClicked: {
@@ -160,7 +160,7 @@ Item {
if (root.network.active) {
Nmcli.disconnectFromNetwork();
}
- Nmcli.forgetNetwork(root.network.ssid, () => {});
+ Nmcli.forgetNetwork(root.network.ssid);
}
}
}
@@ -214,7 +214,6 @@ Item {
deviceDetails: Nmcli.wirelessDeviceDetails
}
}
-
}
}
@@ -236,26 +235,21 @@ Item {
if (hasSavedProfile) {
Nmcli.connectToNetwork(root.network.ssid, "", root.network.bssid, null);
} else {
- Nmcli.connectToNetworkWithPasswordCheck(
- root.network.ssid,
- root.network.isSecure,
- (result) => {
- if (result.needsPassword) {
- if (Nmcli.pendingConnection) {
- Nmcli.connectionCheckTimer.stop();
- Nmcli.immediateCheckTimer.stop();
- Nmcli.immediateCheckTimer.checkCount = 0;
- Nmcli.pendingConnection = null;
- }
- root.session.network.showPasswordDialog = true;
- root.session.network.pendingNetwork = root.network;
+ Nmcli.connectToNetworkWithPasswordCheck(root.network.ssid, root.network.isSecure, result => {
+ if (result.needsPassword) {
+ if (Nmcli.pendingConnection) {
+ Nmcli.connectionCheckTimer.stop();
+ Nmcli.immediateCheckTimer.stop();
+ Nmcli.immediateCheckTimer.checkCount = 0;
+ Nmcli.pendingConnection = null;
}
- },
- root.network.bssid
- );
+ root.session.network.showPasswordDialog = true;
+ root.session.network.pendingNetwork = root.network;
+ }
+ }, root.network.bssid);
}
} else {
Nmcli.connectToNetwork(root.network.ssid, "", root.network.bssid, null);
}
}
-} \ No newline at end of file
+}
diff --git a/modules/controlcenter/network/WirelessPasswordDialog.qml b/modules/controlcenter/network/WirelessPasswordDialog.qml
index d0c023f..f3381b7 100644
--- a/modules/controlcenter/network/WirelessPasswordDialog.qml
+++ b/modules/controlcenter/network/WirelessPasswordDialog.qml
@@ -48,7 +48,7 @@ Item {
MouseArea {
anchors.fill: parent
- onClicked: closeDialog();
+ onClicked: closeDialog()
}
}
@@ -94,7 +94,7 @@ Item {
}
}
- Keys.onEscapePressed: closeDialog();
+ Keys.onEscapePressed: closeDialog()
ColumnLayout {
id: content
@@ -314,25 +314,25 @@ Item {
Layout.fillWidth: true
spacing: Appearance.spacing.normal
- SimpleButton {
+ TextButton {
id: cancelButton
Layout.fillWidth: true
Layout.minimumHeight: Appearance.font.size.normal + Appearance.padding.normal * 2
- color: Colours.palette.m3secondaryContainer
- onColor: Colours.palette.m3onSecondaryContainer
+ inactiveColour: Colours.palette.m3secondaryContainer
+ inactiveOnColour: Colours.palette.m3onSecondaryContainer
text: qsTr("Cancel")
- onClicked: closeDialog();
+ onClicked: root.closeDialog()
}
- SimpleButton {
+ TextButton {
id: connectButton
Layout.fillWidth: true
Layout.minimumHeight: Appearance.font.size.normal + Appearance.padding.normal * 2
- color: Colours.palette.m3primary
- onColor: Colours.palette.m3onPrimary
+ inactiveColour: Colours.palette.m3primary
+ inactiveOnColour: Colours.palette.m3onPrimary
text: qsTr("Connect")
enabled: passwordContainer.passwordBuffer.length > 0 && !connecting
@@ -354,24 +354,19 @@ Item {
text = qsTr("Connecting...");
// Connect to network
- Nmcli.connectToNetwork(
- root.network.ssid,
- password,
- root.network.bssid || "",
- (result) => {
- if (result && result.success) {
- // Connection successful, monitor will handle the rest
- } else if (result && result.needsPassword) {
- // Shouldn't happen since we provided password
- connectionMonitor.stop();
- connecting = false;
- enabled = true;
- text = qsTr("Connect");
- } else {
- // Connection failed, monitor will handle timeout
- }
- }
- );
+ Nmcli.connectToNetwork(root.network.ssid, password, root.network.bssid || "", result => {
+ if (result && result.success)
+ // Connection successful, monitor will handle the rest
+ {} else if (result && result.needsPassword) {
+ // Shouldn't happen since we provided password
+ connectionMonitor.stop();
+ connecting = false;
+ enabled = true;
+ text = qsTr("Connect");
+ } else
+ // Connection failed, monitor will handle timeout
+ {}
+ });
// Start monitoring connection
connectionMonitor.start();
@@ -387,8 +382,7 @@ Item {
}
// Check if we're connected to the target network (case-insensitive SSID comparison)
- const isConnected = root.network && Nmcli.active && Nmcli.active.ssid &&
- Nmcli.active.ssid.toLowerCase().trim() === root.network.ssid.toLowerCase().trim();
+ const isConnected = root.network && Nmcli.active && Nmcli.active.ssid && Nmcli.active.ssid.toLowerCase().trim() === root.network.ssid.toLowerCase().trim();
if (isConnected) {
// Successfully connected - give it a moment for network list to update
@@ -459,7 +453,7 @@ Item {
if (isClosing) {
return;
}
-
+
isClosing = true;
passwordContainer.passwordBuffer = "";
connectButton.connecting = false;