// Copyright (C) 2026 Danilo M. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. import Quickshell.Networking import QtQuick import "../.." // The wired half. Sibling of NetworkPage's wifi half, added in Task 2. Column { id: page required property var net signal back spacing: 14 function stateLabel(s) { return s === ConnectionState.Connected ? "connected" : s === ConnectionState.Connecting ? "connecting" : s === ConnectionState.Disconnecting ? "disconnecting" : "disconnected"; } Text { visible: page.net.wiredDevices.length > 0 text: "Wired" font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true } color: Theme.subtext } Repeater { model: page.net.wiredDevices Rectangle { required property var modelData width: page.width implicitHeight: wiredText.implicitHeight + 16 radius: 8 color: Qt.alpha(Theme.surface, 0.35) Text { id: wiredText anchors { left: parent.left; leftMargin: 10; verticalCenter: parent.verticalCenter } text: modelData.name + " " + page.stateLabel(modelData.state) font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 } color: modelData.connected ? Theme.text : Theme.subtext } Button { anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter } visible: modelData.connected text: "Disconnect" onClicked: page.net.disconnectNetwork(modelData) } } } }