File indexing completed on 2024-10-27 04:51:08

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <Akonadi/Item>
0010 #include <QList>
0011 #include <QObject>
0012 namespace MessageViewer
0013 {
0014 class MessageViewerCheckBeforeDeletingInterface;
0015 }
0016 class QAction;
0017 class KActionCollection;
0018 class KMailPluginCheckBeforeDeletingManagerInterface : public QObject
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit KMailPluginCheckBeforeDeletingManagerInterface(QObject *parent = nullptr);
0023     ~KMailPluginCheckBeforeDeletingManagerInterface() override;
0024     void initializePlugins();
0025 
0026     [[nodiscard]] QWidget *parentWidget() const;
0027     void setParentWidget(QWidget *newParentWidget);
0028 
0029     [[nodiscard]] Akonadi::Item::List confirmBeforeDeleting(const Akonadi::Item::List &list);
0030 
0031     void setActionCollection(KActionCollection *ac);
0032 
0033     const QList<QAction *> actions() const;
0034 
0035 private:
0036     QList<QAction *> mActions;
0037     QList<MessageViewer::MessageViewerCheckBeforeDeletingInterface *> mListPluginInterface;
0038     QWidget *mParentWidget = nullptr;
0039     KActionCollection *mActionCollection = nullptr;
0040     bool mWasInitialized = false;
0041 };