cbcd370847
- Add patches to fix browsing kdeconnect://: * 0001-Remove-old-kio_fonts-hack-in-KCoreDirLister-hostname.patch * 0002-KUrlCompletion-accommodate-local-protocols-that-use-.patch OBS-URL: https://build.opensuse.org/request/show/834106 OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kio?expand=0&rev=307
50 lines
2.2 KiB
Diff
50 lines
2.2 KiB
Diff
From 37440b39539d32e6e2d8ba840ae670348554d0d8 Mon Sep 17 00:00:00 2001
|
|
From: Ahmad Samir <a.samirh78@gmail.com>
|
|
Date: Sat, 12 Sep 2020 20:45:44 +0200
|
|
Subject: [PATCH 2/2] KUrlCompletion: accommodate ":local" protocols that use
|
|
hostname in url
|
|
|
|
An example of that is kdeconnect://, offering completions for it is
|
|
redundant since it uses the hostname part of the url as the deviceId (a
|
|
sequence of letters and numbers that's not easy to remember), so can't use
|
|
that, and the UDS_NAME is the pretty name (e.g. SM-J500H) users see listed in
|
|
kdeconnect:// but kdeconnect://SM-J500H doesn't work. Also because the code in
|
|
KUrlCompletion::_k_slotEntries() is expecting a list of files/dirs to offer
|
|
as completions, and not hostnames (_k_slotEntries uses addPathtoUrl helper
|
|
method), no useful completions are feasible.
|
|
|
|
Instead if the "filename" part of the url is empty we just skip it.
|
|
|
|
Note that this prevents the code from hitting an assert in addPathToUrl
|
|
(after applying https://invent.kde.org/frameworks/kio/-/merge_requests/127
|
|
which is needed to make accessing devices using the kdeconnect ioslave
|
|
actually work at all).
|
|
---
|
|
src/widgets/kurlcompletion.cpp | 9 +++++++--
|
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/widgets/kurlcompletion.cpp b/src/widgets/kurlcompletion.cpp
|
|
index 88bbaace..849a0f38 100644
|
|
--- a/src/widgets/kurlcompletion.cpp
|
|
+++ b/src/widgets/kurlcompletion.cpp
|
|
@@ -1213,9 +1213,14 @@ void KUrlCompletionPrivate::_k_slotEntries(KIO::Job *, const KIO::UDSEntryList &
|
|
entry_name = entry.stringValue(KIO::UDSEntry::UDS_NAME);
|
|
}
|
|
|
|
- //qDebug() << "name:" << name;
|
|
+ // This can happen with kdeconnect://deviceId as a completion for kdeconnect:/,
|
|
+ // there's no fileName [and the UDS_NAME is unrelated, can't use that].
|
|
+ // This code doesn't support completing hostnames anyway (see addPathToUrl below).
|
|
+ if (entry_name.isEmpty()) {
|
|
+ continue;
|
|
+ }
|
|
|
|
- if ((!entry_name.isEmpty() && entry_name.at(0) == QLatin1Char('.')) &&
|
|
+ if (entry_name.at(0) == QLatin1Char('.') &&
|
|
(list_urls_no_hidden ||
|
|
entry_name.length() == 1 ||
|
|
(entry_name.length() == 2 && entry_name.at(1) == QLatin1Char('.')))) {
|
|
--
|
|
2.25.1
|
|
|