Libkleo

subkeylistmodel.h
1/* -*- mode: c++; c-basic-offset:4 -*-
2 models/subkeylistmodel.h
3
4 This file is part of Kleopatra, the KDE keymanager
5 SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9
10#pragma once
11
12#include "kleo_export.h"
13
14#include <QAbstractTableModel>
15
16#include <vector>
17
18namespace GpgME
19{
20class Key;
21class Subkey;
22}
23
24namespace Kleo
25{
26
27class KLEO_EXPORT SubkeyListModel : public QAbstractTableModel
28{
29 Q_OBJECT
30public:
31 explicit SubkeyListModel(QObject *parent = nullptr);
32 ~SubkeyListModel() override;
33
34 GpgME::Key key() const;
35
36 enum Columns {
37 ID,
38 Type,
39 ValidFrom,
40 ValidUntil,
41 Status,
42 Strength,
43 Usage,
44
45 NumColumns,
46 Icon = ID // which column shall the icon be displayed in?
47 };
48
49 GpgME::Subkey subkey(const QModelIndex &idx) const;
50 std::vector<GpgME::Subkey> subkeys(const QList<QModelIndex> &indexes) const;
51
53 QModelIndex index(const GpgME::Subkey &subkey, int col = 0) const;
54 QList<QModelIndex> indexes(const std::vector<GpgME::Subkey> &subkeys) const;
55
56public Q_SLOTS:
57 void setKey(const GpgME::Key &key);
58 void clear();
59
60public:
61 int columnCount(const QModelIndex &pidx = QModelIndex()) const override;
62 int rowCount(const QModelIndex &pidx = QModelIndex()) const override;
63 QVariant headerData(int section, Qt::Orientation o, int role = Qt::DisplayRole) const override;
64 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
65
66private:
67 class Private;
69};
70
71}
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
DisplayRole
Orientation
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.