Libksieve

sieveincludewidget.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 "sievewidgetpageabstract.h"
10#include <Libkdepim/KWidgetLister>
11#include <QComboBox>
12
13class QPushButton;
14class QGridLayout;
15class QCheckBox;
17namespace KSieveUi
18{
19class SieveHelpButton;
20class IncludeFileLineEdit;
21class SieveIncludeLocation : public QComboBox
22{
24public:
25 explicit SieveIncludeLocation(QWidget *parent = nullptr);
26 ~SieveIncludeLocation() override;
27
28 [[nodiscard]] QString code() const;
29 void setCode(const QString &code, QString &error);
30
32 void valueChanged();
33
34private:
35 void initialize();
36};
37
38class SieveIncludeActionWidget : public QWidget
39{
41public:
42 explicit SieveIncludeActionWidget(QWidget *parent = nullptr);
43 ~SieveIncludeActionWidget() override;
44
45 void generatedScript(QString &script);
46 void updateAddRemoveButton(bool addButtonEnabled, bool removeButtonEnabled);
47 void loadScript(QXmlStreamReader &element, QString &error);
48 [[nodiscard]] bool isInitialized() const;
49 void clear();
50 void setListOfIncludeFile(const QStringList &listOfIncludeFile);
51
52private Q_SLOTS:
53 void slotAddWidget();
54 void slotRemoveWidget();
55
57 void addWidget(QWidget *w);
58 void removeWidget(QWidget *w);
59 void valueChanged();
60
61private:
62 void initWidget();
63 QPushButton *mAdd = nullptr;
64 QPushButton *mRemove = nullptr;
65 QGridLayout *mLayout = nullptr;
66 QCheckBox *mOptional = nullptr;
67 QCheckBox *mOnce = nullptr;
68 SieveIncludeLocation *mLocation = nullptr;
69 IncludeFileLineEdit *mIncludeFileName = nullptr;
70};
71
72class SieveIncludeWidgetLister : public KPIM::KWidgetLister
73{
75public:
76 explicit SieveIncludeWidgetLister(QWidget *parent = nullptr);
77 ~SieveIncludeWidgetLister() override;
78
79 void generatedScript(QString &script, QStringList &requireModules);
80 void loadScript(QXmlStreamReader &element, QString &error);
81
82 void setListOfIncludeFile(const QStringList &listOfIncludeFile);
83
85 void valueChanged();
86
87public Q_SLOTS:
88 void slotAddWidget(QWidget *w);
89 void slotRemoveWidget(QWidget *w);
90
91protected:
92 void clearWidget(QWidget *aWidget) override;
93 QWidget *createWidget(QWidget *parent) override;
94
95private:
96 void reconnectWidget(SieveIncludeActionWidget *w);
97 void updateAddRemoveButton();
98 QStringList mListOfIncludeFile;
99};
100
101class SieveIncludeWidget : public SieveWidgetPageAbstract
102{
104public:
105 explicit SieveIncludeWidget(QWidget *parent = nullptr);
106 ~SieveIncludeWidget() override;
107
108 void generatedScript(QString &script, QStringList &requireModules, bool inForEveryPartLoop) override;
109
110 void loadScript(QXmlStreamReader &element, QString &error);
111
112 void setListOfIncludeFile(const QStringList &lst);
113private Q_SLOTS:
114 void slotHelp();
115
116private:
117 SieveIncludeWidgetLister *mIncludeLister = nullptr;
118 SieveHelpButton *mHelpButton = nullptr;
119};
120}
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 Fri Nov 22 2024 12:09:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.