not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / applets / kickoff / core / recentapplications.h
bloba0feddca1cebbeb556623216bcc6c5c30e13a2a4
1 /*
2 Copyright 2007 Robert Knight <robertknight@gmail.com>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef RECENTAPPLICATIONS_H
21 #define RECENTAPPLICATIONS_H
23 #include "core/kickoff_export.h"
25 // Qt
26 #include <QtCore/QObject>
27 #include <QDateTime>
29 // KDE
30 #include <KService>
32 namespace Kickoff
35 /**
36 * Singleton class which can be used to keep track of recently started applications
37 * in the Kickoff launcher.
39 * RecentApplications information persists between sessions.
41 class KICKOFF_EXPORT RecentApplications : public QObject
43 Q_OBJECT
44 public:
45 class Private;
46 friend class Private;
48 static RecentApplications *self();
50 /**
51 * List of service pointers for recently started applications in the order in which
52 * they were started, with the most recently used application first.
54 QList<KService::Ptr> recentApplications() const;
55 /** Returns the number of times an application represented by @p service has been started. */
56 int startCount(KService::Ptr service) const;
57 /** Returns the last time and date with the application represented by @p service was started. */
58 QDateTime lastStartedTime(KService::Ptr service) const;
60 /** Sets the maximum number of recently used applications to remember. */
61 void setMaximum(int max);
62 /** Returns the maximum number of recently used applications that are remembered. */
63 int maximum() const;
64 /** Returns the default maximum number of recently used applications that are remembered as defined
65 either in the configfile as "MaxApplications" or via the DEFAULT_MAX_SERVICES macro. */
66 int defaultMaximum() const;
68 public Q_SLOTS:
69 /**
70 * Registers the startup of an application. This should be called whenever a new application
71 * or service is started.
73 void add(KService::Ptr service);
74 /** Clear the list of recent applications. */
75 void clear();
77 Q_SIGNALS:
78 /** Emitted after add() has been called. */
79 void applicationAdded(KService::Ptr service, int startCount);
80 /** Emitted after remove() has been called. */
81 void applicationRemoved(KService::Ptr service);
82 /** Emitted after clear() has been called. */
83 void cleared();
85 private:
86 RecentApplications();
91 #endif // RECENTAPPLICATIONS_H