Libksieve

selectheadertypecombobox.h
1 /*
2  SPDX-FileCopyrightText: 2013-2021 Laurent Montel <[email protected]>
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 
13 class QLineEdit;
14 class QPushButton;
15 namespace KSieveUi
16 {
17 class SelectHeadersWidget : public QListWidget
18 {
19  Q_OBJECT
20 public:
21  explicit SelectHeadersWidget(QWidget *parent = nullptr);
22  ~SelectHeadersWidget() override;
23 
24  Q_REQUIRED_RESULT QString headers() const;
25  void setListHeaders(const QMap<QString, QString> &lst, const QStringList &selectedHeaders);
26  void addNewHeader(const QString &header);
27 
28 private:
29  enum HeaderEnum { HeaderId = Qt::UserRole + 1 };
30 
31  void init();
32 };
33 
34 class SelectHeadersDialog : public QDialog
35 {
36  Q_OBJECT
37 public:
38  explicit SelectHeadersDialog(QWidget *parent = nullptr);
39  ~SelectHeadersDialog();
40 
41  Q_REQUIRED_RESULT QString headers() const;
42  void setListHeaders(const QMap<QString, QString> &lst, const QStringList &selectedHeaders);
43 
44 private:
45  void slotNewHeaderTextChanged(const QString &text);
46  void slotAddNewHeader();
47  void readConfig();
48  void writeConfig();
49  SelectHeadersWidget *mListWidget = nullptr;
50  QLineEdit *mNewHeader = nullptr;
51  QPushButton *mAddNewHeader = nullptr;
52 };
53 
54 class SelectHeaderTypeComboBox : public QComboBox
55 {
56  Q_OBJECT
57 public:
58  explicit SelectHeaderTypeComboBox(bool onlyEnvelopType = false, QWidget *parent = nullptr);
59  ~SelectHeaderTypeComboBox();
60 
61  Q_REQUIRED_RESULT QString code() const;
62  void setCode(const QString &code);
63 
64 Q_SIGNALS:
65  void valueChanged();
66 
67 private Q_SLOTS:
68  void slotSelectItem(const QString &str);
69 
70 private:
71  void initialize(bool onlyEnvelopType);
72  void changeReadOnlyStatus();
73  void headerMap(bool onlyEnvelopType);
74  QMap<QString, QString> mHeaderMap;
75  QString mCode;
76 };
77 }
78 
KCRASH_EXPORT void initialize()
Q_OBJECTQ_OBJECT
UserRole
QCA_EXPORT void init()
void readConfig()
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Apr 11 2021 23:09:36 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.