Make it possible to use a distinct selection model in the foldertreewidget.
[kdepim.git] / kjots / kjotssortproxymodel.h
blob07619159ac604cd53af2e0e8a5073c66958f80bb
1 /*
2 This file is part of KJots.
4 Copyright (c) 2010 Stephen Kelly <steveire@gmail.com>
6 This library is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Library General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or (at your
9 option) any later version.
11 This library is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301, USA.
22 #ifndef KJOTSSORTPROXYMODEL_H
23 #define KJOTSSORTPROXYMODEL_H
25 #include <QSortFilterProxyModel>
27 #include <akonadi/collection.h>
29 class KJotsSortProxyModel : public QSortFilterProxyModel
31 Q_OBJECT
32 public:
33 KJotsSortProxyModel(QObject* parent = 0);
34 ~KJotsSortProxyModel();
36 void sortChildrenAlphabetically( const QModelIndex &parent );
37 void sortChildrenByCreationTime( const QModelIndex &parent );
39 protected:
40 virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const;
42 private:
43 Akonadi::Collection::Id collectionId( const QModelIndex &parent ) const;
45 private:
46 QSet<Akonadi::Collection::Id> m_alphaSorted;
47 QSet<Akonadi::Collection::Id> m_dateTimeSorted;
50 #endif