Libksieve

sieveconditionwidgetlister.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 <Libkdepim/KWidgetLister>
10#include <QList>
11class QPushButton;
12class QGridLayout;
14class QToolButton;
15class QComboBox;
16
17namespace KSieveUi
18{
19class SieveCondition;
20class SieveHelpButton;
21class SieveEditorGraphicalModeWidget;
22class SieveConditionWidget : public QWidget
23{
25public:
26 explicit SieveConditionWidget(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QWidget *parent);
27 ~SieveConditionWidget() override;
28
29 void updateAddRemoveButton(bool addButtonEnabled, bool removeButtonEnabled);
30 void generatedScript(QString &script, QStringList &required, bool inForEveryPartLoop);
31 void setCondition(const QString &conditionName, QXmlStreamReader &element, bool notCondition, QString &error);
32 void clear();
33
35 void addWidget(QWidget *w);
36 void removeWidget(QWidget *w);
37 void valueChanged();
38
39private:
40 void slotAddWidget();
41 void slotRemoveWidget();
42 void slotConditionChanged(int index);
43 void slotHelp();
44 void slotAddComment();
45 void initWidget();
46 void setFilterCondition(QWidget *widget);
48 QPushButton *mAdd = nullptr;
49 QPushButton *mRemove = nullptr;
50 QComboBox *mComboBox = nullptr;
51 QGridLayout *mLayout = nullptr;
52 SieveHelpButton *mHelpButton = nullptr;
53 QToolButton *mCommentButton = nullptr;
54 SieveEditorGraphicalModeWidget *const mSieveGraphicalModeWidget;
55};
56
57class SieveConditionWidgetLister : public KPIM::KWidgetLister
58{
60public:
61 explicit SieveConditionWidgetLister(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QWidget *parent = nullptr);
62 ~SieveConditionWidgetLister() override;
63
64 void generatedScript(QString &script, int &numberOfCondition, QStringList &requireModules, bool inForEveryPartLoop);
65 int conditionNumber() const;
66 void loadScript(QXmlStreamReader &element, bool uniqTest, bool notCondition, QString &error);
67
69 void valueChanged();
70
71public Q_SLOTS:
72 void slotAddWidget(QWidget *w);
73 void slotRemoveWidget(QWidget *w);
74
75protected:
76 void clearWidget(QWidget *aWidget) override;
77 QWidget *createWidget(QWidget *parent) override;
78
79private:
80 void loadTest(QXmlStreamReader &e, bool notCondition, QString &error);
81 void reconnectWidget(SieveConditionWidget *w);
82 void updateAddRemoveButton();
83 SieveEditorGraphicalModeWidget *mSieveGraphicalModeWidget = nullptr;
84};
85}
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 Sat Dec 21 2024 16:57:10 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.