Libksieve

sieveconditionwidgetlister.h
1 /*
2  SPDX-FileCopyrightText: 2013-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <Libkdepim/KWidgetLister>
10 #include <QVector>
11 class QPushButton;
12 class QGridLayout;
13 class QXmlStreamReader;
14 class QToolButton;
15 class QComboBox;
16 
17 namespace KSieveUi
18 {
19 class SieveCondition;
20 class SieveHelpButton;
21 class SieveEditorGraphicalModeWidget;
22 class SieveConditionWidget : public QWidget
23 {
24  Q_OBJECT
25 public:
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 
34 Q_SIGNALS:
35  void addWidget(QWidget *w);
36  void removeWidget(QWidget *w);
37  void valueChanged();
38 
39 private:
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 
57 class SieveConditionWidgetLister : public KPIM::KWidgetLister
58 {
59  Q_OBJECT
60 public:
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 
68 Q_SIGNALS:
69  void valueChanged();
70 
71 public Q_SLOTS:
72  void slotAddWidget(QWidget *w);
73  void slotRemoveWidget(QWidget *w);
74 
75 protected:
76  void clearWidget(QWidget *aWidget) override;
77  QWidget *createWidget(QWidget *parent) override;
78 
79 private:
80  void loadTest(QXmlStreamReader &e, bool notCondition, QString &error);
81  void reconnectWidget(SieveConditionWidget *w);
82  void updateAddRemoveButton();
83  SieveEditorGraphicalModeWidget *mSieveGraphicalModeWidget = nullptr;
84 };
85 }
86 
Q_SIGNALSQ_SIGNALS
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Apr 15 2021 23:09:37 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.