File indexing completed on 2025-03-09 04:54:44
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "messageviewer_export.h" 0010 #include "viewerplugininterface.h" 0011 #include <Akonadi/Item> 0012 #include <QObject> 0013 class KActionCollection; 0014 class QAction; 0015 namespace MessageViewer 0016 { 0017 class ViewerPluginToolManagerPrivate; 0018 class ViewerPluginInterface; 0019 /** 0020 * @brief The ViewerPluginToolManager class 0021 * @author Laurent Montel <montel@kde.org> 0022 */ 0023 class MESSAGEVIEWER_EXPORT ViewerPluginToolManager : public QObject 0024 { 0025 Q_OBJECT 0026 public: 0027 explicit ViewerPluginToolManager(QWidget *parentWidget, QObject *parent = nullptr); 0028 ~ViewerPluginToolManager() override; 0029 0030 void closeAllTools(); 0031 0032 void createView(); 0033 void setActionCollection(KActionCollection *ac); 0034 0035 void setPluginName(const QString &pluginName); 0036 [[nodiscard]] QString pluginName() const; 0037 [[nodiscard]] bool initializePluginList(); 0038 [[nodiscard]] QList<QAction *> viewerPluginActionList(ViewerPluginInterface::SpecificFeatureTypes features) const; 0039 0040 void updateActions(const Akonadi::Item &messageItem); 0041 0042 /** 0043 * @brief refreshActionList Refresh the list of action menu. 0044 */ 0045 void refreshActionList(); 0046 0047 void setPluginDirectory(const QString &directory); 0048 [[nodiscard]] QString pluginDirectory() const; 0049 Q_SIGNALS: 0050 void activatePlugin(MessageViewer::ViewerPluginInterface *); 0051 0052 private: 0053 std::unique_ptr<ViewerPluginToolManagerPrivate> const d; 0054 }; 0055 }