From 5b5a9957a5e3e8faa94e9c2f0ca559876e9c1c3c Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 14 May 2020 17:25:32 +0200 Subject: [PATCH] Fix TestXdgShellClient::testDesktopFileName Summary: Allows AbstractClient::m_desktopFileName be an absolute path, which is used by tests. Test Plan: Test passes, other things still work, including telegram. Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D29758 --- abstract_client.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index 213725352d..e3a3c8438d 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -43,6 +43,7 @@ along with this program. If not, see . #include +#include #include #include @@ -2545,8 +2546,16 @@ void AbstractClient::setDesktopFileName(QByteArray name) QString AbstractClient::iconFromDesktopFile() const { const QString desktopFileName = QString::fromUtf8(m_desktopFileName); - QString desktopFilePath = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, - desktopFileName); + QString desktopFilePath; + + if (QDir::isAbsolutePath(desktopFileName)) { + desktopFilePath = desktopFileName; + } + + if (desktopFilePath.isEmpty()) { + desktopFilePath = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, + desktopFileName); + } if (desktopFilePath.isEmpty()) { desktopFilePath = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, desktopFileName + QLatin1String(".desktop"));