~ubuntu-branches/ubuntu/gutsy/kdebase-workspace/gutsy-backports

« back to all changes in this revision

Viewing changes to plasma/applets/kickoff/core/applicationmodel.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-10-31 19:16:54 UTC
  • Revision ID: james.westby@ubuntu.com-20071031191654-xuof6e1jg6uxqaze
Tags: 3.95.0-0ubuntu1~gutsy1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
    Copyright 2007 Pino Toscano <pino@kde.org>
 
3
    Copyright 2007 Robert Knight <robertknight@gmail.com>
 
4
 
 
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.
 
9
 
 
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.
 
14
 
 
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.
 
19
*/
 
20
 
 
21
#ifndef APPLICATIONMODEL_H 
 
22
#define APPLICATIONMODEL_H 
 
23
 
 
24
#include <QtCore/QAbstractItemModel>
 
25
 
 
26
class ApplicationModelPrivate;
 
27
 
 
28
/**
 
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.
 
31
 */
 
32
class ApplicationModel : public QAbstractItemModel
 
33
{
 
34
    Q_OBJECT
 
35
 
 
36
    public:
 
37
        ApplicationModel(QObject *parent = 0);
 
38
        virtual ~ApplicationModel();
 
39
 
 
40
        /** 
 
41
         * This enum describes the policy for 
 
42
         * handling duplicate applications (that is,
 
43
         * two applications with the same name in the same group)
 
44
         */
 
45
        enum DuplicatePolicy
 
46
        {
 
47
            /** Display duplicate entries. */
 
48
            ShowDuplicatesPolicy,
 
49
            /** 
 
50
             * Show only the entry for the most recent
 
51
             * version of the application.
 
52
             *
 
53
             * Currently only a crude heuristic to determine whether the
 
54
             * application is from KDE 3 or KDE 4 is used to determine
 
55
             * recent-ness.
 
56
             *
 
57
             * eg.  If MyGame/KDE 3 and MyGame/KDE 4 are found
 
58
             * show only MyGame/KDE 4
 
59
             */
 
60
            ShowLatestOnlyPolicy
 
61
        };
 
62
        /** 
 
63
         * Sets the policy for handling duplicate applications.
 
64
         * See DuplicatePolicy
 
65
         */
 
66
        void setDuplicatePolicy(DuplicatePolicy policy);
 
67
        /** See setDuplicatePolicy() */
 
68
        DuplicatePolicy duplicatePolicy() const;
 
69
 
 
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;
 
80
 
 
81
    private:
 
82
        friend class ApplicationModelPrivate;
 
83
        ApplicationModelPrivate *const d;
 
84
 
 
85
        Q_DISABLE_COPY(ApplicationModel)
 
86
};
 
87
 
 
88
#endif