1 /* This file is part of the KDE libraries
2 Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
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 KDELIBS_KNOTIFICATIONRESTRICTIONS_H
21 #define KDELIBS_KNOTIFICATIONRESTRICTIONS_H
23 #include <kdeui_export.h>
25 #include <QtCore/QObject>
28 * KNotificationRestrictions provides a simple mechanism to avoid disruptions
29 * during full screen presentations or other use cases where the screensaver or
30 * desktop notifcations are inappropriate.
32 * Using KNotificationRestrictions is quite straightforward: create an instance
33 * of KNotificationRestrictions, passing in the set of or'd flags representing
34 * the services that should be prevented from interrupting the user. When done
35 * (for instance when the presentation is complete) simply delete the
36 * KNotificationRestrictions object.
38 * Example: to ensure the screensaver does not turn on during a presentation:
40 * void MyApp::doPresentation()
42 * KNotificationRestrictions restrict(KNotificationRestrictions::ScreenSaver);
43 * // show presentation
47 class KDEUI_EXPORT KNotificationRestrictions
: public QObject
58 * The baseline "don't disable anything" value.
62 * Causes the screensaver to be prevented from automatically
67 * Causes instant messaging and email notifications to not appear.
69 * @note <b>not implemented yet</b>
73 * Causes non-critical desktop messages to be suppressed.
75 * @note <b>not implemented yet</b>
79 * Causes all desktop notifications, including critical ones
80 * (such as as "battery low" warnings) to be suppressed.
82 * @note <b>not implemented yet</b>
84 CriticalNotifications
= 8,
85 NonCriticalServices
= ScreenSaver
|
88 AllServices
= NonCriticalServices
| CriticalNotifications
90 Q_DECLARE_FLAGS(Services
, Service
)
93 * Constructs a new service for restrict some services.
95 * @param control the services to be restricted
96 * @param parent the parent of this object
98 explicit KNotificationRestrictions(Services control
= NonCriticalServices
,
100 virtual ~KNotificationRestrictions();
106 Q_PRIVATE_SLOT( d
, void screensaverFakeKeyEvent() )
109 Q_DECLARE_OPERATORS_FOR_FLAGS(KNotificationRestrictions::Services
)