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

Start to create this plugin

parent d1ce5c8a
set(kmail_expertplugin_SRCS
expertplugin.cpp
expertplugininterface.cpp
)
kcoreaddons_add_plugin(kmail_expertplugin JSON kmail_expertplugin.json SOURCES
${kmail_expertplugin_SRCS} INSTALL_NAMESPACE kmail)
target_link_libraries(kmail_expertplugin
KF5::PimCommon KF5::IconThemes KF5::PimCommonAkonadi KF5::XmlGui KF5::Libkdepim 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 "expertplugin.h"
#include "expertplugininterface.h"
#include <kpluginfactory.h>
K_PLUGIN_FACTORY_WITH_JSON(KMailExpertPluginFactory, "kmail_expertplugin.json", registerPlugin<ExpertPlugin>();
)
ExpertPlugin::ExpertPlugin(QObject *parent, const QList<QVariant> &)
: PimCommon::GenericPlugin(parent)
{
}
ExpertPlugin::~ExpertPlugin()
{
}
PimCommon::GenericPluginInterface *ExpertPlugin::createInterface(KActionCollection *ac, QObject *parent)
{
ExpertPluginInterface *interface = new ExpertPluginInterface(parent);
interface->createAction(ac);
return interface;
}
#include "expertplugin.moc"
/*
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 EXPERTPLUGIN_H
#define EXPERTPLUGIN_H
#include <pimcommon/genericplugin.h>
#include <PimCommonAkonadi/GenericPluginInterface>
#include <QVariant>
class ExpertPlugin : public PimCommon::GenericPlugin
{
Q_OBJECT
public:
explicit ExpertPlugin(QObject *parent = nullptr, const QList<QVariant> & = QList<QVariant>());
~ExpertPlugin();
PimCommon::GenericPluginInterface *createInterface(KActionCollection *ac, QObject *parent = nullptr) override;
};
#endif // EXPERTPLUGIN_H
/*
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 "expertplugininterface.h"
#include <KLocalizedString>
#include <KActionCollection>
#include <QAction>
ExpertPluginInterface::ExpertPluginInterface(QObject *parent)
: PimCommon::GenericPluginInterface(parent)
{
}
ExpertPluginInterface::~ExpertPluginInterface()
{
}
void ExpertPluginInterface::createAction(KActionCollection *ac)
{
/*
QAction *action = new QAction(i18n("&Log Activities..."), this);
ac->addAction(QStringLiteral("logactivities"), action);
connect(action, &QAction::triggered, this, &ExpertPluginInterface::slotActivated);
PimCommon::ActionType type(action, PimCommon::ActionType::Tools);
addActionType(type);
*/
}
void ExpertPluginInterface::slotActivated()
{
Q_EMIT emitPluginActivated(this);
}
void ExpertPluginInterface::exec()
{
}
/*
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 EXPERTPLUGININTERFACE_H
#define EXPERTPLUGININTERFACE_H
#include <PimCommonAkonadi/GenericPluginInterface>
class ExpertPluginInterface : public PimCommon::GenericPluginInterface
{
public:
explicit ExpertPluginInterface(QObject *parent = nullptr);
~ExpertPluginInterface();
void exec() override;
void createAction(KActionCollection *ac) override;
private:
void slotActivated();
};
#endif // EXPERTPLUGININTERFACE_H
{
"KPlugin": {
"Description": "This plugin activates some expert actions.",
"EnabledByDefault": "false",
"Id": "kmailexpert",
"Name": "Expert Plugin",
"ServiceTypes": [
"KMail/MainViewPlugin"
],
"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