Commit 87605e14 authored by Laurent Montel's avatar Laurent Montel 😁

Add support for multi instance

parent bf2faaeb
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <itemfetchscope.h> #include <itemfetchscope.h>
#include <mailtransportakonadi/sentactionattribute.h> #include <mailtransportakonadi/sentactionattribute.h>
#include <mailtransportakonadi/sentbehaviourattribute.h> #include <mailtransportakonadi/sentbehaviourattribute.h>
#include <AkonadiCore/ServerManager>
#include <knotifyconfigwidget.h> #include <knotifyconfigwidget.h>
#include "maildispatcher_debug.h" #include "maildispatcher_debug.h"
...@@ -192,7 +193,12 @@ MailDispatcherAgent::MailDispatcherAgent(const QString &id) ...@@ -192,7 +193,12 @@ MailDispatcherAgent::MailDispatcherAgent(const QString &id)
KDBusConnectionPool::threadConnection().registerObject(QStringLiteral("/MailDispatcherAgent"), KDBusConnectionPool::threadConnection().registerObject(QStringLiteral("/MailDispatcherAgent"),
this, QDBusConnection::ExportAdaptors); this, QDBusConnection::ExportAdaptors);
KDBusConnectionPool::threadConnection().registerService(QStringLiteral("org.freedesktop.Akonadi.MailDispatcherAgent")); QString service = QStringLiteral("org.freedesktop.Akonadi.MailDispatcherAgent");
if (Akonadi::ServerManager::hasInstanceIdentifier()) {
service += QLatin1Char('.') + Akonadi::ServerManager::instanceIdentifier();
}
KDBusConnectionPool::threadConnection().registerService(service);
d->queue = new OutboxQueue(this); d->queue = new OutboxQueue(this);
connect(d->queue, SIGNAL(newItems()), connect(d->queue, SIGNAL(newItems()),
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <mailtransportakonadi/transportattribute.h> #include <mailtransportakonadi/transportattribute.h>
#include <mailtransport/transportjob.h> #include <mailtransport/transportjob.h>
#include <mailtransport/transportmanager.h> #include <mailtransport/transportmanager.h>
#include <AkonadiCore/ServerManager>
#include <QTimer> #include <QTimer>
#include <QtDBus/QDBusInterface> #include <QtDBus/QDBusInterface>
...@@ -321,8 +322,13 @@ bool SendJob::Private::filterItem(int filterset) ...@@ -321,8 +322,13 @@ bool SendJob::Private::filterItem(int filterset)
Q_ASSERT(mailfilterInterface == nullptr); Q_ASSERT(mailfilterInterface == nullptr);
// TODO: create on stack // TODO: create on stack
QString service = QStringLiteral("org.freedesktop.Akonadi.MailFilterAgent");
if (Akonadi::ServerManager::hasInstanceIdentifier()) {
service += QLatin1Char('.') + Akonadi::ServerManager::instanceIdentifier();
}
mailfilterInterface = new QDBusInterface( mailfilterInterface = new QDBusInterface(
QStringLiteral("org.freedesktop.Akonadi.MailFilterAgent"), service,
QStringLiteral("/MailFilterAgent"), QStringLiteral("org.freedesktop.Akonadi.MailFilterAgent"), QStringLiteral("/MailFilterAgent"), QStringLiteral("org.freedesktop.Akonadi.MailFilterAgent"),
KDBusConnectionPool::threadConnection(), q); KDBusConnectionPool::threadConnection(), q);
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "newmailnotifieragentsettings.h" #include "newmailnotifieragentsettings.h"
#include "newmailnotifiersettingsdialog.h" #include "newmailnotifiersettingsdialog.h"
#include <AkonadiCore/ServerManager>
#include <KIdentityManagement/IdentityManager> #include <KIdentityManagement/IdentityManager>
#include <kdbusconnectionpool.h> #include <kdbusconnectionpool.h>
...@@ -77,7 +78,12 @@ NewMailNotifierAgent::NewMailNotifierAgent(const QString &id) ...@@ -77,7 +78,12 @@ NewMailNotifierAgent::NewMailNotifierAgent(const QString &id)
KDBusConnectionPool::threadConnection().registerObject(QStringLiteral("/NewMailNotifierAgent"), KDBusConnectionPool::threadConnection().registerObject(QStringLiteral("/NewMailNotifierAgent"),
this, QDBusConnection::ExportAdaptors); this, QDBusConnection::ExportAdaptors);
KDBusConnectionPool::threadConnection().registerService(QStringLiteral("org.freedesktop.Akonadi.NewMailNotifierAgent"));
QString service = QStringLiteral("org.freedesktop.Akonadi.NewMailNotifierAgent");
if (Akonadi::ServerManager::hasInstanceIdentifier()) {
service += QLatin1Char('.') + Akonadi::ServerManager::instanceIdentifier();
}
KDBusConnectionPool::threadConnection().registerService(service);
connect(Akonadi::AgentManager::self(), &Akonadi::AgentManager::instanceStatusChanged, this, &NewMailNotifierAgent::slotInstanceStatusChanged); connect(Akonadi::AgentManager::self(), &Akonadi::AgentManager::instanceStatusChanged, this, &NewMailNotifierAgent::slotInstanceStatusChanged);
connect(Akonadi::AgentManager::self(), &Akonadi::AgentManager::instanceRemoved, this, &NewMailNotifierAgent::slotInstanceRemoved); connect(Akonadi::AgentManager::self(), &Akonadi::AgentManager::instanceRemoved, this, &NewMailNotifierAgent::slotInstanceRemoved);
......
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