configuresecuritypage.h 2.95 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
/*
Laurent Montel's avatar
Laurent Montel committed
2
  SPDX-FileCopyrightText: 2013-2021 Laurent Montel <montel@kde.org>
Laurent Montel's avatar
Laurent Montel committed
3

4
  SPDX-License-Identifier: GPL-2.0-only
Laurent Montel's avatar
Laurent Montel committed
5
6
*/

Laurent Montel's avatar
Laurent Montel committed
7
#pragma once
Laurent Montel's avatar
Laurent Montel committed
8
9

#include "configuredialog_p.h"
Laurent Montel's avatar
Laurent Montel committed
10
11
#include "kmail_export.h"
#include "ui_composercryptoconfiguration.h"
Laurent Montel's avatar
Laurent Montel committed
12
13
#include "ui_securitypagegeneraltab.h"
#include "ui_securitypagemdntab.h"
14
#include "ui_smimeconfiguration.h"
Laurent Montel's avatar
Laurent Montel committed
15
#include "ui_warningconfiguration.h"
16

Laurent Montel's avatar
Laurent Montel committed
17
18
#include <KCMultiDialog>

Laurent Montel's avatar
Laurent Montel committed
19
20
namespace QGpgME
{
21
class CryptoConfig;
Laurent Montel's avatar
Laurent Montel committed
22
23
}

Laurent Montel's avatar
Laurent Montel committed
24
25
class SecurityPageGeneralTab : public ConfigModuleTab
{
Laurent Montel's avatar
Laurent Montel committed
26
27
    Q_OBJECT
public:
Laurent Montel's avatar
Laurent Montel committed
28
    explicit SecurityPageGeneralTab(QWidget *parent = nullptr);
Laurent Montel's avatar
Laurent Montel committed
29
    Q_REQUIRED_RESULT QString helpAnchor() const;
Laurent Montel's avatar
Laurent Montel committed
30

31
    void save() override;
Laurent Montel's avatar
Laurent Montel committed
32
33

private:
34
    void doLoadOther() override;
Laurent Montel's avatar
Laurent Montel committed
35
36

private:
37
    void slotOpenExternalReferenceExceptions();
Laurent Montel's avatar
Laurent Montel committed
38
    void slotLinkClicked(const QString &link);
Laurent Montel's avatar
Laurent Montel committed
39
    Ui_SecurityPageGeneralTab mSGTab;
Laurent Montel's avatar
Laurent Montel committed
40
41
};

Laurent Montel's avatar
Laurent Montel committed
42
43
class SecurityPageMDNTab : public ConfigModuleTab
{
Laurent Montel's avatar
Laurent Montel committed
44
45
    Q_OBJECT
public:
Laurent Montel's avatar
Laurent Montel committed
46
    explicit SecurityPageMDNTab(QWidget *parent = nullptr);
Laurent Montel's avatar
Laurent Montel committed
47
48
    QString helpAnchor() const;

49
    void save() override;
Laurent Montel's avatar
Laurent Montel committed
50
51

private:
52
    void doLoadOther() override;
Laurent Montel's avatar
Laurent Montel committed
53
54

private:
Laurent Montel's avatar
Laurent Montel committed
55
    void slotLinkClicked(const QString &link);
Laurent Montel's avatar
Laurent Montel committed
56
57
    QButtonGroup *mMDNGroup = nullptr;
    QButtonGroup *mOrigQuoteGroup = nullptr;
Laurent Montel's avatar
Laurent Montel committed
58
59
60
    Ui_SecurityPageMDNTab mUi;
};

Laurent Montel's avatar
Laurent Montel committed
61
62
class SecurityPageComposerCryptoTab : public ConfigModuleTab
{
Laurent Montel's avatar
Laurent Montel committed
63
64
    Q_OBJECT
public:
Laurent Montel's avatar
Laurent Montel committed
65
    explicit SecurityPageComposerCryptoTab(QWidget *parent = nullptr);
Laurent Montel's avatar
Laurent Montel committed
66
    ~SecurityPageComposerCryptoTab() override;
Laurent Montel's avatar
Laurent Montel committed
67
68
69

    QString helpAnchor() const;

70
    void save() override;
Laurent Montel's avatar
Laurent Montel committed
71
72

private:
73
74
    void doLoadFromGlobalSettings() override;
    void doLoadOther() override;
Laurent Montel's avatar
Laurent Montel committed
75
76

private:
Laurent Montel's avatar
Laurent Montel committed
77
    Ui::ComposerCryptoConfiguration *mWidget = nullptr;
Laurent Montel's avatar
Laurent Montel committed
78
79
};

Laurent Montel's avatar
Laurent Montel committed
80
81
class SecurityPageWarningTab : public ConfigModuleTab
{
Laurent Montel's avatar
Laurent Montel committed
82
83
    Q_OBJECT
public:
Laurent Montel's avatar
Laurent Montel committed
84
    explicit SecurityPageWarningTab(QWidget *parent = nullptr);
Laurent Montel's avatar
Laurent Montel committed
85
    ~SecurityPageWarningTab() override;
Laurent Montel's avatar
Laurent Montel committed
86
87
88

    QString helpAnchor() const;

89
    void save() override;
Laurent Montel's avatar
Laurent Montel committed
90

Laurent Montel's avatar
Laurent Montel committed
91
private:
Laurent Montel's avatar
Laurent Montel committed
92
93
    void slotReenableAllWarningsClicked();
    void slotConfigureGnupg();
94
95
    void doLoadFromGlobalSettings() override;
    void doLoadOther() override;
Laurent Montel's avatar
Laurent Montel committed
96
97

private:
Laurent Montel's avatar
Laurent Montel committed
98
    Ui::WarningConfiguration *mWidget = nullptr;
Laurent Montel's avatar
Laurent Montel committed
99
100
};

Laurent Montel's avatar
Laurent Montel committed
101
102
class SecurityPageSMimeTab : public ConfigModuleTab
{
Laurent Montel's avatar
Laurent Montel committed
103
104
    Q_OBJECT
public:
Laurent Montel's avatar
Laurent Montel committed
105
    explicit SecurityPageSMimeTab(QWidget *parent = nullptr);
Laurent Montel's avatar
Laurent Montel committed
106
    ~SecurityPageSMimeTab() override;
Laurent Montel's avatar
Laurent Montel committed
107
108
109

    QString helpAnchor() const;

110
    void save() override;
Laurent Montel's avatar
Laurent Montel committed
111

Laurent Montel's avatar
Laurent Montel committed
112
private Q_SLOTS:
Laurent Montel's avatar
Laurent Montel committed
113
114
115
    void slotUpdateHTTPActions();

private:
116
    void doLoadOther() override;
Laurent Montel's avatar
Laurent Montel committed
117
118

private:
Laurent Montel's avatar
Laurent Montel committed
119
    Ui::SMimeConfiguration *const mWidget;
Laurent Montel's avatar
Laurent Montel committed
120
    QGpgME::CryptoConfig *mConfig = nullptr;
Laurent Montel's avatar
Laurent Montel committed
121
122
};

Laurent Montel's avatar
Laurent Montel committed
123
124
125
126
class GpgSettingsDialog : public KCMultiDialog
{
    Q_OBJECT
public:
Laurent Montel's avatar
Laurent Montel committed
127
    explicit GpgSettingsDialog(QWidget *parent = nullptr);
Laurent Montel's avatar
Laurent Montel committed
128
    ~GpgSettingsDialog();
Laurent Montel's avatar
Laurent Montel committed
129

Laurent Montel's avatar
Laurent Montel committed
130
131
132
133
134
private:
    void readConfig();
    void saveConfig();
};

Laurent Montel's avatar
Laurent Montel committed
135
136
class KMAIL_EXPORT SecurityPage : public ConfigModuleWithTabs
{
Laurent Montel's avatar
Laurent Montel committed
137
138
    Q_OBJECT
public:
Laurent Montel's avatar
Laurent Montel committed
139
    explicit SecurityPage(QWidget *parent = nullptr, const QVariantList &args = {});
Laurent Montel's avatar
Laurent Montel committed
140

141
    QString helpAnchor() const override;
Laurent Montel's avatar
Laurent Montel committed
142
143
};