Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / plasma / applets / kickoff / core / applicationmodel.h
blob298eddc0ce127e6de88f2a8be5de6aa71efe5ecf
1 /*
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/kickoffabstractmodel.h"
26 class ApplicationModelPrivate;
28 namespace Kickoff
31 /**
32 * ApplicationModel provides a tree model containing all of the user's installed graphical programs.
33 * The applications are arranged into categories, based on the information in their .desktop files.
35 class ApplicationModel : public KickoffAbstractModel
37 Q_OBJECT
39 public:
40 ApplicationModel(QObject *parent = 0);
41 virtual ~ApplicationModel();
43 /**
44 * This enum describes the policy for
45 * handling duplicate applications (that is,
46 * two applications with the same name in the same group)
48 enum DuplicatePolicy
50 /** Display duplicate entries. */
51 ShowDuplicatesPolicy,
52 /**
53 * Show only the entry for the most recent
54 * version of the application.
56 * Currently only a crude heuristic to determine whether the
57 * application is from KDE 3 or KDE 4 is used to determine
58 * recent-ness.
60 * eg. If MyGame/KDE 3 and MyGame/KDE 4 are found
61 * show only MyGame/KDE 4
63 ShowLatestOnlyPolicy
66 /**
67 * Sets the policy for handling duplicate applications.
68 * See DuplicatePolicy
70 void setDuplicatePolicy(DuplicatePolicy policy);
71 /** See setDuplicatePolicy() */
72 DuplicatePolicy duplicatePolicy() const;
74 // reimplemented from QAbstractItemModel
75 virtual bool canFetchMore(const QModelIndex &parent) const;
76 virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
77 virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
78 virtual void fetchMore(const QModelIndex &parent);
79 virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
80 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
81 virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
82 virtual QModelIndex parent(const QModelIndex &index) const;
83 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
85 private:
86 friend class ApplicationModelPrivate;
87 ApplicationModelPrivate *const d;
89 Q_DISABLE_COPY(ApplicationModel)
94 #endif