kio: pass the full path to KIO::pixmapForUrl() from KFileWidgetPrivate::setLocationText()

for best MIME type determination results the content of the file may have
to be read and relative path (only the filename in this case) does not cut
it

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-06-04 15:49:55 +03:00
parent f6ebdfe0a7
commit ed8815b5c9

View file

@ -1165,7 +1165,13 @@ void KFileWidgetPrivate::removeDummyHistoryEntry()
void KFileWidgetPrivate::setLocationText(const KUrl& url) void KFileWidgetPrivate::setLocationText(const KUrl& url)
{ {
if (!url.isEmpty()) { if (!url.isEmpty()) {
QPixmap urlIcon = KIO::pixmapForUrl(url, KIconLoader::Small); QPixmap urlIcon;
const QString u = url.url();
if (!KUrl::isRelativeUrl(u)) {
urlIcon = KIO::pixmapForUrl(url, KIconLoader::Small);
} else {
urlIcon = KIO::pixmapForUrl(KUrl(this->url, u), KIconLoader::Small);
}
if (url.hasPath()) { if (url.hasPath()) {
if (!url.directory().isEmpty()) { if (!url.directory().isEmpty()) {
KUrl u(url); KUrl u(url);