Bug 313869 - Doesn't do operations with more than two terms
Summary: Doesn't do operations with more than two terms
Status: RESOLVED FIXED
Alias: None
Product: plasma4
Classification: Unclassified
Component: widget-calculator (show other bugs)
Version: 4.11.0
Platform: Other Linux
: NOR normal with 1 vote (vote)
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: junior-jobs, reproducible
: 315935 324140 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-01-25 07:59 UTC by Antonio Rojas
Modified: 2013-09-12 04:02 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.11.2


Attachments
This patch should fix the bug (1.62 KB, patch)
2013-09-08 21:02 UTC, p.b.r
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio Rojas 2013-01-25 07:59:43 UTC
The calculator plasmoid fails to perform operations that involve more than two terms

Reproducible: Always

Steps to Reproduce:
1. Type 1+1+1=

Actual Results:  
1

Expected Results:  
3
Comment 1 Martin Flöser 2013-01-25 08:25:54 UTC
works fine here, just gave it a try.

In general I would suggest to move the = to the beginning. It helps KRunner to realize that a calculation is following
Comment 2 Antonio Rojas 2013-01-25 08:27:58 UTC
This is not about the runner, it's about the plasmoid
Comment 3 Martin Flöser 2013-01-25 08:34:59 UTC
sorry - misread. I just gave it a try and can reproduce
Comment 4 Jekyll Wu 2013-03-01 09:18:54 UTC
*** Bug 315935 has been marked as a duplicate of this bug. ***
Comment 5 Jekyll Wu 2013-08-28 03:43:12 UTC
*** Bug 324140 has been marked as a duplicate of this bug. ***
Comment 6 p.b.r 2013-09-08 21:02:30 UTC
Created attachment 82226 [details]
This patch should fix the bug

The problem was this: when you enter something like a+b=, then the result is shown. If you now click on a number, you want to start a new calculation. However, the code that implements this behaviour also gets called when clicking on a number after the second operator. 

This patch adds a new variable to prevent calling the code when it's not wanted.
Comment 7 Jekyll Wu 2013-09-11 10:00:56 UTC
(In reply to comment #6)
> Created attachment 82226 [details]
> This patch should fix the bug

Please submit the patch to git.reviewboard.kde.org for reviewing.  A patch attached in the bug tracker is easily to be forgotten or ignored.
Comment 8 Sebastian Kügler 2013-09-11 18:13:26 UTC
Git commit 4a25adbac6677db9ca97e3a467004c835bada965 by Sebastian Kügler.
Committed on 11/09/2013 at 18:10.
Pushed by sebas into branch 'master'.

correctly determine input in calculator

The bug reported this behaviour: if you press something like 'a+b+c=',
the result would be incorrect because the calculator plasmoid wrongly
resets the calculator when pressing 'c'. The intended behaviour is that
the calculation is cleared when pressing a number after pressing '='.

This patch adds a variable to determine this situation correctly.

Patch by Paul Rohrbach

CCMAIL:p.b.r@gmx.net
REVIEW:112674

M  +10   -2    applets/calculator/package/contents/ui/calculator.qml

http://commits.kde.org/kdeplasma-addons/4a25adbac6677db9ca97e3a467004c835bada965