diff options
author | Wolfgang Müller | 2024-11-05 22:04:25 +0100 |
---|---|---|
committer | Wolfgang Müller | 2024-11-05 22:05:17 +0100 |
commit | e8769453265943ebf373a6d99fa88834c8109356 (patch) | |
tree | 8edef5f175e3f6eb0f1d7487d89781c8f3475362 /desktop-plasma/patches/kde-apps | |
parent | 6cd82213a1bb5211b4b30558da98dee33199f807 (diff) | |
download | portage-roles-e8769453265943ebf373a6d99fa88834c8109356.tar.gz |
These fixes are now all available on unstable Plasma packages, so remove
them here.
Diffstat (limited to 'desktop-plasma/patches/kde-apps')
-rw-r--r-- | desktop-plasma/patches/kde-apps/dolphin-24.08.1/0001-Ignore-trailing-slashes-when-comparing-place-URLs.patch | 73 |
1 files changed, 0 insertions, 73 deletions
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?= <wolf@oriole.systems> -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 - |