Changeset View
Changeset View
Standalone View
Standalone View
libdiscover/backends/PackageKitBackend/LocalFilePKResource.cpp
Show All 20 Lines | |||||
21 | #include "LocalFilePKResource.h" | 21 | #include "LocalFilePKResource.h" | ||
22 | #include <QDebug> | 22 | #include <QDebug> | ||
23 | #include <QFileInfo> | 23 | #include <QFileInfo> | ||
24 | #include <QProcess> | 24 | #include <QProcess> | ||
25 | #include <PackageKit/Daemon> | 25 | #include <PackageKit/Daemon> | ||
26 | #include <PackageKit/Details> | 26 | #include <PackageKit/Details> | ||
27 | #include <utils.h> | 27 | #include <utils.h> | ||
28 | #include "config-paths.h" | 28 | #include "config-paths.h" | ||
29 | #include "libdiscover_backend_debug.h" | ||||
29 | 30 | | |||
30 | LocalFilePKResource::LocalFilePKResource(QUrl path, PackageKitBackend* parent) | 31 | LocalFilePKResource::LocalFilePKResource(QUrl path, PackageKitBackend* parent) | ||
31 | : PackageKitResource(path.toString(), path.toString(), parent) | 32 | : PackageKitResource(path.toString(), path.toString(), parent) | ||
32 | , m_path(std::move(path)) | 33 | , m_path(std::move(path)) | ||
33 | { | 34 | { | ||
34 | } | 35 | } | ||
35 | 36 | | |||
36 | int LocalFilePKResource::size() | 37 | int LocalFilePKResource::size() | ||
Show All 38 Lines | 66 | { | |||
75 | connect(transaction2, &PackageKit::Transaction::errorCode, this, &PackageKitResource::failedFetchingDetails); | 76 | connect(transaction2, &PackageKit::Transaction::errorCode, this, &PackageKitResource::failedFetchingDetails); | ||
76 | connect(transaction2, &PackageKit::Transaction::files, this, [this] (const QString &/*pkgid*/, const QStringList & files) { | 77 | connect(transaction2, &PackageKit::Transaction::files, this, [this] (const QString &/*pkgid*/, const QStringList & files) { | ||
77 | const auto execIdx = kIndexOf(files, [](const QString& file) { return file.endsWith(QLatin1String(".desktop")) && file.contains(QLatin1String("usr/share/applications")); }); | 78 | const auto execIdx = kIndexOf(files, [](const QString& file) { return file.endsWith(QLatin1String(".desktop")) && file.contains(QLatin1String("usr/share/applications")); }); | ||
78 | if (execIdx >= 0) | 79 | if (execIdx >= 0) | ||
79 | m_exec = files[execIdx]; | 80 | m_exec = files[execIdx]; | ||
80 | else | 81 | else | ||
81 | qWarning() << "could not find an executable desktop file for" << m_path << "among" << files; | 82 | qWarning() << "could not find an executable desktop file for" << m_path << "among" << files; | ||
82 | }); | 83 | }); | ||
83 | connect(transaction2, &PackageKit::Transaction::finished, this, [] {qDebug() << "."; }); | 84 | connect(transaction2, &PackageKit::Transaction::finished, this, [] {qCDebug(LIBDISCOVER_BACKEND_LOG) << "."; }); | ||
84 | } | 85 | } | ||
85 | 86 | | |||
86 | void LocalFilePKResource::invokeApplication() const | 87 | void LocalFilePKResource::invokeApplication() const | ||
87 | { | 88 | { | ||
88 | QProcess::startDetached(QStringLiteral(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/discover/runservice"), {m_exec}); | 89 | QProcess::startDetached(QStringLiteral(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/discover/runservice"), {m_exec}); | ||
89 | } | 90 | } |