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
This commit is contained in:
parent
d7687ce277
commit
7ea7aa1ee9
1 changed files with 8 additions and 7 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue