File indexing completed on 2024-04-21 14:55:58

0001 /* This file is part of the KDE libraries
0002     Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
0003     Copyright (c) 1998, 1999 KDE Team
0004 
0005     This library is free software; you can redistribute it and/or
0006     modify it under the terms of the GNU Library General Public
0007     License as published by the Free Software Foundation; either
0008     version 2 of the License, or (at your option) any later version.
0009 
0010     This library is distributed in the hope that it will be useful,
0011     but WITHOUT ANY WARRANTY; without even the implied warranty of
0012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013     Library General Public License for more details.
0014 
0015     You should have received a copy of the GNU Library General Public License
0016     along with this library; see the file COPYING.LIB.  If not, write to
0017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018     Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef KSESSIONMANAGER_H
0022 #define KSESSIONMANAGER_H
0023 
0024 #include <kdelibs4support_export.h>
0025 
0026 #include <QList>
0027 #include <QSessionManager>
0028 
0029 /**
0030    Provides highlevel access to session management on a per-object
0031    base.
0032 
0033    KSessionManager makes it possible to provide implementations for
0034  QApplication::commitData() and QApplication::saveState(), without
0035    subclassing KApplication. KMainWindow internally makes use of this.
0036 
0037    You don't need to do anything with this class when using
0038    KMainWindow. Instead, use KMainWindow::saveProperties(),
0039  KMainWindow::readProperties(), KMainWindow::queryClose(),
0040  KMainWindow::queryExit() and friends.
0041 
0042   @short Highlevel access to session management.
0043   @author Matthias Ettrich <ettrich@kde.org>
0044   @see QApplication::saveStateRequest
0045   @see QApplication::commitDataRequest
0046   @deprecated Since 5.0 connect to signals emitted by QGuiApplication
0047  */
0048 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KSessionManager
0049 {
0050 public:
0051     KSessionManager();
0052     virtual ~KSessionManager();
0053 
0054     /**
0055        See QApplication::saveState() for documentation.
0056 
0057        This function is just a convenience version to avoid subclassing KApplication.
0058 
0059        Return true to indicate a successful state save or false to
0060        indicate a problem and to halt the shutdown process (will
0061        implicitly call sm.cancel() ).
0062 
0063        @deprecated Since 5.0 connect to the signal QGuiApplication::saveStateRequest(QSessionManager &)
0064      */
0065     virtual bool saveState(QSessionManager &sm);
0066     /**
0067        See QApplication::commitData() for documentation.
0068 
0069        This function is just a convenience version to avoid subclassing KApplication.
0070 
0071        Return true to indicate a successful commit of data or false to
0072        indicate a problem and to halt the shutdown process (will
0073        implicitly call sm.cancel() ).
0074 
0075        @deprecated Since 5.0 connect to the signal QGuiApplication::commitDataRequest(QSessionManager &)
0076      */
0077     virtual bool commitData(QSessionManager &sm);
0078 
0079     static QList<KSessionManager *> &sessionClients();
0080 
0081 protected:
0082     /** Virtual hook, used to add new "virtual" functions while maintaining
0083         binary compatibility. Unused in this class.
0084     */
0085     virtual void virtual_hook(int id, void *data);
0086 
0087 private:
0088     class Private;
0089     Private *const d;
0090 
0091     Q_DISABLE_COPY(KSessionManager)
0092 };
0093 
0094 #endif // KSESSIONMANAGER_H
0095