5
* Copyright (C) 2010 David Hubner <hubnerd@ntlworld.com>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
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, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31
#include <QStringList>
32
#include <QAbstractItemModel>
33
#include <QModelIndex>
38
#include "kcmtreeitem.h"
42
class InfoKcmModel : public QAbstractItemModel
49
* Create InfoKcmModel object.
50
* Abstract data model to display KCM's for a tree view
52
* @param parent objects parent
54
InfoKcmModel(QObject *parent);
59
* Get index of item in model
61
* @param row row position
62
* @param column column position
63
* @param parent parent of object
64
* @return index of object
66
QModelIndex index(int row, int column, const QModelIndex& parent) const;
67
QModelIndex index(int row, int column, KcmTreeItem *parent) const;
70
* Get parent of item in model
72
QModelIndex parent(const QModelIndex& index) const;
75
* Get amount of rows under parent
77
int rowCount(const QModelIndex& parent) const;
80
* Get amount of columns under parent
82
int columnCount(const QModelIndex& parent) const;
85
* Get the stored data for a role
87
* @param index objects index
88
* @param role role to retrieve data about
90
QVariant data(const QModelIndex& index, int role) const;
93
* Get header information
95
QVariant headerData(int, Qt::Orientation, int) const;
98
* Get set flags for a treeitem
100
Qt::ItemFlags flags(const QModelIndex &) const;
103
* Get the first valid item on the treeview
104
* Checks main root items only
106
* @return index of valid item
108
QModelIndex firstValid() const;
111
* Get all KCM keywords for all KCMs stored in the model
113
QStringList allChildrenKeywords();
116
* Get QModelIndex of a KcmTreeItem
118
QModelIndex indexOf(KcmTreeItem *item);
125
void createTreeItems();
128
* Get a certain KCM's keywords
130
QStringList childrenKeywords(KcmTreeItem *kcmItem);
132
KService::List m_moduleList;
136
#endif // INFOKCMMODEL