Libksieve

sievetextedit.h
1/* SPDX-FileCopyrightText: 2011-2024 Laurent Montel <montel@kde.org>
2 *
3 * SPDX-License-Identifier: LGPL-2.0-or-later
4 */
5
6#pragma once
7
8#include "ksieveui_export.h"
9#include <TextCustomEditor/PlainTextEditor>
10#include <memory>
11
12class QMenu;
13namespace KSieveUi
14{
15class SieveTextEditPrivate;
16/**
17 * @brief The SieveTextEdit class
18 * @author Laurent Montel <montel@kde.org>
19 */
21{
22 Q_OBJECT
23
24public:
25 explicit SieveTextEdit(QWidget *parent = nullptr);
26 ~SieveTextEdit() override;
27
28 void lineNumberAreaPaintEvent(QPaintEvent *event);
29 [[nodiscard]] 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 setWordWrap(bool state);
42 [[nodiscard]] bool isWordWrap() const;
43
44protected:
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;
55Q_SIGNALS:
56 void openHelp(const QUrl &url);
57 void editRule(const QString &selectedText);
58 void insertRule();
59
60private:
61 KSIEVEUI_NO_EXPORT void slotUpdateLineNumberAreaWidth(int newBlockCount);
62 KSIEVEUI_NO_EXPORT void slotUpdateLineNumberArea(const QRect &, int);
63 KSIEVEUI_NO_EXPORT void slotHelp();
64 KSIEVEUI_NO_EXPORT void slotEditRule();
65 [[nodiscard]] KSIEVEUI_NO_EXPORT bool openVariableHelp();
66 KSIEVEUI_NO_EXPORT bool overrideShortcut(QKeyEvent *event);
67 [[nodiscard]] KSIEVEUI_NO_EXPORT QStringList completerList() const;
68 KSIEVEUI_NO_EXPORT void setCompleterList(const QStringList &list);
69 [[nodiscard]] KSIEVEUI_NO_EXPORT QString selectedWord(QPoint pos = QPoint()) const;
70
71 std::unique_ptr<SieveTextEditPrivate> const d;
72};
73}
The SieveTextEdit class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:09:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.