Libksieve

sieveactionwidgetlister.h
1/*
2 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "sieveglobalvariablewidget.h"
10#include <Libkdepim/KWidgetLister>
11class QPushButton;
12class QComboBox;
13class QGridLayout;
14class QToolButton;
16
17namespace KSieveUi
18{
19class SieveAction;
20class SieveHelpButton;
21class SieveEditorGraphicalModeWidget;
22class SieveActionWidget : public QWidget
23{
25public:
26 explicit SieveActionWidget(SieveEditorGraphicalModeWidget *graphicalModeWidget, QWidget *parent);
27 ~SieveActionWidget() override;
28
29 void updateAddRemoveButton(bool addButtonEnabled, bool removeButtonEnabled);
30 void generatedScript(QString &script, QStringList &required, bool onlyActions, bool inForEveryPartLoop);
31 void setAction(const QString &actionName, QXmlStreamReader &element, const QString &comment, QString &error);
32 [[nodiscard]] bool isConfigurated() const;
33 void clear();
34
35 void setLocaleVariable(const SieveGlobalVariableActionWidget::VariableElement &var);
36
38 void addWidget(QWidget *w);
39 void removeWidget(QWidget *w);
40 void valueChanged();
41
42private:
43 void slotAddWidget();
44 void slotRemoveWidget();
45 void slotActionChanged(int index);
46 void slotHelp();
47 void slotAddComment();
48 void setFilterAction(QWidget *widget);
49 void initWidget();
51 QPushButton *mAdd = nullptr;
52 QPushButton *mRemove = nullptr;
53 QComboBox *mComboBox = nullptr;
54 QGridLayout *mLayout = nullptr;
55 SieveHelpButton *mHelpButton = nullptr;
56 QToolButton *mCommentButton = nullptr;
57 SieveEditorGraphicalModeWidget *const mSieveGraphicalModeWidget;
58};
59
60class SieveActionWidgetLister : public KPIM::KWidgetLister
61{
63public:
64 explicit SieveActionWidgetLister(SieveEditorGraphicalModeWidget *graphicalModeWidget, QWidget *parent = nullptr);
65 ~SieveActionWidgetLister() override;
66
67 void generatedScript(QString &script, QStringList &requireModules, bool onlyActions, bool inForEveryPartLoop);
68 void loadScript(QXmlStreamReader &element, bool onlyActions, QString &error);
69
70 int actionNumber() const;
71
72 void loadLocalVariable(const SieveGlobalVariableActionWidget::VariableElement &var);
73public Q_SLOTS:
74 void slotAddWidget(QWidget *w);
75 void slotRemoveWidget(QWidget *w);
76
78 void valueChanged();
79
80protected:
81 void clearWidget(QWidget *aWidget) override;
82 QWidget *createWidget(QWidget *parent) override;
83
84private:
85 void reconnectWidget(SieveActionWidget *w);
86 void updateAddRemoveButton();
87
88 SieveEditorGraphicalModeWidget *const mSieveGraphicalModeWidget;
89};
90}
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.