Akonadi

entitymimetypefiltermodel.h
1 /*
2  Copyright (c) 2007 Bruno Virlet <[email protected]>
3  Copyright (c) 2009 Stephen Kelly <[email protected]>
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_ENTITYMIMETYPEFILTERMODEL_H
22 #define AKONADI_ENTITYMIMETYPEFILTERMODEL_H
23 
24 #include "akonadicore_export.h"
25 #include "entitytreemodel.h"
26 
27 #include <QSortFilterProxyModel>
28 
29 namespace Akonadi
30 {
31 
32 class EntityMimeTypeFilterModelPrivate;
33 
62 class AKONADICORE_EXPORT EntityMimeTypeFilterModel : public QSortFilterProxyModel
63 {
64  Q_OBJECT
65 
66 public:
72  explicit EntityMimeTypeFilterModel(QObject *parent = nullptr);
73 
77  ~EntityMimeTypeFilterModel() override;
78 
84  void addMimeTypeInclusionFilters(const QStringList &mimeTypes);
85 
91  void addMimeTypeExclusionFilters(const QStringList &mimeTypes);
92 
98  void addMimeTypeInclusionFilter(const QString &mimeType);
99 
105  void addMimeTypeExclusionFilter(const QString &mimeType);
106 
110  Q_REQUIRED_RESULT QStringList mimeTypeInclusionFilters() const;
111 
115  Q_REQUIRED_RESULT QStringList mimeTypeExclusionFilters() const;
116 
120  void clearFilters();
121 
127  void setHeaderGroup(EntityTreeModel::HeaderGroup headerGroup);
128 
129  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
130 
131  Q_REQUIRED_RESULT bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
132 
133  Q_REQUIRED_RESULT bool canFetchMore(const QModelIndex &parent) const override;
134 
135  Q_REQUIRED_RESULT QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const override;
136 
137  Q_REQUIRED_RESULT int columnCount(const QModelIndex &parent = QModelIndex()) const override;
138 
139 protected:
140  bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
141  bool filterAcceptsColumn(int sourceColumn, const QModelIndex &sourceParent) const override;
142 
143 private:
144  //@cond PRIVATE
145  Q_DECLARE_PRIVATE(EntityMimeTypeFilterModel)
146  EntityMimeTypeFilterModelPrivate *const d_ptr;
147  //@endcond
148 };
149 
150 }
151 
152 #endif
typedef MatchFlags
A proxy model that filters entities by mime type.
HeaderGroup
Describes what header information the model shall return.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed May 27 2020 22:43:39 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.