Skip to content

Commit

Permalink
Fix org.telegram.desktop identification
Browse files Browse the repository at this point in the history
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
  • Loading branch information
aleixpol committed May 14, 2020
1 parent d7687ce commit 7ea7aa1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions abstract_client.cpp
Expand Up @@ -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();
}

Expand Down

0 comments on commit 7ea7aa1

Please sign in to comment.