Commit 8bc9c7f0 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Port away from KToolInvocation

It's about to be deprecated.
parent 7eee1f67
......@@ -15,7 +15,7 @@ include(FeatureSummary)
set(QT_MIN_VERSION "5.11.0")
# TODO: when bumping to 5.72+ drop FindTaglib.cmake
set(KF5_MIN_VERSION "5.66.0")
set(KF5_MIN_VERSION "5.69.0")
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS DBus Network Widgets Svg)
find_package(Qt5Test ${QT_MIN_VERSION} CONFIG QUIET)
......
......@@ -37,8 +37,8 @@
#include <kfileplacesmodel.h>
#include <solid/device.h>
#include <solid/deviceinterface.h>
#include <ktoolinvocation.h>
#include <QGuiApplication>
#include <KIO/ApplicationLauncherJob>
using namespace KIO;
......@@ -185,10 +185,22 @@ void BookmarksProtocol::get( const QUrl& url )
if (path.isEmpty() || path == "/") {
echoIndex();
} else if (path == "/config") {
KToolInvocation::startServiceByDesktopName("bookmarks", "");
const KService::Ptr bookmarksKCM = KService::serviceByDesktopName(QStringLiteral("bookmarks"));
if (bookmarksKCM) {
auto job = new KIO::ApplicationLauncherJob(bookmarksKCM);
job->start();
} else {
error(KIO::ERR_SLAVE_DEFINED, i18n("Could not find bookmarks config"));
}
echoHead("bookmarks:/");
} else if (path == "/editbookmarks") {
KToolInvocation::kdeinitExec("keditbookmarks");
const KService::Ptr keditbookmarks = KService::serviceByDesktopName(QStringLiteral("org.kde.keditbookmarks"));
if (keditbookmarks) {
auto job = new KIO::ApplicationLauncherJob(keditbookmarks);
job->start();
} else {
error(KIO::ERR_SLAVE_DEFINED, i18n("Could not find bookmarks editor"));
}
echoHead("bookmarks:/");
} else if (path.indexOf(regexp, 0, &rmatch) >= 0) {
echoImage(rmatch.captured(1), rmatch.captured(2), QUrlQuery(url).queryItemValue("size"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment