Accept dot as decimal separator even if the decimal separator is comma and the group separator is not dot neither comma
ClosedPublic

Authored by martonmiklos on Feb 15 2018, 8:17 PM.

Details

Summary

There are some software which does not tolerate the locale and producing float numbers with fixed dot decimal separator.

Copy-pasting data from these software can be painful because kcalc cannot interpret numbers with dot decimal separators if the locale has comma decimal separator.

To increase the user experience this patch will allow pasting both separators if the decimal separator is comma and the thousand-group separator is not a dot neither a comma. (Usually it is a space).

Test Plan
  • Set some locale where the thousand separator is a space. For e.g.: Hungarian can be set with export LANG=hu_HU.UTF-8
  • Paste a number with the proper decimal separator (in the Hungarian example this is comma so the test number example is: 42,42)
  • Check if the number pasted correctly
  • Paste a number with the another decimal separator (in the Hungarian example this is dot so the test number example is: 42.42)
  • Check if the number pasted correctly

Diff Detail

Repository
R353 KCalc
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
martonmiklos created this revision.Feb 15 2018, 8:17 PM
Restricted Application added a subscriber: kde-utils-devel. · View Herald TranscriptFeb 15 2018, 8:17 PM
martonmiklos requested review of this revision.Feb 15 2018, 8:17 PM
cfeck added a subscriber: cfeck.

Thanks Marton, I will review in the coming days. There are some issues in the patch.

martonmiklos retitled this revision from Accept both decimal separators (dot and comma) if the group separator is not dot neither comma to Accept dot as decimal separator even if the decimal separator is comma and the group separator is not dot neither comma .Feb 15 2018, 10:31 PM
martonmiklos edited the summary of this revision. (Show Details)

Thanks Marton, I will review in the coming days. There are some issues in the patch.

I have just updated the description because it does not 100%ly described what it does. (It have been a while when I have created it.)

cfeck added inline comments.Aug 15 2018, 2:44 PM
kcalcdisplay.cpp
314

Move && to beginning of lines.

316

Please use QChar for comparisons and replacements.

Thanks for the review, I have changed the raw char literals to QChar-s.

martonmiklos marked 2 inline comments as done.Aug 16 2018, 7:39 PM

Hi @cfeck !

May I ask for an another round of review (and if looks good merge?)
Thanks in advance for your time!

cfeck accepted this revision.Feb 23 2019, 2:37 PM
This revision is now accepted and ready to land.Feb 23 2019, 2:37 PM
This revision was automatically updated to reflect the committed changes.
cfeck added a comment.Feb 23 2019, 2:48 PM

Thanks and excuse the delay.