Commit 7ea7aa1e authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

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
parent d7687ce2
......@@ -2544,14 +2544,15 @@ void AbstractClient::setDesktopFileName(QByteArray name)
QString AbstractClient::iconFromDesktopFile() const
{
if (m_desktopFileName.isEmpty()) {
return QString();
}
QString desktopFile = QString::fromUtf8(m_desktopFileName);
if (!desktopFile.endsWith(QLatin1String(".desktop"))) {
desktopFile.append(QLatin1String(".desktop"));
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"));
}
KDesktopFile df(desktopFile);
KDesktopFile df(desktopFilePath);
return df.readIcon();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment