File indexing completed on 2024-12-29 04:54:44

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 "sieveeditorgraphicalmodewidgetabstract.h"
0011 #include "util/sieveimapaccountsettings.h"
0012 class QSplitter;
0013 class QStackedWidget;
0014 
0015 namespace KSieveUi
0016 {
0017 class SieveScriptPage;
0018 class SieveScriptListBox;
0019 class SieveEditorParsingMissingFeatureWarning;
0020 class KSIEVEUI_TESTS_EXPORT SieveEditorGraphicalModeWidget : public SieveEditorGraphicalModeWidgetAbstract
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit SieveEditorGraphicalModeWidget(QWidget *parent = nullptr);
0025     ~SieveEditorGraphicalModeWidget() override;
0026 
0027     [[nodiscard]] QString script(QStringList &required) const override;
0028 
0029     void setSieveCapabilities(const QStringList &capabilities) override;
0030     [[nodiscard]] QStringList sieveCapabilities() override;
0031 
0032     void loadScript(const QString &doc, QString &error) override;
0033 
0034     [[nodiscard]] QString currentscript() override;
0035     void setImportScript(const QString &) override;
0036 
0037     void setListOfIncludeFile(const QStringList &listOfIncludeFile) override;
0038     [[nodiscard]] QStringList listOfIncludeFile() const override;
0039 
0040 Q_SIGNALS:
0041     void enableButtonOk(bool);
0042     void switchTextMode(const QString &script);
0043     void valueChanged();
0044 
0045 private:
0046     void readConfig();
0047     void writeConfig();
0048 
0049 private Q_SLOTS:
0050     void slotSwitchToTextMode();
0051     void slotAddScriptPage(KSieveUi::SieveScriptPage *page);
0052     void slotRemoveScriptPage(QWidget *page);
0053     void slotActivateScriptPage(QWidget *page);
0054 
0055 private:
0056     QStringList mCapabilities;
0057     QStringList mListOfIncludeFile;
0058     SieveScriptListBox *const mSieveScript;
0059     QStackedWidget *mStackWidget = nullptr;
0060     QSplitter *const mSplitter;
0061     SieveEditorParsingMissingFeatureWarning *mSieveParsingWarning = nullptr;
0062 };
0063 }