File indexing completed on 2024-04-28 05:35:35

0001 /*
0002     SPDX-FileCopyrightText: 2004, 2005 Oswald Buddenhagen <ossi@kde.org>
0003     SPDX-FileCopyrightText: 2005 Stephan Kulow <coolo@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include "kworkspace.h"
0011 #include "kworkspace_export.h"
0012 #include <QByteArray>
0013 #include <QList>
0014 #include <QString>
0015 
0016 struct KWORKSPACE_EXPORT SessEnt {
0017     QString display, from, user, session;
0018     int vt;
0019     bool self : 1, tty : 1;
0020 };
0021 
0022 typedef QList<SessEnt> SessList;
0023 
0024 class KWORKSPACE_EXPORT KDisplayManager
0025 {
0026 public:
0027     KDisplayManager();
0028     ~KDisplayManager();
0029 
0030     bool canShutdown();
0031     void shutdown(KWorkSpace::ShutdownType shutdownType, KWorkSpace::ShutdownMode shutdownMode, const QString &bootOption = QString());
0032 
0033     bool isSwitchable();
0034     int numReserve();
0035     void startReserve();
0036     bool localSessions(SessList &list);
0037     bool switchVT(int vt);
0038     void lockSwitchVT(int vt);
0039 
0040     bool bootOptions(QStringList &opts, int &dflt, int &curr);
0041 
0042     static QString sess2Str(const SessEnt &se);
0043     static void sess2Str2(const SessEnt &se, QString &user, QString &loc);
0044 
0045 private:
0046     bool exec(const char *cmd, QByteArray &ret);
0047     bool exec(const char *cmd);
0048 
0049     void GDMAuthenticate();
0050 
0051 private:
0052     class Private;
0053     Private *const d;
0054 
0055 }; // class KDisplayManager