[wayland] Improve mapping of windowClass to desktop file

QtWayland might also pass a name like "app.desktop". In that case
we should not append .desktop to it.
This commit is contained in:
Martin Gräßlin 2015-07-15 17:18:39 +02:00
parent f7d317601e
commit a3db04f66e

View file

@ -672,10 +672,14 @@ bool ShellClient::hasStrut() const
void ShellClient::updateIcon() void ShellClient::updateIcon()
{ {
if (m_shellSurface->windowClass().isEmpty()) { QString desktopFile = QString::fromUtf8(m_shellSurface->windowClass());
if (desktopFile.isEmpty()) {
setIcon(QIcon()); setIcon(QIcon());
} }
KDesktopFile df(QStringLiteral("%0.desktop").arg(QString::fromUtf8(m_shellSurface->windowClass()))); if (!desktopFile.endsWith(QLatin1String(".desktop"))) {
desktopFile.append(QLatin1String(".desktop"));
}
KDesktopFile df(desktopFile);
setIcon(QIcon::fromTheme(df.readIcon())); setIcon(QIcon::fromTheme(df.readIcon()));
} }