Fix crash when changing language (using Qt 4.3)
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@290 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
e3dcd73b89
commit
9ce0432cff
|
@ -130,10 +130,10 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
|
||||||
|
|
||||||
//Language
|
//Language
|
||||||
translations = getAllTranslations();
|
translations = getAllTranslations();
|
||||||
|
initLanguageList();
|
||||||
QString currentLang = config->language();
|
QString currentLang = config->language();
|
||||||
bool foundCurrent = false;
|
bool foundCurrent = false;
|
||||||
for (int i=0; i<translations.size(); i++){
|
for (int i=0; i<translations.size(); i++){
|
||||||
listSelectLanguage->addItem(translations[i].nameLong);
|
|
||||||
if (translations[i].nameCode==currentLang){
|
if (translations[i].nameCode==currentLang){
|
||||||
listSelectLanguage->setCurrentRow(i+2);
|
listSelectLanguage->setCurrentRow(i+2);
|
||||||
foundCurrent = true;
|
foundCurrent = true;
|
||||||
|
@ -272,7 +272,8 @@ void CSettingsDlg::apply(){
|
||||||
if (config->language() != oldLang){
|
if (config->language() != oldLang){
|
||||||
installTranslator();
|
installTranslator();
|
||||||
retranslateUi(this);
|
retranslateUi(this);
|
||||||
OnSelectLanguage(langIndex);
|
initLanguageList();
|
||||||
|
listSelectLanguage->setCurrentRow(langIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Security
|
//Security
|
||||||
|
@ -398,6 +399,9 @@ void CSettingsDlg::OnBackupDeleteChange(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsDlg::OnSelectLanguage(int index){
|
void CSettingsDlg::OnSelectLanguage(int index){
|
||||||
|
if (index == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
if (index==0){
|
if (index==0){
|
||||||
labelLang->clear();
|
labelLang->clear();
|
||||||
labelAuthor->clear();
|
labelAuthor->clear();
|
||||||
|
@ -415,6 +419,14 @@ void CSettingsDlg::OnSelectLanguage(int index){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSettingsDlg::initLanguageList() {
|
||||||
|
listSelectLanguage->clear(); // completely rebuild the list because of a bug in Qt 4.3
|
||||||
|
listSelectLanguage->addItem(tr("System Language"));
|
||||||
|
listSelectLanguage->addItem("English (United States)"); // Don't translate this string
|
||||||
|
for (int i=0; i<translations.size(); i++)
|
||||||
|
listSelectLanguage->addItem(translations[i].nameLong);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef GLOBAL_AUTOTYPE
|
#ifdef GLOBAL_AUTOTYPE
|
||||||
void CSettingsDlg::resetGlobalShortcut(){
|
void CSettingsDlg::resetGlobalShortcut(){
|
||||||
autoType->unregisterGlobalShortcut();
|
autoType->unregisterGlobalShortcut();
|
||||||
|
|
|
@ -58,6 +58,7 @@ class CSettingsDlg : public QDialog, private Ui_SettingsDialog
|
||||||
private:
|
private:
|
||||||
virtual void paintEvent(QPaintEvent*);
|
virtual void paintEvent(QPaintEvent*);
|
||||||
virtual void resizeEvent(QResizeEvent*);
|
virtual void resizeEvent(QResizeEvent*);
|
||||||
|
void initLanguageList();
|
||||||
void apply();
|
void apply();
|
||||||
QColor color1,color2,textcolor;
|
QColor color1,color2,textcolor;
|
||||||
QPixmap BannerPixmap;
|
QPixmap BannerPixmap;
|
||||||
|
|
|
@ -832,16 +832,6 @@ QListView::item {
|
||||||
<property name="selectionBehavior" >
|
<property name="selectionBehavior" >
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>System Language</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text" >
|
|
||||||
<string>English</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
Loading…
Reference in New Issue