From cf7381d7fbff0c966b93b7c2df4cd748011689e2 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 6 Aug 2018 14:33:04 +0200 Subject: [PATCH] [Service Runner] Look up relative entryPaths For KCMs we get a relative entryPath() for our KService resulting in an invalid URL being created. CCBUG: 397070 Differential Revision: https://phabricator.kde.org/D14546 --- runners/services/servicerunner.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/runners/services/servicerunner.cpp b/runners/services/servicerunner.cpp index 3f99dee85..82da1e041 100644 --- a/runners/services/servicerunner.cpp +++ b/runners/services/servicerunner.cpp @@ -22,8 +22,10 @@ #include -#include #include +#include +#include +#include #include #include @@ -467,16 +469,22 @@ void ServiceRunner::run(const Plasma::RunnerContext &context, const Plasma::Quer QMimeData * ServiceRunner::mimeDataForMatch(const Plasma::QueryMatch &match) { KService::Ptr service = KService::serviceByStorageId(match.data().toString()); - if (service) { - QMimeData * result = new QMimeData(); - QList urls; - urls << QUrl::fromLocalFile(service->entryPath()); - qCDebug(RUNNER_SERVICES) << urls; - result->setUrls(urls); - return result; + if (!service) { + return nullptr; + } + + QString path = service->entryPath(); + if (!QDir::isAbsolutePath(path)) { + path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kservices5/") + path); + } + + if (path.isEmpty()) { + return nullptr; } - return 0; + QMimeData *data = new QMimeData(); + data->setUrls(QList{QUrl::fromLocalFile(path)}); + return data; } K_EXPORT_PLASMA_RUNNER(services, ServiceRunner)