Messagelib

plugineditorgrammarcustomtoolsviewinterface.h
1 /*
2  SPDX-FileCopyrightText: 2019-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "messagecomposer_export.h"
10 #include <PimCommon/CustomToolsViewInterface>
11 #include <QDebug>
12 
13 namespace KPIMTextEdit
14 {
15 class RichTextComposer;
16 }
17 namespace MessageComposer
18 {
19 class PluginEditorGrammarCustomToolsViewInterfacePrivate;
20 /**
21  * @brief The PluginGrammarAction class
22  * @author Laurent Montel <[email protected]>
23  */
24 class MESSAGECOMPOSER_EXPORT PluginGrammarAction
25 {
26 public:
28 
29  Q_REQUIRED_RESULT QString replacement() const;
30  void setReplacement(const QString &replacement);
31 
32  Q_REQUIRED_RESULT int start() const;
33  void setStart(int start);
34 
35  Q_REQUIRED_RESULT int length() const;
36  void setLength(int length);
37 
38  Q_REQUIRED_RESULT QStringList suggestions() const;
39  void setSuggestions(const QStringList &suggestions);
40 
41  Q_REQUIRED_RESULT int blockId() const;
42  void setBlockId(int blockId);
43 
44  Q_REQUIRED_RESULT QStringList infoUrls() const;
45  void setInfoUrls(const QStringList &urls);
46 
47 private:
48  QStringList mSuggestions;
49  QStringList mInfoUrls;
50  QString mReplacement;
51  int mStart = -1;
52  int mLength = -1;
53  int mBlockId = -1;
54 };
55 
56 /**
57  * @brief The PluginEditorGrammarCustomToolsViewInterface class
58  * @author Laurent Montel <[email protected]>
59  */
61 {
62  Q_OBJECT
63 public:
64  explicit PluginEditorGrammarCustomToolsViewInterface(QWidget *parent = nullptr);
66 
67  void setParentWidget(QWidget *parent);
68  Q_REQUIRED_RESULT QWidget *parentWidget() const;
69 
70  Q_REQUIRED_RESULT KPIMTextEdit::RichTextComposer *richTextEditor() const;
71  void setRichTextEditor(KPIMTextEdit::RichTextComposer *richTextEditor);
72 
73 Q_SIGNALS:
74  void replaceText(const MessageComposer::PluginGrammarAction &act);
75 
76 private:
77  std::unique_ptr<PluginEditorGrammarCustomToolsViewInterfacePrivate> const d;
78 };
79 }
80 Q_DECLARE_METATYPE(MessageComposer::PluginGrammarAction)
81 MESSAGECOMPOSER_EXPORT QDebug operator<<(QDebug d, const MessageComposer::PluginGrammarAction &t);
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Dec 6 2021 23:04:58 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.