1 /* This file is part of the KDE project
2 Copyright 2007 Will Stephenson <wstephenson@kde.org>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License or (at your option) version 3 or any later version
8 accepted by the membership of KDE e.V. (or its successor approved
9 by the membership of KDE e.V.), which shall act as a proxy
10 defined in Section 14 of version 3 of the license.
12 This program 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
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef KCMODULEMODEL_H
21 #define KCMODULEMODEL_H
23 #include <QAbstractItemModel>
24 #include <kcategorizedsortfilterproxymodel.h>
27 class KCModuleModelPrivate
;
29 class SystemSettingsProxyModel
: public KCategorizedSortFilterProxyModel
32 SystemSettingsProxyModel(QObject
*parent
= 0);
33 virtual ~SystemSettingsProxyModel();
34 virtual bool subSortLessThan(const QModelIndex
&left
, const QModelIndex
&right
) const;
35 virtual bool filterAcceptsRow( int source_column
, const QModelIndex
& source_parent
) const;
38 class KCModuleModel
: public QAbstractItemModel
42 static const int UserFilterRole
, WeightRole
;
43 KCModuleModel( MenuItem
* menuRoot
, QObject
* parent
= 0 );
46 // QAbstractItemModel reimplementations
47 QModelIndex
index( int row
, int column
, const QModelIndex
& parent
= QModelIndex() ) const;
48 QModelIndex
parent( const QModelIndex
& index
) const;
49 int rowCount( const QModelIndex
& index
) const;
50 int columnCount( const QModelIndex
& index
) const;
52 QVariant
data(const QModelIndex
&index
, int role
) const;
54 Qt::ItemFlags
flags(const QModelIndex
&index
) const;
55 QVariant
headerData(int section
, Qt::Orientation orientation
, int role
= Qt::DisplayRole
) const;
57 KCModuleModelPrivate
* d
;
60 class KCModuleSortFilterProxyModel
: public KCategorizedSortFilterProxyModel