1 /***************************************************************************
2 * Copyright (C) 2006-2010 by Peter Penz <peter.penz@gmx.at> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program 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 *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef DOLPHINSORTFILTERPROXYMODEL_H
21 #define DOLPHINSORTFILTERPROXYMODEL_H
23 #include <views/dolphinview.h>
24 #include <kdirsortfilterproxymodel.h>
25 #include <libdolphin_export.h>
28 * @brief Acts as proxy model for DolphinModel to sort and filter
31 * Per default a natural sorting is done. This means that items like:
40 class LIBDOLPHINPRIVATE_EXPORT DolphinSortFilterProxyModel
: public KDirSortFilterProxyModel
45 DolphinSortFilterProxyModel(QObject
* parent
= 0);
46 virtual ~DolphinSortFilterProxyModel();
48 void setSorting(DolphinView::Sorting sorting
);
49 DolphinView::Sorting
sorting() const;
51 void setSortOrder(Qt::SortOrder sortOrder
);
52 Qt::SortOrder
sortOrder() const;
54 void setSortFoldersFirst(bool foldersFirst
);
57 virtual void sort(int column
,
58 Qt::SortOrder order
= Qt::AscendingOrder
);
61 * Helper method to get the DolphinView::Sorting type for a given
62 * column \a column. If the column is smaller 0 or greater than the
63 * available columns, DolphinView::SortByName is returned.
65 static DolphinView::Sorting
sortingForColumn(int column
);
68 void sortingRoleChanged();
71 DolphinView::Sorting m_sorting
:16;
72 Qt::SortOrder m_sortOrder
:16;
75 inline DolphinView::Sorting
DolphinSortFilterProxyModel::sorting() const
80 inline Qt::SortOrder
DolphinSortFilterProxyModel::sortOrder() const