~ubuntu-branches/ubuntu/lucid/kdebase/lucid

« back to all changes in this revision

Viewing changes to kdmlib/dmctl.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-27 12:09:48 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20080527120948-dottsyd5rcwhzd36
Tags: 4:4.0.80-1ubuntu1
* Merge with Debian
 - remove 97_fix_target_link_libraries.diff
 - Add replaces/conflicts on -kde4 packages

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
   Copyright (C) 2004,2005 Oswald Buddenhagen <ossi@kde.org>
3
 
   Copyright (C) 2005 Stephan Kulow <coolo@kde.org>
4
 
 
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.
9
 
 
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.
14
 
 
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.
19
 
*/
20
 
 
21
 
#ifndef DMCTL_H
22
 
#define DMCTL_H
23
 
 
24
 
#include <kapplication.h>
25
 
 
26
 
struct SessEnt {
27
 
        QString display, from, user, session;
28
 
        int vt;
29
 
        bool self:1, tty:1;
30
 
};
31
 
 
32
 
typedef QValueList<SessEnt> SessList;
33
 
 
34
 
class DM {
35
 
 
36
 
#ifdef Q_WS_X11
37
 
 
38
 
public:
39
 
        DM();
40
 
        ~DM();
41
 
 
42
 
        bool canShutdown();
43
 
        void shutdown( KApplication::ShutdownType shutdownType,
44
 
                       KApplication::ShutdownMode shutdownMode,
45
 
                       const QString &bootOption = QString::null );
46
 
 
47
 
        void setLock( bool on );
48
 
 
49
 
        bool isSwitchable();
50
 
        int numReserve();
51
 
        void startReserve();
52
 
        bool localSessions( SessList &list );
53
 
        bool switchVT( int vt );
54
 
        void lockSwitchVT( int vt );
55
 
 
56
 
        bool bootOptions( QStringList &opts, int &dflt, int &curr );
57
 
 
58
 
        static QString sess2Str( const SessEnt &se );
59
 
        static void sess2Str2( const SessEnt &se, QString &user, QString &loc );
60
 
 
61
 
private:
62
 
        int fd;
63
 
 
64
 
        bool exec( const char *cmd, QCString &ret );
65
 
        bool exec( const char *cmd );
66
 
 
67
 
        void GDMAuthenticate();
68
 
 
69
 
#else // Q_WS_X11
70
 
 
71
 
public:
72
 
        DM() {}
73
 
 
74
 
        bool canShutdown() { return false; }
75
 
        void shutdown( KApplication::ShutdownType shutdownType,
76
 
                       KApplication::ShutdownMode shutdownMode,
77
 
                       const QString &bootOption = QString::null ) {}
78
 
 
79
 
        void setLock( bool ) {}
80
 
 
81
 
        bool isSwitchable() { return false; }
82
 
        int numReserve() { return -1; }
83
 
        void startReserve() {}
84
 
        bool localSessions( SessList &list ) { return false; }
85
 
        void switchVT( int vt ) {}
86
 
 
87
 
        bool bootOptions( QStringList &opts, int &dflt, int &curr );
88
 
 
89
 
#endif // Q_WS_X11
90
 
 
91
 
}; // class DM
92
 
 
93
 
#endif // DMCTL_H