Bug 382391

Summary: Accept both decimal separators (comma and dot) from clipboard with locales where it is straightforward
Product: [Applications] kcalc Reporter: martonmiklos <martonmiklosqdev>
Component: generalAssignee: Evan Teran <eteran>
Status: RESOLVED FIXED    
Severity: normal CC: kde, lueck, mail
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 19.04.0
Attachments: Proposed patch
attachment-12836-0.html

Description martonmiklos 2017-07-16 09:00:32 UTC
Created attachment 106660 [details]
Proposed patch

In the Hungarian locale the group separator is a space and the decimal is a comma. 
It would be convenient to accept both the dot and the comma as a decimal separator.
 
I am working with a CAD software (Autodesk EAGLE) which does not use the localised settings, but displays every number with dot. Working with the numbers copied from there is a bit painful.

Patch attached, please review it. 
Thank you in advance!
Comment 1 Julien F 2018-01-24 11:51:16 UTC
In the French locale, the expected behaviour is the same as the proposed patch.
I think most users there are expecting the key "." on the numpad to be interpreted as ",". The current behaviour is very frustrating.
Comment 2 Christoph Feck 2018-02-14 21:55:05 UTC
Marton, the idea for the patch is good, but we shouldn't hardcode 'Nbsp' as the only allowed group separator. I suggest to just check that it is neither '.' nor ','. Would you like to upload an updated patch to https://phabricator.kde.org/differential/diff/create/ so that we can review it?

Julien, this ticket is for the Paste action, and not related to Numpad input.
Comment 3 martonmiklos 2018-02-15 20:19:02 UTC
Thanks Cristoph for the hint, I have created the D10555 phabricator issue. 
I have no idea who should I add as reviewer. Evan Teran no longer seems to be active here and I have not been able to find him in the reviewer list.
Comment 4 Evan Teran 2018-02-15 22:15:36 UTC
Created attachment 110694 [details]
attachment-12836-0.html

It has been a while since I was terribly active with kcalc. Fortunately,
Christopher has been awesome about handling the occasiobal issue that crops
up (thanks!).

I've always had mixed feeling about how to handle the separator issue. How
shall we parse 1,234?

1234?

Or

1 + (234/1000)

You solution seems mostly reasonable, but we should be careful about the
corner cases if any come up.

Thanks for looking into this issue!

On Thu, Feb 15, 2018, 3:19 PM martonmiklos <bugzilla_noreply@kde.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=382391
>
> --- Comment #3 from martonmiklos <martonmiklosqdev@gmail.com> ---
> Thanks Cristoph for the hint, I have created the D10555 phabricator issue.
> I have no idea who should I add as reviewer. Evan Teran no longer seems to
> be
> active here and I have not been able to find him in the reviewer list.
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
Comment 5 martonmiklos 2018-02-15 22:26:21 UTC
The attached patch only works for locale which decimal separator is , and the thousand separator is neither . or , (most commonly space). With this locale it will interpret the . as a decimal point too.
Comment 6 Julian Steinmann 2019-02-12 18:59:23 UTC
I've seen that the revision has been stale for a while, @martonmiklos: feel free to ping Christoph again now that you have fixed the inline issues :)
Comment 7 Christoph Feck 2019-07-10 20:03:16 UTC
Fixed with https://phabricator.kde.org/D10555