diff -r 730c025d4b77 -r f378acbc9cfb src/hbcore/i18n/hbextendedlocale.cpp --- a/src/hbcore/i18n/hbextendedlocale.cpp Thu Jul 15 14:03:49 2010 +0100 +++ b/src/hbcore/i18n/hbextendedlocale.cpp Thu Jul 22 16:36:53 2010 +0100 @@ -115,15 +115,18 @@ /*! Returns the date separator, which can occur in four different positions: - Beginning of the expression - Between the first and second part - Between the second and third part - At the end of the expression - Some of the positions may contain an empty string if a separator is not used in that position in the locale in question + Beginning of the expression; + Between the first and second part; + Between the second and third part; + At the end of the expression; + Some of the positions may contain an empty string if a separator is not used in that position in the locale in question. + + \attention Symbian specific API - \return one of the four characters used to separate the day, + \return Symbian - One of the four characters used to separate the day, month and year components of the date according to the - system locale. + system locale + \return other platforms - Empty QChar or '\' (depending on index) \param index Index of the separator (0-3) */ @@ -147,6 +150,8 @@ month and year components of the date according to the system locale. + \attention Symbian specific API + \param ch Character to set, \param index Index of the separator (0-3) @@ -171,11 +176,14 @@ } /*! - Retrieves the time separator (for example, colon or full stop) + Retrieves the time separator (for example, colon or full stop). - \return one of the four characters used to separate the hour, + \attention Symbian specific API + + \return Symbian - One of the four characters used to separate the hour, minute and second components of the date according to the - system locale. + system locale + \return other platforms - Empty QChar or ':' (depending on index) \param index Index of the separator (0-3) */ @@ -198,6 +206,8 @@ Sets one of the four characters used to separate the hour, minute and second components of the date. + \attention Symbian specific API + \param ch Character to set, \param index Index of the separator (0-3) @@ -229,15 +239,19 @@ or year-month-day (used, for example, in Japanese, Chinese and Swedish) This enum defines the order of date components. - \value American American order (mm/dd/yyyy) - \value European European order (dd/mm/yyyy) - \value Japanese Japanese order (yyyy/mm/dd) + \value American American order (mm/dd/yyyy) + \value European European order (dd/mm/yyyy) + \value Japanese Japanese order (yyyy/mm/dd) \sa dateStyle(), setDateStyle() */ /*! - \return date style from system locale. The date style is returned according to DateStyle. + Returns date style from system locale. The date style is returned according to DateStyle. + + \attention Symbian specific API + + \return date style for Symbian and HbExtendedLocale::American for other platforms */ HbExtendedLocale::DateStyle HbExtendedLocale::dateStyle() const { @@ -265,6 +279,8 @@ /*! Sets date style to system locale. The date style is chosen according to the \a style parameter. + + \attention Symbian specific API \return true for Symbian and false for other OS */ @@ -301,14 +317,18 @@ \enum HbExtendedLocale::TimeStyle Finds out if the 12-hour or the 24-hour clock is used - \value Time12 12 hour clock style - \value Time24 24 hour clock style + \value Time12 12 hour clock style + \value Time24 24 hour clock style \sa timeStyle(), setTimeStyle() */ /*! - \return time style from system locale. The time style is returned according to TimeStyle. + Returns time style from system locale. The time style is returned according to TimeStyle. + + \attention Symbian specific API + + \return time style for Symbian and HbExtendedLocale::Time12 for other platforms */ HbExtendedLocale::TimeStyle HbExtendedLocale::timeStyle() const { @@ -331,6 +351,8 @@ /*! Sets time style to system locale. The time style is chosen according to the \a style parameter. + + \attention Symbian specific API \return true for Symbian and false for other OS */ @@ -360,9 +382,12 @@ /*! - Finds out if the AM/PM symbol is separated by a space from the time expression + Finds out if the AM/PM symbol is separated by a space from the time expression. + + \attention Symbian specific API - \return true if space is inserted between the time and the preceding or trailing am/pm text; otherwise returns false. + \return Symbian - True if space is inserted between the time and the preceding or trailing am/pm text; otherwise returns false. + \return other platforms - true */ bool HbExtendedLocale::amPmSpace() const { @@ -376,6 +401,8 @@ /*! Sets whether a \a space is inserted between the time and the preceding or trailing am/pm text. + + \attention Symbian specific API \return true for Symbian and false for other OS */ @@ -396,7 +423,7 @@ \enum HbExtendedLocale::SymbolPos \value Before - \value After + \value After Retrieves the position of the AM/PM symbol (before or after the time expression) \sa amPmSymbolPosition(), setAmPmSymbolPosition() @@ -404,7 +431,11 @@ */ /*! - \return Before if am/pm text is positioned before time; otherwise returns After. + Returns HbExtendedLocale::Before if am/pm text is positioned before time; otherwise returns HbExtendedLocale::After. + + \attention Symbian specific API + + \return After/Before for Symbian and HbExtendedLocale::After for other platforms */ HbExtendedLocale::SymbolPos HbExtendedLocale::amPmSymbolPosition() const { @@ -413,18 +444,19 @@ TLocalePos position = _symbianLocale.GetLocale()->AmPmSymbolPosition(); if ( position == ELocaleBefore ) { return HbExtendedLocale::Before; - } else if ( position == ELocaleAfter ) { + } else { return HbExtendedLocale::After; } #else return HbExtendedLocale::After; #endif - return HbExtendedLocale::After; } /*! Sets the am/pm text position. The position is chosen according to the \a position parameter. + + \attention Symbian specific API \return true for Symbian if succesfull and false for other OS */ @@ -462,10 +494,13 @@ */ /*! - Retrives the measurement system (if metric or imperial units are in use) + Retrives the measurement system (if metric or imperial units are in use). + + \attention Symbian specific API - \return short unit distance format from system locale. Format is specified by UnitsFormat. - */ + \return Symbian - Short unit distance format from system locale. Format is specified by UnitsFormat. + \return other platforms - QLocale::MetricSystem +*/ QLocale::MeasurementSystem HbExtendedLocale::unitsDistanceShort() const { #if defined(Q_OS_SYMBIAN) @@ -486,6 +521,8 @@ /*! Sets short unit distance \a format to system locale. + \attention Symbian specific API + \return true for Symbian and false for other OS */ bool HbExtendedLocale::setUnitsDistanceShort( const QLocale::MeasurementSystem format ) @@ -514,7 +551,11 @@ } /*! - \return long unit distance format from system locale. Format is specified by UnitsFormat. + Returns long unit distance format from system locale. Format is specified by UnitsFormat. + + \attention Symbian specific API + + \return long unit distance format for Symbian and QLocale::MetricSystem for other platforms */ QLocale::MeasurementSystem HbExtendedLocale::unitsDistanceLong() const { @@ -535,6 +576,8 @@ /*! Sets long unit distance \a format to system locale. + + \attention Symbian specific API \return true for Symbian and false for other OS */ @@ -564,8 +607,10 @@ /*! Sets general unit distance \a format to system locale. + + \attention Symbian specific API - \return true for Symbian and -1 for other OS + \return true for Symbian and false for other OS */ bool HbExtendedLocale::setUnitsGeneral( const QLocale::MeasurementSystem format ) { @@ -607,8 +652,12 @@ */ /*! - \return the negative currency format from system locale. - */ + Returns the negative currency format from system locale. + + \attention Symbian specific API + + \return the negative currency format for Symbian and HbExtendedLocale::LeadingMinusSign for other platforms +*/ HbExtendedLocale::NegativeCurrencyFormat HbExtendedLocale::negativeCurrencyFormat() const { #if defined(Q_OS_SYMBIAN) @@ -632,6 +681,8 @@ /*! Sets negative currency \a format to system locale. + + \attention Symbian specific API \return true for Symbian and false for other OS */ @@ -666,7 +717,11 @@ /*! Finds out if the currency symbol is separated by a space from the amount. - \return true if negative currency values have a space between the currency symbol and the value; otherwise returns false. + + \attention Symbian specific API + + \return Symbian - True if negative currency values have a space between the currency symbol and the value; otherwise returns false. + \return other platforms - false */ bool HbExtendedLocale::negativeCurrencySpace() const { @@ -681,6 +736,8 @@ /*! Sets whether negative currency values have a space between the currency symbol and the value. + \attention Symbian specific API + \param space True to set a flag which indicates that negative currency values should have the space between the value and the symbol. False to unset it. @@ -703,9 +760,12 @@ Finds out if the currency symbol is placed on the opposite side with negative currencies compared to where it is placed with non-negative currencies. - \return true if in negative currency values, the position of the currency + \attention Symbian specific API + + \return Symbian - True if in negative currency values, the position of the currency symbol is set to be the opposite of the position used for non-negative values; otherwise returns false. + \return other platforms - false */ bool HbExtendedLocale::negativeCurrencySymbolOpposite() const { @@ -722,6 +782,8 @@ values should be the \a opposite of the position used for non-negative values. + \attention Symbian specific API + \return true for Symbian and false for other OS */ bool HbExtendedLocale::setNegativeCurrencySymbolOpposite( const bool opposite ) @@ -741,8 +803,10 @@ Finds out if currency triads are used (the grouping of digits in large numbers, for example, 123 456 789). The Symbian OS only supports the grouping of currency amounts. - \return true if currency triads are allowed in currency values; otherwise returns false. - + \attention Symbian specific API + + \return Symbian - True if currency triads are allowed in currency values; otherwise returns false. + \return other platforms - false */ bool HbExtendedLocale::currencyTriadsAllowed() const { @@ -757,7 +821,9 @@ /*! Sets whether triads are \a allowed in currency values. - \return true for Symbian and false for other CS + \attention Symbian specific API + + \return true for Symbian and false for other OS */ bool HbExtendedLocale::setCurrencyTriadsAllowed( const bool allowed ) { @@ -774,10 +840,15 @@ /*! - \return true if a space is inserted between the currency symbol and - a positive currency value; otherwise returns false. + Returns boolean which tells if currency format contains a space. + + \attention Symbian specific API - \note For negative currency values, the space can be inserted using + \return Symbian - True if a space is inserted between the currency symbol and + a positive currency value; otherwise returns false. + \return other platforms - false + + \note For negative currency values, the space can be inserted using setNegativeCurrencySpace(). */ bool HbExtendedLocale::currencySpace() const @@ -794,7 +865,9 @@ Sets whether a \a space is inserted between the currency symbol and the currency amount. - \return true for Symbian and false for other OS + \attention Symbian specific API + + \return true for Symbian and false for other OS */ bool HbExtendedLocale::setCurrencySpace( const bool space ) { @@ -813,7 +886,10 @@ /*! The currency symbol may contain a different number of characters in different countries/regions. Example: ś, $, Ft, kn, Euro symbol - \return the currency symbol. + + \attention Symbian specific API + + \return the currency symbol for Symbian and empty QString for other platforms */ QString HbExtendedLocale::currencySymbol() const { @@ -829,6 +905,8 @@ /*! Sets the currency \a symbol. + \attention Symbian specific API + \return true for Symbian if succesfull and false for other OS */ bool HbExtendedLocale::setCurrencySymbol( const QString &symbol ) @@ -850,9 +928,13 @@ /*! Retrieves position of the currency symbol (before or after the amount). - \return the currency symbol position. + + \attention Symbian specific API + + \return Symbian - the currency symbol position + \return other platforms - HbExtendedLocale::Before - \note For negative currency values, this position may be reversed using + \note For negative currency values, this position may be reversed using SetNegativeCurrencySymbolOpposite(). */ HbExtendedLocale::SymbolPos HbExtendedLocale::currencySymbolPosition() const @@ -873,9 +955,11 @@ } /*! - Sets the currency symbol \a position. + Sets the currency symbol \a position. + + \attention Symbian specific API - \return true for Symbian and false for other OS + \return true for Symbian and false for other OS */ bool HbExtendedLocale::setCurrencySymbolPosition( const SymbolPos position ) { @@ -901,7 +985,12 @@ } /*! - \return the number of decimal places to which currency values are set. + Returns the number of decimal places to which currency values are set. + + \attention Symbian specific API + + \return Symbian - the number of decimal place + \return other platforms - '0' */ int HbExtendedLocale::currencyDecimalPlaces() const { @@ -914,9 +1003,11 @@ } /*! - Sets the number of decimal \a places to which currency values should be set. + Sets the number of decimal \a places to which currency values should be set. + + \attention Symbian specific API - \return true for Symbian and false for other OS + \return true for Symbian and false for other OS */ bool HbExtendedLocale::setCurrencyDecimalPlaces( const int places ) { @@ -955,6 +1046,9 @@ These settings include the currency symbol, the symbol's position and how negative values are formatted. + \attention Cross-Platform API + \attention Uses QString::number() function with other platforms than Symbian. + \sa setCurrencyDecimalPlaces(), setCurrencySpace(), setCurrencySymbol(), setCurrencySymbolPosition(), setNegativeCurrencySpace(), setNegativeCurrencyFormat(), setCurrencyTriadsAllowed(), setNegativeCurrencySymbolOpposite(), @@ -973,7 +1067,7 @@ HBufC *bufPtr = HBufC::New(bufferMinSize); - if ( bufPtr == NULL ) { + if ( !bufPtr ) { return QString(); } @@ -996,7 +1090,7 @@ HBufC *newBufPtr = bufPtr->ReAlloc(fSize); - if ( newBufPtr == NULL ) { + if ( !newBufPtr ) { delete bufPtr; return QString(); } @@ -1008,8 +1102,10 @@ _symbianLocale.LoadSystemSettings(); _symbianLocale.GetLocale()->FormatCurrency(modifiableBufPtr, overflow, TInt64(amount)); } - - return QString::fromUtf16(bufPtr->Ptr(), bufPtr->Length()); + QString value = QString::fromUtf16(bufPtr->Ptr(), bufPtr->Length()); + delete bufPtr; + bufPtr = 0; + return value; #else return QString::number(amount); @@ -1018,6 +1114,8 @@ /*! Sets decimal point character \a ch to system locale. + + \attention Symbian specific API \return true for Symbian and false for other OS */ @@ -1037,6 +1135,8 @@ /*! Sets group separator character \a ch to system locale. + + \attention Symbian specific API \return true for Symbian and false for other OS */ @@ -1057,6 +1157,8 @@ /*! Sets zero digit \a type to system locale. + \attention Symbian specific API + \return true for Symbian and false for other OS */ bool HbExtendedLocale::setZeroDigit( const DigitType type ) @@ -1095,89 +1197,194 @@ Mapping from Symbian to ISO locale */ struct symbianToISO { + // enumeration of symbian language int symbian_language; + // string of ISO value char iso_name[8]; }; #if defined(Q_OS_SYMBIAN) +/*! + Mapping from Symbian to ISO locale +*/ static const symbianToISO symbian_to_iso_list[] = { - { ELangEnglish, "en_GB" }, - { ELangFrench, "fr_FR" }, - { ELangGerman, "de_DE" }, - { ELangSpanish, "es_ES" }, - { ELangItalian, "it_IT" }, - { ELangSwedish, "sv_SE" }, - { ELangDanish, "da_DK" }, - { ELangNorwegian, "no_NO" }, - { ELangFinnish, "fi_FI" }, - { ELangAmerican, "en_US" }, - { ELangPortuguese, "pt_PT" }, - { ELangTurkish, "tr_TR" }, - { ELangIcelandic, "is_IS" }, - { ELangRussian, "ru_RU" }, - { ELangHungarian, "hu_HU" }, - { ELangDutch, "nl_NL" }, - { ELangCzech, "cs_CZ" }, - { ELangSlovak, "sk_SK" }, - { ELangPolish, "pl_PL" }, - { ELangSlovenian, "sl_SI" }, - { ELangTaiwanChinese, "zh_TW" }, - { ELangHongKongChinese, "zh_HK" }, - { ELangPrcChinese, "zh_CN" }, - { ELangJapanese, "ja_JP" }, - { ELangThai, "th_TH" }, - { ELangArabic, "ar_AE" }, - { ELangTagalog, "tl_PH" }, - { ELangBengali, "bn_IN" }, // Bangladesh/India - { ELangBulgarian, "bg_BG" }, - { ELangCatalan, "ca_ES" }, - { ELangCroatian, "hr_HR" }, - { ELangEstonian, "et_EE" }, - { ELangFarsi, "fa_IR" }, - { ELangCanadianFrench, "fr_CA" }, - { ELangGreek, "el_GR" }, - { ELangGujarati, "gu_IN" }, - { ELangHebrew, "he_IL" }, - { ELangHindi, "hi_IN" }, - { ELangIndonesian, "id_ID" }, - { ELangKannada, "kn_IN" }, - { ELangKorean, "ko_KR" }, - { ELangLatvian, "lv_LV" }, - { ELangLithuanian, "lt_LT" }, - { ELangMalay, "ms_MY" }, - { ELangMalayalam, "ml_IN" }, - { ELangMarathi, "mr_IN" }, - { ELangBrazilianPortuguese, "pt_BR" }, - { ELangRomanian, "ro_RO" }, - { ELangSerbian, "sr_YU" }, - { ELangLatinAmericanSpanish, "es_MX" }, - { ELangTamil, "ta_IN" }, - { ELangTelugu, "te_IN" }, - { ELangUkrainian, "uk_UA" }, - { ELangUrdu, "ur_PK" }, // India/Pakistan - { ELangVietnamese, "vi_VN" }, + { ELangEnglish, "en_GB" }, + { ELangFrench, "fr_FR" }, + { ELangGerman, "de_DE" }, + { ELangSpanish, "es_ES" }, + { ELangItalian, "it_IT" }, + { ELangSwedish, "sv_SE" }, + { ELangDanish, "da_DK" }, + { ELangNorwegian, "nb_NO" }, + { ELangFinnish, "fi_FI" }, + { ELangAmerican, "en_US" }, + { ELangSwissFrench, "fr_CH" }, + { ELangSwissGerman, "de_CH" }, + { ELangPortuguese, "pt_PT" }, + { ELangTurkish, "tr_TR" }, + { ELangIcelandic, "is_IS" }, + { ELangRussian, "ru_RU" }, + { ELangHungarian, "hu_HU" }, + { ELangDutch, "nl_NL" }, + { ELangBelgianFlemish, "nl_BE" }, + { ELangAustralian, "en_AU" }, + { ELangBelgianFrench, "fr_AU" }, + { ELangAustrian, "de_AT" }, + { ELangNewZealand, "en_NZ" }, + { ELangInternationalFrench, "fr_ZZ" }, + { ELangCzech, "cs_CZ" }, + { ELangSlovak, "sk_SK" }, + { ELangPolish, "pl_PL" }, + { ELangSlovenian, "sl_SI" }, + { ELangTaiwanChinese, "zh_TW" }, + { ELangHongKongChinese, "zh_HK" }, + { ELangPrcChinese, "zh_CN" }, + { ELangJapanese, "ja_JP" }, + { ELangThai, "th_TH" }, + { ELangAfrikaans, "af_ZA" }, + { ELangAlbanian, "sq_AL" }, + { ELangAmharic, "am_ET" }, + { ELangArabic, "ar_AE" }, + { ELangArmenian, "hy_AM" }, + { ELangTagalog, "tl_PH" }, + { ELangBelarussian, "be_BY" }, + { ELangBengali, "bn_IN" }, + { ELangBulgarian, "bg_BG" }, + { ELangBurmese, "my_MM" }, + { ELangCatalan, "ca_ES" }, + { ELangCroatian, "hr_HR" }, + { ELangCanadianEnglish, "en_CA" }, + { ELangInternationalEnglish,"en_ZZ" }, + { ELangSouthAfricanEnglish, "en_ZA" }, + { ELangEstonian, "et_EE" }, + { ELangFarsi, "fa_IR" }, + { ELangCanadianFrench, "fr_CA" }, + { ELangScotsGaelic, "gd_GB" }, + { ELangGeorgian, "ka_GE" }, + { ELangGreek, "el_GR" }, + { ELangCyprusGreek, "el_CY" }, + { ELangGujarati, "gu_IN" }, + { ELangHebrew, "he_IL" }, + { ELangHindi, "hi_IN" }, + { ELangIndonesian, "id_ID" }, + { ELangIrish, "ga_IE" }, + { ELangSwissItalian, "it_CH" }, + { ELangKannada, "kn_IN" }, + { ELangKazakh, "kk_KZ" }, + { ELangKhmer, "km_KH" }, + { ELangKorean, "ko_KR" }, + { ELangLao, "lo_LA" }, + { ELangLatvian, "lv_LV" }, + { ELangLithuanian, "lt_LT" }, + { ELangMacedonian, "mk_MK" }, + { ELangMalay, "ms_MY" }, + { ELangMalayalam, "ml_IN" }, + { ELangMarathi, "mr_IN" }, + { ELangMoldavian, "ro_MD" }, + { ELangMongolian, "mn_MN" }, + { ELangNorwegianNynorsk, "nn_NO" }, + { ELangBrazilianPortuguese, "pt_BR" }, + { ELangPunjabi, "pa_IN" }, + { ELangRomanian, "ro_RO" }, + { ELangSerbian, "sr_YU" }, + { ELangSinhalese, "si_LK" }, + { ELangSomali, "so_SO" }, + { ELangInternationalSpanish,"es_ZZ" }, + { ELangLatinAmericanSpanish,"es_419" }, + { ELangSwahili, "sw_KE" }, + { ELangFinlandSwedish, "sv_FI" }, + { ELangTamil, "ta_IN" }, + { ELangTelugu, "te_IN" }, + { ELangTibetan, "bo_CN" }, + { ELangTigrinya, "ti_ER" }, + { ELangCyprusTurkish, "tr_CY" }, + { ELangTurkmen, "tk_TM" }, + { ELangUkrainian, "uk_UA" }, + { ELangUrdu, "ur_PK" }, + { ELangVietnamese, "vi_VN" }, + { ELangWelsh, "cy_GB" }, + { ELangZulu, "zu_ZA" }, + { ELangManufacturerEnglish, "en_XZ" }, + { ELangSouthSotho, "st_LS" }, #ifdef __E32LANG_H__ // 5.0 - { ELangBasque, "eu_ES" }, - { ELangGalician, "gl_ES" }, + { ELangBasque, "eu_ES" }, + { ELangGalician, "gl_ES" }, #endif - { ELangEnglish_Apac, "en_APAC" }, - { ELangEnglish_Taiwan, "en_TW" }, - { ELangEnglish_HongKong, "en_HK" }, - { ELangEnglish_Prc, "en_CN" }, - { ELangEnglish_Japan, "en_JP"}, - { ELangEnglish_Thailand, "en_TH" }, - { ELangEnglish_India, "en_IN" }, - { ELangMalay_Apac, "ms_APAC" }, - { ELangIndonesian_Apac, "id_APAC" } + { ELangJavanese, "jv_ID" }, + { ELangMaithili, "bh_IN" }, + { ELangAzerbaijani_Latin, "az_AZ" }, + { ELangOriya, "or_IN" }, + { ELangBhojpuri, "bh_IN" }, + { ELangSundanese, "su_ID" }, + { ELangKurdish_Latin, "ku_TR" }, + { ELangKurdish_Arabic, "ku_IQ" }, + { ELangPashto, "ps_AF" }, + { ELangHausa, "ha_NG" }, + { ELangOromo, "om_ET" }, + { ELangUzbek_Latin, "uz_UZ" }, + { ELangSindhi_Arabic, "sd_PK" }, + { ELangSindhi_Devanagari, "sd_IN" }, + { ELangYoruba, "yo_NG" }, + { ELangIgbo, "ig_NG" }, + { ELangMalagasy, "mg_MG" }, + { ELangNepali, "ne_NP" }, + { ELangAssamese, "as_IN" }, + { ELangShona, "sn_ZW" }, + { ELangZhuang, "za_CN" }, + { ELangEnglish_Taiwan, "en_TW" }, + { ELangEnglish_HongKong, "en_HK" }, + { ELangEnglish_Prc, "en_CN" }, + { ELangEnglish_Japan, "en_JP" }, + { ELangEnglish_Thailand, "en_TH" }, + { ELangFulfulde, "ff_NE" }, + { ELangBolivianQuechua, "qu_BO" }, + { ELangPeruQuechua, "qu_PE" }, + { ELangEcuadorQuechua, "qu_EC" }, + { ELangTajik_Cyrillic, "tg_TJ" }, + { ELangNyanja, "ny_MW" }, + { ELangHaitianCreole, "ht_HT" }, + { ELangKoongo, "kg_CG" }, + { ELangAkan, "ak_GH" }, + { ELangYi, "ii_CN" }, + { ELangUyghur, "ug_CN" }, + { ELangRwanda, "rw_RW" }, + { ELangXhosa, "xh_ZA" }, + { ELangGikuyu, "ki_KE" }, + { ELangRundi, "rn_BI" }, + { ELangTswana, "tn_BW" }, + { ELangKanuri, "kr_NE" }, + { ELangKashmiri_Devanagari, "ks_ZZ" }, + { ELangKashmiri_PersoArabic,"ks_XZ" }, + { ELangWolof, "wo_SN" }, + { ELangTsonga, "ts_ZA" }, + { ELangYiddish, "yi_IL" }, + { ELangKirghiz, "ky_KG" }, + { ELangGanda, "lg_UG" }, + { ELangBambara, "bm_ML" }, + { ELangCentralAymara, "ay_BO" }, + { ELangLingala, "ln_CG" }, + { ELangBashkir, "ba_RU" }, + { ELangChuvash, "cv_RU" }, + { ELangSwati, "ss_SZ" }, + { ELangTatar, "tt_RU" }, + { ELangSouthernNdebele, "nr_ZA" }, + { ELangSardinian, "sc_IT" }, + { ELangWalloon, "wa_BE" }, + { ELangEnglish_India, "en_IN" } }; #endif /*! - \return ISO name corresponding to the Symbian language \a code. + Returns ISO name corresponding to the Symbian language \a code. If the code does not does not correspond to any Symbian language, returns a empty string. + \attention Symbian specific API + + \return Symbian - ISO style language code + \return other platforms - empty QString + \sa User::Language() */ QString HbExtendedLocale::symbianLangToISO( const int code ) @@ -1189,8 +1396,7 @@ int cmp = code - symbian_to_iso_list[0].symbian_language; if (cmp < 0) { return QString(); - } - else { + } else { if (cmp == 0) { return symbian_to_iso_list[0].iso_name; } @@ -1223,9 +1429,14 @@ } /*! - \return RFC3066 name corresponding to the Symbian language \a code. + Returns RFC3066 name corresponding to the Symbian language \a code. If the code does not does not correspond to any Symbian language, - returns a empty string. + returns a empty string. + + \attention Symbian specific API + + \return Symbian - RFC3066 style language code + \return other platforms - empty QString \sa User::Language() */ @@ -1237,9 +1448,11 @@ /*! Converts ISO tag to Symbian language code. + \attention Symbian specific API + \param langAndCountry ISO tag, example "fi_FI" - \return Symbian language code or -1 (failed case) + \return Symbian language code if successful. With other platforms or if case fails then '-1'. */ int HbExtendedLocale::ISOToSymbianLang( const QString &langAndCountry ) { @@ -1287,7 +1500,12 @@ /*! Returns a Qt version of the given \a sys_fmt Symbian datetime format string. Some convertable fields use data from current system locale, - unwanted locale may cause unexpected results. + unwanted locale may cause unexpected results. + + \attention Symbian specific API + + \return Symbian - datetime format string + \return other platforms - "not supported" */ QString HbExtendedLocale::symbianDateTimeToQt( const QString &sys_fmt ) { @@ -1507,6 +1725,9 @@ case 'A': { // quickie to get capitalization, can't use s60 string as is because Qt 'hh' format's am/pm logic TAmPmName ampm = TAmPmName(); + if ( ampm.Size() == 0 ) { + return QString(); + } TChar first(ampm[0]); QString qtampm = QString::fromLatin1(first.IsUpper() ? "AP" : "ap"); @@ -1599,7 +1820,12 @@ if ( n_mode ) { offset += 10; } - + + // 'offset + (c.digitValue()-1' cannot be bigger than us_locale_dep, eu_locale_dep or jp_locale_dep table + if ( (offset + (c.digitValue()-1)) > 19 ) { + return QString(); + } + result += QLatin1String(locale_dep[offset + (c.digitValue()-1)]); } break; @@ -1658,15 +1884,17 @@ \enum HbExtendedLocale::WeekDay This enum defines weekdays. - \sa startOfWeek() + \sa startOfWeek() */ /*! Gets first day of the week. It is usually Saturday, Sunday or Monday, but the Symbian OS allows setting any weekday as the first. - Returns enum WeekDay. + + \attention Symbian specific API - \return Monday for other OS + \return Symbian - enum of WeekDay + \return other platforms - HbExtendedLocale::Monday */ HbExtendedLocale::WeekDay HbExtendedLocale::startOfWeek() const { @@ -1697,8 +1925,13 @@ /*! Sets the day which is considered to be the first day of the week. - \param day The first day of the week. + + \attention Symbian specific API + + \param day The first day of the week. + \return true for Symbian and false for other OS + \sa startOfWeek() */ @@ -1744,13 +1977,15 @@ /*! - Gets days which are working days of week. - Returns QString which describes workdays as binary array. - 1 meaning workday and 0 as non working day. + Gets days which are working days of week. + 1 meaning workday and 0 as non working day. + + \attention Symbian specific API - \return 0011111 for other OS + \return Symbian - QString which describes workdays as binary array + \return other platforms - "0011111" - \sa setWorkDays() + \sa setWorkDays() */ QString HbExtendedLocale::workDays() const { @@ -1768,7 +2003,10 @@ } /*! - Sets working days of week. + Sets working days of week. + + \attention Symbian specific API + \param days which describes workdays as QString binary array. 1 meaning workday and 0 non workday. @@ -1798,8 +2036,12 @@ } /*! - Checks whether or not daylight saving is set for the home city - \return True if home daylight saving is set, false if home daylight saving is not set + Checks whether or not daylight saving is set for the home city. + + \attention Symbian specific API + + \return Symbian - True if home daylight saving is set. False if home daylight saving is not set. + \return other platforms - false */ bool HbExtendedLocale::homeHasDaylightSavingOn() const @@ -1813,14 +2055,26 @@ } /*! + \enum HbExtendedLocale::DaylightSavingZone + Enumeration for "daylight saving time" settings. + + \sa setHomeDaylightSavingZone(), homeHasDaylightSavingOn() + */ + +/*! Returns the daylight saving zone in which the home city is located. + \attention Symbian specific API + \value Home Home daylight saving zone \value European European daylight saving zone \value Northern Northern hemisphere (non-European) daylight saving zone \value Southern Southern hemisphere daylight saving zone \value None No daylight saving zone + \return Symbian - the daylight saving zone + \return other platforms - HbExtendedLocale::None + \sa setHomeDaylightSavingZone() */ HbExtendedLocale::DaylightSavingZone HbExtendedLocale::homeDaylightSavingZone() const @@ -1847,7 +2101,10 @@ } /*! - Gets the locale’s universal time offset + Gets the locale’s universal time offset. + + \attention Symbian specific API + \return Offset in seconds from universal time. For other platforms it returns 0. */ int HbExtendedLocale::universalTimeOffset() const @@ -1861,6 +2118,11 @@ #endif } +/*! + Constructor of HbExtendedLocale. + + \attention Cross-Platform API + */ HbExtendedLocale::HbExtendedLocale() { #if defined(Q_OS_SYMBIAN) @@ -1869,7 +2131,11 @@ #endif } -//! Returns new/dummy copy of HbExtendedLocale. +/*! + Returns new/dummy copy of HbExtendedLocale. + + \attention Cross-Platform API + */ HbExtendedLocale HbExtendedLocale::system() { // make sure QLocale's lp is updated if in future QApplication does not do it @@ -1883,10 +2149,12 @@ For example, what date components are included, and if leading zeroes are used. This is a function uses the date formats defined in the hbi18ndef.h header file. + \attention Cross-Platform API + \param date The date to be formatted. \param dateFormat The wanted format to be used. - \return The date as a string. + \return the date as a string */ QString HbExtendedLocale::format( const QDate &date, const QString &dateFormat ) { @@ -1940,7 +2208,7 @@ #else Q_UNUSED(dateFormat); - return toString(date, ShortFormat ); + return toString(date, ShortFormat ); #endif } @@ -1949,10 +2217,12 @@ For example, what components are included (hours/minutes/seconds), and if leading zeroes and AM/PM or am/pm symbols are used. This is a function uses the time formats defined in the hbi18ndef.h header file. - \param time The time to be formatted. - \param timeFormat The wanted format to be used. + \attention Cross-Platform API + + \param time The time to be formatted. + \param timeFormat The wanted format to be used. - \return The time as a string. + \return the time as a string */ QString HbExtendedLocale::format( const QTime &time, const QString &timeFormat ) { @@ -1997,6 +2267,6 @@ return TDesC2QString(s60TimeStr->Des()); #else Q_UNUSED(timeFormat); - return toString(time, ShortFormat); + return toString(time, ShortFormat); #endif }