summaryrefslogtreecommitdiff
path: root/modules/controlcenter/network/Details.qml
diff options
context:
space:
mode:
Diffstat (limited to 'modules/controlcenter/network/Details.qml')
-rw-r--r--modules/controlcenter/network/Details.qml305
1 files changed, 71 insertions, 234 deletions
diff --git a/modules/controlcenter/network/Details.qml b/modules/controlcenter/network/Details.qml
index 31d20bc..a53f62e 100644
--- a/modules/controlcenter/network/Details.qml
+++ b/modules/controlcenter/network/Details.qml
@@ -54,272 +54,109 @@ Item {
anchors.right: parent.right
spacing: Appearance.spacing.normal
- MaterialIcon {
- Layout.alignment: Qt.AlignHCenter
- animate: true
- text: root.network?.isSecure ? "lock" : "wifi"
- font.pointSize: Appearance.font.size.extraLarge * 3
- font.bold: true
+ ConnectionHeader {
+ icon: root.network?.isSecure ? "lock" : "wifi"
+ title: root.network?.ssid ?? qsTr("Unknown")
}
- StyledText {
- Layout.alignment: Qt.AlignHCenter
- animate: true
- text: root.network?.ssid ?? qsTr("Unknown")
- font.pointSize: Appearance.font.size.large
- font.bold: true
+ SectionHeader {
+ title: qsTr("Connection status")
+ description: qsTr("Connection settings for this network")
}
- StyledText {
- Layout.topMargin: Appearance.spacing.large
- text: qsTr("Connection status")
- font.pointSize: Appearance.font.size.larger
- font.weight: 500
- }
-
- StyledText {
- text: qsTr("Connection settings for this network")
- color: Colours.palette.m3outline
- }
-
- StyledRect {
- Layout.fillWidth: true
- implicitHeight: networkStatus.implicitHeight + Appearance.padding.large * 2
-
- radius: Appearance.rounding.normal
- color: Colours.tPalette.m3surfaceContainer
-
- ColumnLayout {
- id: networkStatus
-
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
- anchors.margins: Appearance.padding.large
-
- spacing: Appearance.spacing.larger
-
- Toggle {
- label: qsTr("Connected")
- checked: root.network?.active ?? false
- toggle.onToggled: {
- if (checked) {
- // If already connected to a different network, disconnect first
- if (Network.active && Network.active.ssid !== root.network.ssid) {
- Network.disconnectFromNetwork();
- // Wait a moment before connecting to new network
- Qt.callLater(() => {
- connectToNetwork();
- });
- } else {
+ SectionContainer {
+ ToggleRow {
+ label: qsTr("Connected")
+ checked: root.network?.active ?? false
+ toggle.onToggled: {
+ if (checked) {
+ // If already connected to a different network, disconnect first
+ if (Network.active && Network.active.ssid !== root.network.ssid) {
+ Network.disconnectFromNetwork();
+ // Wait a moment before connecting to new network
+ Qt.callLater(() => {
connectToNetwork();
- }
+ });
} else {
- Network.disconnectFromNetwork();
+ connectToNetwork();
}
+ } else {
+ Network.disconnectFromNetwork();
}
+ }
- function connectToNetwork(): void {
- if (root.network.isSecure) {
- // Try connecting without password first (in case it's saved)
- Network.connectToNetworkWithPasswordCheck(
- root.network.ssid,
- root.network.isSecure,
- () => {
- // Callback: connection failed, show password dialog
- root.session.network.showPasswordDialog = true;
- root.session.network.pendingNetwork = root.network;
- }
- );
- } else {
- Network.connectToNetwork(root.network.ssid, "");
- }
+ function connectToNetwork(): void {
+ if (root.network.isSecure) {
+ // Try connecting without password first (in case it's saved)
+ Network.connectToNetworkWithPasswordCheck(
+ root.network.ssid,
+ root.network.isSecure,
+ () => {
+ // Callback: connection failed, show password dialog
+ root.session.network.showPasswordDialog = true;
+ root.session.network.pendingNetwork = root.network;
+ }
+ );
+ } else {
+ Network.connectToNetwork(root.network.ssid, "");
}
}
}
}
- StyledText {
- Layout.topMargin: Appearance.spacing.large
- text: qsTr("Network properties")
- font.pointSize: Appearance.font.size.larger
- font.weight: 500
- }
-
- StyledText {
- text: qsTr("Additional information")
- color: Colours.palette.m3outline
+ SectionHeader {
+ title: qsTr("Network properties")
+ description: qsTr("Additional information")
}
- StyledRect {
- Layout.fillWidth: true
- implicitHeight: networkProps.implicitHeight + Appearance.padding.large * 2
+ SectionContainer {
+ contentSpacing: Appearance.spacing.small / 2
- radius: Appearance.rounding.normal
- color: Colours.tPalette.m3surfaceContainer
-
- ColumnLayout {
- id: networkProps
-
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
- anchors.margins: Appearance.padding.large
-
- spacing: Appearance.spacing.small / 2
-
- StyledText {
- text: qsTr("SSID")
- }
-
- StyledText {
- text: root.network?.ssid ?? qsTr("Unknown")
- color: Colours.palette.m3outline
- font.pointSize: Appearance.font.size.small
- }
-
- StyledText {
- Layout.topMargin: Appearance.spacing.normal
- text: qsTr("BSSID")
- }
-
- StyledText {
- text: root.network?.bssid ?? qsTr("Unknown")
- color: Colours.palette.m3outline
- font.pointSize: Appearance.font.size.small
- }
-
- StyledText {
- Layout.topMargin: Appearance.spacing.normal
- text: qsTr("Signal strength")
- }
-
- StyledText {
- text: root.network ? qsTr("%1%").arg(root.network.strength) : qsTr("N/A")
- color: Colours.palette.m3outline
- font.pointSize: Appearance.font.size.small
- }
-
- StyledText {
- Layout.topMargin: Appearance.spacing.normal
- text: qsTr("Frequency")
- }
+ PropertyRow {
+ label: qsTr("SSID")
+ value: root.network?.ssid ?? qsTr("Unknown")
+ }
- StyledText {
- text: root.network ? qsTr("%1 MHz").arg(root.network.frequency) : qsTr("N/A")
- color: Colours.palette.m3outline
- font.pointSize: Appearance.font.size.small
- }
+ PropertyRow {
+ showTopMargin: true
+ label: qsTr("BSSID")
+ value: root.network?.bssid ?? qsTr("Unknown")
+ }
- StyledText {
- Layout.topMargin: Appearance.spacing.normal
- text: qsTr("Security")
- }
+ PropertyRow {
+ showTopMargin: true
+ label: qsTr("Signal strength")
+ value: root.network ? qsTr("%1%").arg(root.network.strength) : qsTr("N/A")
+ }
- StyledText {
- text: root.network ? (root.network.isSecure ? root.network.security : qsTr("Open")) : qsTr("N/A")
- color: Colours.palette.m3outline
- font.pointSize: Appearance.font.size.small
- }
+ PropertyRow {
+ showTopMargin: true
+ label: qsTr("Frequency")
+ value: root.network ? qsTr("%1 MHz").arg(root.network.frequency) : qsTr("N/A")
}
- }
- StyledText {
- Layout.topMargin: Appearance.spacing.large
- text: qsTr("Connection information")
- font.pointSize: Appearance.font.size.larger
- font.weight: 500
+ PropertyRow {
+ showTopMargin: true
+ label: qsTr("Security")
+ value: root.network ? (root.network.isSecure ? root.network.security : qsTr("Open")) : qsTr("N/A")
+ }
}
- StyledText {
- text: qsTr("Network connection details")
- color: Colours.palette.m3outline
+ SectionHeader {
+ title: qsTr("Connection information")
+ description: qsTr("Network connection details")
}
- StyledRect {
- Layout.fillWidth: true
- implicitHeight: connectionInfo.implicitHeight + Appearance.padding.large * 2
-
- radius: Appearance.rounding.normal
- color: Colours.tPalette.m3surfaceContainer
-
- ColumnLayout {
- id: connectionInfo
-
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
- anchors.margins: Appearance.padding.large
-
- spacing: Appearance.spacing.small / 2
-
- StyledText {
- text: qsTr("IP Address")
- }
-
- StyledText {
- text: Network.wirelessDeviceDetails?.ipAddress || qsTr("Not available")
- color: Colours.palette.m3outline
- font.pointSize: Appearance.font.size.small
- }
-
- StyledText {
- Layout.topMargin: Appearance.spacing.normal
- text: qsTr("Subnet Mask")
- }
-
- StyledText {
- text: Network.wirelessDeviceDetails?.subnet || qsTr("Not available")
- color: Colours.palette.m3outline
- font.pointSize: Appearance.font.size.small
- }
-
- StyledText {
- Layout.topMargin: Appearance.spacing.normal
- text: qsTr("Gateway")
- }
-
- StyledText {
- text: Network.wirelessDeviceDetails?.gateway || qsTr("Not available")
- color: Colours.palette.m3outline
- font.pointSize: Appearance.font.size.small
- }
-
- StyledText {
- Layout.topMargin: Appearance.spacing.normal
- text: qsTr("DNS Servers")
- }
-
- StyledText {
- text: (Network.wirelessDeviceDetails && Network.wirelessDeviceDetails.dns && Network.wirelessDeviceDetails.dns.length > 0) ? Network.wirelessDeviceDetails.dns.join(", ") : qsTr("Not available")
- color: Colours.palette.m3outline
- font.pointSize: Appearance.font.size.small
- wrapMode: Text.Wrap
- Layout.maximumWidth: parent.width
- }
+ SectionContainer {
+ ConnectionInfoSection {
+ deviceDetails: Network.wirelessDeviceDetails
}
}
}
}
- component Toggle: RowLayout {
- required property string label
- property alias checked: toggle.checked
- property alias toggle: toggle
-
- Layout.fillWidth: true
- spacing: Appearance.spacing.normal
+}
- StyledText {
- Layout.fillWidth: true
- text: parent.label
- }
- StyledSwitch {
- id: toggle
- cLayer: 2
- }
- }
-}