plugineditorinterface.cpp 2.45 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
/*
Laurent Montel's avatar
Laurent Montel committed
2
   SPDX-FileCopyrightText: 2015-2021 Laurent Montel <montel@kde.org>
3
4

   SPDX-License-Identifier: LGPL-2.0-or-later
Laurent Montel's avatar
Laurent Montel committed
5
6
7
*/

#include "plugineditorinterface.h"
Laurent Montel's avatar
Laurent Montel committed
8
#include "plugincomposerinterface.h"
Laurent Montel's avatar
Laurent Montel committed
9
10
11
12
13
14
15
16
17

using namespace MessageComposer;

class MessageComposer::PluginEditorInterfacePrivate
{
public:
    PluginEditorInterfacePrivate()
    {
    }
Laurent Montel's avatar
Laurent Montel committed
18

19
20
21
22
23
    ~PluginEditorInterfacePrivate()
    {
        delete mComposerInterface;
    }

Laurent Montel's avatar
Laurent Montel committed
24
    PluginEditorInterface::ApplyOnFieldTypes mApplyOnFieldTypes = {PluginEditorInterface::ApplyOnFieldType::All};
Laurent Montel's avatar
Laurent Montel committed
25
    PluginActionType mActionType;
Laurent Montel's avatar
Laurent Montel committed
26
27
    QWidget *mParentWidget = nullptr;
    KPIMTextEdit::RichTextEditor *mRichTextEditor = nullptr;
Laurent Montel's avatar
Laurent Montel committed
28
    MessageComposer::PluginComposerInterface *mComposerInterface = nullptr;
Laurent Montel's avatar
Laurent Montel committed
29
    PluginEditor *plugin = nullptr;
Laurent Montel's avatar
Laurent Montel committed
30
    QWidget *statusBarWidget = nullptr;
31
    bool mSelectedText = false;
Laurent Montel's avatar
Laurent Montel committed
32
33
34
};

PluginEditorInterface::PluginEditorInterface(QObject *parent)
Laurent Montel's avatar
Laurent Montel committed
35
36
    : PimCommon::AbstractGenericPluginInterface(parent)
    , d(new MessageComposer::PluginEditorInterfacePrivate)
Laurent Montel's avatar
Laurent Montel committed
37
38
39
40
41
42
43
44
{
}

PluginEditorInterface::~PluginEditorInterface()
{
    delete d;
}

Laurent Montel's avatar
Laurent Montel committed
45
void PluginEditorInterface::setActionType(PluginActionType type)
Laurent Montel's avatar
Laurent Montel committed
46
47
48
49
{
    d->mActionType = type;
}

Laurent Montel's avatar
Laurent Montel committed
50
PluginActionType PluginEditorInterface::actionType() const
Laurent Montel's avatar
Laurent Montel committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{
    return d->mActionType;
}

KPIMTextEdit::RichTextEditor *PluginEditorInterface::richTextEditor() const
{
    return d->mRichTextEditor;
}

void PluginEditorInterface::setRichTextEditor(KPIMTextEdit::RichTextEditor *richTextEditor)
{
    d->mRichTextEditor = richTextEditor;
}

Laurent Montel's avatar
Laurent Montel committed
65
66
67
68
69
70
71
72
73
void PluginEditorInterface::setNeedSelectedText(bool b)
{
    d->mSelectedText = b;
}

bool PluginEditorInterface::needSelectedText() const
{
    return d->mSelectedText;
}
Laurent Montel's avatar
Laurent Montel committed
74
75
76
77
78
79
80
81
82
83

void PluginEditorInterface::setStatusBarWidget(QWidget *w)
{
    d->statusBarWidget = w;
}

QWidget *PluginEditorInterface::statusBarWidget() const
{
    return d->statusBarWidget;
}
Laurent Montel's avatar
Laurent Montel committed
84
85
86
87
88
89
90
91
92
93

PluginComposerInterface *PluginEditorInterface::composerInterface() const
{
    return d->mComposerInterface;
}

void PluginEditorInterface::setComposerInterface(PluginComposerInterface *w)
{
    d->mComposerInterface = w;
}
94
95
96

bool PluginEditorInterface::processProcessKeyEvent(QKeyEvent *event)
{
Laurent Montel's avatar
Laurent Montel committed
97
    Q_UNUSED(event)
98
99
    return false;
}
100
101
102
103
104
105
106
107
108
109

PluginEditorInterface::ApplyOnFieldTypes PluginEditorInterface::applyOnFieldTypes() const
{
    return d->mApplyOnFieldTypes;
}

void PluginEditorInterface::setApplyOnFieldTypes(PluginEditorInterface::ApplyOnFieldTypes types)
{
    d->mApplyOnFieldTypes = types;
}