Libkleo

useridlistmodel.h
1/* -*- mode: c++; c-basic-offset:4 -*-
2 models/useridlistmodel.h
3
4 This file is part of Kleopatra, the KDE keymanager
5 SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
6 SPDX-FileCopyrightText: 2016 Andre Heinecke <aheinecke@gnupg.org>
7 SPDX-FileCopyrightText: 2021 g10 Code GmbH
8 SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
9
10 SPDX-License-Identifier: GPL-2.0-or-later
11*/
12
13#pragma once
14
15#include "kleo_export.h"
16
17#include <QAbstractItemModel>
18
19#include <gpgme++/key.h> // since Signature is nested in UserID...
20
21#include <memory>
22
23class UIDModelItem;
24
25namespace Kleo
26{
27
28class KLEO_EXPORT UserIDListModel : public QAbstractItemModel
29{
30 Q_OBJECT
31public:
32 enum class Column {
33 Id,
34 Name,
35 Email,
36 Status,
37 Exportable,
38 ValidFrom,
39 ValidUntil,
40 Tags,
41 TrustSignatureDomain,
42 };
43
44 enum ModelRoles {
45 SignerKeyIdRole = Qt::UserRole,
46 };
47
48 explicit UserIDListModel(QObject *parent = nullptr);
49 ~UserIDListModel() override;
50
51 GpgME::Key key() const;
52
53public:
54 GpgME::UserID userID(const QModelIndex &index) const;
55 QList<GpgME::UserID> userIDs(const QModelIndexList &indexes) const;
56 GpgME::UserID::Signature signature(const QModelIndex &index) const;
57 QList<GpgME::UserID::Signature> signatures(const QModelIndexList &indexes) const;
58 void enableRemarks(bool value);
59
60public Q_SLOTS:
61 void setKey(const GpgME::Key &key);
62
63public:
64 int columnCount(const QModelIndex &pindex = QModelIndex()) const override;
65 int rowCount(const QModelIndex &pindex = QModelIndex()) const override;
66 QVariant headerData(int section, Qt::Orientation o, int role = Qt::DisplayRole) const override;
67 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
68
69 QModelIndex index(int row, int col, const QModelIndex &parent = QModelIndex()) const override;
70 QModelIndex parent(const QModelIndex &index) const override;
71
72private:
73 GpgME::Key mKey;
74 bool mRemarksEnabled = false;
75 std::unique_ptr<UIDModelItem> mRootItem;
76};
77
78}
int64_t Id
UserRole
Orientation
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:02:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.