Author: pulkomandy Date: 2010-07-20 17:47:16 +0200 (Tue, 20 Jul 2010) New Revision: 37619 Changeset: http://dev.haiku-os.org/changeset/37619 Modified: haiku/trunk/headers/os/locale/LocaleRoster.h haiku/trunk/src/preferences/locale/Jamfile haiku/trunk/src/preferences/locale/LocaleWindow.cpp haiku/trunk/src/preferences/locale/TimeFormatSettingsView.cpp Log: * Remove direct access to ICU in locale preflet, use the locale kit instead. Modified: haiku/trunk/headers/os/locale/LocaleRoster.h =================================================================== --- haiku/trunk/headers/os/locale/LocaleRoster.h 2010-07-20 13:15:23 UTC (rev 37618) +++ haiku/trunk/headers/os/locale/LocaleRoster.h 2010-07-20 15:47:16 UTC (rev 37619) @@ -23,6 +23,7 @@ class EditableCatalog; } + enum { B_LOCALE_CHANGED = '_LCC', }; @@ -33,16 +34,14 @@ BLocaleRoster(); ~BLocaleRoster(); -// status_t GetLocaleFor(const char *langCode, const char *countryCode); - status_t GetSystemCatalog(BCatalogAddOn **) const; status_t GetDefaultCollator(BCollator **) const; status_t GetDefaultLanguage(BLanguage **) const; status_t GetDefaultCountry(BCountry **) const; void SetDefaultCountry(BCountry *) const; - status_t GetLanguage(const char* languageCode, - BLanguage** _language) const; + status_t GetLanguage(const char* languageCode, BLanguage** _language) + const; status_t GetPreferredLanguages(BMessage *) const; status_t SetPreferredLanguages(BMessage *); Modified: haiku/trunk/src/preferences/locale/Jamfile =================================================================== --- haiku/trunk/src/preferences/locale/Jamfile 2010-07-20 13:15:23 UTC (rev 37618) +++ haiku/trunk/src/preferences/locale/Jamfile 2010-07-20 15:47:16 UTC (rev 37619) @@ -11,15 +11,10 @@ TimeFormatSettingsView.cpp ; -SubDirSysHdrs $(HAIKU_ICU_HEADERS) ; -Includes [ FGristFiles $(sources) ] : $(HAIKU_ICU_HEADERS_DEPENDENCY) ; - # Dependency needed to trigger downloading/unzipping the package before - # compiling the files. - Preference Locale : $(sources) - : be $(TARGET_LIBSTDC++) $(TARGET_LIBSUPC++) - libshared.a $(HAIKU_LOCALE_LIBS) $(HAIKU_ICU_LIBS) + : be $(TARGET_LIBSTDC++) $(TARGET_LIBSUPC++) libshared.a + $(HAIKU_LOCALE_LIBS) : Locale.rdef ; Modified: haiku/trunk/src/preferences/locale/LocaleWindow.cpp =================================================================== --- haiku/trunk/src/preferences/locale/LocaleWindow.cpp 2010-07-20 13:15:23 UTC (rev 37618) +++ haiku/trunk/src/preferences/locale/LocaleWindow.cpp 2010-07-20 15:47:16 UTC (rev 37619) @@ -26,11 +26,6 @@ #include <TabView.h> #include <UnicodeChar.h> -#include <ICUWrapper.h> - -#include <unicode/locid.h> -#include <unicode/datefmt.h> - #include "TimeFormatSettingsView.h" @@ -176,6 +171,25 @@ // get all available countries from ICU // Use DateFormat::getAvailableLocale so we get only the one we can // use. Maybe check the NumberFormat one and see if there is more. + BMessage countryList; + be_locale_roster->GetInstalledLanguages(&countryList); + BString countryCode; + + for (int i = 0; countryList.FindString("langs", i, &countryCode) == B_OK; + i++) { + BCountry country(countryCode); + BString countryName; + + country.Name(countryName); + + LanguageListItem* item + = new LanguageListItem(countryName, countryCode, + NULL); + listView->AddItem(item); + if (!strcmp(countryCode, defaultCountry->Code())) + listView->Select(listView->CountItems() - 1); + } + /* int32_t localeCount; const Locale* currentLocale = Locale::getAvailableLocales(localeCount); @@ -192,7 +206,7 @@ listView->AddItem(item); if (!strcmp(currentLocale[index].getName(), defaultCountry->Code())) listView->Select(listView->CountItems() - 1); - } + }*/ // TODO: find a real solution intead of this hack listView->SetExplicitMinSize( Modified: haiku/trunk/src/preferences/locale/TimeFormatSettingsView.cpp =================================================================== --- haiku/trunk/src/preferences/locale/TimeFormatSettingsView.cpp 2010-07-20 13:15:23 UTC (rev 37618) +++ haiku/trunk/src/preferences/locale/TimeFormatSettingsView.cpp 2010-07-20 15:47:16 UTC (rev 37619) @@ -30,9 +30,7 @@ #include <TextControl.h> #include <Window.h> -#include <unicode/utypes.h> - #undef B_TRANSLATE_CONTEXT #define B_TRANSLATE_CONTEXT "TimeFormatSettings" @@ -613,10 +611,10 @@ fShortTimeExampleView->SetText(timeFormat); status_t Error = fCountry->FormatNumber(&timeFormat, 1234.5678); - if (Error == U_ZERO_ERROR) + if (Error == B_OK) fNumberFormatExampleView->SetText(timeFormat); else - fNumberFormatExampleView->SetText(u_errorName((UErrorCode)Error)); + fNumberFormatExampleView->SetText("ERROR"); }