Libksieve

sieveeditorwidget.h
1/*
2 SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5
6*/
7
8#pragma once
9#include "ksieveui_export.h"
10
11#include <QWidget>
12class QStackedWidget;
13class QLineEdit;
14class QAction;
15namespace KSieveCore
16{
17class SieveImapAccountSettings;
18}
19namespace KSieveUi
20{
21class SieveEditorTextModeWidget;
22class SieveEditorGraphicalModeWidget;
23/**
24 * @brief The SieveEditorWidget class
25 * @author Laurent Montel <montel@kde.org>
26 */
27class KSIEVEUI_EXPORT SieveEditorWidget : public QWidget
28{
29 Q_OBJECT
30public:
31 explicit SieveEditorWidget(bool useMenuBar, QWidget *parent = nullptr);
32 ~SieveEditorWidget() override;
33 enum EditorMode { Unknown = -1, TextMode = 0, GraphicMode = 1 };
34
35 void setReadOnly(bool b);
36 [[nodiscard]] QString script() const;
37 [[nodiscard]] QString originalScript() const;
38 void setScript(const QString &script, bool clearUndoRedo = false);
39 void setDebugScript(const QString &debug);
40 void setScriptName(const QString &name);
41
42 void resultDone();
43
44 void setSieveCapabilities(const QStringList &capabilities);
45 void setSieveImapAccountSettings(const KSieveCore::SieveImapAccountSettings &sieveImapAccountSettings);
46 void setListOfIncludeFile(const QStringList &listOfIncludeFile);
47
48 void addFailedMessage(const QString &err);
49 void addOkMessage(const QString &msg);
50 void addNormalMessage(const QString &msg);
51
52 void setModified(bool b);
53 [[nodiscard]] bool isModified() const;
54
55 [[nodiscard]] EditorMode mode() const;
56
57 [[nodiscard]] bool isRedoAvailable() const;
58 [[nodiscard]] bool isUndoAvailable() const;
59 [[nodiscard]] bool hasSelection() const;
60
61 void checkSpelling();
62 void import();
63 void lowerCase();
64 void upperCase();
65 void sentenceCase();
66 void reverseCase();
67 void zoomOut();
68 void zoomIn();
69 [[nodiscard]] QString currentHelpTitle() const;
70 [[nodiscard]] QUrl currentHelpUrl() const;
71 void openBookmarkUrl(const QUrl &url);
72 void debugSieveScript();
73 void zoomReset();
74 bool isWordWrap() const;
75
76 void updateOriginalScript();
77 void print();
78 void printPreview();
79
80 bool printSupportEnabled() const;
81 bool isTextEditor() const;
82public Q_SLOTS:
83 void find();
84 void replace();
85 void undo();
86 void redo();
87 void paste();
88 void copy();
89 void cut();
90 void selectAll();
91 void goToLine();
92 void slotSaveAs();
93 void slotImport();
94 void slotCreateRulesGraphically();
95 void slotCheckSyntax();
96 void comment();
97 void uncomment();
98 void setWordWrap(bool state);
99
100Q_SIGNALS:
101 void checkSyntax();
102 void enableButtonOk(bool b);
103 void valueChanged(bool b);
104 void modeEditorChanged(KSieveUi::SieveEditorWidget::EditorMode);
105 void undoAvailable(bool);
106 void redoAvailable(bool);
107 void copyAvailable(bool);
108 void changeModeEditor(bool);
109 void sieveEditorTabCurrentChanged();
110
111private:
112 KSIEVEUI_NO_EXPORT void slotEnableButtonOk(bool b);
113 KSIEVEUI_NO_EXPORT void slotGenerateXml();
114 KSIEVEUI_NO_EXPORT void slotSwitchMode();
115 KSIEVEUI_NO_EXPORT void slotSwitchTextMode(const QString &script);
116 KSIEVEUI_NO_EXPORT void slotSwitchToGraphicalMode();
117 KSIEVEUI_NO_EXPORT void slotModified();
118 KSIEVEUI_NO_EXPORT void changeSwitchButtonText();
119 KSIEVEUI_NO_EXPORT void changeMode(EditorMode mode);
120 KSIEVEUI_NO_EXPORT void addMessageEntry(const QString &errorMsg, const QColor &color);
121 KSIEVEUI_NO_EXPORT void slotServerInfo();
122 QString mOriginalScript;
123 SieveEditorTextModeWidget *mTextModeWidget = nullptr;
124 SieveEditorGraphicalModeWidget *mGraphicalModeWidget = nullptr;
125 QStackedWidget *mStackedWidget = nullptr;
126 QLineEdit *mScriptName = nullptr;
127 QAction *mCheckSyntax = nullptr;
128 QAction *mSwitchMode = nullptr;
129 QAction *mCreateRulesGraphically = nullptr;
130 QAction *mSaveAs = nullptr;
131 QAction *mGenerateXml = nullptr;
132 QAction *mServerInfo = nullptr;
133 EditorMode mMode = EditorMode::TextMode;
134 bool mModified = false;
135 bool mDebug = false;
136};
137}
The SieveImapAccountSettings class.
The SieveEditorTextModeWidget class.
The SieveEditorWidget class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:19 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.