Libksieve

selectheadertypecombobox.h
1/*
2 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6#pragma once
7
8#include <QComboBox>
9#include <QDialog>
10
11#include <QListWidget>
12
13class QLineEdit;
14class QPushButton;
15namespace KSieveUi
16{
17class SelectHeadersWidget : public QListWidget
18{
20public:
21 explicit SelectHeadersWidget(QWidget *parent = nullptr);
22 ~SelectHeadersWidget() override;
23
24 [[nodiscard]] QString headers() const;
25 void setListHeaders(const QMap<QString, QString> &lst, const QStringList &selectedHeaders);
26 void addNewHeader(const QString &header);
27
28private:
29 enum HeaderEnum {
30 HeaderId = Qt::UserRole + 1
31 };
32
33 void init();
34};
35
36class SelectHeadersDialog : public QDialog
37{
39public:
40 explicit SelectHeadersDialog(QWidget *parent = nullptr);
41 ~SelectHeadersDialog() override;
42
43 [[nodiscard]] QString headers() const;
44 void setListHeaders(const QMap<QString, QString> &lst, const QStringList &selectedHeaders);
45
46private:
47 void slotNewHeaderTextChanged(const QString &text);
48 void slotAddNewHeader();
49 void readConfig();
50 void writeConfig();
51 SelectHeadersWidget *const mListWidget;
52 QLineEdit *const mNewHeader;
53 QPushButton *const mAddNewHeader;
54};
55
56class SelectHeaderTypeComboBox : public QComboBox
57{
59public:
60 explicit SelectHeaderTypeComboBox(bool onlyEnvelopType = false, QWidget *parent = nullptr);
61 ~SelectHeaderTypeComboBox() override;
62
63 [[nodiscard]] QString code() const;
64 void setCode(const QString &code);
65
67 void valueChanged();
68
69private Q_SLOTS:
70 void slotSelectItem(const QString &str);
71
72private:
73 [[nodiscard]] const QString getSelectMultipleHeadersTranslated() const;
74 void initialize(bool onlyEnvelopType);
75 void changeReadOnlyStatus();
76 void headerMap(bool onlyEnvelopType);
77 QMap<QString, QString> mHeaderMap;
78 QString mCode;
79};
80}
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
UserRole
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.