nmcli: migrated all of ethernet controlcenter

This commit is contained in:
ATMDA 2025-11-13 19:56:44 -05:00
parent 7799ec67fd
commit 2bb9cd068f
3 changed files with 12 additions and 14 deletions

View file

@ -18,15 +18,15 @@ Item {
Component.onCompleted: {
if (device && device.interface) {
Network.updateEthernetDeviceDetails(device.interface);
Nmcli.getEthernetDeviceDetails(device.interface, () => {});
}
}
onDeviceChanged: {
if (device && device.interface) {
Network.updateEthernetDeviceDetails(device.interface);
Nmcli.getEthernetDeviceDetails(device.interface, () => {});
} else {
Network.ethernetDeviceDetails = null;
Nmcli.ethernetDeviceDetails = null;
}
}
@ -59,11 +59,10 @@ Item {
checked: root.device?.connected ?? false
toggle.onToggled: {
if (checked) {
// Use connection name if available, otherwise use interface
Network.connectEthernet(root.device?.connection || "", root.device?.interface || "");
Nmcli.connectEthernet(root.device?.connection || "", root.device?.interface || "", () => {});
} else {
if (root.device?.connection) {
Network.disconnectEthernet(root.device.connection);
Nmcli.disconnectEthernet(root.device.connection, () => {});
}
}
}
@ -103,7 +102,7 @@ Item {
SectionContainer {
ConnectionInfoSection {
deviceDetails: Network.ethernetDeviceDetails
deviceDetails: Nmcli.ethernetDeviceDetails
}
}

View file

@ -49,7 +49,7 @@ ColumnLayout {
spacing: Appearance.spacing.small
StyledText {
text: qsTr("Devices (%1)").arg(Network.ethernetDeviceCount || Network.ethernetDevices.length)
text: qsTr("Devices (%1)").arg(Nmcli.ethernetDevices.length)
font.pointSize: Appearance.font.size.large
font.weight: 500
}
@ -66,7 +66,7 @@ ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
model: Network.ethernetDevices
model: Nmcli.ethernetDevices
spacing: Appearance.spacing.small / 2
clip: true
@ -145,10 +145,9 @@ ColumnLayout {
StateLayer {
function onClicked(): void {
if (modelData.connected && modelData.connection) {
Network.disconnectEthernet(modelData.connection);
Nmcli.disconnectEthernet(modelData.connection, () => {});
} else {
// Use connection name if available, otherwise use interface
Network.connectEthernet(modelData.connection || "", modelData.interface || "");
Nmcli.connectEthernet(modelData.connection || "", modelData.interface || "", () => {});
}
}
}

View file

@ -64,7 +64,7 @@ ColumnLayout {
}
StyledText {
text: qsTr("%1").arg(Network.ethernetDeviceCount || Network.ethernetDevices.length)
text: qsTr("%1").arg(Nmcli.ethernetDevices.length)
color: Colours.palette.m3outline
font.pointSize: Appearance.font.size.small
}
@ -75,7 +75,7 @@ ColumnLayout {
}
StyledText {
text: qsTr("%1").arg(Network.ethernetDevices.filter(d => d.connected).length)
text: qsTr("%1").arg(Nmcli.ethernetDevices.filter(d => d.connected).length)
color: Colours.palette.m3outline
font.pointSize: Appearance.font.size.small
}