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 <Akonadi/Item> 0011 #include <PimCommon/AbstractGenericPluginInterface> 0012 0013 namespace PimCommon 0014 { 0015 class GenericPluginInterfacePrivate; 0016 /** 0017 * @brief The GenericPluginInterface class 0018 * @author Laurent Montel <montel@kde.org> 0019 */ 0020 class PIMCOMMONAKONADI_EXPORT GenericPluginInterface : public AbstractGenericPluginInterface 0021 { 0022 Q_OBJECT 0023 public: 0024 explicit GenericPluginInterface(QObject *parent = nullptr); 0025 ~GenericPluginInterface() override; 0026 0027 enum RequireType { 0028 None = 0, 0029 CurrentItems = 1, 0030 Items = 2, 0031 CurrentCollection = 3, 0032 Collections = 4, 0033 }; 0034 Q_ENUM(RequireType) 0035 Q_DECLARE_FLAGS(RequireTypes, RequireType) 0036 0037 void setActionTypes(const QList<ActionType> &type); 0038 void addActionType(ActionType type); 0039 [[nodiscard]] QList<ActionType> actionTypes() const; 0040 0041 virtual void setCurrentItems(const Akonadi::Item::List &items); 0042 virtual void setItems(const Akonadi::Item::List &items); 0043 virtual void setCurrentCollection(const Akonadi::Collection &col); 0044 virtual void setCollections(const Akonadi::Collection::List &cols); 0045 0046 virtual GenericPluginInterface::RequireTypes requiresFeatures() const; 0047 0048 virtual void updateActions(int numberOfSelectedItems, int numberOfSelectedCollections); 0049 0050 private: 0051 std::unique_ptr<GenericPluginInterfacePrivate> const d; 0052 }; 0053 } 0054 Q_DECLARE_TYPEINFO(PimCommon::ActionType, Q_RELOCATABLE_TYPE);