Bug 281484 - Calculator plasmoid does not accept entries with more than 4 digits
Summary: Calculator plasmoid does not accept entries with more than 4 digits
Status: RESOLVED DUPLICATE of bug 288963
Alias: None
Product: plasma4
Classification: Plasma
Component: widget-misc (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-06 15:54 UTC by Sergio
Modified: 2011-12-16 09:05 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergio 2011-09-06 15:54:35 UTC
Version:           unspecified (using KDE 4.7.0) 
OS:                Linux

You cannot enter numbers larger than 9999 in the calculator (either with the mouse or with the keyboard). Calculator shows "0" after the fourth digit.

Can this be related to the use of a latin (italian) locale?

Reproducible: Didn't try

Steps to Reproduce:
Try entering 12345+1

Type 1 > On screen you get "1"
Type 2 > On screen you get "12"
Type 3 > On screen you get "123"
Type 4 > On screen you get "1.234"
Type 5 > On screen you get "0"




Actual Results:  
See steps to reproduce

Expected Results:  
The obvious one
Comment 1 Sergio 2011-09-26 20:39:24 UTC
Still present in 4.7.1
Comment 2 Matteo Agostinelli 2011-10-02 20:55:23 UTC
Confirmed in 4.7.1, Archlinux binaries.
Comment 3 Matteo Agostinelli 2011-10-02 20:57:23 UTC
On further inspection, the bug can be also reproduced with US english locale
Comment 4 jmaspons 2011-10-20 10:01:27 UTC
Same problem in Kubuntu 11.10 (4.7.1)
Comment 5 Sergio 2011-10-23 22:48:55 UTC
Still buggy in 4.7.2. Please, consider removing the plasmoid altogether from the software compilation and readding when eventually fixed. Plasmoid has already remained broken through 3 point releases. Having broken stuff just creates confusion and kalgebra is a valid substitute anyway.
Comment 6 Thorsteinn A. Malmjursson 2011-12-10 16:45:20 UTC
Seems to hasve an additional bug as well (4.7.2) - it doesn't like any numbers (even 4 digit ones) which have a 5 or a 6 in them - I'd agree with sergio, if this has been buggy since back at 4.7.1 or earlier, I'd go with "remove the entire plasmoid."  We don't even need a calculator widget, this is why we have kcalc :)
Comment 7 Reza 2011-12-14 13:45:08 UTC
I tried adding some kDebug lines like below.
The result of currentValue is 0, may be something wrong at readNumber.

void CalculatorApplet::slotDigitClicked()
{
    Plasma::PushButton *clickedButton = qobject_cast<Plasma::PushButton *>(sender());
    int newDigit = clickedButton->text().toInt();

    if (inputText == QLatin1String( "0" ) && newDigit == 0.0)
        return;

    if (inputText.length() >= MaxInputLength)
        return;

    if (waitingForDigit) {
        inputText.clear();
        waitingForDigit = false;
    }

    inputText += QString::number(newDigit);

    if (!inputText.contains(KGlobal::locale()->decimalSymbol())) {
      //If there is no decimal, then we need to reformat the number
      inputText = "1234567";
      kDebug() << "Input =" << inputText;
      double currentValue = KGlobal::locale()->readNumber(inputText);
      kDebug() << "Current value=" << currentValue;
      QString localizedString = KGlobal::locale()->formatNumber(currentValue, 0);
      mOutputDisplay->setText(localizedString);
    } else {
      //Once we have a decimal, then all we have to do is append the number
      mOutputDisplay->setText(mOutputDisplay->text()+QString::number(newDigit));
    }
}
Comment 8 bill p. (aka google01103) 2011-12-15 23:34:04 UTC
+1 to remove it if it's not going to be fixed
Comment 9 Anne-Marie Mahfouf 2011-12-16 09:05:51 UTC
This bug is a duplicate of 288963 and the bug is not in the Calculator widget code but in kdelibs. I tracked down the faulty code but I am not sure I can fix it, this code is tricky. I'll do my best to have this fixed before 4.8 is out.

*** This bug has been marked as a duplicate of bug 288963 ***