Commit 3ac76438 authored by Laurent Montel's avatar Laurent Montel 😁

Add new plugins

parent 60f8b6ee
set(kmail_changecaseeditorplugin_SRCS
changecaseplugineditor.cpp
changecaseplugineditorinterface.cpp
)
add_library(kmail_changecaseeditorplugin MODULE ${kmail_changecaseeditorplugin_SRCS})
target_link_libraries(kmail_changecaseeditorplugin
KF5::IconThemes KF5::MessageComposer KF5::XmlGui
)
install(TARGETS kmail_changecaseeditorplugin DESTINATION ${PLUGIN_INSTALL_DIR}/kmail)
if(BUILD_TESTING)
add_subdirectory(autotests)
endif()
macro(add_kmail_editorplugin_unittest _source _additional)
set( _test ${_source} ${_additional})
get_filename_component(_name ${_source} NAME_WE)
add_executable( ${_name} ${_test} )
add_test( ${_name} ${_name} )
ecm_mark_as_test(kmail_editorplugin-${_name})
target_link_libraries( ${_name} Qt5::Test KF5::XmlGui KF5::IconThemes KF5::MessageComposer)
endmacro ()
add_kmail_editorplugin_unittest(changecaseplugineditortest.cpp "../changecaseplugineditor.cpp;../changecaseplugineditorinterface.cpp")
add_kmail_editorplugin_unittest(changecaseplugineditorinterfacetest.cpp "../changecaseplugineditorinterface.cpp")
/*
Copyright (c) 2016 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, 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 "insertspecialcharacterplugineditorinterfacetest.h"
#include "../insertspecialcharacterplugineditorinterface.h"
#include <QTest>
InsertSpecialCharacterPluginEditorInterfaceTest::InsertSpecialCharacterPluginEditorInterfaceTest(QObject *parent)
: QObject(parent)
{
}
InsertSpecialCharacterPluginEditorInterfaceTest::~InsertSpecialCharacterPluginEditorInterfaceTest()
{
}
QTEST_MAIN(InsertSpecialCharacterPluginEditorInterfaceTest)
/*
Copyright (c) 2016 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, 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
*/
#ifndef InsertSpecialCharacterPLUGINEDITORINTERFACETEST_H
#define InsertSpecialCharacterPLUGINEDITORINTERFACETEST_H
#include <QObject>
class InsertSpecialCharacterPluginEditorInterfaceTest : public QObject
{
Q_OBJECT
public:
explicit InsertSpecialCharacterPluginEditorInterfaceTest(QObject *parent = Q_NULLPTR);
~InsertSpecialCharacterPluginEditorInterfaceTest();
};
#endif
/*
Copyright (c) 2016 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, 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 "insertspecialcharacterplugineditortest.h"
#include "../insertspecialcharacterplugineditor.h"
#include <KActionCollection>
#include <QTest>
InsertSpecialCharacterPluginEditorTest::InsertSpecialCharacterPluginEditorTest(QObject *parent)
: QObject(parent)
{
}
InsertSpecialCharacterPluginEditorTest::~InsertSpecialCharacterPluginEditorTest()
{
}
void InsertSpecialCharacterPluginEditorTest::shouldHaveDefaultValue()
{
InsertSpecialCharacterPluginEditor plugin;
QVERIFY(plugin.createInterface(new KActionCollection(this)));
}
QTEST_MAIN(InsertSpecialCharacterPluginEditorTest)
/*
Copyright (c) 2016 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, 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
*/
#ifndef InsertSpecialCharacterPLUGINEDITORTEST_H
#define InsertSpecialCharacterPLUGINEDITORTEST_H
#include <QObject>
class InsertSpecialCharacterPluginEditorTest : public QObject
{
Q_OBJECT
public:
explicit InsertSpecialCharacterPluginEditorTest(QObject *parent = Q_NULLPTR);
~InsertSpecialCharacterPluginEditorTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif
/*
Copyright (c) 2016 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, 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 "changecaseplugineditor.h"
#include "changecaseplugineditorinterface.h"
#include <KLocalizedString>
#include <kpluginfactory.h>
K_PLUGIN_FACTORY_WITH_JSON(changecasePluginEditorFactory, "kmail_changecaseeditorplugin.json", registerPlugin<changecasePluginEditor>();)
changecasePluginEditor::changecasePluginEditor(QObject *parent, const QList<QVariant> &)
: MessageComposer::PluginEditor(parent)
{
}
changecasePluginEditor::~changecasePluginEditor()
{
}
MessageComposer::PluginEditorInterface *changecasePluginEditor::createInterface(KActionCollection *ac, QObject *parent)
{
changecasePluginEditorInterface *interface = new changecasePluginEditorInterface(parent);
interface->createAction(ac);
return interface;
}
#include "changecaseplugineditor.moc"
/*
Copyright (c) 2016 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, 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
*/
#ifndef CHANGECASEPLUGINEDITOR_H
#define CHANGECASEPLUGINEDITOR_H
#include <messagecomposer/plugineditor.h>
#include <messagecomposer/plugineditorinterface.h>
#include <QVariant>
class changecasePluginEditor : public MessageComposer::PluginEditor
{
Q_OBJECT
public:
explicit changecasePluginEditor(QObject *parent = Q_NULLPTR, const QList<QVariant> & = QList<QVariant>());
~changecasePluginEditor();
MessageComposer::PluginEditorInterface *createInterface(KActionCollection *ac, QObject *parent = Q_NULLPTR) Q_DECL_OVERRIDE;
};
#endif
/*
Copyright (c) 2016 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, 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 "changecaseplugineditorinterface.h"
#include <KPIMTextEdit/RichTextEditor>
#include <KLocalizedString>
#include <KActionCollection>
#include <QAction>
changecasePluginEditorInterface::changecasePluginEditorInterface(QObject *parent)
: MessageComposer::PluginEditorInterface(parent)
{
}
changecasePluginEditorInterface::~changecasePluginEditorInterface()
{
}
void changecasePluginEditorInterface::createAction(KActionCollection *ac)
{
QAction *action = new QAction(i18n("Insert Special Character..."), this);
ac->addAction(QStringLiteral("insert_special_character"), action);
connect(action, &QAction::triggered, this, &changecasePluginEditorInterface::slotActivated);
MessageComposer::ActionType type(action, MessageComposer::ActionType::Edit);
setActionType(type);
}
void changecasePluginEditorInterface::slotActivated()
{
Q_EMIT emitPluginActivated(this);
}
void changecasePluginEditorInterface::exec()
{
}
/*
Copyright (c) 2016 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, 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
*/
#ifndef CHANGECASEPLUGINEDITORINTERFACE_H
#define CHANGECASEPLUGINEDITORINTERFACE_H
#include <messagecomposer/plugineditorinterface.h>
#include <QPointer>
class changecasePluginEditorInterface : public MessageComposer::PluginEditorInterface
{
Q_OBJECT
public:
explicit changecasePluginEditorInterface(QObject *parent = Q_NULLPTR);
~changecasePluginEditorInterface();
void createAction(KActionCollection *ac) Q_DECL_OVERRIDE;
void exec() Q_DECL_OVERRIDE;
private Q_SLOTS:
void slotActivated();
private:
};
#endif
{
"KPlugin": {
"Name": "Change Case",
"ServiceTypes": [
"KMailEditor/Plugin"
],
"Version": "1.0"
}
}
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