File indexing completed on 2025-01-05 04:58:22
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "pimcommonakonadi_export.h" 0010 #include <PimCommon/PluginUtil> 0011 #include <PimCommonAkonadi/GenericPluginInterface> 0012 #include <QObject> 0013 class KActionCollection; 0014 class QAction; 0015 class KXMLGUIClient; 0016 namespace PimCommon 0017 { 0018 class PluginInterfacePrivate; 0019 /** 0020 * @brief The PluginInterface class 0021 * @author Laurent Montel <montel@kde.org> 0022 */ 0023 class PIMCOMMONAKONADI_EXPORT PluginInterface : public QObject 0024 { 0025 Q_OBJECT 0026 public: 0027 explicit PluginInterface(QObject *parent = nullptr); 0028 ~PluginInterface() override; 0029 0030 void setParentWidget(QWidget *widget); 0031 [[nodiscard]] QHash<PimCommon::ActionType::Type, QList<QAction *>> actionsType(); 0032 void createPluginInterface(); 0033 0034 void setPluginName(const QString &name); 0035 void setPluginDirectory(const QString &name); 0036 void initializePlugins(); 0037 virtual bool initializeInterfaceRequires(AbstractGenericPluginInterface *interface); 0038 static QString actionXmlExtension(PimCommon::ActionType::Type type); 0039 0040 void initializePluginActions(const QString &prefix, KXMLGUIClient *guiClient); 0041 void updateActions(int numberOfSelectedItems, int numberOfSelectedCollections); 0042 0043 void setActionCollection(KActionCollection *ac); 0044 0045 [[nodiscard]] QList<PimCommon::PluginUtilData> pluginsDataList() const; 0046 [[nodiscard]] QString configGroupName() const; 0047 [[nodiscard]] QString configPrefixSettingKey() const; 0048 0049 PimCommon::GenericPlugin *pluginFromIdentifier(const QString &id); 0050 void clearPluginActions(const QString &prefix, KXMLGUIClient *guiClient); 0051 private Q_SLOTS: 0052 PIMCOMMONAKONADI_NO_EXPORT void slotPluginActivated(PimCommon::AbstractGenericPluginInterface *interface); 0053 0054 private: 0055 std::unique_ptr<PluginInterfacePrivate> const d; 0056 }; 0057 }