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

Fix api

parent c33c1003
......@@ -13,7 +13,7 @@ kcoreaddons_add_plugin(kmail_markdownplugin JSON kmail_markdownplugin.json SOURC
${kmail_markdownplugin_SRCS} INSTALL_NAMESPACE kmail)
target_link_libraries(kmail_markdownplugin
KF5::IconThemes KF5::MessageComposer KF5::I18n
KF5::IconThemes KF5::MessageComposer KF5::I18n KF5::XmlGui
)
if(BUILD_TESTING)
......
......@@ -18,6 +18,9 @@
*/
#include "markdowninterface.h"
#include <KLocalizedString>
#include <QAction>
#include <KActionCollection>
MarkdownInterface::MarkdownInterface(QObject *parent)
: MessageComposer::PluginEditorConvertTextInterface(parent)
......@@ -29,3 +32,31 @@ MarkdownInterface::~MarkdownInterface()
{
}
void MarkdownInterface::createAction(KActionCollection *ac)
{
QAction *action = new QAction(i18n("Generate HTML from markdown."), this);
ac->addAction(QStringLiteral("generate_markdown"), action);
connect(action, &QAction::triggered, this, &MarkdownInterface::slotActivated);
MessageComposer::PluginActionType type(action, MessageComposer::PluginActionType::Edit);
setActionType(type);
}
bool MarkdownInterface::reformatText()
{
return false;
}
bool MarkdownInterface::convertTextToFormat(MessageComposer::TextPart *textPart)
{
return false;
}
void MarkdownInterface::reloadConfig()
{
}
void MarkdownInterface::slotActivated()
{
}
......@@ -22,13 +22,23 @@
#include <QObject>
#include <MessageComposer/PluginEditorConvertTextInterface>
class KActionCollection;
class MarkdownInterface : public MessageComposer::PluginEditorConvertTextInterface
{
Q_OBJECT
public:
explicit MarkdownInterface(QObject *parent = nullptr);
~MarkdownInterface();
~MarkdownInterface() override;
void createAction(KActionCollection *ac) override;
bool reformatText() override;
bool convertTextToFormat(MessageComposer::TextPart *textPart) override;
public Q_SLOTS:
void reloadConfig() override;
private:
void slotActivated();
};
#endif // MARKDOWNINTERFACE_H
......@@ -19,6 +19,7 @@
#include "markdownplugin.h"
#include "markdowninterface.h"
#include <KLocalizedString>
#include <kpluginfactory.h>
#include "kcoreaddons_kdepim_compat.h"
......@@ -37,10 +38,10 @@ MarkdownPlugin::~MarkdownPlugin()
}
MessageComposer::PluginEditorConverttextInterface *MarkdownPlugin::createInterface(QObject *parent)
MessageComposer::PluginEditorConvertTextInterface *MarkdownPlugin::createInterface(QObject *parent)
{
//TODO
return nullptr;
return new MarkdownInterface(parent);
}
......@@ -56,8 +57,7 @@ void MarkdownPlugin::showConfigureDialog(QWidget *parent)
QString MarkdownPlugin::description() const
{
//TODO
return {};
return i18n("Generate HTML from markdown language.");
}
#include "markdownplugin.moc"
......@@ -29,7 +29,7 @@ public:
explicit MarkdownPlugin(QObject *parent = nullptr, const QList<QVariant> & = {});
~MarkdownPlugin() override;
MessageComposer::PluginEditorConverttextInterface *createInterface(QObject *parent) override;
MessageComposer::PluginEditorConvertTextInterface *createInterface(QObject *parent) override;
bool hasConfigureDialog() const override;
void showConfigureDialog(QWidget *parent) override;
......
......@@ -29,7 +29,7 @@ class InsertSpecialCharacterPluginEditorInterface : public MessageComposer::Plug
Q_OBJECT
public:
explicit InsertSpecialCharacterPluginEditorInterface(QObject *parent = nullptr);
~InsertSpecialCharacterPluginEditorInterface();
~InsertSpecialCharacterPluginEditorInterface() override;
void createAction(KActionCollection *ac) override;
void exec() override;
......
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