source: src-qt4/PCDM/src/pcdm-backend.h @ fdf420c

releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since fdf420c was fdf420c, checked in by Ken Moore <ken@…>, 10 months ago

Small update to PCDM:
1) Clean up session management/restarts (in case login fails during all the PAM or user/group changes)
2) Update the location of the lastlogin file (/var/db/pcdm/lastlogin), and make sure it is getting saved/loaded properly.

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/* PCDM Login Manager:
2*  Written by Ken Moore (ken@pcbsd.org) 2012/2013
3*  Copyright(c) 2013 by the PC-BSD Project
4*  Available under the 3-clause BSD license
5*/
6
7#ifndef PCDM_BACKEND_H
8#define PCDM_BACKEND_H
9
10#include <QStringList>
11#include <QString>
12#include <QDebug>
13#include <QDir>
14#include <QProcess>
15#include <QFile>
16#include <QTextStream>
17
18#include "pcdm-config.h"
19#include "pcbsd-utils.h"
20
21#define PCSYSINSTALL    QString("/usr/sbin/pc-sysinstall")
22#define DBDIR QString("/var/db/pcdm/")
23
24class Process : public QProcess {
25public:
26    Process(const QStringList &args) {
27        setReadChannel(QProcess::StandardOutput);
28        start(PCSYSINSTALL, args);
29    }
30};
31
32class Backend {
33public:
34    static QStringList getAvailableDesktops();
35    static QString getDesktopComment(QString);
36    static QString getNLDesktopName(QString);
37    static QString getDesktopIcon(QString);
38    static QString getDesktopBinary(QString);
39    static QStringList getSystemUsers();
40    static QString getUsernameFromDisplayname(QString);
41    static QString getDisplayNameFromUsername(QString);
42    static QStringList keyModels();
43    static QStringList keyLayouts();
44    static QStringList keyVariants(const QString &layout, QStringList &savedKeyVariants);
45    static bool changeKbMap(QString model, QString layout, QString variant);
46    static QStringList languages();
47    static void openLogFile(QString);
48    static void log(QString); 
49    static QString getUserHomeDir(QString);
50    static QString getUserShell(QString);
51    static void checkLocalDirs();
52
53    static QString getALUsername();
54    static QString getALDesktopCmd();
55    static QString getALPassword();
56   
57    static QString getLastUser();
58    static QString getLastDE(QString);
59    static void saveLoginInfo(QString, QString);
60    static void readDefaultSysEnvironment(QString &lang, QString &keymodel, QString &keylayout, QString &keyvariant);
61    static void saveDefaultSysEnvironment(QString lang, QString keymodel, QString keylayout, QString keyvariant);
62   
63    static bool writeFile(QString fileName, QStringList contents);
64   
65private:       
66    static void loadXSessionsData();
67    static QStringList readXSessionsFile(QString, QString);
68    static void readSystemUsers();
69    static void readSystemLastLogin();
70    static void writeSystemLastLogin(QString, QString);
71    static QString readUserLastDesktop(QString);
72    static void writeUserLastDesktop(QString, QString);
73   
74};
75
76
77#endif // PCDM_BACKEND_H
Note: See TracBrowser for help on using the repository browser.