Libksieve

sievetextedit.h
1 /* SPDX-FileCopyrightText: 2011-2021 Laurent Montel <[email protected]>
2  *
3  * SPDX-License-Identifier: LGPL-2.0-or-later
4  */
5 
6 #pragma once
7 
8 #include "ksieveui_export.h"
9 #include <KPIMTextEdit/PlainTextEditor>
10 #include <memory>
11 
12 class QMenu;
13 namespace KSieveUi
14 {
15 class SieveTextEditPrivate;
16 /**
17  * @brief The SieveTextEdit class
18  * @author Laurent Montel <[email protected]>
19  */
20 class KSIEVEUI_EXPORT SieveTextEdit : public KPIMTextEdit::PlainTextEditor
21 {
22  Q_OBJECT
23 
24 public:
25  explicit SieveTextEdit(QWidget *parent = nullptr);
26  ~SieveTextEdit() override;
27 
28  void lineNumberAreaPaintEvent(QPaintEvent *event);
29  Q_REQUIRED_RESULT int lineNumberAreaWidth() const;
30 
31  void setSieveCapabilities(const QStringList &capabilities);
32 
33  void setShowHelpMenu(bool b);
34 
35  void uncomment();
36  void comment();
37  void upperCase();
38  void lowerCase();
39  void sentenceCase();
40  void reverseCase();
41  void wordWrap(bool state);
42  Q_REQUIRED_RESULT bool isWordWrap() const;
43 
44 protected:
45  void initCompleter();
46  void keyPressEvent(QKeyEvent *e) override;
47  void resizeEvent(QResizeEvent *event) override;
48  void addExtraMenuEntry(QMenu *menu, QPoint pos) override;
49  bool event(QEvent *ev) override;
50  Sonnet::SpellCheckDecorator *createSpellCheckDecorator() override;
51 
52  void updateHighLighter() override;
53  void clearDecorator() override;
54  void createHighlighter() override;
55 Q_SIGNALS:
56  void openHelp(const QUrl &url);
57  void editRule(const QString &selectedText);
58  void insertRule();
59 
60 private:
61  void slotUpdateLineNumberAreaWidth(int newBlockCount);
62  void slotUpdateLineNumberArea(const QRect &, int);
63  void slotHelp();
64  void slotEditRule();
65  Q_REQUIRED_RESULT bool openVariableHelp();
66  bool overrideShortcut(QKeyEvent *event);
67  Q_REQUIRED_RESULT QStringList completerList() const;
68  void setCompleterList(const QStringList &list);
69  Q_REQUIRED_RESULT QString selectedWord(const QPoint &pos = QPoint()) const;
70 
71  std::unique_ptr<SieveTextEditPrivate> const d;
72 };
73 }
The SieveTextEdit class.
Definition: sievetextedit.h:20
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Apr 16 2021 23:09:34 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.