From 2698ced0e2a6dcd299d1613cbc95e62cc25207fa Mon Sep 17 00:00:00 2001 From: SadColourfulHues <46611929+SadColourfulHues@users.noreply.github.com> Date: Fri, 21 Jun 2024 22:03:03 +0800 Subject: [PATCH] fix: updated network button label for Plasma 6.1 --- package/contents/ui/components/Network.qml | 11 +++++++---- package/contents/ui/components/SectionButtons.qml | 13 +++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/package/contents/ui/components/Network.qml b/package/contents/ui/components/Network.qml index 83d5b0a..8ba4e46 100644 --- a/package/contents/ui/components/Network.qml +++ b/package/contents/ui/components/Network.qml @@ -4,7 +4,7 @@ import org.kde.plasma.networkmanagement as PlasmaNM Item { property var appletProxyModel: appletProxyModel - property var networkStatus: networkStatus.networkStatus + property var netStatusText: netStatus.activeConnections property var activeConnectionIcon: activeConnectionIcon.connectionIcon property var enabledConnections: enabledConnections property var availableDevices: availableDevices @@ -13,13 +13,16 @@ Item { PlasmaNM.ConnectionIcon { id: activeConnectionIcon + connectivity: netStatus.connectivity } + + PlasmaNM.NetworkStatus { + id: netStatus + } + PlasmaNM.Handler { id: handler } - PlasmaNM.NetworkStatus { - id: networkStatus - } PlasmaNM.AppletProxyModel { id: appletProxyModel sourceModel: PlasmaNM.NetworkModel{} diff --git a/package/contents/ui/components/SectionButtons.qml b/package/contents/ui/components/SectionButtons.qml index ea15a37..58a7155 100644 --- a/package/contents/ui/components/SectionButtons.qml +++ b/package/contents/ui/components/SectionButtons.qml @@ -6,6 +6,9 @@ import org.kde.plasma.core as PlasmaCore import org.kde.bluezqt as BluezQt import org.kde.kcmutils +import org.kde.kirigami as Kirigami +import org.kde.plasma.networkmanagement as PlasmaNM + import "../lib" as Lib import "../js/funcs.js" as Funcs @@ -33,10 +36,16 @@ Lib.Card { Lib.LongButton { title: i18n("Network") - subtitle: network.networkStatus + subtitle: network.netStatusText source: network.activeConnectionIcon - sourceColor: network.networkStatus === "Connected" ? + + // TODO:Better method? + // Replacement for previous implementation // + // I'm not too familiar with the KDE/Qt API, so maybe + // there's a better way of getting the connectivity state? + sourceColor: network.netStatusText.includes("Connected") ? Kirigami.Theme.highlightColor : Kirigami.Theme.disabledTextColor + onClicked: { sectionNetworks.toggleNetworkSection() }