Bug 340140

Summary: Calculator isn't triggering in some situations with floating point numbers
Product: [Plasma] krunner Reporter: Wyatt Childers <kdebugs.81do7>
Component: calculatorAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: me, simonandric5
Priority: NOR    
Version: 5.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.6

Description Wyatt Childers 2014-10-20 00:07:27 UTC
Whenever you try to use a floating point integer as the first number of a calculation, the calculator runner is not triggered. 

If the operation is multiplication the following works:
"5*5"
"4.3*6."
"4.3*6="
"4.3*6.0="
"4*6.0="
But the following does not:
"4.3*6"
"4.4*6.0"
"4*6.0"

If the operation is division the following works:
"5/5"
"5/5="
But the following does not:
"5.5/5"
"5.5/5="
"5.5/5.5"
"5.5/5.5="
"5/5.5"
"5/5.5="
* Division is the most severly broken, as even when specifying the equals sign the calculator is not triggered.

If the operation is addition the following works:
"5+4"
"5+5="
"5.5+4="
"4+5.5="
But the following does not:
"5.5+4"
"4+5.5"

If the operation is subtraction the following works:
"5-4"
"5-5="
"5.5-4="
"4-5.5="
But the following does not:
"5.5-4"
"4-5.5"

Reproducible: Always

Steps to Reproduce:
Enter one of the describe combinations that do not work into Krunner with the calculator enabled.

Actual Results:  
For the input 5.5+4, Locations Go to http://0.5.0.4 will be triggered for 5.5+4.

Expected Results:  
For the input 5.5+4, or some other valid mathematic expression, the calculator runner will be triggered resulting in -- for this case -- 9.5.

I'm using Manjaro, so the packages aren't 100% Arch packages, but there should be virtually no difference.
Comment 1 Vishesh Handa 2014-11-21 16:35:57 UTC
Confirmed. This seems to be problem with the KRunner Framework. Here is the offending commit -

commit c1a347df696ec9260b9965fe9deff6589d44a9fb
Author: Marco Martin <notmart@gmail.com>
Date:   Tue May 27 19:59:56 2014 +0200

    add some heuristics to recognize urls

    QUrl::fromUserInput is way more stupid than KProtocolInfo
    It will produce an http url from pretty much any string,
    so ignore http urls of words without a dot (ie kde.org will
    become http://kde.org but  kde will not be considered an url)
Comment 2 Vishesh Handa 2014-12-29 16:23:15 UTC
Git commit e709270d49be919405ece827f37e43f393cdd254 by Vishesh Handa.
Committed on 21/11/2014 at 18:06.
Pushed by vhanda into branch 'master'.

Do not detect anything with a '.' as a NetworkLocation

One can also uses a decimal point in a calculator.
REVIEW: 121201
FIXED-IN: 5.6

M  +4    -1    autotests/runnercontexttest.cpp
M  +8    -4    src/runnercontext.cpp

http://commits.kde.org/krunner/e709270d49be919405ece827f37e43f393cdd254