Commit 5783d76c authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Port away from deprecated KToolInvokation::startServiceByDesktopPath

In once place port it to KIO::ApplicationLauncher.

In other places we don't actually need something at all given we can just rely on DBus-activation. We loose the error logging though.
parent 817bbad3
Pipeline #30805 passed with stage
in 20 minutes and 42 seconds
......@@ -73,6 +73,7 @@ target_link_libraries(korgac
KF5::IconThemes
KF5::Service
KF5::KIOCore
KF5::KIOGui
KF5::WindowSystem
)
......
......@@ -37,7 +37,6 @@
#include <KMessageBox>
#include <KNotification>
#include <KSharedConfig>
#include <KToolInvocation>
#include <KWindowSystem>
#include <QDialogButtonBox>
......@@ -1045,17 +1044,6 @@ void AlarmDialog::keyPressEvent(QKeyEvent *e)
bool AlarmDialog::openIncidenceEditorThroughKOrganizer(const Incidence::Ptr &incidence)
{
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral(
"org.kde.korganizer"))) {
if (KToolInvocation::startServiceByDesktopName(QStringLiteral("org.kde.korganizer"),
QString())) {
KMessageBox::error(
this,
i18nc("@info",
"Could not start KOrganizer so editing is not possible."));
return false;
}
}
org::kde::korganizer::Korganizer korganizer(
QStringLiteral("org.kde.korganizer"), QStringLiteral(
"/Korganizer"), QDBusConnection::sessionBus());
......
......@@ -16,8 +16,8 @@
#include <KIconLoader>
#include <KLocalizedString>
#include <KMessageBox>
#include <KToolInvocation>
#include <KSharedConfig>
#include <KIO/ApplicationLauncherJob>
#include <QMenu>
#include "koalarmclient_debug.h"
......@@ -167,7 +167,9 @@ void AlarmDockWindow::enableAutostart(bool enable)
void AlarmDockWindow::activate(const QPoint &pos)
{
Q_UNUSED(pos);
KToolInvocation::startServiceByDesktopName(QStringLiteral("org.kde.korganizer"), QString());
const KService::Ptr korga = KService::serviceByDesktopName(QStringLiteral("org.kde.korganizer"));
auto job = new KIO::ApplicationLauncherJob(korga);
job->start();
}
void AlarmDockWindow::slotQuit()
......
......@@ -18,7 +18,6 @@
#include <AkonadiCore/Item>
#include <KLocalizedString>
#include <KToolInvocation>
#include <QIcon>
#include <QDialogButtonBox>
#include <QPushButton>
......@@ -86,18 +85,12 @@ void KOEventViewerDialog::editIncidence()
const Akonadi::Item item = mEventViewer->item();
if (CalendarSupport::hasIncidence(item)) {
// make sure korganizer is running or the part is shown
const QString desktopFile = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, QStringLiteral(
"org.kde.korganizer.desktop"));
QString error;
if (KToolInvocation::startServiceByDesktopPath(desktopFile, QStringList(), &error) == 0) {
OrgKdeKorganizerKorganizerInterface korganizerIface(
QStringLiteral("org.kde.korganizer"), QStringLiteral(
"/Korganizer"), QDBusConnection::sessionBus());
korganizerIface.editIncidence(QString::number(item.id()));
} else {
qCWarning(KORGANIZER_LOG) << "Failure starting korganizer:" << error;
}
OrgKdeKorganizerKorganizerInterface korganizerIface(
QStringLiteral("org.kde.korganizer"),
QStringLiteral("/Korganizer"),
QDBusConnection::sessionBus());
korganizerIface.editIncidence(QString::number(item.id()));
}
}
......@@ -107,16 +100,12 @@ void KOEventViewerDialog::showIncidenceContext()
if (CalendarSupport::hasIncidence(item)) {
// make sure korganizer is running or the part is shown
const QString desktopFile = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, QStringLiteral(
"org.kde.korganizer.desktop"));
QString error;
if (KToolInvocation::startServiceByDesktopPath(desktopFile, QStringList(), &error) == 0) {
OrgKdeKorganizerKorganizerInterface korganizerIface(
QStringLiteral("org.kde.korganizer"), QStringLiteral(
"/Korganizer"), QDBusConnection::sessionBus());
korganizerIface.showIncidenceContext(QString::number(item.id()));
} else {
qCWarning(KORGANIZER_LOG) << "Failure starting korganizer:" << error;
}
OrgKdeKorganizerKorganizerInterface korganizerIface(
QStringLiteral("org.kde.korganizer"),
QStringLiteral("/Korganizer"),
QDBusConnection::sessionBus());
korganizerIface.showIncidenceContext(QString::number(item.id()));
}
}
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