Add kde patches

The nixpkgs patch is to clear out a conflict with a patch that's applied
to plasma-workspace by nixpkgs
This commit is contained in:
Toast 2025-07-04 22:31:07 +02:00
parent fd0f27145a
commit 98f9b3a8fc
23 changed files with 7818 additions and 0 deletions

View file

@ -0,0 +1,168 @@
From 63a9d544dc4f5160f28e5f3203a2c0a5e639e5ac Mon Sep 17 00:00:00 2001
From: Nate Graham <nate@kde.org>
Date: Fri, 13 Jun 2025 12:24:22 -0600
Subject: [PATCH] applet: use standard section headers
We have them, so we might as well use them. This lets us get rid of a
bunch of complex and fragile code that's responsible for the existing
separator.
---
applet/contents/ui/ConnectionItem.qml | 14 -----
applet/contents/ui/ConnectionListPage.qml | 10 ++--
applet/contents/ui/ListItem.qml | 64 -----------------------
libs/models/networkmodelitem.cpp | 8 ++-
4 files changed, 12 insertions(+), 84 deletions(-)
delete mode 100644 applet/contents/ui/ListItem.qml
diff --git a/applet/contents/ui/ConnectionItem.qml b/applet/contents/ui/ConnectionItem.qml
index ed154e633..5bb5c530c 100644
--- a/applet/contents/ui/ConnectionItem.qml
+++ b/applet/contents/ui/ConnectionItem.qml
@@ -321,20 +321,6 @@ PlasmaExtras.ExpandableListItem {
}
}
- onDeactivatedChanged: {
- /* Separator is part of section, which is visible only when available connections exist. Need to determine
- if there is a connection in use, to show Separator. Otherwise need to hide it from the top of the list.
- Connections in use are always on top, only need to check the first one. */
- if (appletProxyModel.data(appletProxyModel.index(0, 0), PlasmaNM.NetworkModel.SectionRole) !== "Available connections") {
- if (connectionView.showSeparator != true) {
- connectionView.showSeparator = true
- }
- return
- }
- connectionView.showSeparator = false
- return
- }
-
onItemCollapsed: {
connectionItem.customExpandedViewContent = detailsComponent;
setDelayModelUpdates(false);
diff --git a/applet/contents/ui/ConnectionListPage.qml b/applet/contents/ui/ConnectionListPage.qml
index b62da252c..d8ebd2c54 100644
--- a/applet/contents/ui/ConnectionListPage.qml
+++ b/applet/contents/ui/ConnectionListPage.qml
@@ -8,7 +8,7 @@ import QtQuick 2.15
import QtQuick.Layouts 1.2
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.kirigami 2.20 as Kirigami
-import org.kde.plasma.extras 2.0 as PlasmaExtras
+import org.kde.plasma.extras as PlasmaExtras
import org.kde.plasma.networkmanagement as PlasmaNM
import org.kde.networkmanager as NMQt
@@ -55,7 +55,6 @@ ColumnLayout {
id: connectionView
property int currentVisibleButtonIndex: -1
- property bool showSeparator: false
Keys.onDownPressed: event => {
connectionView.incrementCurrentIndex();
@@ -80,9 +79,10 @@ ColumnLayout {
model: appletProxyModel
currentIndex: -1
boundsBehavior: Flickable.StopAtBounds
- section.property: showSeparator ? "Section" : ""
- section.delegate: ListItem {
- separator: true
+ section.property: "Section"
+ section.delegate: PlasmaExtras.ListSectionHeader {
+ width: connectionView.width - connectionView.leftMargin - connectionView.rightMargin
+ text: section
}
highlight: PlasmaExtras.Highlight { }
highlightMoveDuration: Kirigami.Units.shortDuration
diff --git a/applet/contents/ui/ListItem.qml b/applet/contents/ui/ListItem.qml
deleted file mode 100644
index bfe1390d1..000000000
--- a/applet/contents/ui/ListItem.qml
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2010 Marco Martin <notmart@gmail.com>
- SPDX-FileCopyrightText: 2016 Jan Grulich <jgrulich@redhat.com>
- SPDX-FileCopyrightText: 2020 George Vogiatzis <gvgeo@protonmail.com>
-
- SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
-*/
-
-import QtQuick 2.1
-import org.kde.kirigami 2.20 as Kirigami
-import org.kde.ksvg 1.0 as KSvg
-
-/**
- * Ignores the theme's listItem margins, and uses custom highlight(pressed) area.
- * Could break some themes but the majority look fine.
- * Also includes a separator to be used in sections.
- */
-MouseArea {
- id: listItem
-
- property bool checked: false
- property bool separator: false
- property rect highlightRect: Qt.rect(0, 0, width, height)
-
- width: parent.width
-
- // Sections have spacing above but not below. Will use 2 of them below.
- height: separator ? separatorLine.height + Kirigami.Units.smallSpacing * 3 : parent.height
- hoverEnabled: true
-
- KSvg.SvgItem {
- id: separatorLine
- anchors {
- horizontalCenter: parent.horizontalCenter
- top: parent.top
- topMargin: Kirigami.Units.smallSpacing
- }
- imagePath: "widgets/line"
- elementId: "horizontal-line"
- width: parent.width - Kirigami.Units.gridUnit * 2
- visible: listItem.separator
- }
-
- KSvg.FrameSvgItem {
- id: background
- imagePath: "widgets/listitem"
- prefix: "normal"
- anchors.fill: parent
- visible: listItem.separator ? false : true
- }
-
- KSvg.FrameSvgItem {
- id: pressed
- imagePath: "widgets/listitem"
- prefix: "pressed"
- opacity: listItem.checked ? 1 : 0
- Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } }
-
- x: listItem.highlightRect.x
- y: listItem.highlightRect.y
- height: listItem.highlightRect.height
- width: listItem.highlightRect.width
- }
-}
diff --git a/libs/models/networkmodelitem.cpp b/libs/models/networkmodelitem.cpp
index b92ec0df2..4d7cbd77d 100644
--- a/libs/models/networkmodelitem.cpp
+++ b/libs/models/networkmodelitem.cpp
@@ -344,7 +344,13 @@ QString NetworkModelItem::originalName() const
QString NetworkModelItem::sectionType() const
{
if (m_connectionState == NetworkManager::ActiveConnection::Deactivated) {
- return QStringLiteral("Available connections");
+ return i18nc("@title:column header for list of available network connections", "Available");
+ // clang-format off
+ } else if (m_connectionState == NetworkManager::ActiveConnection::Activating
+ || m_connectionState == NetworkManager::ActiveConnection::Activated
+ || m_connectionState == NetworkManager::ActiveConnection::Deactivating) {
+ // clang-format on
+ return i18nc("@title:column header for list of connected network connections", "Connected");
} else {
return {};
}
--
GitLab