Commit 55a52768 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Fix Akonadi instance support

Use Akonadi::ServerManager to get agent's DBus service name to make sure
that the service name includes Akonadi instance, when present.
parent 200b25af
......@@ -20,6 +20,7 @@ target_link_libraries(KF5FollowupReminder
PRIVATE
KF5::ConfigGui
KF5::CoreAddons
KF5::AkonadiCore
Qt5::DBus
)
......
......@@ -19,13 +19,30 @@
#include "followupreminderutil.h"
#include "followupreminderinfo.h"
#include <AkonadiCore/ServerManager>
#include <QDBusInterface>
#include "followupreminderagentsettings.h"
namespace {
QString serviceName()
{
return Akonadi::ServerManager::agentServiceName(Akonadi::ServerManager::Agent,
QStringLiteral("akonadi_followupreminder_agent"));
}
QString dbusPath()
{
return QStringLiteral("/FollowUpReminder");
}
}
bool FollowUpReminder::FollowUpReminderUtil::followupReminderAgentWasRegistered()
{
QDBusInterface interface(QStringLiteral("org.freedesktop.Akonadi.Agent.akonadi_followupreminder_agent"), QStringLiteral("/FollowUpReminder"));
QDBusInterface interface(serviceName(), dbusPath());
return interface.isValid();
}
......@@ -36,7 +53,7 @@ bool FollowUpReminder::FollowUpReminderUtil::followupReminderAgentEnabled()
void FollowUpReminder::FollowUpReminderUtil::reload()
{
QDBusInterface interface(QStringLiteral("org.freedesktop.Akonadi.Agent.akonadi_followupreminder_agent"), QStringLiteral("/FollowUpReminder"));
QDBusInterface interface(serviceName(), dbusPath());
if (interface.isValid()) {
interface.call(QStringLiteral("reload"));
}
......
......@@ -27,6 +27,23 @@
#include <QDBusInterface>
#include <QStringList>
#include <AkonadiCore/ServerManager>
namespace {
QString serviceName()
{
return Akonadi::ServerManager::agentServiceName(Akonadi::ServerManager::Agent,
QStringLiteral("akonadi_sendlater_agent"));
}
QString dbusPath()
{
return QStringLiteral("/SendLaterAgent");
}
}
bool SendLater::SendLaterUtil::compareSendLaterInfo(SendLater::SendLaterInfo *left, SendLater::SendLaterInfo *right)
{
if (left->dateTime() == right->dateTime()) {
......@@ -104,7 +121,7 @@ void SendLater::SendLaterUtil::writeSendLaterInfo(KSharedConfig::Ptr config, Sen
bool SendLater::SendLaterUtil::sentLaterAgentWasRegistered()
{
QDBusInterface interface(QStringLiteral("org.freedesktop.Akonadi.Agent.akonadi_sendlater_agent"), QStringLiteral("/SendLaterAgent"));
QDBusInterface interface(serviceName(), dbusPath());
return interface.isValid();
}
......@@ -122,7 +139,7 @@ bool SendLater::SendLaterUtil::sentLaterAgentEnabled()
void SendLater::SendLaterUtil::reload()
{
qCDebug(LIBSENDLATER_LOG) << " void SendLater::SendLaterUtil::reload()";
QDBusInterface interface(QStringLiteral("org.freedesktop.Akonadi.Agent.akonadi_sendlater_agent"), QStringLiteral("/SendLaterAgent"));
QDBusInterface interface(serviceName(), dbusPath());
if (interface.isValid()) {
interface.call(QStringLiteral("reload"));
} else {
......
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