2 Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at>
3 Copyright (C) 2006 by Dominic Battre <dominic@battre.de>
4 Copyright (C) 2006 by Martin Pool <mbp@canonical.com>
6 Separated from Dolphin by Nick Shaforostoff <shafff@ukr.net>
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License version 2 as published by the Free Software Foundation.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
23 #ifndef KDIRSORTFILTERPROXYMODEL_H
24 #define KDIRSORTFILTERPROXYMODEL_H
26 #include <QtCore/QFileInfo>
28 #include <kcategorizedsortfilterproxymodel.h>
30 #include <kfile_export.h>
33 * @brief Acts as proxy model for KDirModel to sort and filter
36 * A natural sorting is done. This means that items like:
46 * It is assured that directories are always sorted before files.
47 * Don't use it with non-KDirModel derivatives.
49 * @author Dominic Battre, Martin Pool and Peter Penz
51 class KFILE_EXPORT KDirSortFilterProxyModel
52 : public KCategorizedSortFilterProxyModel
55 KDirSortFilterProxyModel(QObject
* parent
= 0);
56 virtual ~KDirSortFilterProxyModel();
58 /** Reimplemented from QAbstractItemModel. Returns true for directories. */
59 virtual bool hasChildren(const QModelIndex
& parent
= QModelIndex()) const;
62 * Reimplemented from QAbstractItemModel.
63 * Returns true for 'empty' directories so they can be populated later.
65 virtual bool canFetchMore(const QModelIndex
& parent
) const;
68 * Returns the permissions in "points". This is useful for sorting by
71 static int pointsForPermissions(const QFileInfo
&info
);
75 * Reimplemented from KCategorizedSortFilterProxyModel.
77 virtual bool subSortLessThan(const QModelIndex
& left
,
78 const QModelIndex
& right
) const;
81 class KDirSortFilterProxyModelPrivate
;
82 KDirSortFilterProxyModelPrivate
* const d
;