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 
23 class UIDModelItem;
24 
25 namespace Kleo
26 {
27 
28 class KLEO_EXPORT UserIDListModel : public QAbstractItemModel
29 {
30  Q_OBJECT
31 public:
32  enum class Column {
33  Id,
34  Name,
35  Email,
36  ValidFrom,
37  ValidUntil,
38  Status,
39  Exportable,
40  Tags,
41  TrustSignatureDomain,
42  };
43 
44  explicit UserIDListModel(QObject *parent = nullptr);
45  ~UserIDListModel() override;
46 
47  GpgME::Key key() const;
48 
49 public:
50  GpgME::UserID userID(const QModelIndex &index) const;
51  QList<GpgME::UserID> userIDs(const QModelIndexList &indexes) const;
52  GpgME::UserID::Signature signature(const QModelIndex &index) const;
53  QList<GpgME::UserID::Signature> signatures(const QModelIndexList &indexes) const;
54  void enableRemarks(bool value);
55 
56 public Q_SLOTS:
57  void setKey(const GpgME::Key &key);
58 
59 public:
60  int columnCount(const QModelIndex &pindex = QModelIndex()) const override;
61  int rowCount(const QModelIndex &pindex = QModelIndex()) const override;
62  QVariant headerData(int section, Qt::Orientation o, int role = Qt::DisplayRole) const override;
63  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
64 
65  QModelIndex index(int row, int col, const QModelIndex &parent = QModelIndex()) const override;
66  QModelIndex parent(const QModelIndex &index) const override;
67 
68 private:
69  GpgME::Key mKey;
70  bool mRemarksEnabled = false;
71  std::unique_ptr<UIDModelItem> mRootItem;
72 };
73 
74 }
DisplayRole
int64_t Id
Email
Orientation
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Feb 15 2024 03:56:14 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.