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
This commit is contained in:
Aleix Pol 2021-09-03 17:46:46 +02:00 committed by Aleix Pol Gonzalez
parent 935fa6a9e1
commit 73279acc63

View file

@ -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 {};