Commit ead92e20fa2f011edefd88edca8a323f88ffbf4c

Changes: work in progress on bug 160142

RevBy: TrustMe

Details:
  
5757 containerPolicy = new DuiLinearLayoutPolicy(containerLayout, Qt::Vertical);
5858 containerLayout->setPolicy(containerPolicy);
5959
60 DuiLocale locale;
6061 QStringList list;
6162 for (int i = 0; i < 10000; ++i) {
62 list << QString::number(10000 + i);
63 list << locale.formatNumber(10000 + i);
6364 }
6465
6566 comboBox1 = new DuiComboBox;
  
105105 if (currentLanguage == model->item(i, 1)->text())
106106 comboBox->setCurrentIndex(i);
107107 }
108 DuiLocale locale;
108109 //% "Please select language"
109 comboBox->setTitle(qtTrId("xx_language_combobox_title"));
110 comboBox->setTitle(qtTrId("xx_language_combobox_title") + " " + locale.formatNumber(1234567890));
110111
111112 connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeLanguage(int)));
112113}
  
6262 const QString SettingsCountry("/Dui/i18n/Country");
6363 const QString SettingsScript("/Dui/i18n/Script");
6464 const QString SettingsVariant("/Dui/i18n/Variant");
65 const QString SettingsLcNumeric("/Dui/i18n/LcNumeric");
6566}
6667
6768/// Helper
315315 , currentLanguageItem(SettingsLanguage),
316316 currentCountryItem(SettingsCountry),
317317 currentScriptItem(SettingsScript),
318 currentVariantItem(SettingsVariant)
318 currentVariantItem(SettingsVariant),
319 currentLcNumericItem(SettingsLcNumeric)
319320#endif
320321{
321322}
343343 , currentLanguageItem(SettingsLanguage),
344344 currentCountryItem(SettingsCountry),
345345 currentScriptItem(SettingsScript),
346 currentVariantItem(SettingsVariant)
346 currentVariantItem(SettingsVariant),
347 currentLcNumericItem(SettingsLcNumeric)
347348#endif
348349{
349350#ifdef HAVE_ICU
637637 DuiGConfItem countryItem(SettingsCountry);
638638 DuiGConfItem scriptItem(SettingsScript);
639639 DuiGConfItem variantItem(SettingsVariant);
640 DuiGConfItem lcNumericItem(SettingsLcNumeric);
640641
641642 QString language = languageItem.value().toString();
642643 QString country = countryItem.value().toString();
643644 QString script = scriptItem.value().toString();
644645 QString variant = variantItem.value().toString();
646 QString lcNumeric = lcNumericItem.value().toString();
645647
646648 DuiLocale *systemLocale;
647649
664664 QString(variant)));
665665 }
666666
667 if (!lcNumeric.isEmpty())
668 systemLocale->setCategoryLocale(DuiLocale::DuiLcNumeric, lcNumeric);
669
667670 return systemLocale;
668671#else
669672 QString language = qgetenv("LANG");
678678#endif
679679}
680680
681
682681//! creates a "C" locale
683682DuiLocale DuiLocale::createCLocale()
684683{
692692
693693 QObject::connect(&d->currentLanguageItem, SIGNAL(valueChanged()),
694694 this, SLOT(refreshSettings()));
695
696695 QObject::connect(&d->currentCountryItem, SIGNAL(valueChanged()),
697696 this, SLOT(refreshSettings()));
698
699697 QObject::connect(&d->currentScriptItem, SIGNAL(valueChanged()),
700698 this, SLOT(refreshSettings()));
701
702699 QObject::connect(&d->currentVariantItem, SIGNAL(valueChanged()),
703700 this, SLOT(refreshSettings()));
701 QObject::connect(&d->currentLcNumericItem, SIGNAL(valueChanged()),
702 this, SLOT(refreshSettings()));
704703#endif
705704}
706705
711711
712712 QObject::disconnect(&d->currentLanguageItem, SIGNAL(valueChanged()),
713713 this, SLOT(refreshSettings()));
714
715714 QObject::disconnect(&d->currentCountryItem, SIGNAL(valueChanged()),
716715 this, SLOT(refreshSettings()));
717
718716 QObject::disconnect(&d->currentScriptItem, SIGNAL(valueChanged()),
719717 this, SLOT(refreshSettings()));
720
721718 QObject::disconnect(&d->currentVariantItem, SIGNAL(valueChanged()),
722719 this, SLOT(refreshSettings()));
720 QObject::disconnect(&d->currentLcNumericItem, SIGNAL(valueChanged()),
721 this, SLOT(refreshSettings()));
723722#endif
724723}
725724
838838
839839 // Setting the default QLocale is needed to get localized number
840840 // support in translations via %Ln, %L1, %L2, ...:
841 QLocale qlocale(locale.language() + '_' + locale.country());
841 QLocale qlocale(locale.categoryLanguage(DuiLcNumeric)
842 + '_'
843 + locale.categoryCountry(DuiLcNumeric));
842844 QLocale::setDefault(qlocale);
843845 // sends QEvent::LanguageChange to qApp:
844846 (s_systemDefault->d_ptr)->insertTrToQCoreApp();
20642064{
20652065#ifdef HAVE_GCONF
20662066 Q_D(DuiLocale);
2067 bool settingsHaveReallyChanged = false;
20672068 QString language = d->currentLanguageItem.value().toString();
20682069 QString country = d->currentCountryItem.value().toString();
20692070 QString script = d->currentScriptItem.value().toString();
20702071 QString variant = d->currentVariantItem.value().toString();
20712072 QString localeName = d->createLocaleString(language, country, script, variant);
2073 QString lcNumeric = d->currentLcNumericItem.value().toString();
20722074
2075 qDebug() << __PRETTY_FUNCTION__ << "***mike start refreshSettings()" << "_defaultLocale=" << d->_defaultLocale << "_messageLocale=" << d->_messageLocale << categoryName(DuiLcMessages) << "_numericLocale=" << d->_numericLocale << categoryName(DuiLcNumeric) << "_collationLocale=" << d->_collationLocale << categoryName(DuiLcCollate) << "_calendarLocale=" << d->_calendarLocale << categoryName(DuiLcTime) << "_monetaryLocale=" << d->_monetaryLocale << categoryName(DuiLcMonetary) << "_nameLocale=" << d->_nameLocale << categoryName(DuiLcName);
2076
20732077 if (localeName != d->_defaultLocale) {
2078 settingsHaveReallyChanged = true;
20742079 d->_defaultLocale = localeName;
2075 setCategoryLocale(DuiLcMessages, localeName);
2076 setCategoryLocale(DuiLcTime, localeName);
2077 setCategoryLocale(DuiLcNumeric, localeName);
2078 setCategoryLocale(DuiLcCollate, localeName);
2079 setCategoryLocale(DuiLcMonetary, localeName);
2080 setCategoryLocale(DuiLcName, localeName);
2081
2080 }
2081 if (lcNumeric != d->_numericLocale) {
2082 settingsHaveReallyChanged = true;
2083 setCategoryLocale(DuiLcNumeric, lcNumeric);
2084 }
2085 if (settingsHaveReallyChanged) {
20822086 if (this == s_systemDefault) {
2087 qDebug () << __PRETTY_FUNCTION__ << "***mike is s_systemDefault";
20832088 // Setting the default QLocale is needed to get localized number
20842089 // support in translations via %Ln, %L1, %L2, ...:
2085 QLocale qlocale(this->language() + '_' + this->country());
2090 QLocale qlocale(this->categoryLanguage(DuiLcNumeric)
2091 + '_'
2092 + this->categoryCountry(DuiLcNumeric));
20862093 QLocale::setDefault(qlocale);
20872094 d->removeTrFromQCoreApp();
20882095 d->loadTrCatalogs();
21012101 else {
21022102 d->loadTrCatalogs();
21032103 }
2104 qDebug () << __PRETTY_FUNCTION__ << "***mike emit settingsChanged()";
21042105 emit settingsChanged();
21052106 }
2107
2108 qDebug() << __PRETTY_FUNCTION__ << "***mike end refreshSettings()" << "_defaultLocale=" << d->_defaultLocale << "_messageLocale=" << d->_messageLocale << categoryName(DuiLcMessages) << "_numericLocale=" << d->_numericLocale << categoryName(DuiLcNumeric) << "_collationLocale=" << d->_collationLocale << categoryName(DuiLcCollate) << "_calendarLocale=" << d->_calendarLocale << categoryName(DuiLcTime) << "_monetaryLocale=" << d->_monetaryLocale << categoryName(DuiLcMonetary) << "_nameLocale=" << d->_nameLocale << categoryName(DuiLcName);
2109
21062110#endif
21072111}
  
134134 DuiGConfItem currentCountryItem;
135135 DuiGConfItem currentScriptItem;
136136 DuiGConfItem currentVariantItem;
137 DuiGConfItem currentLcNumericItem;
137138#endif
138139
139140 DuiLocale *q_ptr;
  
722722 foreach(QGraphicsItem *item, items)
723723 if(!item->parentItem()) itemsWithoutParents << item;
724724 foreach(QGraphicsItem * item, itemsWithoutParents) {
725 qDebug() << __PRETTY_FUNCTION__ << "***mike QEvent::LanguageChange handler";
725726 d->handleLanguageChangeEvent(item);
726727 }
727728 }