~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to libs/kworkspace/kdisplaymanager.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

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 KDISPLAYMANAGER_H
 
22
#define KDISPLAYMANAGER_H
 
23
 
 
24
#include "kworkspace.h"
 
25
#include <kdemacros.h>
 
26
#include <QtCore/QString>
 
27
#include <QtCore/QList>
 
28
#include <QtCore/QByteArray>
 
29
 
 
30
struct KDE_EXPORT SessEnt {
 
31
    QString display, from, user, session;
 
32
    int vt;
 
33
    bool self:1, tty:1;
 
34
};
 
35
 
 
36
typedef QList<SessEnt> SessList;
 
37
 
 
38
class KDE_EXPORT KDisplayManager {
 
39
 
 
40
#ifdef Q_WS_X11
 
41
 
 
42
public:
 
43
    KDisplayManager();
 
44
    ~KDisplayManager();
 
45
 
 
46
    bool canShutdown();
 
47
    void shutdown(KWorkSpace::ShutdownType shutdownType,
 
48
                  KWorkSpace::ShutdownMode shutdownMode,
 
49
                  const QString &bootOption = QString());
 
50
 
 
51
    void setLock(bool on);
 
52
 
 
53
    bool isSwitchable();
 
54
    int numReserve();
 
55
    void startReserve();
 
56
    bool localSessions(SessList &list);
 
57
    bool switchVT(int vt);
 
58
    void lockSwitchVT(int vt);
 
59
 
 
60
    bool bootOptions(QStringList &opts, int &dflt, int &curr);
 
61
 
 
62
    static QString sess2Str(const SessEnt &se);
 
63
    static void sess2Str2(const SessEnt &se, QString &user, QString &loc);
 
64
 
 
65
private:
 
66
    bool exec(const char *cmd, QByteArray &ret);
 
67
    bool exec(const char *cmd);
 
68
 
 
69
    void GDMAuthenticate();
 
70
 
 
71
#else // Q_WS_X11
 
72
 
 
73
public:
 
74
    KDisplayManager() {}
 
75
 
 
76
    bool canShutdown() { return false; }
 
77
    void shutdown(KWorkSpace::ShutdownType shutdownType,
 
78
                  KWorkSpace::ShutdownMode shutdownMode,
 
79
                  const QString &bootOption = QString()) {}
 
80
 
 
81
    void setLock(bool) {}
 
82
 
 
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) {}
 
88
 
 
89
    bool bootOptions(QStringList &opts, int &dflt, int &curr);
 
90
 
 
91
#endif // Q_WS_X11
 
92
 
 
93
private:
 
94
#ifdef Q_WS_X11
 
95
    class Private;
 
96
    Private * const d;
 
97
#endif // Q_WS_X11
 
98
 
 
99
}; // class KDisplayManager
 
100
 
 
101
#endif // KDISPLAYMANAGER_H
 
102