File indexing completed on 2024-05-12 05:17:08

0001 // SPDX-FileCopyrightText: 2023 Claudio Cambra <claudio.cambra@kde.org>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 #pragma once
0005 
0006 #include "kidentitymanagementquick_export.h"
0007 
0008 #include <QObject>
0009 #include <QSharedPointer>
0010 
0011 class QAbstractItemModel;
0012 
0013 namespace KIdentityManagementCore
0014 {
0015 class Identity;
0016 }
0017 namespace KIdentityManagementQuick
0018 {
0019 /**
0020  * @brief Defines the interface used by the Cryptography Editor Backend.
0021  *
0022  * This class is held by the CryptographyBackend, which exposes what is
0023  * needed to the Cryptography Editor QtQuick UI.
0024  *
0025  * Contains utility methods to access required objects and data for
0026  * identity-related cryptography editing.
0027  */
0028 class KIDENTITYMANAGEMENTQUICK_EXPORT CryptographyBackendInterface
0029 {
0030     friend class CryptographyEditorBackend;
0031 
0032 public:
0033     virtual ~CryptographyBackendInterface()
0034     {
0035     }
0036 
0037     /**
0038      * A list model providing a list of OpenPGP keys.
0039      */
0040     virtual QAbstractItemModel *openPgpKeyListModel() const = 0;
0041 
0042     /**
0043      * A list model providing a list of S/MIME keys.
0044      */
0045     virtual QAbstractItemModel *smimeKeyListModel() const = 0;
0046 
0047 protected:
0048     /**
0049      * @brief The identity that affects what data to show.
0050      */
0051     virtual KIdentityManagementCore::Identity identity() const = 0;
0052     virtual void setIdentity(const KIdentityManagementCore::Identity &identity) = 0;
0053 };
0054 
0055 using CryptographyBackendInterfacePtr = QSharedPointer<CryptographyBackendInterface>;
0056 }
0057 
0058 Q_DECLARE_INTERFACE(KIdentityManagementQuick::CryptographyBackendInterface, "CryptographyBackendInterface")
0059 Q_DECLARE_METATYPE(KIdentityManagementQuick::CryptographyBackendInterfacePtr)