Astyle kdelibs
[kdepim.git] / sieveeditor / sieveeditormainwidget.h
blob68cd7887a94c2427a6103fbc84c332e3f7758408
1 /*
2 Copyright (c) 2013-2016 Montel Laurent <montel@kde.org>
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
21 #ifndef SIEVEEDITORMAINWIDGET_H
22 #define SIEVEEDITORMAINWIDGET_H
24 #include <QSplitter>
25 #include <QUrl>
26 #include "ksieveui/sieveeditorwidget.h"
27 class QTabWidget;
28 class QStackedWidget;
29 class SieveEditorTabWidget;
30 class SieveEditorScriptManagerWidget;
31 class SieveEditorPageWidget;
32 class SieveEditorEmptyTabWidgetLabel;
33 class SieveEditorMainWidget : public QSplitter
35 Q_OBJECT
36 public:
37 explicit SieveEditorMainWidget(QWidget *parent = Q_NULLPTR);
38 ~SieveEditorMainWidget();
40 void createNewScript();
41 void deleteScript();
42 void updateServerList();
43 void editScript();
44 void desactivateScript();
45 void refreshList();
46 void uploadScript();
47 bool needToSaveScript();
49 QTabWidget *tabWidget() const;
51 KSieveUi::SieveEditorWidget::EditorMode pageMode() const;
52 bool isUndoAvailable() const;
53 bool isRedoAvailable() const;
54 bool isWordWrap() const;
56 bool hasSelection() const;
57 QString currentHelpTitle() const;
58 QUrl currentHelpUrl() const;
59 void openBookmarkUrl(const QUrl &url);
60 public Q_SLOTS:
61 void slotDebugSieveScript();
62 void slotGoToLine();
64 void slotReplace();
65 void slotFind();
66 void slotCopy();
67 void slotPaste();
68 void slotCut();
69 void slotSaveAs();
70 void slotCheckSpelling();
71 void slotShare();
72 void slotImport();
73 void slotAutoGenerateScript();
74 void slotCheckSyntax();
75 void slotComment();
76 void slotUncomment();
77 void slotUpperCase();
78 void slotSentenceCase();
79 void slotLowerCase();
80 void slotReverseCase();
81 void slotZoomIn();
82 void slotZoomOut();
83 void slotZoomReset();
84 void slotWordWrap(bool);
86 Q_SIGNALS:
87 void updateButtons(bool newScriptAction, bool editScriptAction, bool deleteScriptAction, bool desactivateScriptAction);
88 void updateScriptList();
89 void modeEditorChanged(KSieveUi::SieveEditorWidget::EditorMode);
90 void serverSieveFound(bool);
91 void undoAvailable(bool);
92 void redoAvailable(bool);
93 void copyAvailable(bool);
95 private Q_SLOTS:
96 void slotCreateScriptPage(const QUrl &url, const QStringList &capabilities, bool isNewScript);
97 void slotScriptDeleted(const QUrl &url);
98 void slotScriptModified(bool modified, SieveEditorPageWidget *page);
99 void slotGeneralPaletteChanged();
100 void slotTabCloseRequested(int index);
101 void slotTabRemoveAllExclude(int index);
102 void slotUndo();
103 void slotRedo();
104 void slotSelectAll();
105 void slotTabCloseAllRequested();
106 private:
107 void updateStackedWidget();
108 QWidget *hasExistingPage(const QUrl &url);
109 QColor mModifiedScriptColor;
110 QColor mScriptColor;
111 SieveEditorTabWidget *mTabWidget;
112 SieveEditorScriptManagerWidget *mScriptManagerWidget;
113 QStackedWidget *mStackedWidget;
114 SieveEditorEmptyTabWidgetLabel *mEditorEmptyLabel;
117 #endif // SIEVEEDITORMAINWIDGET_H