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

releng/10.0.1releng/10.0.2releng/10.0.3
Last change on this file since 3b71e5d was 3b71e5d, checked in by Ken Moore <ken@…>, 8 months ago

If the ~/.xprofile exists, create and run a simple script file to ensure that the QProcess runs the commands in sequence. Fall back on the old seperate QProcess commands if it could not create the script file.

  • 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
23class Process : public QProcess {
24public:
25    Process(const QStringList &args) {
26        setReadChannel(QProcess::StandardOutput);
27        start(PCSYSINSTALL, args);
28    }
29};
30
31class Backend {
32public:
33    static QStringList getAvailableDesktops();
34    static QString getDesktopComment(QString);
35    static QString getNLDesktopName(QString);
36    static QString getDesktopIcon(QString);
37    static QString getDesktopBinary(QString);
38    static QStringList getSystemUsers();
39    static QString getUsernameFromDisplayname(QString);
40    static QString getDisplayNameFromUsername(QString);
41    static QStringList keyModels();
42    static QStringList keyLayouts();
43    static QStringList keyVariants(const QString &layout, QStringList &savedKeyVariants);
44    static bool changeKbMap(QString model, QString layout, QString variant);
45    static QStringList languages();
46    static void openLogFile(QString);
47    static void log(QString); 
48    static QString getUserHomeDir(QString);
49    static QString getUserShell(QString);
50    static void checkLocalDirs();
51
52    static QString getALUsername();
53    static QString getALDesktopCmd();
54    static QString getALPassword();
55   
56    static QString getLastUser();
57    static QString getLastDE(QString);
58    static void saveLoginInfo(QString, QString);
59    static void readDefaultSysEnvironment(QString &lang, QString &keymodel, QString &keylayout, QString &keyvariant);
60    static void saveDefaultSysEnvironment(QString lang, QString keymodel, QString keylayout, QString keyvariant);
61   
62    static bool writeFile(QString fileName, QStringList contents);
63   
64private:       
65    static void loadXSessionsData();
66    static QStringList readXSessionsFile(QString, QString);
67    static void readSystemUsers();
68    static void readSystemLastLogin();
69    static void writeSystemLastLogin(QString, QString);
70    static QString readUserLastDesktop(QString);
71    static void writeUserLastDesktop(QString, QString);
72   
73};
74
75
76#endif // PCDM_BACKEND_H
Note: See TracBrowser for help on using the repository browser.