Corrected behaviour on repeated pressing of operator buttons
ClosedPublic

Authored by mschiller on Sep 12 2018, 8:25 PM.

Details

Summary

Fixes "wrong" behavior to the correct one as described in the bug report.
Before the fix pressing "10 * / 5 =" normally would result in 20 (Stack: (10,*), (10,/), (5,=)) but with those changes it results in 2 (Stack: (10, /), (5, =)).

Internally this is achieved by "blocking" node adding after a operator (*,-,/,...) has been pressed until a number is entered. If another operator is pressed whilst blocked the top (last) operator is changed instead.

BUG: 57349

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.
mschiller created this revision.Sep 12 2018, 8:25 PM
Restricted Application added a subscriber: kde-utils-devel. · View Herald TranscriptSep 12 2018, 8:25 PM
mschiller requested review of this revision.Sep 12 2018, 8:25 PM
aacid added a subscriber: cfeck.Sep 20 2018, 7:54 PM
aacid added a subscriber: aacid.
aacid added inline comments.
kcalc_core.h
110

I'm not sure we have much people to agree/disagree if this is how it should work, but let's fix style issues first :)

Please don't make a public member variable, use getter/setter like the rest of the code does.

mschiller updated this revision to Diff 42184.Sep 23 2018, 2:00 PM

Sure. This patch was just something I've been using for a while now and found it very useful. So I just put it out there after seeing that rather old bug report from 2003.
Update: Made the bool field private and use getter/setter.

cfeck added inline comments.Oct 2 2018, 2:49 AM
kcalc.cpp
2059

The indentation is inconsistent with surrounding code.

mschiller updated this revision to Diff 42709.Oct 2 2018, 8:11 AM

Fixed indentation

mschiller marked an inline comment as done.Oct 2 2018, 8:11 AM
cfeck accepted this revision.Oct 5 2018, 5:41 PM
This revision is now accepted and ready to land.Oct 5 2018, 5:41 PM
This revision was automatically updated to reflect the committed changes.