From 73279acc63f72d36b8040e614fa489b7dcbfe127 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 3 Sep 2021 17:46:46 +0200 Subject: [PATCH] Fix absolute desktop file names Qt understands that the spec wants the id without .desktop postfix and chops it, so we need to add it back if we want to infer the desktop file. https://code.qt.io/cgit/qt/qtwayland.git/tree/src/client/qwaylandwindow.cpp?h=5.15#n161 BUG: 425403 --- src/abstract_client.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/abstract_client.cpp b/src/abstract_client.cpp index fda1d5c473..8c3885b0ea 100644 --- a/src/abstract_client.cpp +++ b/src/abstract_client.cpp @@ -2698,10 +2698,15 @@ QString AbstractClient::iconFromDesktopFile(const QString &desktopFileName) return {}; } + const QString desktopFileNameWithPrefix = desktopFileName + QLatin1String(".desktop"); QString desktopFilePath; if (QDir::isAbsolutePath(desktopFileName)) { - desktopFilePath = desktopFileName; + if (QFile::exists(desktopFileNameWithPrefix)) { + desktopFilePath = desktopFileNameWithPrefix; + } else { + desktopFilePath = desktopFileName; + } } if (desktopFilePath.isEmpty()) { @@ -2710,7 +2715,7 @@ QString AbstractClient::iconFromDesktopFile(const QString &desktopFileName) } if (desktopFilePath.isEmpty()) { desktopFilePath = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, - desktopFileName + QLatin1String(".desktop")); + desktopFileNameWithPrefix); } if (desktopFilePath.isEmpty()) { return {};