2
Copyright 2007 Pino Toscano <pino@kde.org>
3
Copyright 2007 Robert Knight <robertknight@gmail.com>
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
15
You should have received a copy of the GNU Library General Public License
16
along with this library; see the file COPYING.LIB. If not, write to
17
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
Boston, MA 02110-1301, USA.
21
#ifndef APPLICATIONMODEL_H
22
#define APPLICATIONMODEL_H
24
#include <QtCore/QAbstractItemModel>
26
class ApplicationModelPrivate;
29
* ApplicationModel provides a tree model containing all of the user's installed graphical programs.
30
* The applications are arranged into categories, based on the information in their .desktop files.
32
class ApplicationModel : public QAbstractItemModel
37
ApplicationModel(QObject *parent = 0);
38
virtual ~ApplicationModel();
41
* This enum describes the policy for
42
* handling duplicate applications (that is,
43
* two applications with the same name in the same group)
47
/** Display duplicate entries. */
50
* Show only the entry for the most recent
51
* version of the application.
53
* Currently only a crude heuristic to determine whether the
54
* application is from KDE 3 or KDE 4 is used to determine
57
* eg. If MyGame/KDE 3 and MyGame/KDE 4 are found
58
* show only MyGame/KDE 4
63
* Sets the policy for handling duplicate applications.
66
void setDuplicatePolicy(DuplicatePolicy policy);
67
/** See setDuplicatePolicy() */
68
DuplicatePolicy duplicatePolicy() const;
70
// reimplemented from QAbstractItemModel
71
virtual bool canFetchMore(const QModelIndex &parent) const;
72
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
73
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
74
virtual void fetchMore(const QModelIndex &parent);
75
virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
76
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
77
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
78
virtual QModelIndex parent(const QModelIndex &index) const;
79
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
82
friend class ApplicationModelPrivate;
83
ApplicationModelPrivate *const d;
85
Q_DISABLE_COPY(ApplicationModel)