xca/lib/main.cpp
Christian Hohnstaedt 0aced7f2c4 improve Smart-card handling
- if PublicKey or Cert CKA_LABEL fails, try CKA_SUBJECT
 - don't use CKA_VALUE attribute on PUBLIC_KEY,
   because not everyone supports it.
   While being at it, add code for DSA and EC Cards.
 - load PKCS#11 engine only after database open.
 - avoid reloading the DLL on windows, because it is not supported.
   Windows users need to restart XCA after changing the PKCS#11 path
 - fix getSlotList() and return a QList<unsigned long>
2009-11-11 22:58:34 +01:00

63 lines
1.3 KiB
C++

/* vi: set sw=4 ts=4:
*
* Copyright (C) 2001 - 2007 Christian Hohnstaedt.
*
* All rights reserved.
*/
#include <qapplication.h>
#include <qtranslator.h>
#include <qtextcodec.h>
#include <qdir.h>
#include <qtranslator.h>
#include "widgets/MainWindow.h"
#include "lib/func.h"
#ifdef WIN32
#include <windows.h>
#endif
int main( int argc, char *argv[] )
{
int ret = 0, pkictr;
QString locale;
QTranslator qtTr( 0 );
QTranslator xcaTr( 0 );
MainWindow *mw;
QApplication a( argc, argv );
#ifdef WIN32
LANGID LangId = PRIMARYLANGID(GetUserDefaultLangID());
switch (LangId) {
case 0x07: locale="de"; break; //German
case 0x0a: locale="es"; break; //Spanish
case 0x0b: locale="fi"; break; //Finn
case 0x0c: locale="fr"; break; //French
case 0x0e: locale="hu"; break; //Hungarian
case 0x19: locale="ru"; break; //Russian
default: locale="c";
}
#else
locale = QLocale::system().name();
#endif
qtTr.load( QString( "qt_" ) + locale, "." );
xcaTr.load( QString( "xca_" ) + locale, getPrefix() );
a.installTranslator( &qtTr );
a.installTranslator( &xcaTr );
mw = new MainWindow(NULL);
mw->read_cmdline();
if (mw->exitApp == 0) {
mw->show();
ret = a.exec();
}
delete mw;
pkictr = pki_base::get_pki_counter();
if (pkictr)
printf("PKI Counter (%d)\n", pkictr);
return ret;
}