* Remove direct access to ICU in locale preflet, use the locale kit instead.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37619 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-07-20 15:47:16 +00:00
parent ce0077c3cb
commit 4b37c7f861
4 changed files with 27 additions and 21 deletions

View File

@ -23,6 +23,7 @@ namespace BPrivate {
class EditableCatalog;
}
enum {
B_LOCALE_CHANGED = '_LCC',
};
@ -33,16 +34,14 @@ class BLocaleRoster {
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 *);

View File

@ -11,15 +11,10 @@ local sources =
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
;

View File

@ -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 @@ LocaleWindow::LocaleWindow()
// 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 @@ LocaleWindow::LocaleWindow()
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(

View File

@ -30,8 +30,6 @@
#include <TextControl.h>
#include <Window.h>
#include <unicode/utypes.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "TimeFormatSettings"
@ -613,10 +611,10 @@ FormatView::_UpdateExamples()
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");
}