1/*
2 Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
3 Copyright (c) 2012 Laurent Montel <montel@kde.org>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
21#ifndef AKONADI_RECURSIVECOLLECTIONFILTERPROXYMODEL_H
22#define AKONADI_RECURSIVECOLLECTIONFILTERPROXYMODEL_H
23
24#include <krecursivefilterproxymodel.h>
25
26#include "akonadi_export.h"
27
28namespace Akonadi
29{
30
31class RecursiveCollectionFilterProxyModelPrivate;
32
33/**
34 * @short A model to filter out collections of non-matching content types.
35 *
36 * @author Stephen Kelly <steveire@gmail.com>
37 * @since 4.6
38 */
39class AKONADI_EXPORT RecursiveCollectionFilterProxyModel : public KRecursiveFilterProxyModel
40{
41 Q_OBJECT
42
43public:
44 /**
45 * Creates a new recursive collection filter proxy model.
46 *
47 * @param parent The parent object.
48 */
49 RecursiveCollectionFilterProxyModel(QObject *parent = 0);
50
51 /**
52 * Destroys the recursive collection filter proxy model.
53 */
54 virtual ~RecursiveCollectionFilterProxyModel();
55
56 /**
57 * Add content mime type to be shown by the filter.
58 *
59 * @param mimeType A mime type to be shown.
60 */
61 void addContentMimeTypeInclusionFilter(const QString &mimeType);
62
63 /**
64 * Add content mime types to be shown by the filter.
65 *
66 * @param mimeTypes A list of content mime types to be included.
67 */
68 void addContentMimeTypeInclusionFilters(const QStringList &mimeTypes);
69
70 /**
71 * Clears the current filters.
72 */
73 void clearFilters();
74
75 /**
76 * Replace the content mime types to be shown by the filter.
77 *
78 * @param mimeTypes A list of content mime types to be included.
79 */
80 void setContentMimeTypeInclusionFilters(const QStringList &mimeTypes);
81
82 /**
83 * Returns the currently included mimetypes in the filter.
84 */
85 QStringList contentMimeTypeInclusionFilters() const;
86
87 /**
88 * Add search pattern
89 * @param pattern the search pattern to add
90 * @since 4.8.1
91 */
92 void setSearchPattern(const QString &pattern);
93
94 /**
95 * Show only checked item
96 * @param checked only shows checked item if set as @c true
97 * @since 4.9
98 */
99 void setIncludeCheckedOnly(bool checked);
100
101protected:
102 /* reimp */ bool acceptRow(int sourceRow, const QModelIndex &sourceParent) const;
103 /* reimp */ int columnCount(const QModelIndex &index) const;
104
105protected:
106 RecursiveCollectionFilterProxyModelPrivate *const d_ptr;
107 Q_DECLARE_PRIVATE(RecursiveCollectionFilterProxyModel)
108};
109
110}
111
112#endif
113