Messagelib

dkimmanageruleswidget.h
1 /*
2  SPDX-FileCopyrightText: 2019-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 #include "messageviewer_export.h"
9 #include <MessageViewer/DKIMRule>
10 #include <QTreeWidgetItem>
11 #include <QWidget>
12 class QTreeWidget;
13 namespace MessageViewer
14 {
15 class DKIMManageRulesComboBox;
16 /**
17  * @brief The DKIMManageRulesWidgetItem class
18  * @author Laurent Montel <[email protected]>
19  */
20 class MESSAGEVIEWER_EXPORT DKIMManageRulesWidgetItem : public QTreeWidgetItem
21 {
22 public:
23  enum ColumnType {
24  Enabled = 0,
25  Domain = 1,
26  ListId = 2,
27  From = 3,
28  SDid = 4,
29  RuleType = 5,
30  Priority = 6,
31  };
32 
33  explicit DKIMManageRulesWidgetItem(QTreeWidget *parent = nullptr);
34  ~DKIMManageRulesWidgetItem() override;
35 
36  Q_REQUIRED_RESULT MessageViewer::DKIMRule rule() const;
37  void setRule(const MessageViewer::DKIMRule &rule);
38 
39 private:
40  void updateInfo();
42  DKIMManageRulesComboBox *const mRuleTypeCombobox;
43 };
44 
45 /**
46  * @brief The DKIMManageRulesWidget class
47  * @author Laurent Montel <[email protected]>
48  */
49 class MESSAGEVIEWER_EXPORT DKIMManageRulesWidget : public QWidget
50 {
51  Q_OBJECT
52 public:
53  explicit DKIMManageRulesWidget(QWidget *parent = nullptr);
54  ~DKIMManageRulesWidget() override;
55  void loadSettings();
56  void saveSettings();
57  Q_REQUIRED_RESULT QByteArray saveHeaders() const;
58  void restoreHeaders(const QByteArray &header);
59 
60  void addRule();
61  Q_REQUIRED_RESULT QVector<MessageViewer::DKIMRule> rules() const;
62 
63 private:
64  void modifyRule(DKIMManageRulesWidgetItem *rulesItem);
65  void slotCustomContextMenuRequested(const QPoint &);
66  void duplicateRule(DKIMManageRulesWidgetItem *rulesItem);
67  QTreeWidget *const mTreeWidget;
68 };
69 }
The DKIMManageRulesWidgetItem class.
The DKIMManageRulesWidget class.
The DKIMRule class.
Definition: dkimrule.h:17
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 23:04:53 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.