Browse Source

Adding top level plugin

master
David Lanzendörfer 4 weeks ago
parent
commit
c76f5d5ee5
7 changed files with 178 additions and 0 deletions
  1. +17
    -0
      pep_plugin/CMakeLists.txt
  2. +10
    -0
      pep_plugin/kmail_pep_plugin.json
  3. +5
    -0
      pep_plugin/pep.qrc
  4. +27
    -0
      pep_plugin/pep_plugin.cpp
  5. +23
    -0
      pep_plugin/pep_plugin.h
  6. +68
    -0
      pep_plugin/pep_plugininterface.cpp
  7. +28
    -0
      pep_plugin/pep_plugininterface.h

+ 17
- 0
pep_plugin/CMakeLists.txt View File

@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: 2015-2021 Laurent Montel <montel@kde.org>
# SPDX-License-Identifier: BSD-3-Clause
kcoreaddons_add_plugin(kmail_pep_plugin INSTALL_NAMESPACE kmail/mainview)
target_sources(kmail_pep_plugin PRIVATE
pep_plugin.cpp
pep_plugininterface.cpp
../kde_pep_common/pep_wizard.cpp
pep.qrc
)
target_link_libraries(kmail_pep_plugin
KF5::PimCommonAkonadi KF5::Completion KF5::MailCommon KF5::XmlGui KF5::I18n KF5::GuiAddons
)
if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
set_target_properties(kmail_pep_plugin PROPERTIES UNITY_BUILD ON)
endif()

+ 10
- 0
pep_plugin/kmail_pep_plugin.json View File

@ -0,0 +1,10 @@
{
"KPlugin":
{
"Description" : "The plugin for writing autoencrypted mails with p≡p",
"EnabledByDefault" : "true",
"Id" : "kmailpep",
"Name" : "The p≡p plugin",
"Version" : "1.0"
}
}

+ 5
- 0
pep_plugin/pep.qrc View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/org/kde/kmail/">
<file>pics/kmwizard.png</file>
</qresource>
</RCC>

+ 27
- 0
pep_plugin/pep_plugin.cpp View File

@ -0,0 +1,27 @@
/*
SPDX-FileCopyrightText: 2015-2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "pep_plugin.h"
#include "pep_plugininterface.h"
#include <KPluginFactory>
K_PLUGIN_CLASS_WITH_JSON(pEpPlugin, "kmail_pep_plugin.json")
pEpPlugin::pEpPlugin(QObject *parent, const QList<QVariant> &)
: PimCommon::GenericPlugin(parent)
{
}
pEpPlugin::~pEpPlugin()
{
}
PimCommon::GenericPluginInterface *pEpPlugin::createInterface(QObject *parent)
{
auto interface = new pEpPluginInterface(parent);
return interface;
}
#include "pep_plugin.moc"

+ 23
- 0
pep_plugin/pep_plugin.h View File

@ -0,0 +1,23 @@
/*
SPDX-FileCopyrightText: 2015-2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <PimCommon/GenericPlugin>
#include <PimCommonAkonadi/GenericPluginInterface>
#include <QVariant>
class pEpPlugin : public PimCommon::GenericPlugin
{
Q_OBJECT
public:
explicit pEpPlugin(QObject *parent = nullptr, const QList<QVariant> & = QList<QVariant>());
~pEpPlugin() override;
PimCommon::GenericPluginInterface *createInterface(QObject *parent = nullptr) override;
};

+ 68
- 0
pep_plugin/pep_plugininterface.cpp View File

@ -0,0 +1,68 @@
/*
SPDX-FileCopyrightText: 2015-2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "pep_plugininterface.h"
#include <KActionCollection>
#include <KLocalizedString>
#include <QAction>
#include <kde_pep_common/pep_wizard.h>
pEpPluginInterface::pEpPluginInterface(QObject *parent)
: PimCommon::GenericPluginInterface(parent)
{
}
pEpPluginInterface::~pEpPluginInterface()
{
}
void pEpPluginInterface::createAction(KActionCollection *ac)
{
QAction *action;
QIcon::setThemeName(QStringLiteral("hicolor"));
action = new QAction(i18n("&p≡p Wizard..."), this);
action->setIcon(QIcon::fromTheme(QStringLiteral("akonadi-pep")));
ac->addAction(QStringLiteral("pepWizard"), action);
connect(action, &QAction::triggered, this, &pEpPluginInterface::slotActivated);
addActionType(PimCommon::ActionType(action, PimCommon::ActionType::ToolBar));
}
void pEpPluginInterface::slotActivated()
{
Q_EMIT emitPluginActivated(this);
}
void pEpPluginInterface::setCurrentItems(const Akonadi::Item::List &items)
{
qDebug() << __func__;
}
void pEpPluginInterface::setItems(const Akonadi::Item::List &items)
{
qDebug() << __func__;
}
void pEpPluginInterface::setCurrentCollection(const Akonadi::Collection &col)
{
qDebug() << __func__;
}
void pEpPluginInterface::setCollections(const Akonadi::Collection::List &cols)
{
qDebug() << __func__;
}
pEpPluginInterface::RequireTypes pEpPluginInterface::requiresFeatures() const
{
return RequireType::CurrentItems;
}
void pEpPluginInterface::exec()
{
pEpWizard wiz(parentWidget());
wiz.exec();
}

+ 28
- 0
pep_plugin/pep_plugininterface.h View File

@ -0,0 +1,28 @@
/*
SPDX-FileCopyrightText: 2015-2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <PimCommonAkonadi/GenericPluginInterface>
class pEpPluginInterface : public PimCommon::GenericPluginInterface
{
public:
explicit pEpPluginInterface(QObject *parent = nullptr);
~pEpPluginInterface() override;
void exec() override;
void createAction(KActionCollection *ac) override;
void setCurrentItems(const Akonadi::Item::List &items) override;
void setItems(const Akonadi::Item::List &items) override;
void setCurrentCollection(const Akonadi::Collection &col) override;
void setCollections(const Akonadi::Collection::List &cols) override;
GenericPluginInterface::RequireTypes requiresFeatures() const override;
private:
void slotActivated();
};

Loading…
Cancel
Save