File indexing completed on 2024-11-24 04:50:43

0001 // SPDX-FileCopyrightText: 2023 Claudio Cambra <claudio.cambra@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 #pragma once
0005 
0006 #include <KIdentityManagementCore/Identity>
0007 #include <KIdentityManagementQuick/CryptographyBackendInterface>
0008 #include <QAbstractItemModel>
0009 
0010 class IdentityKeyListModel;
0011 
0012 class IdentityCryptographyBackend : public QObject, public KIdentityManagementQuick::CryptographyBackendInterface
0013 {
0014     Q_OBJECT
0015     Q_INTERFACES(KIdentityManagementQuick::CryptographyBackendInterface)
0016 
0017 public:
0018     explicit IdentityCryptographyBackend(QObject *parent = nullptr);
0019 
0020     Q_INVOKABLE QAbstractItemModel *openPgpKeyListModel() const override;
0021     Q_INVOKABLE QAbstractItemModel *smimeKeyListModel() const override;
0022 
0023 protected:
0024     KIdentityManagementCore::Identity identity() const override;
0025     void setIdentity(const KIdentityManagementCore::Identity &identity) override;
0026 
0027 private:
0028     IdentityKeyListModel *m_openPgpKeyListModel = nullptr;
0029     IdentityKeyListModel *m_smimeKeyListModel = nullptr;
0030     KIdentityManagementCore::Identity m_identity;
0031 };