[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [discover/Plasma/5.12] libdiscover/backends/PackageKitBackend: PackageKit: Try harder to find the ap
From:       Aleix Pol <null () kde ! org>
Date:       2018-05-15 23:26:45
Message-ID: E1fIjLB-0001Bm-Bi () code ! kde ! org
[Download RAW message or body]

Git commit def5203424618f0f29e25c2a9c66e15decb007c4 by Aleix Pol.
Committed on 15/05/2018 at 23:25.
Pushed by apol into branch 'Plasma/5.12'.

PackageKit: Try harder to find the application desktop file

BUG: 394270

M  +15   -4    libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp

https://commits.kde.org/discover/def5203424618f0f29e25c2a9c66e15decb007c4

diff --git a/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp \
b/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp index \
                8af5a446..bee92691 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;
         }
     });
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic