Libkleo

keylistsortfilterproxymodel.h
1/* -*- mode: c++; c-basic-offset:4 -*-
2 models/keylistsortfilterproxymodel.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 "keylistmodelinterface.h"
13#include "kleo_export.h"
14
15#include <QSortFilterProxyModel>
16
17#include <memory>
18
19namespace GpgME
20{
21class Key;
22}
23
24namespace Kleo
25{
26
27class KeyFilter;
28
29class KLEO_EXPORT AbstractKeyListSortFilterProxyModel : public QSortFilterProxyModel, public KeyListModelInterface
30{
31 Q_OBJECT
32protected:
33 AbstractKeyListSortFilterProxyModel(const AbstractKeyListSortFilterProxyModel &);
34
35public:
36 explicit AbstractKeyListSortFilterProxyModel(QObject *parent = nullptr);
37 ~AbstractKeyListSortFilterProxyModel() override;
38
39 virtual AbstractKeyListSortFilterProxyModel *clone() const = 0;
40
41 GpgME::Key key(const QModelIndex &idx) const override;
42 std::vector<GpgME::Key> keys(const QList<QModelIndex> &indexes) const override;
43
44 KeyGroup group(const QModelIndex &idx) const override;
45
47 QModelIndex index(const GpgME::Key &key) const override;
48 QList<QModelIndex> indexes(const std::vector<GpgME::Key> &keys) const override;
49
50 QModelIndex index(const KeyGroup &group) const override;
51
52private:
53 void init();
54};
55
56class KLEO_EXPORT KeyListSortFilterProxyModel : public AbstractKeyListSortFilterProxyModel
57{
58 Q_OBJECT
59protected:
60 KeyListSortFilterProxyModel(const KeyListSortFilterProxyModel &);
61
62public:
63 explicit KeyListSortFilterProxyModel(QObject *parent = nullptr);
64 ~KeyListSortFilterProxyModel() override;
65
66 std::shared_ptr<const KeyFilter> keyFilter() const;
67 void setKeyFilter(const std::shared_ptr<const KeyFilter> &kf);
68
69 KeyListSortFilterProxyModel *clone() const override;
70
71protected:
72 bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
73
74private:
75 class Private;
77};
78
79}
QCA_EXPORT void init()
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:39:42 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.