fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / kdeui / util / knotificationrestrictions.h
blob7b83d25c7e354094f49ee0127c472cc4d1de6559
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>
27 /**
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:
39 * @code
40 * void MyApp::doPresentation()
41 * {
42 * KNotificationRestrictions restrict(KNotificationRestrictions::ScreenSaver);
43 * // show presentation
44 * }
45 * @endcode
47 class KDEUI_EXPORT KNotificationRestrictions : public QObject
49 Q_OBJECT
51 public:
52 /**
53 * @enum Service
55 enum Service
57 /**
58 * The baseline "don't disable anything" value.
60 NoServices = 0,
61 /**
62 * Causes the screensaver to be prevented from automatically
63 * turning on.
65 ScreenSaver = 1,
66 /**
67 * Causes instant messaging and email notifications to not appear.
69 * @note <b>not implemented yet</b>
71 MessagingPopups = 2,
72 /**
73 * Causes non-critical desktop messages to be suppressed.
75 * @note <b>not implemented yet</b>
77 Notifications = 4,
78 /**
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 |
86 MessagingPopups |
87 Notifications,
88 AllServices = NonCriticalServices | CriticalNotifications
90 Q_DECLARE_FLAGS(Services, Service)
92 /**
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,
99 QObject* parent = 0);
100 virtual ~KNotificationRestrictions();
102 private:
103 class Private;
104 Private * const d;
106 Q_PRIVATE_SLOT( d, void screensaverFakeKeyEvent() )
109 Q_DECLARE_OPERATORS_FOR_FLAGS(KNotificationRestrictions::Services)
110 #endif