Fix a bug : bad selected language in PreferencesPanel

This commit is contained in:
Grégory Soutadé 2012-04-01 10:49:39 +02:00
parent 85e891bfd1
commit 62541cbe2e
4 changed files with 17 additions and 10 deletions

View File

@ -7,11 +7,12 @@ g++
make
gettext
Optionnal :
Optional :
git
poeditor
xgettext
qt4-dev-tools
debhelper, devscripts, dh-make, fakeroot
php5

2
TODO
View File

@ -37,5 +37,3 @@ it's not taken in account by UpdateStats
it will not be displayed. In this case we must load whole meta.
This bug can't be resolved without use of hashtable because of
complexity in searching this issue.
* Français not correctly spelled (cause UTF-8) in StatsPanel

View File

@ -159,8 +159,6 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(ki
_language = new QListWidget();
//_language->SetWindowStyle(wxCB_READONLY);
InitLanguage(user);
connect(_language, SIGNAL(currentRowChanged(int)), this, SLOT(OnLanguageChange(int)));
staticBoxSizer->addWidget(_language);
@ -452,17 +450,23 @@ void PreferencesPanel::InitLanguage(User* user)
int i, select=0;
QListWidgetItem* item;
_inModification = true;
_language->clear();
for (i=0; i<SupportedLanguages::NB_SUPPORTED_LANGUAGES; i++)
{
item = new QListWidgetItem(SupportedLanguages::languages[i].name);
item = new QListWidgetItem(SupportedLanguages::languages[i].name.toLatin1());
item->setIcon(QIcon(SupportedLanguages::languages[i].icon)),
_language->addItem(item);
if (SupportedLanguages::languages[i].name == _wxUI->_language)
if (SupportedLanguages::languages[i].name == _wxUI->_curLanguage.name)
select = i;
}
_language->setCurrentItem(_language->item(select));
_language->setCurrentRow(select);
_inModification = false;
}
void PreferencesPanel::InitOperationOrder(User* user)
@ -1068,6 +1072,8 @@ void PreferencesPanel::OnLanguageChange(int index)
int language = SupportedLanguages::languages[index].language;
QString name_lang = SupportedLanguages::languages[index].name;
if (_inModification) return;
if (_wxUI->SetLanguage(name_lang) || language == SupportedLanguages::English)
{
_wxUI->NeedReload();
@ -1081,6 +1087,8 @@ void PreferencesPanel::OnLanguageChange(int index)
void PreferencesPanel::OnShow()
{
_wxUI->setWindowTitle(_kiss->GetUser()->_name + " - " + _("Preferences"));
InitLanguage(_kiss->GetUser());
}
void PreferencesPanel::OnKillMe()

View File

@ -34,8 +34,8 @@ namespace SupportedLanguages {
} language ;
static const language languages[NB_SUPPORTED_LANGUAGES] = {
{ QString::fromUtf8("English"), ICONS_PATH "/United Kingdom.png", QLocale::English, "english", "yyyy/MM/dd"},
{ QString::fromUtf8("Français"),ICONS_PATH "/France.png", QLocale::French, "french", "dd/MM/yyyy"}
{ "English", ICONS_PATH "/United Kingdom.png", QLocale::English, "english", "yyyy/MM/dd"},
{ "Français",ICONS_PATH "/France.png", QLocale::French, "french", "dd/MM/yyyy"}
};
}