source: src-qt4/pc-dmconf/main.cpp @ fb7fe1b

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3
Last change on this file since fb7fe1b was fb7fe1b, checked in by Kris Moore <kris@…>, 14 months ago

Add new pc-dmconf utility to the system and control panel,
it will allow configuring the login manager PCDM

  • Property mode set to 100644
File size: 1022 bytes
Line 
1#include <QMessageBox>
2#include <qtranslator.h>
3#include <qlocale.h>
4#include <qtsingleapplication.h>
5#include <QFile>
6#include "mainwindow.h"
7#include "../config.h"
8
9int main(int argc, char *argv[])
10{   
11    QtSingleApplication a(argc, argv);
12
13    if ( a.isRunning() )
14          return !(a.sendMessage("show"));
15
16    QTranslator translator;
17    QLocale mylocale;
18    QString langCode = mylocale.name();
19    if ( ! QFile::exists(PREFIX + "/share/pcbsd/i18n/pc-dmconf_" + langCode + ".qm" ) )
20        langCode.truncate(langCode.indexOf("_"));
21    translator.load( QString("pc-dmconf_") + langCode, PREFIX + "/share/pcbsd/i18n/" );
22    a.installTranslator( &translator );   
23
24    MainWindow w;
25    w.show();
26
27    //Check for root
28    if (0 != geteuid())
29    {
30        QMessageBox msg;
31        msg.setText(w.tr("You should run this application as root"));
32        msg.exec();
33        exit(2);
34    }
35
36    QObject::connect(&a, SIGNAL(messageReceived(const QString &)), &w, SLOT(slotSingleInstance()));
37
38    return a.exec();
39}
Note: See TracBrowser for help on using the repository browser.