fixed Östereich issue

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@94 b624d157-de02-0410-bad0-e51aec6abb33
master
tarek_saidi 19 years ago
parent fa68023a76
commit b3a1a6d216
  1. 3
      changelog
  2. 55
      src/main.cpp

@ -4,10 +4,11 @@
-fixed crash when parsing config file under Win32 -fixed crash when parsing config file under Win32
-fixed loss of entry icons when saving a database which was not created -fixed loss of entry icons when saving a database which was not created
with KeePassX (no KPX_CUSTOM_ICONS metastream) with KeePassX (no KPX_CUSTOM_ICONS metastream)
-when there is no translation installed for the system's country preference but
one for the same language the program will now use it
-when canceling the file dialog for the opening of an existing database a already -when canceling the file dialog for the opening of an existing database a already
openend database will not longer be closed openend database will not longer be closed
-same for the creation of a new database -same for the creation of a new database
--------------- ---------------
0.2.1 0.2.1
--------------- ---------------

@ -77,6 +77,7 @@ QIcon *Icon_Swap;
inline void loadImages(); inline void loadImages();
inline void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg,QString& ArgLang); inline void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg,QString& ArgLang);
bool loadTranslation(QTranslator* tr,const QString& prefix,const QString& LocaleCode,const QStringList& SearchPaths);
int main(int argc, char **argv) int main(int argc, char **argv)
@ -113,38 +114,33 @@ QTranslator* translator = NULL;
QTranslator* qtTranslator=NULL; QTranslator* qtTranslator=NULL;
translator=new QTranslator; translator=new QTranslator;
qtTranslator=new QTranslator; qtTranslator=new QTranslator;
bool TrFound=true;
QString locname;
if(!translator->load("keepass-"+loc.name(),app->applicationDirPath()+"/../share/keepass/i18n/")){
if(!translator->load("keepass-"+loc.name(),QDir::homePath()+"/.keepass/")){
if(loc.name()!="en_US")
qWarning(QString("KeePassX: No Translation found language '%1 (%2)' using 'English (UnitedStates)'")
.arg(QLocale::languageToString(loc.language()))
.arg(QLocale::countryToString(loc.country())).toAscii());
TrFound=false;
}
}
if(TrFound) if(loadTranslation(translator,"keepass-",loc.name(),QStringList()
<< app->applicationDirPath()+"/../share/keepass/i18n/"
<< QDir::homePath()+"/.keepass/" ))
app->installTranslator(translator); app->installTranslator(translator);
else else{
if(loc.name()!="en_US")
qWarning(QString("Kpx: No Translation found for '%1 (%2)'using 'English (UnitedStates)'")
.arg(QLocale::languageToString(loc.language()))
.arg(QLocale::countryToString(loc.country())).toAscii());
delete translator; delete translator;
TrActive=false;
}
if(loadTranslation(qtTranslator,"qt_",loc.name(),QStringList()
if(!qtTranslator->load("qt_"+loc.name().left(2),QLibraryInfo::location(QLibraryInfo::TranslationsPath))){ << QLibraryInfo::location(QLibraryInfo::TranslationsPath)
<< app->applicationDirPath()+"/../share/keepass/i18n/"
<< QDir::homePath()+"/.keepass/" ))
app->installTranslator(qtTranslator);
else{
if(loc.name()!="en_US") if(loc.name()!="en_US")
qWarning(QString("Qt: No Translation found for '%1 (%2)'using 'English (UnitedStates)'") qWarning(QString("Qt: No Translation found for '%1 (%2)'using 'English (UnitedStates)'")
.arg(QLocale::languageToString(loc.language())) .arg(QLocale::languageToString(loc.language()))
.arg(QLocale::countryToString(loc.country())).toAscii()); .arg(QLocale::countryToString(loc.country())).toAscii());
delete qtTranslator; delete qtTranslator;
}else{
app->installTranslator(qtTranslator);
} }
TrActive=TrFound;
loadImages(); loadImages();
SecString::generateSessionKey(); SecString::generateSessionKey();
int r=0; int r=0;
@ -297,6 +293,23 @@ _loadIcon(Icon_Swap,"/actions/reload.png");
} }
bool loadTranslation(QTranslator* tr,const QString& prefix,const QString& loc,const QStringList& paths){
for(int i=0;i<paths.size();i++)
if(tr->load(prefix+loc+".qm",paths[i])) return true;
for(int i=0;i<paths.size();i++){
QDir dir(paths[i]);
QStringList TrFiles=dir.entryList(QStringList()<<"*.qm",QDir::Files);
for(int j=0;j<TrFiles.size();j++){
if(TrFiles[j].left(prefix.length()+2)==prefix+loc.left(2)){
if(tr->load(TrFiles[j],paths[i]))return true;
}
}
}
return false;
}
void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg,QString& ArgLang){ void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg,QString& ArgLang){
if(argc>1){ if(argc>1){
int i=1; int i=1;