Bug 241530 - calculators in kalzium are broken
Summary: calculators in kalzium are broken
Status: RESOLVED FIXED
Alias: None
Product: kalzium
Classification: Applications
Component: Calculator (show other bugs)
Version: 0.30
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Kalzium Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-12 11:49 UTC by Etienne
Modified: 2012-09-23 20:57 UTC (History)
3 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 Etienne 2010-06-12 11:49:38 UTC
Version:           0.30 (using Devel) 
OS:                Linux

Hi
The calculators (concentration, gas and nuklear) do not work.

For the concentration calculator the error ocours somewhere in kunitconversion. The Volume is always 0. 

Since there has been no changes, i assume they never worked?
If i find some time i could try to debug a bit and share my findings.

Reproducible: Always

Steps to Reproduce:
Open the concentration calculator in kalzium.
change some values, i.e mass and volume

Actual Results:  
only an error is displayed "Volume must be greater than 0".
concentration is not calculated.

Expected Results:  
the concentration should be calculated

OS: Linux (i686) release 2.6.33-ARCH
Compiler: gcc
Comment 1 Burkhard Lück 2010-06-13 09:57:38 UTC
confirmed recent trunk + branch compiled from sources + lucid (4.4.2)
Comment 2 Quincy 2010-07-03 10:33:16 UTC
I can confirm this bug, too, but only when the application language is set to German. If I switch to English the calculators work fine. Perhaps there is some problem with the decimal separator?

Versions are KDE 4.4.4 (Gentoo) with Kalzium 2.3.80
Comment 3 Burkhard Lück 2010-07-15 10:18:04 UTC
(In reply to comment #2)
> I can confirm this bug, too, but only when the application language is set to
> German. 

Not only in german, but also using language x-test.

> If I switch to English the calculators work fine. Perhaps there is some
> problem with the decimal separator?
> 
There is a strange matter with the decimal separator in the calculators here in trunk + 4.5, it is always the comma.
Even if I change that in systemsettings to dot, it is still the comma in the calculators, whereas in kalzium's main window the decimal separator is used according to the choice in systemsettings.
Comment 4 Alexander Potashev 2011-03-12 18:24:27 UTC
May be a i18n() should be used for names of units in calls to Value(...)?

Example:
    m_vol = Value(22.4, "liters");
Comment 5 Etienne 2011-03-17 22:58:08 UTC
Thanks Alexander. 
I tested your theory and it actually has a positiv effect. But i feel uneasy to link technical information to the i18n team. 
So, after browsing the KUnitConverter docs i found out that all units have an enum.

Example:
    m_vol = Value(22.4, KUnitConversion::Liter);

That works:)
There is still the issue with the comboboxes though. But that should not be a problem now that we have found the bug. I just need a little time.
Comment 6 Etienne 2011-03-18 17:28:39 UTC
SVN commit 1225239 by erebetez:

Fixing the gas calculator when i18n was used.
Now using the unit id's instead of the string.
CCBUG:241530

 M  +79 -54    gasCalculator.cpp  
 M  +17 -0     gasCalculator.h  
 M  +10 -173   gasCalculator.ui  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1225239
Comment 7 Etienne 2012-09-23 20:57:15 UTC
Git commit 79626beaefee13be4dd25bc6b9a84da3bdb68260 by Etienne Rebetez.
Committed on 23/09/2012 at 22:56.
Pushed by erebetez into branch 'master'.

Fixing the other calculators with the unit issue.
Also add the populateUnitCombobox to the kalzium utils

M  +75   -66   src/calculator/concCalculator.cpp
M  +8    -2    src/calculator/concCalculator.h
M  +7    -13   src/calculator/gasCalculator.cpp
M  +93   -47   src/calculator/nuclearCalculator.cpp
M  +10   -1    src/calculator/nuclearCalculator.h
M  +2    -12   src/kalziumunitcombobox.cpp
M  +18   -0    src/kalziumutils.cpp
M  +9    -0    src/kalziumutils.h

http://commits.kde.org/kalzium/79626beaefee13be4dd25bc6b9a84da3bdb68260