entitymimetypefiltermodel.h
00001 /* 00002 Copyright (c) 2007 Bruno Virlet <bruno.virlet@gmail.com> 00003 Copyright (c) 2009 Stephen Kelly <steveire@gmail.com> 00004 00005 This library is free software; you can redistribute it and/or modify it 00006 under the terms of the GNU Library General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or (at your 00008 option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, but WITHOUT 00011 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to the 00017 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 02110-1301, USA. 00019 */ 00020 00021 #ifndef AKONADI_ENTITYMIMETYPEFILTERMODEL_H 00022 #define AKONADI_ENTITYMIMETYPEFILTERMODEL_H 00023 00024 #include "akonadi_export.h" 00025 #include "entitytreemodel.h" 00026 00027 #include <QtGui/QSortFilterProxyModel> 00028 00029 namespace Akonadi { 00030 00031 class EntityMimeTypeFilterModelPrivate; 00032 00061 class AKONADI_EXPORT EntityMimeTypeFilterModel : public QSortFilterProxyModel 00062 { 00063 Q_OBJECT 00064 00065 public: 00071 explicit EntityMimeTypeFilterModel( QObject *parent = 0 ); 00072 00076 virtual ~EntityMimeTypeFilterModel(); 00077 00083 void addMimeTypeInclusionFilters( const QStringList &mimeTypes ); 00084 00090 void addMimeTypeExclusionFilters( const QStringList &mimeTypes ); 00091 00097 void addMimeTypeInclusionFilter( const QString &mimeType ); 00098 00104 void addMimeTypeExclusionFilter( const QString &mimeType ); 00105 00109 QStringList mimeTypeInclusionFilters() const; 00110 00114 QStringList mimeTypeExclusionFilters() const; 00115 00119 void clearFilters(); 00120 00126 void setHeaderGroup( EntityTreeModel::HeaderGroup headerGroup ); 00127 00128 virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; 00129 00130 virtual bool hasChildren(const QModelIndex& parent = QModelIndex()) const; 00131 00132 virtual bool canFetchMore(const QModelIndex &parent) const; 00133 00134 virtual QModelIndexList match( const QModelIndex& start, int role, const QVariant& value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap ) ) const; 00135 00136 virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; 00137 00138 protected: 00139 virtual bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const; 00140 00141 private: 00142 //@cond PRIVATE 00143 Q_DECLARE_PRIVATE( EntityMimeTypeFilterModel ) 00144 EntityMimeTypeFilterModelPrivate * const d_ptr; 00145 //@endcond 00146 }; 00147 00148 } 00149 00150 #endif