1 /* 2 SPDX-FileCopyrightText: 2015-2021 Laurent Montel <montel@kde.org> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #pragma once 8 9 #include <MessageComposer/PluginEditorInterface> 10 #include <QHash> 11 #include <QObject> 12 namespace KPIMTextEdit 13 { 14 class RichTextEditor; 15 } 16 namespace MessageComposer 17 { 18 class PluginEditorInterface; 19 class ComposerViewBase; 20 } 21 class KActionCollection; 22 class KMailPluginEditorManagerInterface : public QObject 23 { 24 Q_OBJECT 25 public: 26 explicit KMailPluginEditorManagerInterface(QObject *parent = nullptr); 27 ~KMailPluginEditorManagerInterface() override; 28 29 KPIMTextEdit::RichTextEditor *richTextEditor() const; 30 void setRichTextEditor(KPIMTextEdit::RichTextEditor *richTextEditor); 31 32 QWidget *parentWidget() const; 33 void setParentWidget(QWidget *parentWidget); 34 35 void initializePlugins(); 36 37 KActionCollection *actionCollection() const; 38 void setActionCollection(KActionCollection *actionCollection); 39 40 Q_REQUIRED_RESULT QHash<MessageComposer::PluginActionType::Type, QList<QAction *>> actionsType(); 41 Q_REQUIRED_RESULT QList<QAction *> actionsType(MessageComposer::PluginActionType::Type type); 42 Q_REQUIRED_RESULT QList<QWidget *> statusBarWidgetList(); 43 44 MessageComposer::ComposerViewBase *composerInterface() const; 45 void setComposerInterface(MessageComposer::ComposerViewBase *composerInterface); 46 47 Q_REQUIRED_RESULT bool processProcessKeyEvent(QKeyEvent *event); 48 49 void setStatusBarWidgetEnabled(MessageComposer::PluginEditorInterface::ApplyOnFieldType type); 50 Q_SIGNALS: 51 void textSelectionChanged(bool hasSelection); 52 void message(const QString &str); 53 void insertText(const QString &str); 54 55 private: 56 Q_DISABLE_COPY(KMailPluginEditorManagerInterface) 57 void slotPluginActivated(MessageComposer::PluginEditorInterface *interface); 58 KPIMTextEdit::RichTextEditor *mRichTextEditor = nullptr; 59 MessageComposer::ComposerViewBase *mComposerInterface = nullptr; 60 QWidget *mParentWidget = nullptr; 61 KActionCollection *mActionCollection = nullptr; 62 QList<MessageComposer::PluginEditorInterface *> mListPluginInterface; 63 QHash<MessageComposer::PluginActionType::Type, QList<QAction *>> mActionHash; 64 QList<QWidget *> mStatusBarWidget; 65 }; 66 67