add more spacing
[personal-kdebase.git] / apps / plasma / applets / folderview / proxymodel.h
blob885eb80ad29b6b316a2ff1ef62626c62ee0d3acd
1 /*
2 * Copyright © 2008 Fredrik Höglund <fredrik@kde.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef PROXYMODEL_H
21 #define PROXYMODEL_H
23 #include <QSortFilterProxyModel>
24 #include <QStringList>
26 class KFileItem;
27 class KUrl;
29 class ProxyModel : public QSortFilterProxyModel
31 public:
32 enum FilterMode {
33 NoFilter = 0,
34 FilterShowMatches,
35 FilterHideMatches
38 ProxyModel(QObject *parent = 0);
39 ~ProxyModel();
41 void setFilterMode(FilterMode filterMode);
42 FilterMode filterMode() const;
44 void setMimeTypeFilterList(const QStringList &mimeList);
45 const QStringList &mimeTypeFilterList() const;
47 void setSortDirectoriesFirst(bool enable);
48 bool sortDirectoriesFirst() const;
50 QModelIndex indexForUrl(const KUrl &url) const;
51 KFileItem itemForIndex(const QModelIndex &index) const;
52 bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
54 static FilterMode filterModeFromInt(int filterMode);
56 protected:
57 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
59 private:
60 FilterMode m_filterMode;
61 QStringList m_mimeList;
62 bool m_sortDirsFirst;
65 #endif