Commit 197686be authored by Laurent Montel's avatar Laurent Montel 😁

Look at to create external composer plugin

parent 64c206a9
set(kmail_externalcomposereditorplugin_SRCS
externalcomposerplugineditor.cpp
externalcomposerplugineditorinterface.cpp
)
kcoreaddons_add_plugin(kmail_externalcomposereditorplugin JSON kmail_externalcomposereditorplugin.json SOURCES
${kmail_externalcomposereditorplugin_SRCS} INSTALL_NAMESPACE kmail)
target_link_libraries(kmail_externalcomposereditorplugin
KF5::IconThemes KF5::MessageComposer KF5::XmlGui KF5::I18n
)
#if(BUILD_TESTING)
# add_subdirectory(autotests)
#endif()
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "externalcomposerplugineditor.h"
#include "externalcomposerplugineditorinterface.h"
#include <kpluginfactory.h>
K_PLUGIN_FACTORY_WITH_JSON(ExternalComposerPluginEditorFactory, "kmail_externalcomposereditorplugin.json", registerPlugin<ExternalComposerPluginEditor>();
)
ExternalComposerPluginEditor::ExternalComposerPluginEditor(QObject *parent, const QList<QVariant> &)
: MessageComposer::PluginEditor(parent)
{
}
ExternalComposerPluginEditor::~ExternalComposerPluginEditor()
{
}
MessageComposer::PluginEditorInterface *ExternalComposerPluginEditor::createInterface(KActionCollection *ac, QObject *parent)
{
ExternalComposerPluginEditorInterface *interface = new ExternalComposerPluginEditorInterface(parent);
interface->createAction(ac);
return interface;
}
#include "externalcomposerplugineditor.moc"
/*
Copyright (C) 2016-2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef INSERTSPECIALCHARACTERPLUGINEDITOR_H
#define INSERTSPECIALCHARACTERPLUGINEDITOR_H
#include <messagecomposer/plugineditor.h>
#include <messagecomposer/plugineditorinterface.h>
#include <QVariant>
class InsertSpecialCharacterPluginEditor : public MessageComposer::PluginEditor
{
Q_OBJECT
public:
explicit InsertSpecialCharacterPluginEditor(QObject *parent = nullptr, const QList<QVariant> & = QList<QVariant>());
~InsertSpecialCharacterPluginEditor();
MessageComposer::PluginEditorInterface *createInterface(KActionCollection *ac, QObject *parent = nullptr) Q_DECL_OVERRIDE;
};
#endif
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "externalcomposerplugineditorinterface.h"
#include <KPIMTextEdit/RichTextEditor>
#include <KLocalizedString>
#include <KActionCollection>
#include <QAction>
ExternalComposerPluginEditorInterface::ExternalComposerPluginEditorInterface(QObject *parent)
: MessageComposer::PluginEditorInterface(parent)
{
}
ExternalComposerPluginEditorInterface::~ExternalComposerPluginEditorInterface()
{
}
void ExternalComposerPluginEditorInterface::createAction(KActionCollection *ac)
{
}
void ExternalComposerPluginEditorInterface::slotActivated()
{
Q_EMIT emitPluginActivated(this);
}
void ExternalComposerPluginEditorInterface::exec()
{
}
void ExternalComposerPluginEditorInterface::charSelected(QChar c)
{
}
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef EXTERNALCOMPOSERPLUGINEDITORINTERFACE_H
#define EXTERNALCOMPOSERPLUGINEDITORINTERFACE_H
#include <messagecomposer/plugineditorinterface.h>
#include <QPointer>
class ExternalComposerPluginEditorInterface : public MessageComposer::PluginEditorInterface
{
Q_OBJECT
public:
explicit ExternalComposerPluginEditorInterface(QObject *parent = nullptr);
~ExternalComposerPluginEditorInterface();
void createAction(KActionCollection *ac) Q_DECL_OVERRIDE;
void exec() Q_DECL_OVERRIDE;
};
#endif
{
"KPlugin": {
"Description": "This plugin allows you to use an external composer.",
"EnabledByDefault": "false",
"Id": "kmailexternalcomposer",
"Name": "Open external composer",
"ServiceTypes": [
"KMailEditor/Plugin"
],
"Version": "1.0"
},
"X-KDE-KMailEditor-Order": "2"
}
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