File indexing completed on 2024-12-29 04:54:45
0001 /* 0002 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "ksieveui_private_export.h" 0010 #include "sievescriptblockwidget.h" 0011 #include <QWidget> 0012 0013 namespace KSieveUi 0014 { 0015 class SieveScriptBlockWidget; 0016 class SieveScriptTabWidget; 0017 class SieveIncludeWidget; 0018 class SieveForEveryPartWidget; 0019 class SieveGlobalVariableWidget; 0020 class SieveEditorGraphicalModeWidget; 0021 class KSIEVEUI_TESTS_EXPORT SieveScriptPage : public QWidget 0022 { 0023 Q_OBJECT 0024 public: 0025 explicit SieveScriptPage(SieveEditorGraphicalModeWidget *sieveEditorGraphicalWidget, QWidget *parent = nullptr); 0026 ~SieveScriptPage() override; 0027 0028 void generatedScript(QString &script, QStringList &required); 0029 0030 [[nodiscard]] SieveIncludeWidget *includeWidget() const; 0031 [[nodiscard]] SieveForEveryPartWidget *forEveryPartWidget() const; 0032 [[nodiscard]] SieveGlobalVariableWidget *globalVariableWidget() const; 0033 [[nodiscard]] SieveScriptBlockWidget *blockIfWidget() const; 0034 [[nodiscard]] SieveScriptBlockWidget *addScriptBlock(KSieveUi::SieveWidgetPageAbstract::PageType type); 0035 0036 void setListOfIncludeFile(const QStringList &lst); 0037 0038 Q_SIGNALS: 0039 void valueChanged(); 0040 0041 private Q_SLOTS: 0042 void slotAddNewBlock(QWidget *widget, KSieveUi::SieveWidgetPageAbstract::PageType type); 0043 void slotCloseTab(int); 0044 0045 private: 0046 [[nodiscard]] SieveScriptBlockWidget *createScriptBlock(KSieveUi::SieveWidgetPageAbstract::PageType type); 0047 [[nodiscard]] bool hasAnElseBlock() const; 0048 [[nodiscard]] QString blockName(SieveWidgetPageAbstract::PageType type) const; 0049 0050 SieveEditorGraphicalModeWidget *const mSieveGraphicalModeWidget; 0051 SieveScriptTabWidget *mTabWidget = nullptr; 0052 SieveIncludeWidget *mIncludeWidget = nullptr; 0053 SieveForEveryPartWidget *mForEveryPartWidget = nullptr; 0054 SieveGlobalVariableWidget *mGlobalVariableWidget = nullptr; 0055 SieveScriptBlockWidget *mBlockIfWidget = nullptr; 0056 }; 0057 }