diff -Nru krunner-5.37.0/autotests/CMakeLists.txt krunner-5.38.0/autotests/CMakeLists.txt --- krunner-5.37.0/autotests/CMakeLists.txt 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/autotests/CMakeLists.txt 2017-09-03 08:13:37.000000000 +0000 @@ -6,3 +6,16 @@ runnercontexttest.cpp LINK_LIBRARIES Qt5::Test KF5::KIOCore KF5Runner ) + +ecm_add_tests( + dbusrunnertest.cpp + LINK_LIBRARIES Qt5::Test KF5::KIOCore KF5Runner Qt5::Widgets +) + +set(demoapp_SRCS testremoterunner.cpp) +qt5_add_dbus_adaptor(demoapp_SRCS "../src/data/org.kde.krunner1.xml" testremoterunner.h TestRemoteRunner) +add_executable(testremoterunner ${demoapp_SRCS}) +target_link_libraries(testremoterunner + Qt5::DBus + KF5::Runner +) diff -Nru krunner-5.37.0/autotests/dbusrunnertest.cpp krunner-5.38.0/autotests/dbusrunnertest.cpp --- krunner-5.37.0/autotests/dbusrunnertest.cpp 1970-01-01 00:00:00.000000000 +0000 +++ krunner-5.38.0/autotests/dbusrunnertest.cpp 2017-09-03 08:13:37.000000000 +0000 @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2017 David Edmundson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License version 2 as + * published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include +#include +#include + +#include "runnermanager.h" +#include +#include +#include + +#include + +using namespace Plasma; + +Q_DECLARE_METATYPE(Plasma::QueryMatch); +Q_DECLARE_METATYPE(QList); + +class DBusRunnerTest : public QObject +{ + Q_OBJECT +public: + DBusRunnerTest(); + ~DBusRunnerTest(); + +private Q_SLOTS: + void initTestCase(); + void testMatch(); +private: + QProcess *m_process; +}; + +DBusRunnerTest::DBusRunnerTest() + : QObject(), + m_process(new QProcess(this)) +{ + m_process->start(QFINDTESTDATA("testremoterunner")); + QVERIFY(m_process->waitForStarted()); + qRegisterMetaType >(); +} + +DBusRunnerTest::~DBusRunnerTest() +{ + m_process->kill(); + m_process->waitForFinished(); +} + +void DBusRunnerTest::initTestCase() +{ + QStandardPaths::setTestModeEnabled(true); + QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)).mkpath("kservices5"); + const QString fakeServicePath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kservices5/dbusrunnertest.desktop"); + QFile::copy(QFINDTESTDATA("dbusrunnertest.desktop"), fakeServicePath); + KSycoca::self()->ensureCacheValid(); +} + +void DBusRunnerTest::testMatch() +{ + RunnerManager m; + auto s = KService::serviceByDesktopPath("dbusrunnertest.desktop"); + QVERIFY(s); + m.loadRunner(s); + m.launchQuery("foo"); + + QSignalSpy spy(&m, &RunnerManager::matchesChanged); + QVERIFY(spy.wait()); + + //verify matches + QCOMPARE(m.matches().count(), 1); + auto result = m.matches().first(); + + //see testremoterunner.cpp + QCOMPARE(result.id(), QStringLiteral("dbusrunnertest_id1")); //note the runner name is prepended + QCOMPARE(result.text(), QStringLiteral("Match 1")); + QCOMPARE(result.iconName(), QStringLiteral("icon1")); + QCOMPARE(result.type(), Plasma::QueryMatch::ExactMatch); + //relevance can't be compared easily becuase RunnerContext meddles with it + + //verify actions + auto actions = m.actionsForMatch(result); + QCOMPARE(actions.count(), 1); + auto action = actions.first(); + + QCOMPARE(action->text(), QStringLiteral("Action 1")); + + QSignalSpy processSpy(m_process, &QProcess::readyRead); + m.run(result); + processSpy.wait(); + QCOMPARE(m_process->readAllStandardOutput().trimmed(), QByteArray("Running:id1:")); + + result.setSelectedAction(action); + m.run(result); + processSpy.wait(); + QCOMPARE(m_process->readAllStandardOutput().trimmed(), QByteArray("Running:id1:action1")); +} + + + +QTEST_MAIN(DBusRunnerTest) + + +#include "dbusrunnertest.moc" diff -Nru krunner-5.37.0/autotests/dbusrunnertest.desktop krunner-5.38.0/autotests/dbusrunnertest.desktop --- krunner-5.37.0/autotests/dbusrunnertest.desktop 1970-01-01 00:00:00.000000000 +0000 +++ krunner-5.38.0/autotests/dbusrunnertest.desktop 2017-09-03 08:13:37.000000000 +0000 @@ -0,0 +1,15 @@ +[Desktop Entry] +Name=DBus runner test +Comment=DBus runner test +X-KDE-ServiceTypes=Plasma/Runner +Type=Service +Icon=internet-web-browser +X-KDE-PluginInfo-Author=Some Developer +X-KDE-PluginInfo-Email=kde@example.com +X-KDE-PluginInfo-Name=dbusrunnertest +X-KDE-PluginInfo-Version=1.0 +X-KDE-PluginInfo-License=LGPL +X-KDE-PluginInfo-EnabledByDefault=true +X-Plasma-API=DBus +X-Plasma-DBusRunner-Service=net.dave +X-Plasma-DBusRunner-Path=/dave diff -Nru krunner-5.37.0/autotests/testremoterunner.cpp krunner-5.38.0/autotests/testremoterunner.cpp --- krunner-5.37.0/autotests/testremoterunner.cpp 1970-01-01 00:00:00.000000000 +0000 +++ krunner-5.38.0/autotests/testremoterunner.cpp 2017-09-03 08:13:37.000000000 +0000 @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2017 David Edmundson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License version 2 as + * published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include +#include + +#include + +#include "testremoterunner.h" +#include "krunner1adaptor.h" + +//Test DBus runner, if the search term contains "foo" it returns a match, otherwise nothing +//Run prints a line to stdout + +TestRemoteRunner::TestRemoteRunner() +{ + new Krunner1Adaptor(this); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + QDBusConnection::sessionBus().registerService("net.dave"); + QDBusConnection::sessionBus().registerObject("/dave", this); +} + +RemoteMatches TestRemoteRunner::Match(const QString& searchTerm) +{ + RemoteMatches ms; + if (searchTerm.contains("foo")) { + RemoteMatch m; + m.id = "id1"; + m.text = "Match 1"; + m.iconName = "icon1"; + m.type = Plasma::QueryMatch::ExactMatch; + m.relevance = 0.8; + ms << m; + } + return ms; + +} + +RemoteActions TestRemoteRunner::Actions() +{ + RemoteAction action; + action.id = "action1"; + action.text = "Action 1"; + action.iconName = "document-browser"; + + return RemoteActions({action}); +} + +void TestRemoteRunner::Run(const QString &id, const QString &actionId) +{ + std::cout << "Running:" << qPrintable(id) << ":" << qPrintable(actionId) << std::endl; + std::cout.flush(); +} + +int main(int argc, char ** argv) +{ + QCoreApplication app(argc, argv); + TestRemoteRunner r; + app.exec(); +} + +#include "testremoterunner.moc" diff -Nru krunner-5.37.0/autotests/testremoterunner.h krunner-5.38.0/autotests/testremoterunner.h --- krunner-5.37.0/autotests/testremoterunner.h 1970-01-01 00:00:00.000000000 +0000 +++ krunner-5.38.0/autotests/testremoterunner.h 2017-09-03 08:13:37.000000000 +0000 @@ -0,0 +1,16 @@ +#pragma once + +#include +#include "../src/dbusutils_p.h" + +class TestRemoteRunner : public QObject +{ + Q_OBJECT +public: + TestRemoteRunner(); + +public Q_SLOTS: + RemoteActions Actions(); + RemoteMatches Match(const QString &searchTerm); + void Run(const QString &id, const QString &actionId); +}; diff -Nru krunner-5.37.0/CMakeLists.txt krunner-5.38.0/CMakeLists.txt --- krunner-5.37.0/CMakeLists.txt 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/CMakeLists.txt 2017-09-03 08:13:37.000000000 +0000 @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.0) -set(KF5_VERSION "5.37.0") # handled by release scripts -set(KF5_DEP_VERSION "5.37.0") # handled by release scripts +set(KF5_VERSION "5.38.0") # handled by release scripts +set(KF5_DEP_VERSION "5.38.0") # handled by release scripts project(KRunner VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.37.0 NO_MODULE) +find_package(ECM 5.38.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) diff -Nru krunner-5.37.0/debian/changelog krunner-5.38.0/debian/changelog --- krunner-5.37.0/debian/changelog 2017-08-12 17:47:52.000000000 +0000 +++ krunner-5.38.0/debian/changelog 2017-09-11 12:16:55.000000000 +0000 @@ -1,3 +1,9 @@ +krunner (5.38.0-0ubuntu1) artful; urgency=low + + * New upstream release (5.38.0) + + -- Rik Mills Mon, 11 Sep 2017 13:16:55 +0100 + krunner (5.37.0-0ubuntu1) artful; urgency=low * New upstream release (5.37.0) diff -Nru krunner-5.37.0/debian/control krunner-5.38.0/debian/control --- krunner-5.37.0/debian/control 2017-08-12 17:47:52.000000000 +0000 +++ krunner-5.38.0/debian/control 2017-09-11 12:16:55.000000000 +0000 @@ -5,15 +5,15 @@ Uploaders: Maximiliano Curia Build-Depends: cmake (>= 2.8.12), debhelper (>= 9), - extra-cmake-modules (>= 5.37.0~), - libkf5config-dev (>= 5.37.0~), - libkf5coreaddons-dev (>= 5.37.0~), - libkf5i18n-dev (>= 5.37.0~), - libkf5kio-dev (>= 5.37.0~), - libkf5plasma-dev (>= 5.37.0~), - libkf5service-dev (>= 5.37.0~), - libkf5solid-dev (>= 5.37.0~), - libkf5threadweaver-dev (>= 5.37.0~), + extra-cmake-modules (>= 5.38.0~), + libkf5config-dev (>= 5.38.0~), + libkf5coreaddons-dev (>= 5.38.0~), + libkf5i18n-dev (>= 5.38.0~), + libkf5kio-dev (>= 5.38.0~), + libkf5plasma-dev (>= 5.38.0~), + libkf5service-dev (>= 5.38.0~), + libkf5solid-dev (>= 5.38.0~), + libkf5threadweaver-dev (>= 5.38.0~), pkg-kde-tools (>= 0.15.15ubuntu1~), qtbase5-dev (>= 5.6.1~), qtdeclarative5-dev (>= 5.6.1~), @@ -27,7 +27,7 @@ Package: libkf5runner-dev Architecture: any Section: libdevel -Depends: libkf5plasma-dev (>= 5.37.0~), +Depends: libkf5plasma-dev (>= 5.38.0~), libkf5runner5 (= ${binary:Version}), qtbase5-dev (>= 5.6.1~), ${misc:Depends} diff -Nru krunner-5.37.0/debian/libkf5runner-dev.install krunner-5.38.0/debian/libkf5runner-dev.install --- krunner-5.37.0/debian/libkf5runner-dev.install 2017-08-12 17:47:52.000000000 +0000 +++ krunner-5.38.0/debian/libkf5runner-dev.install 2017-09-11 12:16:55.000000000 +0000 @@ -3,4 +3,5 @@ usr/lib/*/cmake/KF5Runner/ usr/lib/*/libKF5Runner.so usr/lib/*/qt5/mkspecs/modules/qt_KRunner.pri +usr/share/dbus-1/interfaces/kf5_org.kde.krunner1.xml usr/share/kdevappwizard/templates/runner.tar.bz2 diff -Nru krunner-5.37.0/examples/runner/plasma-runner-example-homefiles.desktop krunner-5.38.0/examples/runner/plasma-runner-example-homefiles.desktop --- krunner-5.37.0/examples/runner/plasma-runner-example-homefiles.desktop 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/examples/runner/plasma-runner-example-homefiles.desktop 2017-09-03 08:13:37.000000000 +0000 @@ -12,6 +12,7 @@ Name[en_GB]=Home Files Name[es]=Archivos personales Name[et]=Kodu failid +Name[eu]=Etxeko fitxategiak Name[fi]=Kodin tiedostot Name[fr]=Fichiers personnels Name[gd]=Faidhlichean dachaigh @@ -56,6 +57,7 @@ Comment[en_GB]=Part of a tutorial demonstrating how to create Runner plugins Comment[es]=Parte de un tutorial que demuestra cómo crear complementos de Runner Comment[et]=Õppematerjal käivitamispluginate loomise kohta +Comment[eu]=Runner pluginak nola sortu erakusten duen tutorial baten zatia Comment[fi]=Osa tutoriaalia, joka näyttää, miten suoritusohjelmaliitännäisiä tehdään Comment[fr]=Éléments d'un tutoriel montrant comment créer des modules « Runner » Comment[gd]=Seo pàirt dhe dh'oideachadh gus sealltainn dhut mar a chruthaicheas tu plugan Runner diff -Nru krunner-5.37.0/po/gl/plasma_runner_example_homefiles.po krunner-5.38.0/po/gl/plasma_runner_example_homefiles.po --- krunner-5.37.0/po/gl/plasma_runner_example_homefiles.po 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/po/gl/plasma_runner_example_homefiles.po 2017-09-03 08:13:37.000000000 +0000 @@ -2,25 +2,26 @@ # This file is distributed under the same license as the PACKAGE package. # # Marce Villarino , 2014. +# Adrián Chaves (Gallaecio) , 2017. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2016-11-19 20:12+0100\n" -"PO-Revision-Date: 2014-05-12 23:23+0200\n" -"Last-Translator: Marce Villarino \n" +"PO-Revision-Date: 2017-08-13 09:20+0100\n" +"Last-Translator: Adrián Chaves (Gallaecio) \n" "Language-Team: Galician \n" "Language: gl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Lokalize 1.5\n" +"X-Generator: Lokalize 2.0\n" #: homefilesrunner.cpp:71 #, kde-format msgid "Finds files matching :q: in the %1 folder" -msgstr "Busca ficheiros que casen con :q: no cartafol %1" +msgstr "Atopa ficheiros que casen con :q: no cartafol %1" #: homefilesrunner.cpp:116 #, kde-format diff -Nru krunner-5.37.0/po/zh_CN/plasma_runner_example_homefiles.po krunner-5.38.0/po/zh_CN/plasma_runner_example_homefiles.po --- krunner-5.37.0/po/zh_CN/plasma_runner_example_homefiles.po 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/po/zh_CN/plasma_runner_example_homefiles.po 2017-09-03 08:13:37.000000000 +0000 @@ -3,7 +3,7 @@ "Project-Id-Version: kdeorg\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2016-11-19 20:12+0100\n" -"PO-Revision-Date: 2017-08-05 09:29-0400\n" +"PO-Revision-Date: 2017-08-31 05:10-0400\n" "Last-Translator: guoyunhebrave \n" "Language-Team: Chinese Simplified\n" "Language: zh_CN\n" diff -Nru krunner-5.37.0/src/abstractrunner.cpp krunner-5.38.0/src/abstractrunner.cpp --- krunner-5.37.0/src/abstractrunner.cpp 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/src/abstractrunner.cpp 2017-09-03 08:13:37.000000000 +0000 @@ -19,7 +19,7 @@ #include "abstractrunner.h" -#include +#include #include #include #include @@ -201,8 +201,12 @@ QMimeData *AbstractRunner::mimeDataForMatch(const QueryMatch &match) { - Q_UNUSED(match) - return nullptr; + if (match.urls().isEmpty()) { + return nullptr; + } + QMimeData *result = new QMimeData(); + result->setUrls(match.urls()); + return result; } bool AbstractRunner::hasRunOptions() diff -Nru krunner-5.37.0/src/CMakeLists.txt krunner-5.38.0/src/CMakeLists.txt --- krunner-5.37.0/src/CMakeLists.txt 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/src/CMakeLists.txt 2017-09-03 08:13:37.000000000 +0000 @@ -1,13 +1,19 @@ add_subdirectory(declarative) -add_library(KF5Runner +set (KF5Runner_SRCS abstractrunner.cpp + dbusrunner.cpp runnerjobs.cpp querymatch.cpp runnercontext.cpp runnermanager.cpp runnersyntax.cpp krunner_debug.cpp) +set_property(SOURCE "data/org.kde.krunner1.xml" PROPERTY INCLUDE dbusutils_p.h) +qt5_add_dbus_interface(KF5Runner_SRCS "data/org.kde.krunner1.xml" krunner_iface) + +add_library(KF5Runner + ${KF5Runner_SRCS}) generate_export_header(KF5Runner BASE_NAME KRunner) add_library(KF5::Runner ALIAS KF5Runner) @@ -21,6 +27,7 @@ Qt5::Core KF5::Plasma # Must be public because abstractrunner.h needs plasma/version.h PRIVATE + Qt5::DBus Qt5::Gui Qt5::Widgets KF5::ConfigCore @@ -96,3 +103,8 @@ ecm_generate_pri_file(BASE_NAME KRunner LIB_NAME KF5Runner DEPS "core" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KF5_INCLUDE_INSTALL_DIR}/KRunner) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) + +install(FILES + "data/org.kde.krunner1.xml" + DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR} + RENAME kf5_org.kde.krunner1.xml) diff -Nru krunner-5.37.0/src/data/org.kde.krunner1.xml krunner-5.38.0/src/data/org.kde.krunner1.xml --- krunner-5.37.0/src/data/org.kde.krunner1.xml 1970-01-01 00:00:00.000000000 +0000 +++ krunner-5.38.0/src/data/org.kde.krunner1.xml 2017-09-03 08:13:37.000000000 +0000 @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru krunner-5.37.0/src/data/servicetypes/plasma-runner.desktop krunner-5.38.0/src/data/servicetypes/plasma-runner.desktop --- krunner-5.37.0/src/data/servicetypes/plasma-runner.desktop 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/src/data/servicetypes/plasma-runner.desktop 2017-09-03 08:13:37.000000000 +0000 @@ -15,6 +15,7 @@ Comment[en_GB]=KRunner plugin Comment[es]=Complemento para KRunner Comment[et]=KRunneri plugin +Comment[eu]=KRunner plugina Comment[fi]=KRunner-liitännäinen Comment[fr]=Module externe de KRunner Comment[gd]=Plugan KRunner @@ -58,3 +59,11 @@ [PropertyDef::X-Plasma-Args] Type=QStringList +[PropertyDef::X-Plasma-Api] +Type=QString + +[PropertyDef::X-Plasma-DBusRunner-Service] +Type=QString + +[PropertyDef::X-Plasma-DBusRunner-Path] +Type=QString diff -Nru krunner-5.37.0/src/dbusrunner.cpp krunner-5.38.0/src/dbusrunner.cpp --- krunner-5.37.0/src/dbusrunner.cpp 1970-01-01 00:00:00.000000000 +0000 +++ krunner-5.38.0/src/dbusrunner.cpp 2017-09-03 08:13:37.000000000 +0000 @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2017 David Edmundson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License version 2 as + * published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "dbusrunner_p.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "krunner_debug.h" +#include "krunner_iface.h" + +DBusRunner::DBusRunner(const KService::Ptr service, QObject *parent) + : Plasma::AbstractRunner(service, parent) +{ + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + + QString serviceName = service->property("X-Plasma-DBusRunner-Service").toString(); + QString path = service->property("X-Plasma-DBusRunner-Path").toString(); + + if (serviceName.isEmpty() || path.isEmpty()) { + qCWarning(KRUNNER) << "Invalid entry:" << service->name(); + return; + } + + m_interface = new OrgKdeKrunner1Interface(serviceName, path, QDBusConnection::sessionBus(), this); + + connect(this, &AbstractRunner::prepare, this, &DBusRunner::requestActions); +} + +DBusRunner::~DBusRunner() = default; + +void DBusRunner::requestActions() +{ + auto reply = m_interface->Actions(); + auto watcher = new QDBusPendingCallWatcher(reply); + connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, watcher]() { + watcher->deleteLater(); + clearActions(); + QDBusReply reply = *watcher; + if (!reply.isValid()) { + return; + } + for(const RemoteAction &action: reply.value()) { + auto a = addAction(action.id, QIcon::fromTheme(action.iconName), action.text); + a->setData(action.id); + } + }); +} + +void DBusRunner::match(Plasma::RunnerContext &context) +{ + if (!m_interface) { + return; + } + + auto reply = m_interface->Match(context.query()); + reply.waitForFinished(); //AbstractRunner::match is called in a new thread, may as well block + if (reply.isError()) { + qCDebug(KRUNNER) << "Error calling" << m_interface->service() << " :" << reply.error().name() << reply.error().message(); + return; + } + for(const RemoteMatch &match: reply.value()) { + Plasma::QueryMatch m(this); + + m.setText(match.text); + m.setData(match.id); + m.setIconName(match.iconName); + m.setType(match.type); + m.setRelevance(match.relevance); + + //split is essential items are as native DBus types, optional extras are in the property map (which is obviously a lot slower to parse) + m.setUrls(QUrl::fromStringList(match.properties.value("urls").toStringList())); + m.setMatchCategory(match.properties.value("category").toString()); + m.setSubtext(match.properties.value("subtext").toString()); + + context.addMatch(m); + } +} + +QList DBusRunner::actionsForMatch(const Plasma::QueryMatch &match) +{ + Q_UNUSED(match) + return actions().values(); +} + +void DBusRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) +{ + Q_UNUSED(context); + if (!m_interface) { + return; + } + + QString actionId; + QString matchId = match.data().toString(); + + if (match.selectedAction()) { + actionId = match.selectedAction()->data().toString(); + } + + m_interface->Run(matchId, actionId); //don't wait for reply before returning to process +} diff -Nru krunner-5.37.0/src/dbusrunner_p.h krunner-5.38.0/src/dbusrunner_p.h --- krunner-5.37.0/src/dbusrunner_p.h 1970-01-01 00:00:00.000000000 +0000 +++ krunner-5.38.0/src/dbusrunner_p.h 2017-09-03 08:13:37.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2017 David Edmundson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License version 2 as + * published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#pragma once + +#include + +#include "dbusutils_p.h" +class OrgKdeKrunner1Interface; + +class DBusRunner : public Plasma::AbstractRunner +{ + Q_OBJECT + +public: + explicit DBusRunner(const KService::Ptr service, QObject *parent = nullptr); + ~DBusRunner() override; + + void match(Plasma::RunnerContext &context) override; + void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &action) override; + QList actionsForMatch(const Plasma::QueryMatch &match) override; + +private: + void requestActions(); + void setActions(const RemoteActions &remoteActions); + OrgKdeKrunner1Interface *m_interface = nullptr; +}; diff -Nru krunner-5.37.0/src/dbusutils_p.h krunner-5.38.0/src/dbusutils_p.h --- krunner-5.37.0/src/dbusutils_p.h 1970-01-01 00:00:00.000000000 +0000 +++ krunner-5.38.0/src/dbusutils_p.h 2017-09-03 08:13:37.000000000 +0000 @@ -0,0 +1,81 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct RemoteMatch +{ + //sssuda{sv} + QString id; + QString text; + QString iconName; + Plasma::QueryMatch::Type type = Plasma::QueryMatch::NoMatch; + qreal relevance = 0; + QVariantMap properties; +}; + +typedef QList RemoteMatches; + +struct RemoteAction +{ + QString id; + QString text; + QString iconName; +}; + +typedef QList RemoteActions; + +inline QDBusArgument &operator<< (QDBusArgument &argument, const RemoteMatch &match) { + argument.beginStructure(); + argument << match.id; + argument << match.text; + argument << match.iconName; + argument << match.type; + argument << match.relevance; + argument << match.properties; + argument.endStructure(); + return argument; +} + +inline const QDBusArgument &operator>>(const QDBusArgument &argument, RemoteMatch &match) { + argument.beginStructure(); + argument >> match.id; + argument >> match.text; + argument >> match.iconName; + uint type; + argument >> type; + match.type = (Plasma::QueryMatch::Type)type; + argument >> match.relevance; + argument >> match.properties; + argument.endStructure(); + + return argument; +} + +inline QDBusArgument &operator<< (QDBusArgument &argument, const RemoteAction &action) +{ + argument.beginStructure(); + argument << action.id; + argument << action.text; + argument << action.iconName; + argument.endStructure(); + return argument; +} + +inline const QDBusArgument &operator>>(const QDBusArgument &argument, RemoteAction &action) { + argument.beginStructure(); + argument >> action.id; + argument >> action.text; + argument >> action.iconName; + argument.endStructure(); + return argument; +} + +Q_DECLARE_METATYPE(RemoteMatch); +Q_DECLARE_METATYPE(RemoteMatches); +Q_DECLARE_METATYPE(RemoteAction); +Q_DECLARE_METATYPE(RemoteActions); + diff -Nru krunner-5.37.0/src/querymatch.cpp krunner-5.38.0/src/querymatch.cpp --- krunner-5.37.0/src/querymatch.cpp 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/src/querymatch.cpp 2017-09-03 08:13:37.000000000 +0000 @@ -19,7 +19,7 @@ #include "querymatch.h" -#include +#include #include #include #include diff -Nru krunner-5.37.0/src/querymatch.h krunner-5.38.0/src/querymatch.h --- krunner-5.37.0/src/querymatch.h 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/src/querymatch.h 2017-09-03 08:13:37.000000000 +0000 @@ -74,7 +74,7 @@ * * @param runner the runner this match belongs to */ - explicit QueryMatch(AbstractRunner *runner); + explicit QueryMatch(AbstractRunner *runner = nullptr); /** * Copy constructor @@ -180,7 +180,7 @@ void setId(const QString &id); /** - * @ruetnr a string that can be used as an ID for this match, + * @return a string that can be used as an ID for this match, * even between different queries. It is based in part * on the source of the match (the AbstractRunner) and * distinguishing information provided by the runner, diff -Nru krunner-5.37.0/src/runnermanager.cpp krunner-5.38.0/src/runnermanager.cpp --- krunner-5.37.0/src/runnermanager.cpp 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/src/runnermanager.cpp 2017-09-03 08:13:37.000000000 +0000 @@ -39,6 +39,7 @@ #include #include +#include "dbusrunner_p.h" #include "runnerjobs_p.h" #include "plasma/pluginloader.h" #include @@ -312,6 +313,8 @@ #endif } } + } else if (api == QLatin1String("DBus")){ + runner = new DBusRunner(service, q); } else { //qCDebug(KRUNNER) << "got a script runner known as" << api; runner = new AbstractRunner(service, q); diff -Nru krunner-5.37.0/templates/runner/%{APPNAMELC}.desktop krunner-5.38.0/templates/runner/%{APPNAMELC}.desktop --- krunner-5.37.0/templates/runner/%{APPNAMELC}.desktop 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/templates/runner/%{APPNAMELC}.desktop 2017-09-03 08:13:37.000000000 +0000 @@ -11,6 +11,7 @@ Name[en_GB]=%{APPNAME} Name[es]=%{APPNAME} Name[et]=%{APPNAME} +Name[eu]=%{APPNAME} Name[fi]=%{APPNAME} Name[fr]=%{APPNAME} Name[gd]=%{APPNAME} @@ -50,6 +51,7 @@ Comment[en_GB]=%{APPNAME} runner Comment[es]=Lanzador de %{APPNAME} Comment[et]=%{APPNAME} käivitaja +Comment[eu]=%{APPNAME} runner Comment[fi]=%{APPNAME}-suoritusohjelma Comment[fr]=Runner %{APPNAME} Comment[gd]=Ruithear %{APPNAME} diff -Nru krunner-5.37.0/templates/runner/runner.kdevtemplate krunner-5.38.0/templates/runner/runner.kdevtemplate --- krunner-5.37.0/templates/runner/runner.kdevtemplate 2017-08-06 18:09:44.000000000 +0000 +++ krunner-5.38.0/templates/runner/runner.kdevtemplate 2017-09-03 08:13:37.000000000 +0000 @@ -11,6 +11,7 @@ Name[el]=C++ Name[en_GB]=C++ Name[es]=C++ +Name[eu]=C++ Name[fi]=C++ Name[fr]=C++ Name[gl]=C++ @@ -45,6 +46,7 @@ Comment[el]=Plasma Runner Template. Ένα πρότυπο εκτελεστή plasma Comment[en_GB]=Plasma Runner Template. A plasma runner template Comment[es]=Plantilla para Plasma Runner. Una plantilla para Plasma Runner. +Comment[eu]=Plasma Runner txantiloia. Plasma runner txantiloi bat Comment[fi]=Plasma-suoritusohjelmamalli. Comment[fr]=Modèle de runner Plasma. Comment[gl]=Modelo de executor de Plasma. Un modelo de executor de Plasma.