diff --git a/src/configuredialog/configureplugins/configurepluginslistwidget.cpp b/src/configuredialog/configureplugins/configurepluginslistwidget.cpp --- a/src/configuredialog/configureplugins/configurepluginslistwidget.cpp +++ b/src/configuredialog/configureplugins/configurepluginslistwidget.cpp @@ -131,6 +131,7 @@ for (PluginItem *item : qAsConst(mAgentPluginsItems)) { for (const PimCommon::PluginUtilData &data : qAsConst(mPluginUtilDataList)) { if (item->mIdentifier == data.mIdentifier) { + qCDebug(KMAIL_LOG) << "saving Akonadi Agent" << item->mIdentifier; changeAgentActiveState(data.mExtraInfo.at(0), data.mExtraInfo.at(1), item->checkState(0) == Qt::Checked); break; } @@ -248,7 +249,11 @@ service += QLatin1Char('.') + Akonadi::ServerManager::instanceIdentifier(); } for (const Akonadi::AgentType &type : lstAgent) { - if (type.identifier() == service) { + QString id = type.identifier(); + if (Akonadi::ServerManager::hasInstanceIdentifier()) { + id += QLatin1Char('.') + Akonadi::ServerManager::instanceIdentifier(); + } + if (id == service) { data.mExtraInfo << service; data.mExtraInfo << path; bool failed = false; @@ -266,7 +271,9 @@ bool ConfigurePluginsListWidget::agentActivateState(const QString &interfaceName, const QString &pathName, bool &failed) { failed = false; - QDBusInterface interface(QLatin1String("org.freedesktop.Akonadi.Agent.") + interfaceName, pathName); + const QString service = + Akonadi::ServerManager::agentServiceName(Akonadi::ServerManager::Agent, interfaceName); + QDBusInterface interface(service, pathName); if (interface.isValid()) { QDBusReply enabled = interface.call(QStringLiteral("enabledAgent")); if (enabled.isValid()) { @@ -278,7 +285,7 @@ } } else { failed = true; - qCDebug(KMAIL_LOG) << interfaceName << "does not exist "; + qCDebug(KMAIL_LOG) << interfaceName << "does not exist when trying to activate the agent state"; } return false; } @@ -286,11 +293,13 @@ void ConfigurePluginsListWidget::changeAgentActiveState(const QString &interfaceName, const QString &path, bool enable) { if (!interfaceName.isEmpty() && !path.isEmpty()) { - QDBusInterface interface(QLatin1String("org.freedesktop.Akonadi.Agent.") + interfaceName, path); + const QString service = + Akonadi::ServerManager::agentServiceName(Akonadi::ServerManager::Agent, interfaceName); + QDBusInterface interface(service, path); if (interface.isValid()) { interface.call(QStringLiteral("setEnableAgent"), enable); } else { - qCDebug(KMAIL_LOG) << interfaceName << "does not exist "; + qCDebug(KMAIL_LOG) << interfaceName << "does not exist when trying to change the agent active state"; } } } @@ -326,7 +335,7 @@ if (interface.isValid()) { interface.call(QStringLiteral("showConfigureDialog"), (qlonglong)winId()); } else { - qCDebug(KMAIL_LOG) << " interface does not exist "; + qCDebug(KMAIL_LOG) << " interface does not exist when trying to configure the plugin"; } break; }