Akonadi

recursivecollectionfilterproxymodel.h
1/*
2 SPDX-FileCopyrightText: 2009 Stephen Kelly <steveire@gmail.com>
3 SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#pragma once
9
10#include "akonadicore_export.h"
11
12#include <QSortFilterProxyModel>
13
14#include <memory>
15
16namespace Akonadi
17{
18class RecursiveCollectionFilterProxyModelPrivate;
19
20/**
21 * @short A model to filter out collections of non-matching content types.
22 *
23 * @author Stephen Kelly <steveire@gmail.com>
24 * @since 4.6
25 */
27{
28 Q_OBJECT
29
30public:
31 /**
32 * Creates a new recursive collection filter proxy model.
33 *
34 * @param parent The parent object.
35 */
36 explicit RecursiveCollectionFilterProxyModel(QObject *parent = nullptr);
37
38 /**
39 * Destroys the recursive collection filter proxy model.
40 */
42
43 /**
44 * Add content mime type to be shown by the filter.
45 *
46 * @param mimeType A mime type to be shown.
47 */
48 void addContentMimeTypeInclusionFilter(const QString &mimeType);
49
50 /**
51 * Add content mime types to be shown by the filter.
52 *
53 * @param mimeTypes A list of content mime types to be included.
54 */
55 void addContentMimeTypeInclusionFilters(const QStringList &mimeTypes);
56
57 /**
58 * Clears the current filters.
59 */
60 void clearFilters();
61
62 /**
63 * Replace the content mime types to be shown by the filter.
64 *
65 * @param mimeTypes A list of content mime types to be included.
66 */
67 void setContentMimeTypeInclusionFilters(const QStringList &mimeTypes);
68
69 /**
70 * Returns the currently included mimetypes in the filter.
71 */
72 [[nodiscard]] QStringList contentMimeTypeInclusionFilters() const;
73
74 /**
75 * Add search pattern
76 * @param pattern the search pattern to add
77 * @since 4.8.1
78 */
79 void setSearchPattern(const QString &pattern);
80
81 /**
82 * Show only checked item
83 * @param checked only shows checked item if set as @c true
84 * @since 4.9
85 */
86 void setIncludeCheckedOnly(bool checked);
87
88 /**
89 * Don't show unified mailbox
90 * @since 5.18.0
91 */
92 void setExcludeUnifiedMailBox(bool exclude);
93
94protected:
95 int columnCount(const QModelIndex &index) const override;
96 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
97
98protected:
99 std::unique_ptr<RecursiveCollectionFilterProxyModelPrivate> const d_ptr;
100 Q_DECLARE_PRIVATE(RecursiveCollectionFilterProxyModel)
101};
102
103}
A model to filter out collections of non-matching content types.
~RecursiveCollectionFilterProxyModel() override
Destroys the recursive collection filter proxy model.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:11:39 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.