Commit 071f300f authored by Janne Pulkkinen's avatar Janne Pulkkinen Committed by Aleix Pol Gonzalez
Browse files

Fix launch for Flatpak apps without .desktop suffix

Use the desktop file launchable instead of constructing the desktop file out of the appstream id.
parent af103a8b
Pipeline #232012 passed with stage
in 1 minute and 13 seconds
......@@ -464,7 +464,16 @@ FlatpakResource::Id FlatpakResource::uniqueId() const
void FlatpakResource::invokeApplication() const
{
const QString desktopFile = installPath() + QLatin1String("/export/share/applications/") + appstreamId();
QString desktopFileName;
auto launchables = m_appdata.launchable(AppStream::Launchable::KindDesktopId).entries();
if (!launchables.isEmpty()) {
desktopFileName = launchables.constFirst();
} else {
qWarning() << "Failed to find launchable for " << m_appdata.name() << ", using AppStream identifier instead";
desktopFileName = appstreamId();
}
const QString desktopFile = installPath() + QLatin1String("/export/share/applications/") + desktopFileName;
const QString runservice = QStringLiteral(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/discover/runservice");
if (QFile::exists(desktopFile) && QFile::exists(runservice)) {
QProcess::startDetached(runservice, {desktopFile});
......
Supports Markdown
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