File indexing completed on 2024-10-27 04:50:59
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 <MessageComposer/PluginEditorInterface> 0010 #include <QHash> 0011 #include <QObject> 0012 namespace TextCustomEditor 0013 { 0014 class RichTextEditor; 0015 } 0016 namespace MessageComposer 0017 { 0018 class PluginEditorInterface; 0019 class ComposerViewBase; 0020 } 0021 class KActionCollection; 0022 class KMailPluginEditorManagerInterface : public QObject 0023 { 0024 Q_OBJECT 0025 public: 0026 explicit KMailPluginEditorManagerInterface(QObject *parent = nullptr); 0027 ~KMailPluginEditorManagerInterface() override; 0028 0029 [[nodiscard]] TextCustomEditor::RichTextEditor *richTextEditor() const; 0030 void setRichTextEditor(TextCustomEditor::RichTextEditor *richTextEditor); 0031 0032 [[nodiscard]] QWidget *parentWidget() const; 0033 void setParentWidget(QWidget *parentWidget); 0034 0035 void initializePlugins(); 0036 0037 [[nodiscard]] KActionCollection *actionCollection() const; 0038 void setActionCollection(KActionCollection *actionCollection); 0039 0040 [[nodiscard]] QHash<MessageComposer::PluginActionType::Type, QList<QAction *>> actionsType(); 0041 [[nodiscard]] QList<QAction *> actionsType(MessageComposer::PluginActionType::Type type); 0042 [[nodiscard]] QList<QWidget *> statusBarWidgetList(); 0043 0044 MessageComposer::ComposerViewBase *composerInterface() const; 0045 void setComposerInterface(MessageComposer::ComposerViewBase *composerInterface); 0046 0047 [[nodiscard]] bool processProcessKeyEvent(QKeyEvent *event); 0048 0049 void setStatusBarWidgetEnabled(MessageComposer::PluginEditorInterface::ApplyOnFieldType type); 0050 Q_SIGNALS: 0051 void textSelectionChanged(bool hasSelection); 0052 void message(const QString &str); 0053 void insertText(const QString &str); 0054 void errorMessage(const QString &message); 0055 void successMessage(const QString &message); 0056 0057 private: 0058 void slotPluginActivated(MessageComposer::PluginEditorInterface *interface); 0059 TextCustomEditor::RichTextEditor *mRichTextEditor = nullptr; 0060 MessageComposer::ComposerViewBase *mComposerInterface = nullptr; 0061 QWidget *mParentWidget = nullptr; 0062 KActionCollection *mActionCollection = nullptr; 0063 QList<MessageComposer::PluginEditorInterface *> mListPluginInterface; 0064 QHash<MessageComposer::PluginActionType::Type, QList<QAction *>> mActionHash; 0065 QList<QWidget *> mStatusBarWidget; 0066 };