From 7ea7aa1ee901921ca4f15e35e07ca8247af7e95b Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 13 May 2020 19:54:03 +0200 Subject: [PATCH] Fix org.telegram.desktop identification Summary: The code we have that adds .desktop at the end of the resource name did not take into account that it might be the case that the application ends with .desktop like it happens on telegram's desktop client This patch looks for the file instead of just checking the name to account for it. Otherwise the look up happens in KConfig. Fixes flathub/org.telegram.desktop#27 on github Test Plan: Tested locally, works. Reviewers: #plasma, #kwin, ngraham Reviewed By: ngraham Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D29728 --- abstract_client.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index a5a6233239..213725352d 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -2544,14 +2544,15 @@ void AbstractClient::setDesktopFileName(QByteArray name) QString AbstractClient::iconFromDesktopFile() const { - if (m_desktopFileName.isEmpty()) { - return QString(); + const QString desktopFileName = QString::fromUtf8(m_desktopFileName); + QString desktopFilePath = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, + desktopFileName); + if (desktopFilePath.isEmpty()) { + desktopFilePath = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, + desktopFileName + QLatin1String(".desktop")); } - QString desktopFile = QString::fromUtf8(m_desktopFileName); - if (!desktopFile.endsWith(QLatin1String(".desktop"))) { - desktopFile.append(QLatin1String(".desktop")); - } - KDesktopFile df(desktopFile); + + KDesktopFile df(desktopFilePath); return df.readIcon(); }