Commit 377d1d85 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to execute plugins

parent 1d876412
Pipeline #68848 passed with stage
in 22 minutes and 51 seconds
......@@ -33,6 +33,7 @@ void KMailPluginCheckBeforeDeletingManagerInterface::initializePlugins()
if (plugin->isEnabled()) {
auto interface = static_cast<MessageViewer::MessageViewerCheckBeforeDeletingInterface *>(plugin->createInterface(this));
interface->setParentWidget(mParentWidget);
mListPluginInterface.append(interface);
}
}
mWasInitialized = true;
......@@ -47,3 +48,12 @@ void KMailPluginCheckBeforeDeletingManagerInterface::setParentWidget(QWidget *ne
{
mParentWidget = newParentWidget;
}
Akonadi::Item::List KMailPluginCheckBeforeDeletingManagerInterface::confirmBeforeDeleting(const Akonadi::Item::List &list)
{
Akonadi::Item::List currentList = list;
for (MessageViewer::MessageViewerCheckBeforeDeletingInterface *interface : std::as_const(mListPluginInterface)) {
currentList = interface->exec(currentList);
}
return currentList;
}
......@@ -5,8 +5,13 @@
#pragma once
#include <AkonadiCore/Item>
#include <QObject>
#include <QVector>
namespace MessageViewer
{
class MessageViewerCheckBeforeDeletingInterface;
}
class KMailPluginCheckBeforeDeletingManagerInterface : public QObject
{
Q_OBJECT
......@@ -18,7 +23,10 @@ public:
Q_REQUIRED_RESULT QWidget *parentWidget() const;
void setParentWidget(QWidget *newParentWidget);
Q_REQUIRED_RESULT Akonadi::Item::List confirmBeforeDeleting(const Akonadi::Item::List &list);
private:
QVector<MessageViewer::MessageViewerCheckBeforeDeletingInterface *> mListPluginInterface;
QWidget *mParentWidget = nullptr;
bool mWasInitialized = false;
};
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