Commit 147e8c26 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add plugin

parent 33afd6d8
......@@ -2,6 +2,10 @@
# SPDX-License-Identifier: BSD-3-Clause
add_library(akonadidatasetools)
target_sources(akonadidatasetools PRIVATE
akonadidatabasetoolsplugin.cpp
akonadidatabasetoolsplugin.h
akonadidatabasetoolsplugininterface.cpp
akonadidatabasetoolsplugininterface.h
)
generate_export_header(akonadidatasetools BASE_NAME akonadidatasetools)
......@@ -13,6 +17,7 @@ target_link_libraries(akonadidatasetools
KF5::I18n
KF5::MessageComposer
KF5::KIOWidgets
KF5::XmlGui
)
set_target_properties(akonadidatasetools
......
/*
SPDX-FileCopyrightText: 2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "akonadidatabasetoolsplugin.h"
#include "akonadidatabasetoolsplugininterface.h"
#include <KPluginFactory>
K_PLUGIN_CLASS_WITH_JSON(AkonadiDatabaseToolsPlugin, "kmail_akonadidatabasetoolsplugin.json")
AkonadiDatabaseToolsPlugin::AkonadiDatabaseToolsPlugin(QObject *parent, const QList<QVariant> &)
: PimCommon::GenericPlugin(parent)
{
}
AkonadiDatabaseToolsPlugin::~AkonadiDatabaseToolsPlugin() = default;
PimCommon::GenericPluginInterface *AkonadiDatabaseToolsPlugin::createInterface(QObject *parent)
{
return new AkonadiDatabaseToolsPluginInterface(parent);
}
#include "akonadidatabasetoolsplugin.moc"
/*
SPDX-FileCopyrightText: 2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <PimCommon/GenericPlugin>
#include <PimCommonAkonadi/GenericPluginInterface>
#include <QVariant>
class AkonadiDatabaseToolsPlugin : public PimCommon::GenericPlugin
{
Q_OBJECT
public:
explicit AkonadiDatabaseToolsPlugin(QObject *parent = nullptr, const QList<QVariant> & = QList<QVariant>());
~AkonadiDatabaseToolsPlugin() override;
PimCommon::GenericPluginInterface *createInterface(QObject *parent = nullptr) override;
};
/*
SPDX-FileCopyrightText: 2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "akonadidatabasetoolsplugininterface.h"
#include <KActionCollection>
#include <KLocalizedString>
#include <QAction>
AkonadiDatabaseToolsPluginInterface::AkonadiDatabaseToolsPluginInterface(QObject *parent)
: PimCommon::GenericPluginInterface(parent)
{
}
AkonadiDatabaseToolsPluginInterface::~AkonadiDatabaseToolsPluginInterface() = default;
void AkonadiDatabaseToolsPluginInterface::createAction(KActionCollection *ac)
{
auto action = new QAction(i18n("&Anti-Spam Wizard..."), this);
ac->addAction(QStringLiteral("antiSpamWizard"), action);
connect(action, &QAction::triggered, this, &AkonadiDatabaseToolsPluginInterface::slotActivated);
PimCommon::ActionType type(action, PimCommon::ActionType::Tools);
addActionType(type);
}
void AkonadiDatabaseToolsPluginInterface::slotActivated()
{
Q_EMIT emitPluginActivated(this);
}
void AkonadiDatabaseToolsPluginInterface::exec()
{
// TODO
}
/*
SPDX-FileCopyrightText: 2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <PimCommonAkonadi/GenericPluginInterface>
class AkonadiDatabaseToolsPluginInterface : public PimCommon::GenericPluginInterface
{
public:
explicit AkonadiDatabaseToolsPluginInterface(QObject *parent = nullptr);
~AkonadiDatabaseToolsPluginInterface() override;
void exec() override;
void createAction(KActionCollection *ac) override;
private:
void slotActivated();
};
{
"KPlugin": {
"Description": "This plugin allows you to manage Akonadi database.",
"EnabledByDefault": "false",
"Id": "kmailakonadidatabasetool",
"Name": "Antispam",
"Version": "1.0"
}
}
Supports Markdown
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