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 "core/kickoff_export.h"
25
#include "core/kickoffabstractmodel.h"
26
#include "core/models.h"
31
class ApplicationModelPrivate;
34
* ApplicationModel provides a tree model containing all of the user's installed graphical programs.
35
* The applications are arranged into categories, based on the information in their .desktop files.
37
class KICKOFF_EXPORT ApplicationModel : public KickoffAbstractModel
42
ApplicationModel(QObject *parent = 0, bool allowSeparators = false);
43
virtual ~ApplicationModel();
46
* This enum describes the policy for
47
* handling duplicate applications (that is,
48
* two applications with the same name in the same group)
50
enum DuplicatePolicy {
51
/** Display duplicate entries. */
54
* Show only the entry for the most recent
55
* version of the application.
57
* Currently only a crude heuristic to determine whether the
58
* application is from KDE 3 or KDE 4 is used to determine
61
* eg. If MyGame/KDE 3 and MyGame/KDE 4 are found
62
* show only MyGame/KDE 4
68
* This enum describes the policy for
69
* handling applications that are configured to appear
72
enum SystemApplicationPolicy {
73
/** Display entries in Applications tab and System tab. */
74
ShowApplicationAndSystemPolicy,
75
/** Display entry only in System tab. */
79
enum PrimaryNamePolicy {
84
void setNameDisplayOrder(DisplayOrder displayOrder);
85
DisplayOrder nameDisplayOrder() const;
86
//DisplayOrder m_displayOrder;
88
* Sets the policy for handling duplicate applications.
91
void setDuplicatePolicy(DuplicatePolicy policy);
92
/** See setDuplicatePolicy() */
93
DuplicatePolicy duplicatePolicy() const;
96
* Sets the policy for handling System applications.
97
* See SystemApplicationPolicy
99
void setSystemApplicationPolicy(SystemApplicationPolicy policy);
100
/** See setSystemApplicationPolicy() */
101
SystemApplicationPolicy systemApplicationPolicy() const;
103
void setPrimaryNamePolicy(PrimaryNamePolicy policy);
104
PrimaryNamePolicy primaryNamePolicy() const;
106
// reimplemented from QAbstractItemModel
107
virtual bool canFetchMore(const QModelIndex &parent) const;
108
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
109
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
110
virtual void fetchMore(const QModelIndex &parent);
111
virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
112
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
113
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
114
virtual QModelIndex parent(const QModelIndex &index) const;
115
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
119
void delayedReloadMenu();
120
void checkSycocaChange(const QStringList &changes);
123
bool nameAfterDescription(const QModelIndex &index) const;
125
friend class ApplicationModelPrivate;
126
ApplicationModelPrivate *const d;
128
Q_DISABLE_COPY(ApplicationModel)