not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / libs / kworkspace / kdisplaymanager.h
blob1610fec975b22e3b7cba6a0d223b5813be398ccf
1 /*
2 Copyright (C) 2004,2005 Oswald Buddenhagen <ossi@kde.org>
3 Copyright (C) 2005 Stephan Kulow <coolo@kde.org>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the Lesser GNU 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.
10 This program 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 General Public License for more details.
15 You should have received a copy of the Lesser GNU General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #ifndef KDISPLAYMANAGER_H
22 #define KDISPLAYMANAGER_H
24 #include "kworkspace.h"
25 #include <kdemacros.h>
26 #include <QtCore/QString>
27 #include <QtCore/QList>
28 #include <QtCore/QByteArray>
30 struct KDE_EXPORT SessEnt {
31 QString display, from, user, session;
32 int vt;
33 bool self:1, tty:1;
36 typedef QList<SessEnt> SessList;
38 class KDE_EXPORT KDisplayManager {
40 #ifdef Q_WS_X11
42 public:
43 KDisplayManager();
44 ~KDisplayManager();
46 bool canShutdown();
47 void shutdown( KWorkSpace::ShutdownType shutdownType,
48 KWorkSpace::ShutdownMode shutdownMode,
49 const QString &bootOption = QString() );
51 void setLock( bool on );
53 bool isSwitchable();
54 int numReserve();
55 void startReserve();
56 bool localSessions( SessList &list );
57 bool switchVT( int vt );
58 void lockSwitchVT( int vt );
60 bool bootOptions( QStringList &opts, int &dflt, int &curr );
62 static QString sess2Str( const SessEnt &se );
63 static void sess2Str2( const SessEnt &se, QString &user, QString &loc );
65 private:
66 bool exec( const char *cmd, QByteArray &ret );
67 bool exec( const char *cmd );
69 void GDMAuthenticate();
71 #else // Q_WS_X11
73 public:
74 KDisplayManager() {}
76 bool canShutdown() { return false; }
77 void shutdown( KWorkSpace::ShutdownType shutdownType,
78 KWorkSpace::ShutdownMode shutdownMode,
79 const QString &bootOption = QString() ) {}
81 void setLock( bool ) {}
83 bool isSwitchable() { return false; }
84 int numReserve() { return -1; }
85 void startReserve() {}
86 bool localSessions( SessList &list ) { return false; }
87 void switchVT( int vt ) {}
89 bool bootOptions( QStringList &opts, int &dflt, int &curr );
91 #endif // Q_WS_X11
93 private:
94 #ifdef Q_WS_X11
95 class Private;
96 Private * const d;
97 #endif // Q_WS_X11
99 }; // class KDisplayManager
101 #endif // KDISPLAYMANAGER_H