File indexing completed on 2025-01-05 04:49:17

0001 /*
0002     SPDX-FileCopyrightText: 2004 Klarävdalens Datakonsult AB
0003     SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0006 */
0007 
0008 #pragma once
0009 
0010 #include <Akonadi/ContactEditorPagePlugin>
0011 
0012 namespace Kleo
0013 {
0014 class KeyRequester;
0015 }
0016 
0017 class QComboBox;
0018 class QCheckBox;
0019 
0020 class CryptoPagePlugin : public Akonadi::ContactEditorPagePlugin
0021 {
0022     Q_OBJECT
0023     Q_INTERFACES(Akonadi::ContactEditorPagePlugin)
0024     Q_PLUGIN_METADATA(IID "org.kde.kaddressbook.CryptoPagePlugin")
0025 public:
0026     CryptoPagePlugin();
0027     ~CryptoPagePlugin() override;
0028     [[nodiscard]] QString title() const override;
0029     void loadContact(const KContacts::Addressee &contact) override;
0030     void storeContact(KContacts::Addressee &contact) const override;
0031     void setReadOnly(bool readOnly) override;
0032 
0033 private:
0034     enum { NumberOfProtocols = 4 };
0035     QCheckBox *mProtocolCB[NumberOfProtocols];
0036     QComboBox *mSignPref = nullptr;
0037     QComboBox *mCryptPref = nullptr;
0038     Kleo::KeyRequester *const mPgpKey;
0039     Kleo::KeyRequester *const mSmimeCert;
0040     bool mReadOnly = false;
0041 };