From e8769453265943ebf373a6d99fa88834c8109356 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Tue, 5 Nov 2024 22:04:25 +0100 Subject: desktop-plasma: Remove obsolete patches These fixes are now all available on unstable Plasma packages, so remove them here. --- ...railing-slashes-when-comparing-place-URLs.patch | 73 ----------------- ...View-have-setUrl-handle-trailing-slashes-.patch | 91 ---------------------- ...s-PlaceholderMessage-Relax-list-type-to-T.patch | 37 --------- ...nager-Avoid-infinite-loop-in-ActivityList.patch | 70 ----------------- 4 files changed, 271 deletions(-) delete mode 100644 desktop-plasma/patches/kde-apps/dolphin-24.08.1/0001-Ignore-trailing-slashes-when-comparing-place-URLs.patch delete mode 100644 desktop-plasma/patches/kde-frameworks/kio-6.6.0/0001-KFilePlacesView-have-setUrl-handle-trailing-slashes-.patch delete mode 100644 desktop-plasma/patches/kde-plasma/libplasma-6.1.5/0001-PlasmaExtras-PlaceholderMessage-Relax-list-type-to-T.patch delete mode 100644 desktop-plasma/patches/kde-plasma/plasma-desktop/0001-activitymanager-Avoid-infinite-loop-in-ActivityList.patch diff --git a/desktop-plasma/patches/kde-apps/dolphin-24.08.1/0001-Ignore-trailing-slashes-when-comparing-place-URLs.patch b/desktop-plasma/patches/kde-apps/dolphin-24.08.1/0001-Ignore-trailing-slashes-when-comparing-place-URLs.patch deleted file mode 100644 index 385da80..0000000 --- a/desktop-plasma/patches/kde-apps/dolphin-24.08.1/0001-Ignore-trailing-slashes-when-comparing-place-URLs.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 046ddcf5607e597cd6290147bf7ee10c08e526dd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Wolfgang=20M=C3=BCller?= -Date: Thu, 19 Sep 2024 11:46:09 +0200 -Subject: [PATCH] Ignore trailing slashes when comparing place URLs - -There's two locations where place URLs are compared in Dolphin. One -is in DolphinContextMenu::placeExists, which determines whether or not -to show an "Add to Places" context menu entry. The other one is in -DolphinViewContainer::caption, which provides the place name for use in -the window title, if applicable. - -Neither of these functions correctly normalize the URL to account for -trailing slashes. Whilst placeExists() does not even attempt it, -caption() was changed in 681d8bb6c (Fix wrong window titles, 2019-09-15) -to support this using a regular expression. - -However, caption() fails to escape the URL before incorporating it in -the regular expression, leading to failed matches and errors like the -following when browsing to directories that do not happen to make up a -valid regular expression: - - QString(View)::contains(): called on an invalid QRegularExpression - object (pattern is '\A(?:file:///home/foo/[Z-A]/?)\z') - -Instead of relying on complex and possibly brittle regular expressions, -use KFilePlacesModel's closestItem() function to find the closest -matching URL and then finally check whether the normalized URLs match -exactly. ---- - src/dolphincontextmenu.cpp | 5 ++--- - src/dolphinviewcontainer.cpp | 9 ++++----- - 2 files changed, 6 insertions(+), 8 deletions(-) - -diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp -index 68f6dbd21..3ce1d1d51 100644 ---- a/src/dolphincontextmenu.cpp -+++ b/src/dolphincontextmenu.cpp -@@ -381,9 +381,8 @@ bool DolphinContextMenu::placeExists(const QUrl &url) const - { - const KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel(); - -- const auto &matchedPlaces = placesModel->match(placesModel->index(0, 0), KFilePlacesModel::UrlRole, url, 1, Qt::MatchExactly); -- -- return !matchedPlaces.isEmpty(); -+ QModelIndex url_index = placesModel->closestItem(url); -+ return url_index.isValid() && placesModel->url(url_index).matches(url, QUrl::StripTrailingSlash); - } - - QAction *DolphinContextMenu::createPasteAction() -diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp -index ef76042b8..e55519d04 100644 ---- a/src/dolphinviewcontainer.cpp -+++ b/src/dolphinviewcontainer.cpp -@@ -552,12 +552,11 @@ QString DolphinViewContainer::caption() const - } - - KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel(); -- const QString pattern = url().adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/?"); -- const auto &matchedPlaces = -- placesModel->match(placesModel->index(0, 0), KFilePlacesModel::UrlRole, QRegularExpression::anchoredPattern(pattern), 1, Qt::MatchRegularExpression); - -- if (!matchedPlaces.isEmpty()) { -- return placesModel->text(matchedPlaces.first()); -+ QModelIndex url_index = placesModel->closestItem(url()); -+ -+ if (url_index.isValid() && placesModel->url(url_index).matches(url(), QUrl::StripTrailingSlash)) { -+ return placesModel->text(url_index); - } - - if (!url().isLocalFile()) { --- -2.46.0 - diff --git a/desktop-plasma/patches/kde-frameworks/kio-6.6.0/0001-KFilePlacesView-have-setUrl-handle-trailing-slashes-.patch b/desktop-plasma/patches/kde-frameworks/kio-6.6.0/0001-KFilePlacesView-have-setUrl-handle-trailing-slashes-.patch deleted file mode 100644 index 09b3415..0000000 --- a/desktop-plasma/patches/kde-frameworks/kio-6.6.0/0001-KFilePlacesView-have-setUrl-handle-trailing-slashes-.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 9140e58ea4ec9034d75fc7a3572cf0789dd4bb32 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Wolfgang=20M=C3=BCller?= -Date: Fri, 20 Sep 2024 09:23:18 +0200 -Subject: [PATCH] KFilePlacesView: have setUrl() handle trailing slashes in - place URLs - -Whilst KFilePlacesView::setUrl() correctly strips its argument when -comparing it to place URLs, it fails to strip the place URL itself. This -means that if a place URL contains a trailing slash, it is not correctly -highlighted in the place view. - -Instead of comparing both QUrl objects directly, use QUrl::matches, -which allows us to pass QUrl::StripTrailingSlash to both. - -Add a test case for this behaviour as well. ---- - autotests/kfileplacesviewtest.cpp | 37 +++++++++++++++++++++++++++++ - src/filewidgets/kfileplacesview.cpp | 2 +- - 2 files changed, 38 insertions(+), 1 deletion(-) - -diff --git a/autotests/kfileplacesviewtest.cpp b/autotests/kfileplacesviewtest.cpp -index 673bec37b..e70979eb3 100644 ---- a/autotests/kfileplacesviewtest.cpp -+++ b/autotests/kfileplacesviewtest.cpp -@@ -34,6 +34,8 @@ private Q_SLOTS: - - void testUrlChanged_data(); - void testUrlChanged(); -+ void testSetUrl_data(); -+ void testSetUrl(); - - private: - QTemporaryDir m_tmpHome; -@@ -100,6 +102,41 @@ void KFilePlacesViewTest::testUrlChanged() - QCOMPARE(args.at(0).toUrl().toString(), expectedUrl); - } - -+void KFilePlacesViewTest::testSetUrl_data() -+{ -+ QTest::addColumn("place"); -+ QTest::addColumn("url"); -+ -+ QString testPath = QString("file://%1/testSetUrl").arg(m_tmpHome.path()); -+ QUrl bareUrl = QUrl(testPath); -+ QUrl trailingUrl = QUrl(testPath.append("/")); -+ -+ QTest::newRow("place-bare-url-bare") << bareUrl << bareUrl; -+ QTest::newRow("place-bare-url-trailing") << bareUrl << trailingUrl; -+ QTest::newRow("place-trailing-url-bare") << trailingUrl << bareUrl; -+ QTest::newRow("place-trailing-url-trailing") << trailingUrl << trailingUrl; -+} -+ -+void KFilePlacesViewTest::testSetUrl() -+{ -+ QFETCH(QUrl, place); -+ QFETCH(QUrl, url); -+ -+ KFilePlacesView pv; -+ KFilePlacesModel pm; -+ pv.setModel(&pm); -+ -+ pm.addPlace("testSetUrl", place); -+ QModelIndex added = pm.closestItem(place); -+ -+ QSignalSpy selectionChangedSpy(pv.selectionModel(), &QItemSelectionModel::selectionChanged); -+ pv.setUrl(url); -+ -+ QVERIFY(!selectionChangedSpy.isEmpty()); -+ const QList args = selectionChangedSpy.takeFirst(); -+ QVERIFY(args.at(0).value().indexes().contains(added)); -+} -+ - QTEST_MAIN(KFilePlacesViewTest) - - #include "kfileplacesviewtest.moc" -diff --git a/src/filewidgets/kfileplacesview.cpp b/src/filewidgets/kfileplacesview.cpp -index dd4830353..c8eefde78 100644 ---- a/src/filewidgets/kfileplacesview.cpp -+++ b/src/filewidgets/kfileplacesview.cpp -@@ -1037,7 +1037,7 @@ void KFilePlacesView::setUrl(const QUrl &url) - - d->m_currentUrl = url; - -- if (placesModel->url(index) == url.adjusted(QUrl::StripTrailingSlash)) { -+ if (placesModel->url(index).matches(url, QUrl::StripTrailingSlash)) { - selectionModel()->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect); - } else { - selectionModel()->clear(); --- -2.46.0 - diff --git a/desktop-plasma/patches/kde-plasma/libplasma-6.1.5/0001-PlasmaExtras-PlaceholderMessage-Relax-list-type-to-T.patch b/desktop-plasma/patches/kde-plasma/libplasma-6.1.5/0001-PlasmaExtras-PlaceholderMessage-Relax-list-type-to-T.patch deleted file mode 100644 index bab012b..0000000 --- a/desktop-plasma/patches/kde-plasma/libplasma-6.1.5/0001-PlasmaExtras-PlaceholderMessage-Relax-list-type-to-T.patch +++ /dev/null @@ -1,37 +0,0 @@ -From d91e9a330eacf673c6c3e18ae218e3d1fb81f7fe Mon Sep 17 00:00:00 2001 -From: ivan tkachenko -Date: Sat, 15 Jun 2024 02:36:26 +0600 -Subject: [PATCH] PlasmaExtras/PlaceholderMessage: Relax list type to T.Action - -Properties should be using Templates version for maximum flexibility. - -CCBUG: 487904 ---- - .../plasmaextracomponents/qml/PlaceholderMessage.qml | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/declarativeimports/plasmaextracomponents/qml/PlaceholderMessage.qml b/src/declarativeimports/plasmaextracomponents/qml/PlaceholderMessage.qml -index 0e227f08a..b23b529c0 100644 ---- a/src/declarativeimports/plasmaextracomponents/qml/PlaceholderMessage.qml -+++ b/src/declarativeimports/plasmaextracomponents/qml/PlaceholderMessage.qml -@@ -6,7 +6,7 @@ - - import QtQuick - import QtQuick.Layouts --import QtQuick.Controls as QQC2 -+import QtQuick.Templates as T - - import org.kde.plasma.components as PlasmaComponents3 - import org.kde.kirigami as Kirigami -@@ -214,7 +214,7 @@ ColumnLayout { - * - * @since 5.72 - */ -- property QQC2.Action helpfulAction -+ property T.Action helpfulAction - - spacing: Kirigami.Units.gridUnit - --- -2.46.0 - diff --git a/desktop-plasma/patches/kde-plasma/plasma-desktop/0001-activitymanager-Avoid-infinite-loop-in-ActivityList.patch b/desktop-plasma/patches/kde-plasma/plasma-desktop/0001-activitymanager-Avoid-infinite-loop-in-ActivityList.patch deleted file mode 100644 index 977ce66..0000000 --- a/desktop-plasma/patches/kde-plasma/plasma-desktop/0001-activitymanager-Avoid-infinite-loop-in-ActivityList.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 6ee8b63fa490477b03f4104ed91ab585c53d8001 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Wolfgang=20M=C3=BCller?= -Date: Sat, 12 Oct 2024 14:39:03 +0200 -Subject: [PATCH] activitymanager: Avoid infinite loop in ActivityList - -When updating the selection in the activity manager we search through -activities using using a do while loop. Each iteration of the loop -increments or decrements selectedIndex depending on the search -direction, wrapping around if needed. The loop stops only once we have -found a visible item to select or if we have looped back to the item we -started with. The latter is done by comparing selectedIndex with the -index we started at, saved earlier in startingWithSelected. - -If the user triggers the activity manager and starts searching -activities right away without first selecting one, startingWithSelected -will remain at its initial value of -1. If there are no matches and the -user then attempts to select the next or previous item, we will loop -infinitely because there are no visible items and selectedIndex can -never again equal -1. This infinite loop will hang the entirety of -plasmashell. - -To fix this, keep track of how many items we have visited and forcibly -break out of the loop if we have seen all activities (meaning that we -have wrapped around). This does not rely on the value of either -selectedIndex or startingWithSelected, meaning it also works if no -activities are visible. We can also keep the old selection behaviour by -setting selectedIndex to startingWithSelected right before we break. ---- - .../contents/activitymanager/ActivityList.qml | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) - -diff --git a/desktoppackage/contents/activitymanager/ActivityList.qml b/desktoppackage/contents/activitymanager/ActivityList.qml -index 4b3402736..7a5cd7bab 100644 ---- a/desktoppackage/contents/activitymanager/ActivityList.qml -+++ b/desktoppackage/contents/activitymanager/ActivityList.qml -@@ -28,9 +28,11 @@ Flickable { - function _selectRelativeToCurrent(distance) - { - var startingWithSelected = selectedIndex; -+ var visited = 0; - - do { - selectedIndex += distance; -+ visited++; - - if (selectedIndex >= activitiesList.count) { - selectedIndex = 0; -@@ -40,11 +42,15 @@ Flickable { - selectedIndex = activitiesList.count - 1; - } - -- // Searching for the first item that is visible, or back to the one -- // that we started with -- } while (!activitiesList.itemAt(selectedIndex).visible -- && startingWithSelected !== selectedIndex); -+ if (visited >= activitiesList.count) { -+ // we've visited all activities but could not find a visible -+ // one, so stop searching and select the one we started with -+ selectedIndex = startingWithSelected; -+ break; -+ } - -+ // Searching for the first item that is visible -+ } while (!activitiesList.itemAt(selectedIndex).visible); - _updateSelectedItem(); - - } --- -2.47.0 - -- cgit v1.2.3-2-gb3c3