Commit 675f284d authored by Laurent Montel's avatar Laurent Montel 😁

Fix Bug 366117 - korgac doesn't start korganizer on click as service name changed

Adapt patch from tkopecek@redhat.com and add test application.
Thanks
FIXED-IN: 5.3.0
BUG: 366117
parent e0c51512
......@@ -1395,7 +1395,7 @@ QString runKMail(bool minimise)
QString errmsg;
if (minimise && Private::startKMailMinimised())
return QString();
if (KToolInvocation::startServiceByDesktopName(QStringLiteral("kmail"), QString(), &errmsg))
if (KToolInvocation::startServiceByDesktopName(QStringLiteral("org.kde.kmail"), QString(), &errmsg))
{
qCCritical(KALARM_LOG) << "Couldn't start KMail (" << errmsg << ")";
return xi18nc("@info", "Unable to start <application>KMail</application><nl/>(<message>%1</message>)", errmsg);
......
......@@ -46,7 +46,7 @@ void FollowUpReminderShowMessageJob::start()
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kmailInterface)) {
// Program is not already running, so start it
QString errmsg;
if (KToolInvocation::startServiceByDesktopName(QStringLiteral("kmail2"), QString(), &errmsg)) {
if (KToolInvocation::startServiceByDesktopName(QStringLiteral("org.kde.kmail"), QString(), &errmsg)) {
qCDebug(FOLLOWUPREMINDERAGENT_LOG) << " Can not start kmail" << errmsg;
deleteLater();
return;
......
......@@ -16,3 +16,8 @@ target_link_libraries(dbustest KF5::KIOCore KF5::I18n Qt5::DBus)
set(searchdbustest_SRCS searchdbustest.cpp)
add_executable(searchdbustest ${searchdbustest_SRCS})
target_link_libraries(searchdbustest Qt5::DBus Qt5::Widgets KF5::PimCommon)
#####
set(ktoolinvocationtest_SRCS ktoolinvocationtest.cpp)
add_executable(ktoolinvocationtest ${ktoolinvocationtest_SRCS})
target_link_libraries(ktoolinvocationtest Qt5::DBus KF5::Service KF5::I18n)
/*
Copyright (C) 2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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 General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include <qdebug.h>
#include <QCoreApplication>
#include <KAboutData>
#include <KLocalizedString>
#include <QCommandLineParser>
#include <KToolInvocation>
int main(int argc, char **argv)
{
qDebug() << "Test kinvocation by desktop name.";
KAboutData aboutData(QStringLiteral("testKInvocation"), i18n("Test for KMail invocation"), QStringLiteral("0.0"));
QCoreApplication app(argc, argv);
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
aboutData.setupCommandLine(&parser);
parser.process(app);
aboutData.processCommandLine(&parser);
QString errmsg;
if (KToolInvocation::startServiceByDesktopName(QStringLiteral("org.kde.kmail"), QString(), &errmsg)) {
qDebug() << " Can not start kmail" << errmsg;
}
qDebug() << "kinvocation done.";
return 0;
}
......@@ -935,7 +935,7 @@ 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("korganizer"), QString())) {
if (KToolInvocation::startServiceByDesktopName(QStringLiteral("org.kde.korganizer"), QString())) {
KMessageBox::error(
this,
i18nc("@info",
......
......@@ -160,7 +160,7 @@ void AlarmDockWindow::enableAutostart(bool enable)
void AlarmDockWindow::activate(const QPoint &pos)
{
Q_UNUSED(pos);
KToolInvocation::startServiceByDesktopName(QStringLiteral("korganizer"), QString());
KToolInvocation::startServiceByDesktopName(QStringLiteral("org.kde.korganizer"), QString());
}
void AlarmDockWindow::slotQuit()
......
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