source: src-qt4/qsudo/main.cpp @ 33b8b3a

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

Update qsudo, now it is smarter, will test passwords and let you retry up to 3x

  • Property mode set to 100644
File size: 861 bytes
Line 
1#include <qtranslator.h>
2#include <qlocale.h>
3#include <QApplication>
4#include <QDebug>
5#include <QFile>
6#include "mainwindow.h"
7#include "../config.h"
8
9int main(int argc, char *argv[])
10{   
11    QApplication a(argc, argv);
12
13    if ( qApp->argc() <= 1 ) {
14       qDebug() << "Error: Need to specify argument to run!";
15       exit(1);
16    }
17
18    QTranslator translator;
19    QLocale mylocale;
20    QString langCode = mylocale.name();
21    if ( ! QFile::exists(PREFIX + "/share/pcbsd/i18n/qsudo_" + langCode + ".qm" ) )
22        langCode.truncate(langCode.indexOf("_"));
23
24    if ( QFile::exists(PREFIX + "/share/pcbsd/i18n/qsudo_" + langCode + ".qm" ) ) {
25      translator.load( QString("qsudo_") + langCode, PREFIX + "/share/pcbsd/i18n/" );
26      a.installTranslator( &translator );
27    }
28
29    MainWindow w;
30    w.ProgramInit();
31    w.show();
32
33    return a.exec();
34}
Note: See TracBrowser for help on using the repository browser.