Libksieve

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