Libksieve

sieveeditortextmodewidget.h
1/* SPDX-FileCopyrightText: 2013-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 "sieveeditorabstractwidget.h"
10class QSplitter;
11namespace TextAddonsWidgets
12{
13class SlideContainer;
14}
15namespace TextCustomEditor
16{
17class TextGoToLineWidget;
18class PlainTextEditFindBar;
19class PlainTextEditor;
20class PlainTextEditorWidget;
21}
22namespace PimCommon
23{
24class PurposeMenuMessageWidget;
25}
26#ifdef HAVE_KTEXTADDONS_TEXT_TO_SPEECH_SUPPORT
28{
29class TextToSpeechContainerWidget;
30}
31#endif
32namespace KSieveUi
33{
34class SieveTextEdit;
35class SieveEditorWarning;
36class SieveEditorParsingMissingFeatureWarning;
37class SieveEditorTabWidget;
38class SieveTemplateWidget;
39/**
40 * @brief The SieveEditorTextModeWidget class
41 * @author Laurent Montel <montel@kde.org>
42 */
43class KSIEVEUI_EXPORT SieveEditorTextModeWidget : public SieveEditorAbstractWidget
44{
45 Q_OBJECT
46public:
47 explicit SieveEditorTextModeWidget(QWidget *parent = nullptr);
49
50 void setSieveCapabilities(const QStringList &capabilities);
51 void setReadOnly(bool b);
52
53 [[nodiscard]] QString script() const;
54 void setScript(const QString &script, bool clearUndoRedo = false);
55
56 void setDebugScript(const QString &debug);
57
58 [[nodiscard]] QString currentscript() override;
59 void setImportScript(const QString &script) override;
60
61 void createRulesGraphically();
62 void generateXml();
63
64 void showEditorWarning();
65 void hideEditorWarning();
66
67 void showParsingEditorWarning();
68
69 void setParsingEditorWarningError(const QString &script, const QString &error);
70 void replace();
71 void find();
72 void undo();
73 void redo();
74 void paste();
75 void cut();
76 void copy();
77 void checkSpelling();
78 void comment();
79 void uncomment();
80
81 bool isUndoAvailable() const;
82 bool isRedoAvailable() const;
83 bool hasSelection() const;
84
85 void selectAll();
86 void upperCase();
87 void lowerCase();
88 void sentenceCase();
89 void reverseCase();
90 void zoomIn();
91 void zoomOut();
92 [[nodiscard]] QString currentHelpTitle() const;
93 [[nodiscard]] QUrl currentHelpUrl() const;
94 void openBookmarkUrl(const QUrl &url);
95 void debugSieveScript();
96 void zoomReset();
97 void setWordWrap(bool state);
98 [[nodiscard]] bool isWordWrap() const;
99 void print();
100 void printPreview();
101 [[nodiscard]] bool printSupportEnabled() const;
102 [[nodiscard]] bool isTextEditor() const;
103 [[nodiscard]] SieveEditorTabWidget *tabWidget() const;
104
105 void setListOfIncludeFile(const QStringList &listOfIncludeFile);
106 [[nodiscard]] QStringList sieveCapabilities() const;
107
108Q_SIGNALS:
109 void enableButtonOk(bool);
110 void switchToGraphicalMode();
111 void valueChanged();
112 void undoAvailable(bool);
113 void redoAvailable(bool);
114 void copyAvailable(bool);
115 void sieveEditorTabCurrentChanged();
116
117public Q_SLOTS:
118 void slotShowGoToLine();
119 void slotShareError(const QString &message);
120 void slotShareSuccess(const QString &url);
121
122private:
123 KSIEVEUI_NO_EXPORT void slotTextChanged();
124 KSIEVEUI_NO_EXPORT void slotFind();
125 KSIEVEUI_NO_EXPORT void slotReplace();
126 KSIEVEUI_NO_EXPORT void slotGoToLine(int line);
127 KSIEVEUI_NO_EXPORT void readConfig();
128 KSIEVEUI_NO_EXPORT void writeConfig();
129 KSIEVEUI_NO_EXPORT void slotEditRule(const QString &selectedText);
130 KSIEVEUI_NO_EXPORT void slotInsertRule();
131 KSIEVEUI_NO_EXPORT void insertRequires(const QStringList &needToAddRequire);
132 [[nodiscard]] KSIEVEUI_NO_EXPORT QStringList insertNecessaryRequires(const QStringList &requireModules);
133 QString mOriginalScript;
134 QStringList mSieveCapabilities;
135 QStringList mListOfIncludeFile;
136 SieveTextEdit *mTextEdit = nullptr;
137 TextCustomEditor::PlainTextEditorWidget *mDebugTextEdit = nullptr;
138 TextCustomEditor::PlainTextEditFindBar *mFindBar = nullptr;
139#ifdef HAVE_KTEXTADDONS_TEXT_TO_SPEECH_SUPPORT
140 TextEditTextToSpeech::TextToSpeechContainerWidget *mTextToSpeechWidget = nullptr;
141#endif
142 QSplitter *mMainSplitter = nullptr;
143 QSplitter *mTemplateSplitter = nullptr;
144 SieveEditorWarning *mSieveEditorWarning = nullptr;
145 SieveEditorParsingMissingFeatureWarning *mSieveParsingWarning = nullptr;
146 SieveEditorTabWidget *mTabWidget = nullptr;
147 TextCustomEditor::TextGoToLineWidget *mGoToLine = nullptr;
148 TextAddonsWidgets::SlideContainer *mGotoLineSliderContainer = nullptr;
149 TextAddonsWidgets::SlideContainer *mSliderContainer = nullptr;
150 SieveTemplateWidget *mSieveTemplateWidget = nullptr;
151 QWidget *mEditorWidget = nullptr;
152 PimCommon::PurposeMenuMessageWidget *const mPurposeMenuMessageWidget;
153};
154}
The SieveEditorTabWidget class.
The SieveEditorTextModeWidget class.
The SieveTextEdit class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:10 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.