Akonadi Contacts

contactsfilterproxymodel.h
1 /*
2  This file is part of Akonadi Contact.
3 
4  SPDX-FileCopyrightText: 2009 Tobias Koenig <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef AKONADI_CONTACTSFILTERPROXYMODEL_H
10 #define AKONADI_CONTACTSFILTERPROXYMODEL_H
11 
12 #include "akonadi-contact_export.h"
13 
14 #include <QSortFilterProxyModel>
15 
16 namespace Akonadi {
46 class AKONADI_CONTACT_EXPORT ContactsFilterProxyModel : public QSortFilterProxyModel
47 {
48  Q_OBJECT
49 
50 public:
51  enum MatchFilterContactFlag {
52  All = 0,
53  OnlyNameAndEmailsAddresses = 1
54  };
55  enum FilterFlag {
56  HasEmail = 0x01
57  };
58  Q_DECLARE_FLAGS(FilterFlags, FilterFlag)
59 
60 
65  explicit ContactsFilterProxyModel(QObject *parent = nullptr);
66 
70  ~ContactsFilterProxyModel() override;
71 
78  void setFilterFlags(ContactsFilterProxyModel::FilterFlags flags);
79 
80 
87  void setMatchFilterContactFlag(ContactsFilterProxyModel::MatchFilterContactFlag flag);
88 
89  Q_REQUIRED_RESULT Qt::ItemFlags flags(const QModelIndex &index) const override;
90 
99  void setExcludeVirtualCollections(bool exclude);
100 
101 public Q_SLOTS:
106  void setFilterString(const QString &filter);
107 
108 protected:
109  //@cond PRIVATE
110  bool filterAcceptsRow(int row, const QModelIndex &parent) const override;
111  bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
112  //@endcond
113 
114 private:
115  //@cond PRIVATE
116  class Private;
117  Private *const d;
118  //@endcond
119 };
120 
121 Q_DECLARE_OPERATORS_FOR_FLAGS(ContactsFilterProxyModel::FilterFlags)
122 }
123 
124 #endif
A proxy model for ContactsTreeModel models.
typedef ItemFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 23:10:45 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.