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 #include "plugineditorinterface.h"
0008 #include "plugincomposerinterface.h"
0009 
0010 using namespace MessageComposer;
0011 
0012 class MessageComposer::PluginEditorInterfacePrivate
0013 {
0014 public:
0015     PluginEditorInterfacePrivate() = default;
0016 
0017     ~PluginEditorInterfacePrivate()
0018     {
0019         delete mComposerInterface;
0020     }
0021 
0022     PluginEditorInterface::ApplyOnFieldTypes mApplyOnFieldTypes = {PluginEditorInterface::ApplyOnFieldType::All};
0023     PluginActionType mActionType;
0024     QWidget *mParentWidget = nullptr;
0025     TextCustomEditor::RichTextEditor *mRichTextEditor = nullptr;
0026     MessageComposer::PluginComposerInterface *mComposerInterface = nullptr;
0027     PluginEditor *plugin = nullptr;
0028     QWidget *statusBarWidget = nullptr;
0029     bool mSelectedText = false;
0030 };
0031 
0032 PluginEditorInterface::PluginEditorInterface(QObject *parent)
0033     : PimCommon::AbstractGenericPluginInterface(parent)
0034     , d(new MessageComposer::PluginEditorInterfacePrivate)
0035 {
0036 }
0037 
0038 PluginEditorInterface::~PluginEditorInterface() = default;
0039 
0040 void PluginEditorInterface::setActionType(PluginActionType type)
0041 {
0042     d->mActionType = type;
0043 }
0044 
0045 PluginActionType PluginEditorInterface::actionType() const
0046 {
0047     return d->mActionType;
0048 }
0049 
0050 TextCustomEditor::RichTextEditor *PluginEditorInterface::richTextEditor() const
0051 {
0052     return d->mRichTextEditor;
0053 }
0054 
0055 void PluginEditorInterface::setRichTextEditor(TextCustomEditor::RichTextEditor *richTextEditor)
0056 {
0057     d->mRichTextEditor = richTextEditor;
0058 }
0059 
0060 void PluginEditorInterface::setNeedSelectedText(bool b)
0061 {
0062     d->mSelectedText = b;
0063 }
0064 
0065 bool PluginEditorInterface::needSelectedText() const
0066 {
0067     return d->mSelectedText;
0068 }
0069 
0070 void PluginEditorInterface::setStatusBarWidget(QWidget *w)
0071 {
0072     d->statusBarWidget = w;
0073 }
0074 
0075 QWidget *PluginEditorInterface::statusBarWidget() const
0076 {
0077     return d->statusBarWidget;
0078 }
0079 
0080 PluginComposerInterface *PluginEditorInterface::composerInterface() const
0081 {
0082     return d->mComposerInterface;
0083 }
0084 
0085 void PluginEditorInterface::setComposerInterface(PluginComposerInterface *w)
0086 {
0087     d->mComposerInterface = w;
0088 }
0089 
0090 bool PluginEditorInterface::processProcessKeyEvent(QKeyEvent *event)
0091 {
0092     Q_UNUSED(event)
0093     return false;
0094 }
0095 
0096 PluginEditorInterface::ApplyOnFieldTypes PluginEditorInterface::applyOnFieldTypes() const
0097 {
0098     return d->mApplyOnFieldTypes;
0099 }
0100 
0101 void PluginEditorInterface::setApplyOnFieldTypes(PluginEditorInterface::ApplyOnFieldTypes types)
0102 {
0103     d->mApplyOnFieldTypes = types;
0104 }
0105 
0106 #include "moc_plugineditorinterface.cpp"