<div dir="ltr"><div><div><div><div>Hey Friedrich and others!<br><br></div>I've hit the very same issue in Sheets earlier that you did, and ended up postponing that part of the porting (though I do have a local branch with partial results). Not really sure what the best solution would be - the problem with KLocale is that it seems to be out of sync with QLocale, so for me at least they both report different locales/languages. Weird, that.<br><br></div>Anyway. I've looked at QLocale's code, and adding precision to the formatting routines would be trivial technically - the routine called by formatMoney supports it, so it's just a matter of adding an optional argument to formatMoney - should even be BIC, as I understand it. Not sure how easy/hard it'd be to get the change into Qt.<br><br></div>The main problem with QLocale seems to be that it essentially is a black box - it has all the locale info we need, but we can't pull it out of it. So if functions to return the format string, precisions, etc for the current locale could be added, so that wrapper classes can be built, that'd probably be all we really need.<br><br></div>/ Tomas<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-06 8:12 GMT+01:00 Friedrich W. H. Kossebau <span dir="ltr"><<a href="mailto:kossebau@kde.org" target="_blank">kossebau@kde.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi developers of finance apps & Calligra Sheets & Calligra Plan,<br>
<br>
(please keep cross-posting to both ml for now)<br>
<br>
I (not only with my Calligra developer hat on) would like to collect<br>
experiences and ideas for conversion of curreny values to and from<br>
strings when using Qt5/KF5, especially when porting from kdelibs4's<br>
KLocale.<br>
<br>
<br>
PROBLEM<br>
<br>
QLocale is rather limited (as of Qt 5.5):<br>
- no currency string parsing method<br>
- string formatting method toCurrencyString() does not allow<br>
to control precision<br>
<br>
KLocale and its currency related methods seem the last blocker to get<br>
rid of kdelibs4support in Calligra in the Qt5/KF5 port. Plan uses them<br>
for handling the costs of resources, and Sheets for the currency<br>
formatted cells. And both limitations are a blocker.<br>
<br>
<br>
APPROACHES<br>
<br>
Long term ideally QLocale gets support in its API for that. So we<br>
developers of currency data handling software should organize and<br>
draft an API.<br>
<br>
First and short term though, until some released & wide-spread Qt<br>
version has the improved QLocale, I am looking for a solution<br>
independent of QLocale.<br>
Most obvious might be to duplicate all currency things from KLocale,<br>
which would also include duplicating the database with all currency<br>
formatting data. This is what I would plan to do if there is no better<br>
idea.<br>
Especially the database duplication is painful though, I would like to<br>
avoid at least that if possible.<br>
<br>
<br>
QUESTIONS<br>
<br>
How have developers of e.g. Skrooge & KMyMoney approached the issue of<br>
conversion of currency values to/from strings?<br>
<br>
Do you know about any activities to improve QLocale here?<br>
<br>
Seems that Calligra apps Plan & Sheets are the only KDE apps using<br>
KLocale::readMoney() ?<br>
<a href="https://lxr.kde.org/ident?v=stable-qt4&_i=readMoney&_remember=1" rel="noreferrer" target="_blank">https://lxr.kde.org/ident?v=stable-qt4&_i=readMoney&_remember=1</a><br>
<br>
But KLocale::formatMoney() might be used by KMyMoney, Skrooge, Kraft &<br>
others (did not check though if not custom code):<br>
<a href="https://lxr.kde.org/ident?v=stable-qt4&_i=formatMoney&_remember=1" rel="noreferrer" target="_blank">https://lxr.kde.org/ident?v=stable-qt4&_i=formatMoney&_remember=1</a><br>
<br>
Cheers<br>
Friedrich<br>
_______________________________________________<br>
calligra-devel mailing list<br>
<a href="mailto:calligra-devel@kde.org">calligra-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/calligra-devel" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/calligra-devel</a><br>
</blockquote></div><br></div>