KIdentityManagement

cryptographyeditorbackend.h
1// SPDX-FileCopyrightText: 2023 Claudio Cambra <claudio.cambra@kde.org>
2// SPDX-License-Identifier: LGPL-2.0-or-later
3
4#pragma once
5
6#include "kidentitymanagementquick_export.h"
7
8#include <QModelIndex>
9#include <QObject>
10
11#include <KIdentityManagementCore/Identity>
12#include <KIdentityManagementQuick/CryptographyBackendInterface>
13#include <KIdentityManagementQuick/KeyListModelInterface>
14
15namespace KIdentityManagementQuick
16{
17/**
18 * @brief The CryptographyEditorBackend class.
19 *
20 * Used by the QML interface to access cryptography-related data.
21 * Note that since the CryptographyBackendInterface is an abstract class,
22 * it is not accessible from QML. You will need to instantiate it in C++
23 * and then feed it into the QML side of the editor with a valid backend
24 * already set!
25 */
26class KIDENTITYMANAGEMENTQUICK_EXPORT CryptographyEditorBackend : public QObject
27{
28 Q_OBJECT
29
30 Q_PROPERTY(KIdentityManagementCore::Identity identity READ identity WRITE setIdentity NOTIFY identityChanged)
31 Q_PROPERTY(QAbstractItemModel *openPgpKeyListModel READ openPgpKeyListModel NOTIFY openPgpKeyListModelChanged)
32 Q_PROPERTY(QAbstractItemModel *smimeKeyListModel READ smimeKeyListModel NOTIFY smimeKeyListModelChanged)
33
34public:
35 explicit CryptographyEditorBackend(QObject *parent = nullptr, const CryptographyBackendInterfacePtr &backend = {});
36
37 CryptographyBackendInterfacePtr cryptographyBackend() const;
38 void setCryptographyBackend(const CryptographyBackendInterfacePtr &cryptographyBackend);
39
40 QAbstractItemModel *openPgpKeyListModel() const;
41 QAbstractItemModel *smimeKeyListModel() const;
42
43 KIdentityManagementCore::Identity identity() const;
44 void setIdentity(const KIdentityManagementCore::Identity &identity);
45
46 Q_INVOKABLE QModelIndex indexForIdentity(QAbstractItemModel *model, const KIdentityManagementCore::Identity &identity, const KeyUseTypes::KeyUse keyUse);
47
48 Q_INVOKABLE static QString stringFromKeyByteArray(const QByteArray &key);
49
50Q_SIGNALS:
51 void cryptographyBackendChanged();
52 void openPgpKeyListModelChanged();
53 void smimeKeyListModelChanged();
54 void identityChanged();
55
56private:
58};
59
60}
User identity information.
Definition identity.h:74
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:04:54 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.