summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <[email protected]>2018-05-16 01:25:43 +0200
committerAleix Pol <[email protected]>2018-05-16 01:25:43 +0200
commitdef5203424618f0f29e25c2a9c66e15decb007c4 (patch)
treec3ae0ab84f175a01a1d427e2dbcc488a55aa6433
parentd9d711ff42a67a2df24317af317e6722f89bd822 (diff)
PackageKit: Try harder to find the application desktop filev5.12.5.1
-rw-r--r--libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp b/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp
index 8af5a44..bee9269 100644
--- a/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp
+++ b/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp
@@ -200,11 +200,22 @@ void AppPackageKitResource::invokeApplication() const
} else {
const QStringList exes = m_appdata.provided(AppStream::Provided::KindBinary).items();
const auto packageExecutables = kFilter<QStringList>(allServices, [filenames](const QString &exe) { return filenames.contains(QLatin1Char('/') + exe); });
- if (packageExecutables.isEmpty()) {
- qWarning() << "Could not find any executables" << exes << filenames;
- return;
+ if (!packageExecutables.isEmpty()) {
+ QProcess::startDetached(exes.constFirst());
+ } else {
+ const auto locations = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation);
+ const auto desktopFiles = kFilter<QStringList>(filenames, [locations](const QString &exe) {
+ for (const auto &location: locations) {
+ if (exe.startsWith(location))
+ return exe.contains(QLatin1String(".desktop"));
+ }
+ return false;
+ });
+ if (!desktopFiles.isEmpty()) {
+ QProcess::startDetached(QStringLiteral(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/discover/runservice"), { desktopFiles });
+ }
}
- QProcess::startDetached(exes.constFirst());
+ qWarning() << "Could not find any executables" << exes << filenames;
}
});
}