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 <Akonadi/Item> 0011 #include <KMime/Message> 0012 #include <QObject> 0013 0014 class QAction; 0015 class KActionCollection; 0016 namespace MessageViewer 0017 { 0018 class ViewerPluginInterfacePrivate; 0019 /** 0020 * @brief The ViewerPluginInterface class 0021 * @author Laurent Montel <montel@kde.org> 0022 */ 0023 class MESSAGEVIEWER_EXPORT ViewerPluginInterface : public QObject 0024 { 0025 Q_OBJECT 0026 public: 0027 explicit ViewerPluginInterface(QObject *parent = nullptr); 0028 ~ViewerPluginInterface() override; 0029 enum SpecificFeatureType { None = 0, NeedSelection = 2, NeedMessage = 4, NeedUrl = 8, All = 16 }; 0030 Q_FLAGS(SpecificFeatureTypes) 0031 Q_DECLARE_FLAGS(SpecificFeatureTypes, SpecificFeatureType) 0032 0033 virtual void execute(); 0034 0035 virtual void setText(const QString &text); 0036 virtual QList<QAction *> actions() const; 0037 virtual void setUrl(const QUrl &url); 0038 virtual void setMessage(const KMime::Message::Ptr &value); 0039 virtual void setMessageItem(const Akonadi::Item &item); 0040 virtual void setCurrentCollection(const Akonadi::Collection &col); 0041 virtual void closePlugin(); 0042 virtual ViewerPluginInterface::SpecificFeatureTypes featureTypes() const = 0; 0043 virtual void updateAction(const Akonadi::Item &item); 0044 virtual void refreshActionList(KActionCollection *ac); 0045 0046 protected: 0047 virtual void showWidget(); 0048 void addHelpTextAction(QAction *act, const QString &text); 0049 0050 protected Q_SLOTS: 0051 void slotActivatePlugin(); 0052 0053 Q_SIGNALS: 0054 void activatePlugin(MessageViewer::ViewerPluginInterface *); 0055 0056 private: 0057 std::unique_ptr<ViewerPluginInterfacePrivate> const d; 0058 }; 0059 }