1/* This file is part of the KDE libraries
2 Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
3 Copyright (c) 1998, 1999 KDE Team
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 KSESSIONMANAGER_H
22#define KSESSIONMANAGER_H
23
24#include <kdeui_export.h>
25
26#include <QtCore/QList>
27#include <QtGui/QSessionManager>
28
29/**
30 Provides highlevel access to session management on a per-object
31 base.
32
33 KSessionManager makes it possible to provide implementations for
34 QApplication::commitData() and QApplication::saveState(), without
35 subclassing KApplication. KMainWindow internally makes use of this.
36
37 You don't need to do anything with this class when using
38 KMainWindow. Instead, use KMainWindow::saveProperties(),
39 KMainWindow::readProperties(), KMainWindow::queryClose(),
40 KMainWindow::queryExit() and friends.
41
42 @short Highlevel access to session management.
43 @author Matthias Ettrich <ettrich@kde.org>
44 */
45class KDEUI_EXPORT KSessionManager
46{
47public:
48 KSessionManager();
49 virtual ~KSessionManager();
50
51 /**
52 See QApplication::saveState() for documentation.
53
54 This function is just a convenience version to avoid subclassing KApplication.
55
56 Return true to indicate a successful state save or false to
57 indicate a problem and to halt the shutdown process (will
58 implicitly call sm.cancel() ).
59 */
60 virtual bool saveState( QSessionManager& sm );
61 /**
62 See QApplication::commitData() for documentation.
63
64 This function is just a convenience version to avoid subclassing KApplication.
65
66 Return true to indicate a successful commit of data or false to
67 indicate a problem and to halt the shutdown process (will
68 implicitly call sm.cancel() ).
69 */
70 virtual bool commitData( QSessionManager& sm );
71
72 static QList<KSessionManager*>& sessionClients();
73
74protected:
75 /** Virtual hook, used to add new "virtual" functions while maintaining
76 binary compatibility. Unused in this class.
77 */
78 virtual void virtual_hook( int id, void* data );
79
80private:
81 class Private;
82 Private* const d;
83
84 Q_DISABLE_COPY(KSessionManager)
85};
86
87#endif // KSESSIONMANAGER_H
88
89