Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit b089047a authored by Laurent Montel's avatar Laurent Montel 😁

Fix loading plugins

parent dbfaedd5
......@@ -27,9 +27,11 @@
#include <MessageComposer/PluginEditorConvertTextManager>
#include <MessageComposer/PluginEditorConvertText>
#include <WebEngineViewer/NetworkUrlInterceptorPluginManager>
#include <MessageComposer/PluginEditorGrammarManager>
#include <PimCommon/GenericPluginManager>
#include <AkonadiCore/ServerManager>
#include <PimCommon/PluginUtil>
#include <PimCommon/CustomToolsPlugin>
#include <KSharedConfig>
#include <KLocalizedString>
#include <MessageComposer/PluginEditorManager>
......@@ -52,6 +54,11 @@ QString pluginEditorGroupName()
return QStringLiteral("plugineditorgroupname");
}
QString pluginEditorGrammarGroupName()
{
return QStringLiteral("plugineditorgrammargroupname");
}
QString viewerPluginGroupName()
{
return QStringLiteral("viewerplugingroupname");
......@@ -117,6 +124,9 @@ void ConfigurePluginsListWidget::save()
PimCommon::ConfigurePluginsListWidget::savePlugins(MessageComposer::PluginEditorCheckBeforeSendManager::self()->configGroupName(),
MessageComposer::PluginEditorCheckBeforeSendManager::self()->configPrefixSettingKey(),
mPluginCheckBeforeSendItems);
PimCommon::ConfigurePluginsListWidget::savePlugins(MessageComposer::PluginEditorGrammarManager::self()->configGroupName(),
MessageComposer::PluginEditorGrammarManager::self()->configPrefixSettingKey(),
mPluginEditorGrammarItems);
PimCommon::ConfigurePluginsListWidget::savePlugins(KMailPluginInterface::self()->configGroupName(),
KMailPluginInterface::self()->configPrefixSettingKey(),
mPluginGenericItems);
......@@ -160,6 +170,7 @@ void ConfigurePluginsListWidget::doResetToDefaultsOther()
changeState(mAgentPluginsItems);
changeState(mPluginEditorInitItems);
changeState(mPluginConvertTextItems);
changeState(mPluginEditorGrammarItems);
}
void ConfigurePluginsListWidget::initialize()
......@@ -180,6 +191,12 @@ void ConfigurePluginsListWidget::initialize()
MessageComposer::PluginEditorInitManager::self()->configPrefixSettingKey(),
mPluginEditorInitItems,
pluginEditorInitGroupName());
PimCommon::ConfigurePluginsListWidget::fillTopItems(MessageComposer::PluginEditorGrammarManager::self()->pluginsDataList(),
i18n("Grammar Checker Plugins"),
MessageComposer::PluginEditorGrammarManager::self()->configGroupName(),
MessageComposer::PluginEditorGrammarManager::self()->configPrefixSettingKey(),
mPluginEditorGrammarItems,
pluginEditorGrammarGroupName());
//Load generic plugins
//Necessary to initialize pluging when we load it outside kmail
......@@ -190,7 +207,6 @@ void ConfigurePluginsListWidget::initialize()
KMailPluginInterface::self()->configPrefixSettingKey(),
mPluginGenericItems,
kmailPluginToolsGroupName());
//Load plugin editor
PimCommon::ConfigurePluginsListWidget::fillTopItems(MessageComposer::PluginEditorManager::self()->pluginsDataList(),
i18n("Editor Plugins"),
......@@ -334,6 +350,9 @@ void ConfigurePluginsListWidget::slotConfigureClicked(const QString &configureGr
} else if (configureGroupName == pluginEditorConvertTextGroupName()) {
MessageComposer::PluginEditorConvertText *plugin = MessageComposer::PluginEditorConvertTextManager::self()->pluginFromIdentifier(identifier);
plugin->showConfigureDialog(this);
} else if (configureGroupName == pluginEditorGrammarGroupName()) {
PimCommon::CustomToolsPlugin *plugin = MessageComposer::PluginEditorGrammarManager::self()->pluginFromIdentifier(identifier);
plugin->showConfigureDialog(this);
} else if (configureGroupName == agentAkonadiGroupName()) {
for (const PimCommon::PluginUtilData &data : qAsConst(mPluginUtilDataList)) {
if (data.mIdentifier == identifier) {
......
......@@ -45,6 +45,7 @@ private:
QList<PluginItem *> mPluginMessageViewerItems;
QList<PluginItem *> mPluginCheckBeforeSendItems;
QList<PluginItem *> mPluginEditorInitItems;
QList<PluginItem *> mPluginEditorGrammarItems;
QList<PluginItem *> mPluginGenericItems;
QList<PluginItem *> mPluginWebEngineItems;
QList<PluginItem *> mPluginHeaderStyleItems;
......
......@@ -1365,6 +1365,20 @@ void KMComposerWin::initializePluginActions()
hashActions.insert(actionlistname, lst);
}
}
const QList<KToggleAction *> customToolsWidgetActionList = mCustomToolsWidget->actionList();
qDebug() << " customToolsWidgetActionList " << customToolsWidgetActionList.count();
const QString actionlistname = QStringLiteral("kmaileditor") + MessageComposer::PluginActionType::actionXmlExtension(MessageComposer::PluginActionType::Tools);
for (KToggleAction * act : customToolsWidgetActionList) {
QList<QAction *> lst;
lst << act;
if (hashActions.contains(actionlistname)) {
lst = hashActions.value(actionlistname) + lst;
hashActions.remove(actionlistname);
}
hashActions.insert(actionlistname, lst);
}
QHash<QString, QList<QAction *> >::const_iterator i = hashActions.constBegin();
while (i != hashActions.constEnd()) {
......
......@@ -70,7 +70,7 @@ void KMailPluginGrammarEditorManagerInterface::setCustomToolsWidget(PimCommon::C
}
void KMailPluginGrammarEditorManagerInterface::initializePlugins()
{
{
if (mWasInitialized) {
qCDebug(KMAIL_LOG) << "KMailPluginGrammarEditorManagerInterface : Plugin was already initialized. This is a bug";
return;
......
<!DOCTYPE gui SYSTEM "kpartgui.dtd" >
<gui version="519" name="kmcomposer" translationDomain="kmail">
<gui version="520" name="kmcomposer" translationDomain="kmail">
<MenuBar>
<Menu noMerge="1" name="file" >
<text>&amp;Message</text>
......@@ -71,9 +71,6 @@
<Separator/>
<Action name="toggle_fixedfont" />
<Action name="snippets" />
<Separator/>
<Action name="translator" />
<Action name="shorten_url" />
</Menu>
<Menu name="attach" >
<text>&amp;Attach</text>
......
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