configurepluginslistwidget.cpp 20.8 KB
Newer Older
1
/*
Laurent Montel's avatar
Laurent Montel committed
2
  Copyright (C) 2016-2020 Laurent Montel <montel@kde.org>
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License, version 2, as
  published by the Free Software Foundation.

  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; if not, write to the Free Software Foundation, Inc.,
  51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/

#include "configurepluginslistwidget.h"
19

20
#include "kmail_debug.h"
Laurent Montel's avatar
Laurent Montel committed
21
#include "util.h"
22
#include "../../plugininterface/kmailplugininterface.h"
23
#include <MessageViewer/ViewerPluginManager>
24
#include <MessageViewer/HeaderStylePluginManager>
25
#include <MessageComposer/PluginEditorCheckBeforeSendManager>
Laurent Montel's avatar
Laurent Montel committed
26
#include <MessageComposer/PluginEditorInitManager>
Laurent Montel's avatar
Laurent Montel committed
27 28
#include <MessageComposer/PluginEditorConvertTextManager>
#include <MessageComposer/PluginEditorConvertText>
29
#include <WebEngineViewer/NetworkUrlInterceptorPluginManager>
Laurent Montel's avatar
Laurent Montel committed
30
#include <MessageComposer/PluginEditorGrammarManager>
Laurent Montel's avatar
Laurent Montel committed
31
#include <PimCommon/GenericPluginManager>
Laurent Montel's avatar
Laurent Montel committed
32
#include <AkonadiCore/ServerManager>
Laurent Montel's avatar
Laurent Montel committed
33
#include <PimCommon/PluginUtil>
Laurent Montel's avatar
Laurent Montel committed
34
#include <PimCommon/CustomToolsPlugin>
Laurent Montel's avatar
Laurent Montel committed
35
#include <KSharedConfig>
Laurent Montel's avatar
Laurent Montel committed
36
#include <KLocalizedString>
37
#include <MessageComposer/PluginEditorManager>
Laurent Montel's avatar
Laurent Montel committed
38

39 40
#include <QDBusInterface>
#include <QDBusReply>
Laurent Montel's avatar
Laurent Montel committed
41
#include <MessageComposer/PluginEditorInit>
42 43
#include <WebEngineViewer/NetworkPluginUrlInterceptor>
#include <MessageComposer/PluginEditorCheckBeforeSend>
Laurent Montel's avatar
Laurent Montel committed
44
#include <MessageViewer/MessageViewerConfigureSettingsPluginManager>
45
#include <MessageViewer/ViewerPlugin>
Laurent Montel's avatar
Laurent Montel committed
46
#include <PimCommon/GenericPlugin>
47
#include <MessageComposer/PluginEditor>
48
#include <MessageViewer/HeaderStylePlugin>
49
#include <AkonadiCore/AgentManager>
50
#include <AkonadiCore/AgentInstance>
Laurent Montel's avatar
Laurent Montel committed
51
#include <MessageViewer/MessageViewerConfigureSettingsPlugin>
Laurent Montel's avatar
Laurent Montel committed
52

Laurent Montel's avatar
Laurent Montel committed
53
namespace {
54 55 56 57
QString pluginEditorGroupName()
{
    return QStringLiteral("plugineditorgroupname");
}
Laurent Montel's avatar
Laurent Montel committed
58

Laurent Montel's avatar
Laurent Montel committed
59 60 61 62 63
QString pluginEditorGrammarGroupName()
{
    return QStringLiteral("plugineditorgrammargroupname");
}

64 65 66 67
QString viewerPluginGroupName()
{
    return QStringLiteral("viewerplugingroupname");
}
Laurent Montel's avatar
Laurent Montel committed
68

69 70 71 72 73
QString pluginEditorCheckBeforeGroupName()
{
    return QStringLiteral("plugineditorcheckbeforegroupname");
}

Laurent Montel's avatar
Laurent Montel committed
74 75 76 77 78
QString pluginEditorInitGroupName()
{
    return QStringLiteral("plugineditorinitgroupname");
}

Laurent Montel's avatar
Laurent Montel committed
79 80 81 82 83
QString pluginEditorConvertTextGroupName()
{
    return QStringLiteral("plugineditorconvertTextgroupname");
}

84 85 86 87
QString kmailPluginToolsGroupName()
{
    return QStringLiteral("kmailplugintoolsgroupname");
}
Laurent Montel's avatar
Laurent Montel committed
88

89 90 91 92
QString networkUrlInterceptorGroupName()
{
    return QStringLiteral("networkurlinterceptorgroupname");
}
Laurent Montel's avatar
Laurent Montel committed
93

94 95 96 97
QString headerStyleGroupName()
{
    return QStringLiteral("headerstylegroupname");
}
Laurent Montel's avatar
Laurent Montel committed
98

99 100 101 102
QString agentAkonadiGroupName()
{
    return QStringLiteral("agentakonadigroupname");
}
Laurent Montel's avatar
Laurent Montel committed
103

Laurent Montel's avatar
Laurent Montel committed
104 105 106 107
QString configurePluginGroupName()
{
    return QStringLiteral("configuregroupname");
}
108 109
}

110
ConfigurePluginsListWidget::ConfigurePluginsListWidget(QWidget *parent)
111
    : PimCommon::ConfigurePluginsListWidget(parent)
112
{
113
    connect(this, &ConfigurePluginsListWidget::configureClicked, this, &ConfigurePluginsListWidget::slotConfigureClicked);
114 115 116 117
}

ConfigurePluginsListWidget::~ConfigurePluginsListWidget()
{
118
}
119

120 121
void ConfigurePluginsListWidget::save()
{
122
    PimCommon::ConfigurePluginsListWidget::savePlugins(MessageComposer::PluginEditorManager::self()->configGroupName(),
Laurent Montel's avatar
Laurent Montel committed
123 124
                                                       MessageComposer::PluginEditorManager::self()->configPrefixSettingKey(),
                                                       mPluginEditorItems);
125
    PimCommon::ConfigurePluginsListWidget::savePlugins(MessageViewer::ViewerPluginManager::self()->configGroupName(),
Laurent Montel's avatar
Laurent Montel committed
126 127
                                                       MessageViewer::ViewerPluginManager::self()->configPrefixSettingKey(),
                                                       mPluginMessageViewerItems);
Laurent Montel's avatar
Laurent Montel committed
128
    PimCommon::ConfigurePluginsListWidget::savePlugins(MessageComposer::PluginEditorInitManager::self()->configGroupName(),
Laurent Montel's avatar
Laurent Montel committed
129 130
                                                       MessageComposer::PluginEditorInitManager::self()->configPrefixSettingKey(),
                                                       mPluginEditorInitItems);
131
    PimCommon::ConfigurePluginsListWidget::savePlugins(MessageComposer::PluginEditorCheckBeforeSendManager::self()->configGroupName(),
Laurent Montel's avatar
Laurent Montel committed
132 133
                                                       MessageComposer::PluginEditorCheckBeforeSendManager::self()->configPrefixSettingKey(),
                                                       mPluginCheckBeforeSendItems);
Laurent Montel's avatar
Laurent Montel committed
134 135 136
    PimCommon::ConfigurePluginsListWidget::savePlugins(MessageComposer::PluginEditorGrammarManager::self()->configGroupName(),
                                                       MessageComposer::PluginEditorGrammarManager::self()->configPrefixSettingKey(),
                                                       mPluginEditorGrammarItems);
137
    PimCommon::ConfigurePluginsListWidget::savePlugins(KMailPluginInterface::self()->configGroupName(),
Laurent Montel's avatar
Laurent Montel committed
138 139
                                                       KMailPluginInterface::self()->configPrefixSettingKey(),
                                                       mPluginGenericItems);
140
    PimCommon::ConfigurePluginsListWidget::savePlugins(WebEngineViewer::NetworkUrlInterceptorPluginManager::self()->configGroupName(),
Laurent Montel's avatar
Laurent Montel committed
141 142
                                                       WebEngineViewer::NetworkUrlInterceptorPluginManager::self()->configPrefixSettingKey(),
                                                       mPluginWebEngineItems);
143
    PimCommon::ConfigurePluginsListWidget::savePlugins(MessageViewer::HeaderStylePluginManager::self()->configGroupName(),
Laurent Montel's avatar
Laurent Montel committed
144 145
                                                       MessageViewer::HeaderStylePluginManager::self()->configPrefixSettingKey(),
                                                       mPluginHeaderStyleItems);
Laurent Montel's avatar
Laurent Montel committed
146 147 148
    PimCommon::ConfigurePluginsListWidget::savePlugins(MessageComposer::PluginEditorConvertTextManager::self()->configGroupName(),
                                                       MessageComposer::PluginEditorConvertTextManager::self()->configPrefixSettingKey(),
                                                       mPluginConvertTextItems);
149 150 151 152 153
    saveAkonadiAgent();
}

void ConfigurePluginsListWidget::saveAkonadiAgent()
{
Laurent Montel's avatar
Laurent Montel committed
154 155
    for (PluginItem *item : qAsConst(mAgentPluginsItems)) {
        for (const PimCommon::PluginUtilData &data : qAsConst(mPluginUtilDataList)) {
Laurent Montel's avatar
Laurent Montel committed
156 157 158 159 160 161
            if (item->mIdentifier == data.mIdentifier) {
                changeAgentActiveState(data.mExtraInfo.at(0), data.mExtraInfo.at(1), item->checkState(0) == Qt::Checked);
                break;
            }
        }
    }
Laurent Montel's avatar
Laurent Montel committed
162
}
163 164 165

void ConfigurePluginsListWidget::doLoadFromGlobalSettings()
{
Laurent Montel's avatar
Laurent Montel committed
166
    initialize();
167
    initializeDone();
168 169 170 171
}

void ConfigurePluginsListWidget::doResetToDefaultsOther()
{
Laurent Montel's avatar
Laurent Montel committed
172 173
    changeState(mPluginEditorItems);
    changeState(mPluginMessageViewerItems);
Laurent Montel's avatar
Laurent Montel committed
174
    changeState(mPluginCheckBeforeSendItems);
Laurent Montel's avatar
Laurent Montel committed
175 176 177
    changeState(mPluginGenericItems);
    changeState(mPluginWebEngineItems);
    changeState(mPluginHeaderStyleItems);
178
    changeState(mAgentPluginsItems);
Laurent Montel's avatar
Laurent Montel committed
179
    changeState(mPluginEditorInitItems);
Laurent Montel's avatar
Laurent Montel committed
180
    changeState(mPluginConvertTextItems);
Laurent Montel's avatar
Laurent Montel committed
181
    changeState(mPluginEditorGrammarItems);
182 183
}

184 185 186 187 188
void ConfigurePluginsListWidget::initialize()
{
    mListWidget->clear();

    //Load CheckBeforeSend
Laurent Montel's avatar
indent  
Laurent Montel committed
189
    PimCommon::ConfigurePluginsListWidget::fillTopItems(MessageComposer::PluginEditorCheckBeforeSendManager::self()->pluginsDataList(),
Laurent Montel's avatar
Laurent Montel committed
190 191 192 193 194
                                                        i18n("Check Before Send Plugins"),
                                                        MessageComposer::PluginEditorCheckBeforeSendManager::self()->configGroupName(),
                                                        MessageComposer::PluginEditorCheckBeforeSendManager::self()->configPrefixSettingKey(),
                                                        mPluginCheckBeforeSendItems,
                                                        pluginEditorCheckBeforeGroupName());
195

Laurent Montel's avatar
Laurent Montel committed
196
    PimCommon::ConfigurePluginsListWidget::fillTopItems(MessageComposer::PluginEditorInitManager::self()->pluginsDataList(),
Laurent Montel's avatar
Laurent Montel committed
197 198 199 200 201
                                                        i18n("Composer Plugins"),
                                                        MessageComposer::PluginEditorInitManager::self()->configGroupName(),
                                                        MessageComposer::PluginEditorInitManager::self()->configPrefixSettingKey(),
                                                        mPluginEditorInitItems,
                                                        pluginEditorInitGroupName());
Laurent Montel's avatar
Laurent Montel committed
202 203 204 205 206 207
    PimCommon::ConfigurePluginsListWidget::fillTopItems(MessageComposer::PluginEditorGrammarManager::self()->pluginsDataList(),
                                                        i18n("Grammar Checker Plugins"),
                                                        MessageComposer::PluginEditorGrammarManager::self()->configGroupName(),
                                                        MessageComposer::PluginEditorGrammarManager::self()->configPrefixSettingKey(),
                                                        mPluginEditorGrammarItems,
                                                        pluginEditorGrammarGroupName());
Laurent Montel's avatar
Laurent Montel committed
208

209
    //Load generic plugins
210
    //Necessary to initialize plugin when we load it outside kmail
Laurent Montel's avatar
Laurent Montel committed
211
    KMailPluginInterface::self()->initializePlugins();
Laurent Montel's avatar
indent  
Laurent Montel committed
212
    PimCommon::ConfigurePluginsListWidget::fillTopItems(KMailPluginInterface::self()->pluginsDataList(),
Laurent Montel's avatar
Laurent Montel committed
213 214 215 216 217
                                                        i18n("Tools Plugins"),
                                                        KMailPluginInterface::self()->configGroupName(),
                                                        KMailPluginInterface::self()->configPrefixSettingKey(),
                                                        mPluginGenericItems,
                                                        kmailPluginToolsGroupName());
218
    //Load plugin editor
Laurent Montel's avatar
indent  
Laurent Montel committed
219
    PimCommon::ConfigurePluginsListWidget::fillTopItems(MessageComposer::PluginEditorManager::self()->pluginsDataList(),
Laurent Montel's avatar
Laurent Montel committed
220 221 222 223 224
                                                        i18n("Editor Plugins"),
                                                        MessageComposer::PluginEditorManager::self()->configGroupName(),
                                                        MessageComposer::PluginEditorManager::self()->configPrefixSettingKey(),
                                                        mPluginEditorItems,
                                                        pluginEditorGroupName());
225

226
    //Load messageviewer plugin
Laurent Montel's avatar
indent  
Laurent Montel committed
227
    PimCommon::ConfigurePluginsListWidget::fillTopItems(MessageViewer::ViewerPluginManager::self()->pluginsDataList(),
Laurent Montel's avatar
Laurent Montel committed
228 229 230 231 232
                                                        i18n("Message Viewer"),
                                                        MessageViewer::ViewerPluginManager::self()->configGroupName(),
                                                        MessageViewer::ViewerPluginManager::self()->configPrefixSettingKey(),
                                                        mPluginMessageViewerItems,
                                                        viewerPluginGroupName());
233

234
    //Load webengineplugin
Laurent Montel's avatar
indent  
Laurent Montel committed
235
    PimCommon::ConfigurePluginsListWidget::fillTopItems(WebEngineViewer::NetworkUrlInterceptorPluginManager::self()->pluginsDataList(),
Laurent Montel's avatar
Laurent Montel committed
236 237 238 239 240
                                                        i18n("Webengine Plugins"),
                                                        WebEngineViewer::NetworkUrlInterceptorPluginManager::self()->configGroupName(),
                                                        WebEngineViewer::NetworkUrlInterceptorPluginManager::self()->configPrefixSettingKey(),
                                                        mPluginWebEngineItems,
                                                        networkUrlInterceptorGroupName());
241

242
    //Load headerstyle
Laurent Montel's avatar
indent  
Laurent Montel committed
243
    PimCommon::ConfigurePluginsListWidget::fillTopItems(MessageViewer::HeaderStylePluginManager::self()->pluginsDataList(),
Laurent Montel's avatar
Laurent Montel committed
244 245 246 247 248
                                                        i18n("Header Style Plugins"),
                                                        MessageViewer::HeaderStylePluginManager::self()->configGroupName(),
                                                        MessageViewer::HeaderStylePluginManager::self()->configPrefixSettingKey(),
                                                        mPluginHeaderStyleItems,
                                                        headerStyleGroupName());
Laurent Montel's avatar
Laurent Montel committed
249
    //Load Converter plugin
Laurent Montel's avatar
Laurent Montel committed
250
    PimCommon::ConfigurePluginsListWidget::fillTopItems(MessageComposer::PluginEditorConvertTextManager::self()->pluginsDataList(),
251
                                                        i18n("Text Conversion Plugins"),
Laurent Montel's avatar
Laurent Montel committed
252 253 254 255
                                                        MessageComposer::PluginEditorConvertTextManager::self()->configGroupName(),
                                                        MessageComposer::PluginEditorConvertTextManager::self()->configPrefixSettingKey(),
                                                        mPluginConvertTextItems,
                                                        pluginEditorConvertTextGroupName());
Laurent Montel's avatar
Laurent Montel committed
256

Laurent Montel's avatar
Laurent Montel committed
257 258 259 260 261 262 263
    PimCommon::ConfigurePluginsListWidget::fillTopItems(MessageViewer::MessageViewerConfigureSettingsPluginManager::self()->pluginsDataList(),
                                                        i18n("Misc"),
                                                        MessageViewer::MessageViewerConfigureSettingsPluginManager::self()->configGroupName(),
                                                        MessageViewer::MessageViewerConfigureSettingsPluginManager::self()->configPrefixSettingKey(),
                                                        mPluginConfigureItems,
                                                        configurePluginGroupName(), false);

264 265
    //Load Agent Plugin
    initializeAgentPlugins();
266
    mListWidget->expandAll();
267
}
268

269 270
void ConfigurePluginsListWidget::initializeAgentPlugins()
{
271
    mPluginUtilDataList.clear();
Laurent Montel's avatar
Laurent Montel committed
272
    mPluginUtilDataList.reserve(5);
273 274 275 276
    mPluginUtilDataList << createAgentPluginData(QStringLiteral("akonadi_sendlater_agent"), QStringLiteral("/SendLaterAgent"));
    mPluginUtilDataList << createAgentPluginData(QStringLiteral("akonadi_archivemail_agent"), QStringLiteral("/ArchiveMailAgent"));
    mPluginUtilDataList << createAgentPluginData(QStringLiteral("akonadi_newmailnotifier_agent"), QStringLiteral("/NewMailNotifierAgent"));
    mPluginUtilDataList << createAgentPluginData(QStringLiteral("akonadi_followupreminder_agent"), QStringLiteral("/FollowUpReminder"));
277
    mPluginUtilDataList << createAgentPluginData(QStringLiteral("akonadi_unifiedmailbox_agent"), QStringLiteral("/UnifiedMailboxAgent"));
278

279
    PimCommon::ConfigurePluginsListWidget::fillTopItems(mPluginUtilDataList,
Laurent Montel's avatar
Laurent Montel committed
280 281 282 283 284
                                                        i18n("Akonadi Agents"),
                                                        QString(),
                                                        QString(),
                                                        mAgentPluginsItems,
                                                        agentAkonadiGroupName());
285 286
}

287
PimCommon::PluginUtilData ConfigurePluginsListWidget::createAgentPluginData(const QString &agentIdentifier, const QString &path)
288 289 290 291
{
    PimCommon::PluginUtilData data;
    data.mEnableByDefault = true;
    data.mHasConfigureDialog = true;
Laurent Montel's avatar
Laurent Montel committed
292 293
    const Akonadi::AgentType::List lstAgent = Akonadi::AgentManager::self()->types();
    for (const Akonadi::AgentType &type : lstAgent) {
294 295
        if (type.identifier() == agentIdentifier) {
            data.mExtraInfo << agentIdentifier;
296
            data.mExtraInfo << path;
297
            const bool enabled = agentActivateState(agentIdentifier, path);
298 299 300 301
            data.mEnableByDefault = enabled;
            data.mName = type.name();
            data.mDescription = type.description();
            data.mIdentifier = type.identifier();
302 303 304 305 306 307
            break;
        }
    }
    return data;
}

308
bool ConfigurePluginsListWidget::agentActivateState(const QString &agentIdentifier, const QString &pathName)
309
{
Laurent Montel's avatar
Laurent Montel committed
310 311
    const QString service
        = Akonadi::ServerManager::agentServiceName(Akonadi::ServerManager::Agent, agentIdentifier);
312
    QDBusInterface interface(service, pathName);
313 314 315 316 317
    if (interface.isValid()) {
        QDBusReply<bool> enabled = interface.call(QStringLiteral("enabledAgent"));
        if (enabled.isValid()) {
            return enabled;
        } else {
318
            qCDebug(KMAIL_LOG) << agentIdentifier << "doesn't have enabledAgent function";
319 320 321
            return false;
        }
    } else {
322
        qCDebug(KMAIL_LOG) << agentIdentifier << "does not exist when trying to activate the agent state";
323 324 325 326
    }
    return false;
}

327
void ConfigurePluginsListWidget::changeAgentActiveState(const QString &agentIdentifier, const QString &path, bool enable)
328
{
329
    if (!agentIdentifier.isEmpty() && !path.isEmpty()) {
Laurent Montel's avatar
Laurent Montel committed
330 331
        const QString service
            = Akonadi::ServerManager::agentServiceName(Akonadi::ServerManager::Agent, agentIdentifier);
332
        QDBusInterface interface(service, path);
333 334 335
        if (interface.isValid()) {
            interface.call(QStringLiteral("setEnableAgent"), enable);
        } else {
336
            qCDebug(KMAIL_LOG) << agentIdentifier << "does not exist when trying to change the agent active state";
337 338 339 340
        }
    }
}

Laurent Montel's avatar
Laurent Montel committed
341
void ConfigurePluginsListWidget::slotConfigureClicked(const QString &groupName, const QString &identifier)
342
{
Laurent Montel's avatar
Laurent Montel committed
343 344
    if (!groupName.isEmpty() && !identifier.isEmpty()) {
        if (groupName == headerStyleGroupName()) {
345 346
            MessageViewer::HeaderStylePlugin *plugin = MessageViewer::HeaderStylePluginManager::self()->pluginFromIdentifier(identifier);
            plugin->showConfigureDialog(this);
Laurent Montel's avatar
Laurent Montel committed
347
        } else if (groupName == networkUrlInterceptorGroupName()) {
348 349
            WebEngineViewer::NetworkPluginUrlInterceptor *plugin = WebEngineViewer::NetworkUrlInterceptorPluginManager::self()->pluginFromIdentifier(identifier);
            plugin->showConfigureDialog(this);
Laurent Montel's avatar
Laurent Montel committed
350
        } else if (groupName == viewerPluginGroupName()) {
351 352
            MessageViewer::ViewerPlugin *plugin = MessageViewer::ViewerPluginManager::self()->pluginFromIdentifier(identifier);
            plugin->showConfigureDialog(this);
Laurent Montel's avatar
Laurent Montel committed
353
        } else if (groupName == pluginEditorGroupName()) {
354 355
            MessageComposer::PluginEditor *plugin = MessageComposer::PluginEditorManager::self()->pluginFromIdentifier(identifier);
            plugin->showConfigureDialog(this);
Laurent Montel's avatar
Laurent Montel committed
356
        } else if (groupName == kmailPluginToolsGroupName()) {
357 358
            PimCommon::GenericPlugin *plugin = KMailPluginInterface::self()->pluginFromIdentifier(identifier);
            plugin->showConfigureDialog(this);
Laurent Montel's avatar
Laurent Montel committed
359
        } else if (groupName == pluginEditorInitGroupName()) {
Laurent Montel's avatar
Laurent Montel committed
360 361
            MessageComposer::PluginEditorInit *plugin = MessageComposer::PluginEditorInitManager::self()->pluginFromIdentifier(identifier);
            plugin->showConfigureDialog(this);
Laurent Montel's avatar
Laurent Montel committed
362
        } else if (groupName == pluginEditorCheckBeforeGroupName()) {
363 364
            MessageComposer::PluginEditorCheckBeforeSend *plugin = MessageComposer::PluginEditorCheckBeforeSendManager::self()->pluginFromIdentifier(identifier);
            plugin->showConfigureDialog(this);
Laurent Montel's avatar
Laurent Montel committed
365
        } else if (groupName == pluginEditorConvertTextGroupName()) {
Laurent Montel's avatar
Laurent Montel committed
366 367
            MessageComposer::PluginEditorConvertText *plugin = MessageComposer::PluginEditorConvertTextManager::self()->pluginFromIdentifier(identifier);
            plugin->showConfigureDialog(this);
Laurent Montel's avatar
Laurent Montel committed
368
        } else if (groupName == pluginEditorGrammarGroupName()) {
Laurent Montel's avatar
Laurent Montel committed
369 370
            PimCommon::CustomToolsPlugin *plugin = MessageComposer::PluginEditorGrammarManager::self()->pluginFromIdentifier(identifier);
            plugin->showConfigureDialog(this);
Laurent Montel's avatar
Laurent Montel committed
371 372 373 374
        } else if (groupName == configurePluginGroupName()) {
            MessageViewer::MessageViewerConfigureSettingsPlugin *plugin = MessageViewer::MessageViewerConfigureSettingsPluginManager::self()->pluginFromIdentifier(identifier);
            plugin->showConfigureDialog(this);
        } else if (groupName == agentAkonadiGroupName()) {
Laurent Montel's avatar
Laurent Montel committed
375
            for (const PimCommon::PluginUtilData &data : qAsConst(mPluginUtilDataList)) {
Laurent Montel's avatar
Laurent Montel committed
376
                if (data.mIdentifier == identifier) {
377 378 379
                    auto instance = Akonadi::AgentManager::self()->instance(identifier);
                    if (instance.isValid()) {
                        instance.configure(this);
380 381 382 383
                    }
                    break;
                }
            }
384
        } else {
Laurent Montel's avatar
Laurent Montel committed
385
            qCWarning(KMAIL_LOG) << "Unknown configureGroupName" << groupName;
386
        }
Laurent Montel's avatar
Laurent Montel committed
387
    }
388
}
Laurent Montel's avatar
Laurent Montel committed
389 390 391

void ConfigurePluginsListWidget::defaults()
{
Laurent Montel's avatar
Laurent Montel committed
392
    doResetToDefaultsOther();
Laurent Montel's avatar
Laurent Montel committed
393
}