Commit 01afddb1 authored by Laurent Montel's avatar Laurent Montel 😁

Add support for multi instance

parent 0b55fdce
......@@ -25,6 +25,7 @@
#include <AgentInstance>
#include <AgentManager>
#include <AkonadiCore/ServerManager>
#include <kdbusconnectionpool.h>
#include <AkonadiCore/changerecorder.h>
#include <AkonadiCore/itemfetchscope.h>
......@@ -48,7 +49,12 @@ NotesAgent::NotesAgent(const QString &id)
mNotesManager = new NotesManager(this);
new NotesAgentAdaptor(this);
KDBusConnectionPool::threadConnection().registerObject(QStringLiteral("/NotesAgent"), this, QDBusConnection::ExportAdaptors);
KDBusConnectionPool::threadConnection().registerService(QStringLiteral("org.freedesktop.Akonadi.NotesAgent"));
QString service = QStringLiteral("org.freedesktop.Akonadi.NotesAgent");
if (Akonadi::ServerManager::hasInstanceIdentifier()) {
service += QLatin1Char('.') + Akonadi::ServerManager::instanceIdentifier();
}
KDBusConnectionPool::threadConnection().registerService(service);
setNeedsNetwork(true);
......
......@@ -18,6 +18,7 @@
*/
#include "knoteutils.h"
#include <AkonadiCore/ServerManager>
#include "attributes/notelockattribute.h"
#include "knotesglobalconfig.h"
......@@ -33,7 +34,11 @@
void KNoteUtils::updateConfiguration()
{
QDBusInterface interface(QStringLiteral("org.freedesktop.Akonadi.Agent.akonadi_notes_agent"), QStringLiteral("/NotesAgent"));
QString service = QStringLiteral("org.freedesktop.Akonadi.Agent.akonadi_notes_agent");
if (Akonadi::ServerManager::hasInstanceIdentifier()) {
service += QLatin1Char('.') + Akonadi::ServerManager::instanceIdentifier();
}
QDBusInterface interface(service, QStringLiteral("/NotesAgent"));
if (interface.isValid()) {
interface.call(QStringLiteral("configurationChanged"));
} 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