1 /* -*- mode: c++; c-basic-offset:4 -*-
2     conf/dirservconfigpage.h
3 
4     This file is part of Kleopatra, the KDE keymanager
5     SPDX-FileCopyrightText: 2004, 2008 Klarälvdalens Datakonsult AB
6 
7     SPDX-License-Identifier: GPL-2.0-or-later
8 */
9 
10 #pragma once
11 
12 #include <KCModule>
13 
14 #include <QGpgME/CryptoConfig>
15 
16 class QCheckBox;
17 class QLabel;
18 class QLineEdit;
19 class QTimeEdit;
20 class QSpinBox;
21 namespace Kleo
22 {
23 class DirectoryServicesWidget;
24 }
25 
26 /**
27  * "Directory Services" configuration page for kleopatra's configuration dialog
28  * The user can configure LDAP servers in this page, to be used for listing/fetching
29  * remote certificates in kleopatra.
30  */
31 class DirectoryServicesConfigurationPage : public KCModule
32 {
33     Q_OBJECT
34 public:
35     explicit DirectoryServicesConfigurationPage(QWidget *parent = nullptr, const QVariantList &args = QVariantList());
36 
37     void load() override;
38     void save() override;
39     void defaults() override;
40 
41 private:
42     enum EntryMultiplicity {
43         SingleValue,
44         ListValue
45     };
46     enum ShowError {
47         DoNotShowError,
48         DoShowError
49     };
50 
51     QGpgME::CryptoConfigEntry *configEntry(const char *componentName,
52                                            const char *entryName,
53                                            QGpgME::CryptoConfigEntry::ArgType argType,
54                                            EntryMultiplicity multiplicity,
55                                            ShowError showError);
56 
57 private:
58     QLineEdit *mOpenPGPKeyserverEdit = nullptr;
59     Kleo::DirectoryServicesWidget *mWidget = nullptr;
60     QTimeEdit *mTimeout = nullptr;
61     QSpinBox *mMaxItems = nullptr;
62     QLabel *mMaxItemsLabel = nullptr;
63     QCheckBox *mAddNewServersCB = nullptr;
64 
65     QGpgME::CryptoConfigEntry *mX509ServicesEntry = nullptr;
66     QGpgME::CryptoConfigEntry *mOpenPGPServiceEntry = nullptr;
67     QGpgME::CryptoConfigEntry *mTimeoutConfigEntry = nullptr;
68     QGpgME::CryptoConfigEntry *mMaxItemsConfigEntry = nullptr;
69     QGpgME::CryptoConfigEntry *mAddNewServersConfigEntry = nullptr;
70 
71     QGpgME::CryptoConfig *mConfig = nullptr;
72 };
73