Question about currencies

Alvaro Soliverez asoliverez at kde.org
Tue May 6 11:52:52 BST 2014


Hi John,
Thanks for your answer.
Since this is to replace existing working code, I'll wait for
KStandards to be implemented.

Regards,
Alvaro


On Tue, May 6, 2014 at 7:29 AM, John Layt <john at layt.net> wrote:
> On 5 May 2014 23:03, Alvaro Soliverez <asoliverez at kde.org> wrote:
>> Hi all,
>> I have a question about the currency features. In KLocale, you can get
>> KCurrencyCode for the current locale, which is fine.
>> Now, for KMyMoney we need to get the list of all currencies for all
>> countries (since a user usually deals with multiple currencies).
>>
>> I haven't found an API for this, only the KLocale one for current
>> locale. Is there any other way to access the list of currencies?
>
> Yes there is api, you need the static method
> KCurrencyCode::allCurrencyCodesList() which by default returns *all*
> currency codes available regardless of status, but you can pass in the
> status you require, e.g. usually just ActiveStatus.  Other
> KCurrencyCode static methods are isValid() to check if a given string
> code is supported, and currencyCodeToName() to get the currency name
> for any valid code in any KDE supported language.
>
> Note you can also get a list of preferred currencies for a given
> locale using KLocale::currencyCodeList().
>
> As Aleix and Alex note, KCurrencyCode will be deprecated for KF5 as it
> is too tightly bound with KLocale, but a very similar API will be
> implemented in a new tier 1 framework KStandards that will support all
> sorts of standard ISO codes like Currency, Country, Language, etc
> using json data files.  Formatting and parsing will be done using
> QLocale, with KStandards adding all the extra features that Qt is
> unwilling to provide.
>
> Cheers!
>
> John.




More information about the kde-core-devel mailing list