Commit b113d44b authored by Laurent Montel's avatar Laurent Montel 😁

Fix usage of KToolInvocation::startServiceByDesktopPath

parent 675f284d
......@@ -25,6 +25,7 @@
#include <KLocalizedString>
#include <QCommandLineParser>
#include <KToolInvocation>
#include <QStandardPaths>
int main(int argc, char **argv)
{
......@@ -46,6 +47,11 @@ int main(int argc, char **argv)
qDebug() << " Can not start kmail" << errmsg;
}
const QString desktopFile = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, QStringLiteral("org.kde.korganizer.desktop"));
if (KToolInvocation::startServiceByDesktopPath(desktopFile) > 0) {
qDebug() << " Can not start korganizer";
}
qDebug() << "kinvocation done.";
return 0;
......
......@@ -25,6 +25,7 @@
#include "koeventviewerdialog.h"
#include "korganizerinterface.h"
#include "korganizer_debug.h"
#include <CalendarSupport/Utils>
#include <CalendarSupport/IncidenceViewer>
......@@ -40,6 +41,7 @@
#include <QPushButton>
#include <KGuiItem>
#include <QVBoxLayout>
#include <QStandardPaths>
KOEventViewerDialog::KOEventViewerDialog(Akonadi::ETMCalendar *calendar, QWidget *parent)
: QDialog(parent)
......@@ -102,11 +104,15 @@ void KOEventViewerDialog::editIncidence()
if (CalendarSupport::hasIncidence(item)) {
// make sure korganizer is running or the part is shown
KToolInvocation::startServiceByDesktopPath(QStringLiteral("korganizer"));
OrgKdeKorganizerKorganizerInterface korganizerIface(
QStringLiteral("org.kde.korganizer"), QStringLiteral("/Korganizer"), QDBusConnection::sessionBus());
korganizerIface.editIncidence(QString::number(item.id()));
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;
}
}
}
......@@ -116,11 +122,15 @@ void KOEventViewerDialog::showIncidenceContext()
if (CalendarSupport::hasIncidence(item)) {
// make sure korganizer is running or the part is shown
KToolInvocation::startServiceByDesktopPath(QStringLiteral("korganizer"));
OrgKdeKorganizerKorganizerInterface korganizerIface(
QStringLiteral("org.kde.korganizer"), QStringLiteral("/Korganizer"), QDBusConnection::sessionBus());
korganizerIface.showIncidenceContext(QString::number(item.id()));
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;
}
}
}
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