Review Request 126528: Fixed formatting of copied number

Boudhayan Gupta bgupta at kde.org
Sat Jan 2 19:07:08 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126528/#review90473
-----------------------------------------------------------


I'm not sure this is the right approach.

I'm assuming the point of this patch is to convert numbers to a standard decimal representation (like 1234.56). For locales that use the format 1.234,56 (using , as the decimal separator and . as the group separator), this code will reduce the number to 1234,56. If this is the intended effect, this patch is fine. Otherwise it's not.

I suggest you do something like this instead:

```
qint64 num = QLocale().toLongLong(txt);
txt = QLocale::c().toString(num);
```

This converts the text into a number and then back into text using the "C" locale, which is the simplest standard locale with a period as a decimal separator and no group separators.


kcalcdisplay.cpp (line 262)
<https://git.reviewboard.kde.org/r/126528/#comment61872>

    You're declaring a new variable inside a switch label, so please put these lines (except the break statement) inside a brace-delimited block.
    
    Note that if you copy my code from above, it doesn't declare new vars so you don't have to put that inside braces.


- Boudhayan Gupta


On Jan. 3, 2016, 12:02 a.m., Dzmitry Rudkouski wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/126528/
> -----------------------------------------------------------
> 
> (Updated Jan. 3, 2016, 12:02 a.m.)
> 
> 
> Review request for KDE Utils, Christoph Feck and Evan Teran.
> 
> 
> Bugs: 356355
>     http://bugs.kde.org/show_bug.cgi?id=356355
> 
> 
> Repository: kcalc
> 
> 
> Description
> -------
> 
> Bug #356635 - KCalc shouldn't keep formatting of copied number
> 
> 
> Diffs
> -----
> 
>   kcalcdisplay.cpp 5d89896 
> 
> Diff: https://git.reviewboard.kde.org/r/126528/diff/
> 
> 
> Testing
> -------
> 
> It works perfectly. Now there is no parasite spaces beetween digits group of clipboard-copied decimal numbers.
> 
> 
> Thanks,
> 
> Dzmitry Rudkouski
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-utils-devel/attachments/20160102/e1b0ada9/attachment.html>


More information about the Kde-utils-devel mailing list