Libksieve

sieveactionwidgetlister.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 "sieveglobalvariablewidget.h"
10 #include <Libkdepim/KWidgetLister>
11 class QPushButton;
12 class QComboBox;
13 class QGridLayout;
14 class QToolButton;
15 class QXmlStreamReader;
16 
17 namespace KSieveUi
18 {
19 class SieveAction;
20 class SieveHelpButton;
21 class SieveEditorGraphicalModeWidget;
22 class SieveActionWidget : public QWidget
23 {
24  Q_OBJECT
25 public:
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  Q_REQUIRED_RESULT bool isConfigurated() const;
33  void clear();
34 
35  void setLocaleVariable(const SieveGlobalVariableActionWidget::VariableElement &var);
36 
37 Q_SIGNALS:
38  void addWidget(QWidget *w);
39  void removeWidget(QWidget *w);
40  void actionModified();
41  void valueChanged();
42 
43 private:
44  void slotAddWidget();
45  void slotRemoveWidget();
46  void slotActionChanged(int index);
47  void slotHelp();
48  void slotAddComment();
49  void setFilterAction(QWidget *widget);
50  void initWidget();
52  QPushButton *mAdd = nullptr;
53  QPushButton *mRemove = nullptr;
54  QComboBox *mComboBox = nullptr;
55  QGridLayout *mLayout = nullptr;
56  SieveHelpButton *mHelpButton = nullptr;
57  QToolButton *mCommentButton = nullptr;
58  SieveEditorGraphicalModeWidget *const mSieveGraphicalModeWidget;
59 };
60 
61 class SieveActionWidgetLister : public KPIM::KWidgetLister
62 {
63  Q_OBJECT
64 public:
65  explicit SieveActionWidgetLister(SieveEditorGraphicalModeWidget *graphicalModeWidget, QWidget *parent = nullptr);
66  ~SieveActionWidgetLister() override;
67 
68  void generatedScript(QString &script, QStringList &requireModules, bool onlyActions, bool inForEveryPartLoop);
69  void loadScript(QXmlStreamReader &element, bool onlyActions, QString &error);
70 
71  int actionNumber() const;
72 
73  void loadLocalVariable(const SieveGlobalVariableActionWidget::VariableElement &var);
74 public Q_SLOTS:
75  void slotAddWidget(QWidget *w);
76  void slotRemoveWidget(QWidget *w);
77 
78 Q_SIGNALS:
79  void valueChanged();
80 
81 protected:
82  void clearWidget(QWidget *aWidget) override;
83  QWidget *createWidget(QWidget *parent) override;
84 
85 private:
86  void reconnectWidget(SieveActionWidget *w);
87  void updateAddRemoveButton();
88 
89  SieveEditorGraphicalModeWidget *const mSieveGraphicalModeWidget;
90 };
91 }
92 
Q_SIGNALSQ_SIGNALS
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Apr 16 2021 23:09:34 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.