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

List:       kde-commits
Subject:    [discover/Plasma/5.13] /: Merge branch 'Plasma/5.12' into Plasma/5.13
From:       Aleix Pol <null () kde ! org>
Date:       2018-05-22 13:32:19
Message-ID: E1fL7Ol-0004lM-8e () code ! kde ! org
[Download RAW message or body]

Git commit 342db07b0a0f12039e317566a52a1d3fb2722f2d by Aleix Pol.
Committed on 22/05/2018 at 13:31.
Pushed by apol into branch 'Plasma/5.13'.

Merge branch 'Plasma/5.12' into Plasma/5.13

M  +6    -1    discover/DiscoverObject.cpp
M  +37   -10   libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp
M  +6    -4    libdiscover/backends/PackageKitBackend/PKTransaction.cpp
M  +5    -0    libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp
M  +2    -2    libdiscover/backends/SnapBackend/SnapResource.cpp

https://commits.kde.org/discover/342db07b0a0f12039e317566a52a1d3fb2722f2d

diff --cc libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp
index 82bfd3bf,bee92691..16db9429
--- a/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp
+++ b/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp
@@@ -24,6 -24,6 +24,7 @@@
  #include <AppStreamQt/image.h>
  #include <AppStreamQt/release.h>
  #include <appstream/AppStreamUtils.h>
++#include <PackageKit/Daemon>
  #include <KLocalizedString>
  #include <KToolInvocation>
  #include <QIcon>
@@@ -31,6 -31,8 +32,7 @@@
  #include <QStandardPaths>
  #include <QDebug>
  #include "config-paths.h"
 -#include <PackageKit/Daemon>
 -#include <utils.h>
++#include "utils.h"
  
  AppPackageKitResource::AppPackageKitResource(const AppStream::Component& data, \
const QString &packageName, PackageKitBackend* parent)  : \
PackageKitResource(packageName, QString(), parent) @@@ -199,21 -191,32 +206,41 @@@ \
void AppPackageKitResource::fetchChange  
  void AppPackageKitResource::invokeApplication() const
  {
-     const QStringList exes = \
                m_appdata.provided(AppStream::Provided::KindBinary).items();
-     if (exes.isEmpty()) {
-         const auto servicePath = \
                QStandardPaths::locate(QStandardPaths::ApplicationsLocation, \
                m_appdata.id());
-         QProcess::startDetached(QStringLiteral(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 \
                "/discover/runservice"), {servicePath});
-     } else {
-         QProcess::startDetached(exes.constFirst());
-     }
+     auto trans = PackageKit::Daemon::getFiles({installedPackageId()});
+     connect(trans, &PackageKit::Transaction::files, this, [this](const QString \
&/*packageID*/, const QStringList &filenames) { +         const auto allServices = \
QStandardPaths::locateAll(QStandardPaths::ApplicationsLocation, m_appdata.id()); +    \
if (!allServices.isEmpty()) { +             const auto packageServices = \
kFilter<QStringList>(allServices, [filenames](const QString &file) { return \
filenames.contains(file); }); +             \
QProcess::startDetached(QStringLiteral(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 \
"/discover/runservice"), {packageServices}); +         } 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()) { +                 \
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 }); +                 }
+             }
+             qWarning() << "Could not find any executables" << exes << filenames;
+         }
+     });
  }
  
 +QDate AppPackageKitResource::releaseDate() const
 +{
 +    if (!m_appdata.releases().isEmpty()) {
 +        auto release = m_appdata.releases().constFirst();
 +        return release.timestamp().date();
 +    }
 +
 +    return {};
 +}
diff --cc libdiscover/backends/SnapBackend/SnapResource.cpp
index df0fbe94,74bdc2f3..6272c734
--- a/libdiscover/backends/SnapBackend/SnapResource.cpp
+++ b/libdiscover/backends/SnapBackend/SnapResource.cpp
@@@ -24,56 -24,12 +24,56 @@@
  #include <QProcess>
  #include <QBuffer>
  #include <QImageReader>
- #include <QQmlComponent>
 +#include <QStandardItemModel>
 +#include <KLocalizedString>
 +#include <utils.h>
+ #include <QProcess>
  
 -SnapResource::SnapResource(QSharedPointer<QSnapdSnap> snap, AbstractResource::State \
                state, SnapBackend* parent)
 -    : AbstractResource(parent)
 +QDebug operator<<(QDebug debug, const QSnapdPlug& plug)
 +{
 +    QDebugStateSaver saver(debug);
 +    debug.nospace() << "QSnapdPlug(";
 +    debug.nospace() << "name:" << plug.name() << ',';
 +    debug.nospace() << "snap:" << plug.snap() << ',';
 +    debug.nospace() << "label:" << plug.label() << ',';
 +    debug.nospace() << "interface:" << plug.interface() << ',';
 +    debug.nospace() << "connectionCount:" << plug.connectionCount();
 +    debug.nospace() << ')';
 +    return debug;
 +}
 +
 +QDebug operator<<(QDebug debug, const QSnapdSlot& slot)
 +{
 +    QDebugStateSaver saver(debug);
 +    debug.nospace() << "QSnapdSlot(";
 +    debug.nospace() << "name:" << slot.name() << ',';
 +    debug.nospace() << "label:" << slot.label() << ',';
 +    debug.nospace() << "snap:" << slot.snap() << ',';
 +    debug.nospace() << "interface:" << slot.interface() << ',';
 +    debug.nospace() << "connectionCount:" << slot.connectionCount();
 +    debug.nospace() << ')';
 +    return debug;
 +}
 +
 +QDebug operator<<(QDebug debug, const QSnapdPlug* plug)
 +{
 +    QDebugStateSaver saver(debug);
 +    debug.nospace() << "*" << *plug;
 +    return debug;
 +}
 +
 +QDebug operator<<(QDebug debug, const QSnapdSlot* slot)
 +{
 +    QDebugStateSaver saver(debug);
 +    debug.nospace() << "*" << *slot;
 +    return debug;
 +}
 +
 +SnapResource::SnapResource(QSharedPointer<QSnapdSnap> snap, AbstractResource::State \
state, SnapBackend* backend)  +    : AbstractResource(backend)
      , m_state(state)
      , m_snap(snap)
 +    , m_objects({ QStringLiteral("qrc:/snapui/PermissionsButton.qml") })
  {
      setObjectName(snap->name());
  }


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

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