fixed Östereich issue
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@94 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
fa68023a76
commit
b3a1a6d216
|
@ -4,10 +4,11 @@
|
|||
-fixed crash when parsing config file under Win32
|
||||
-fixed loss of entry icons when saving a database which was not created
|
||||
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
|
||||
openend database will not longer be closed
|
||||
-same for the creation of a new database
|
||||
|
||||
---------------
|
||||
0.2.1
|
||||
---------------
|
||||
|
|
57
src/main.cpp
57
src/main.cpp
|
@ -77,6 +77,7 @@ QIcon *Icon_Swap;
|
|||
|
||||
inline void loadImages();
|
||||
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)
|
||||
|
@ -113,38 +114,33 @@ QTranslator* translator = NULL;
|
|||
QTranslator* qtTranslator=NULL;
|
||||
translator=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(loadTranslation(translator,"keepass-",loc.name(),QStringList()
|
||||
<< app->applicationDirPath()+"/../share/keepass/i18n/"
|
||||
<< QDir::homePath()+"/.keepass/" ))
|
||||
app->installTranslator(translator);
|
||||
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;
|
||||
TrActive=false;
|
||||
}
|
||||
|
||||
if(TrFound)
|
||||
app->installTranslator(translator);
|
||||
else
|
||||
delete translator;
|
||||
|
||||
|
||||
if(!qtTranslator->load("qt_"+loc.name().left(2),QLibraryInfo::location(QLibraryInfo::TranslationsPath))){
|
||||
if(loadTranslation(qtTranslator,"qt_",loc.name(),QStringList()
|
||||
<< QLibraryInfo::location(QLibraryInfo::TranslationsPath)
|
||||
<< app->applicationDirPath()+"/../share/keepass/i18n/"
|
||||
<< QDir::homePath()+"/.keepass/" ))
|
||||
app->installTranslator(qtTranslator);
|
||||
else{
|
||||
if(loc.name()!="en_US")
|
||||
qWarning(QString("Qt: No Translation found for '%1 (%2)'using 'English (UnitedStates)'")
|
||||
.arg(QLocale::languageToString(loc.language()))
|
||||
.arg(QLocale::countryToString(loc.country())).toAscii());
|
||||
delete qtTranslator;
|
||||
}else{
|
||||
app->installTranslator(qtTranslator);
|
||||
}
|
||||
|
||||
|
||||
|
||||
TrActive=TrFound;
|
||||
loadImages();
|
||||
SecString::generateSessionKey();
|
||||
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){
|
||||
if(argc>1){
|
||||
int i=1;
|
||||
|
|
Loading…
Reference in New Issue