File indexing completed on 2024-06-23 05:18:34
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 "messagecomposer_export.h" 0010 #include <MessageComposer/PluginActionType> 0011 #include <PimCommon/AbstractGenericPluginInterface> 0012 #include <QObject> 0013 0014 class QKeyEvent; 0015 namespace TextCustomEditor 0016 { 0017 class RichTextEditor; 0018 } 0019 0020 namespace MessageComposer 0021 { 0022 class PluginEditorInterfacePrivate; 0023 class PluginEditor; 0024 class PluginComposerInterface; 0025 /** 0026 * @brief The PluginEditorInterface class 0027 * @author Laurent Montel <montel@kde.org> 0028 */ 0029 class MESSAGECOMPOSER_EXPORT PluginEditorInterface : public PimCommon::AbstractGenericPluginInterface 0030 { 0031 Q_OBJECT 0032 public: 0033 enum ApplyOnFieldType { 0034 Composer = 1, 0035 EmailFields = 2, 0036 SubjectField = 4, 0037 All = Composer | EmailFields | SubjectField, 0038 }; 0039 Q_FLAG(ApplyOnFieldType) 0040 Q_DECLARE_FLAGS(ApplyOnFieldTypes, ApplyOnFieldType) 0041 0042 explicit PluginEditorInterface(QObject *parent = nullptr); 0043 ~PluginEditorInterface() override; 0044 0045 void setActionType(PluginActionType type); 0046 [[nodiscard]] PluginActionType actionType() const; 0047 0048 [[nodiscard]] TextCustomEditor::RichTextEditor *richTextEditor() const; 0049 void setRichTextEditor(TextCustomEditor::RichTextEditor *richTextEditor); 0050 0051 void setNeedSelectedText(bool b); 0052 [[nodiscard]] bool needSelectedText() const; 0053 0054 void setStatusBarWidget(QWidget *w); 0055 [[nodiscard]] QWidget *statusBarWidget() const; 0056 0057 [[nodiscard]] MessageComposer::PluginComposerInterface *composerInterface() const; 0058 void setComposerInterface(MessageComposer::PluginComposerInterface *w); 0059 0060 virtual bool processProcessKeyEvent(QKeyEvent *event); 0061 0062 [[nodiscard]] PluginEditorInterface::ApplyOnFieldTypes applyOnFieldTypes() const; 0063 0064 void setApplyOnFieldTypes(PluginEditorInterface::ApplyOnFieldTypes types); 0065 Q_SIGNALS: 0066 void emitPluginActivated(MessageComposer::PluginEditorInterface *interface); 0067 void insertText(const QString &str); 0068 0069 void errorMessage(const QString &message); 0070 void successMessage(const QString &message); 0071 0072 private: 0073 std::unique_ptr<PluginEditorInterfacePrivate> const d; 0074 }; 0075 }