Messagelib

plugineditorconverttextinterface.h
1 /*
2  SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "messagecomposer_export.h"
10 #include <KMime/Message>
11 #include <MessageComposer/PluginActionType>
12 #include <QObject>
13 
14 namespace KPIMTextEdit
15 {
16 class RichTextComposer;
17 }
18 class KActionCollection;
19 namespace MessageComposer
20 {
21 class TextPart;
22 class PluginEditorConvertTextInterfacePrivate;
23 class PluginEditorConverterInitialData;
24 class PluginEditorConverterBeforeConvertingData;
25 class PluginEditorConvertText;
26 /**
27  * @brief The PluginEditorConvertTextInterface class
28  * @author Laurent Montel <montel@kde.org>
29  */
30 class MESSAGECOMPOSER_EXPORT PluginEditorConvertTextInterface : public QObject
31 {
32  Q_OBJECT
33 public:
34  explicit PluginEditorConvertTextInterface(QObject *parent = nullptr);
36 
37  enum class ConvertTextStatus {
38  NotConverted,
39  Converted,
40  Error,
41  };
42 
43  virtual bool reformatText();
44 
45  virtual PluginEditorConvertTextInterface::ConvertTextStatus convertTextToFormat(MessageComposer::TextPart *textPart) = 0;
46 
47  void setParentWidget(QWidget *parent);
48  [[nodiscard]] QWidget *parentWidget() const;
49 
50  [[nodiscard]] KPIMTextEdit::RichTextComposer *richTextEditor() const;
51  void setRichTextEditor(KPIMTextEdit::RichTextComposer *richTextEditor);
52 
53  void setActionType(const QList<PluginActionType> &type);
54  void addActionType(PluginActionType type);
55  [[nodiscard]] QList<PluginActionType> actionTypes() const;
56 
57  virtual void createAction(KActionCollection *ac);
58 
59  virtual void setInitialData(const PluginEditorConverterInitialData &data);
60  [[nodiscard]] PluginEditorConverterInitialData initialData() const;
61 
62  virtual void setBeforeConvertingData(const PluginEditorConverterBeforeConvertingData &data);
63  [[nodiscard]] PluginEditorConverterBeforeConvertingData beforeConvertingData() const;
64 
65  virtual void enableDisablePluginActions(bool richText);
66 
67  void setStatusBarWidget(QWidget *w);
68 
69  QWidget *statusBarWidget() const;
70 
71  void setPlugin(PluginEditorConvertText *plugin);
72  [[nodiscard]] PluginEditorConvertText *plugin() const;
73 
74 public Q_SLOTS:
75  virtual void reloadConfig();
76 
77 Q_SIGNALS:
78  void textReformated();
79 
80 private:
81  std::unique_ptr<PluginEditorConvertTextInterfacePrivate> const d;
82 };
83 }
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
The PluginEditorConvertText class.
The PluginActionType class.
The TextPart class.
Definition: textpart.h:20
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Feb 15 2024 03:55:21 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.