KDE Bug Tracking System
Home
Report New Wish or Bug
Query Existing Reports
First
Last
Prev
Next
No search results available
Search page
Bug
125828
:
Integer-valued cells unaffected by "Increase/de...
P
roduct
:
kspread
Co
m
ponent
:
general
Status
:
RESOLVED
Resolution
:
FIXED
Target
:
---
Version
:
unspecified
Pr
i
ority
:
NOR
Severity
:
normal
V
otes
:
0
Description
:
Opened:
2006-04-18 19:39
Last Changed:
2006-04-22 14:59:40
Version: 3.5rc1 (using KDE KDE 3.5.1) Installed from: Fedora RPMs Steps to reproduce: 1. Open a new blank worksheet. 2. Enter an integral value (e.g., 12) in any cell 3. Click the "Increase the decimal precision shown onscreen" button. The button will have no effect. On the other hand, if you change the contents of the cell to a decimal point value, e.g. 12.0, then the requested precision will be reflected in the display.
Comment
#1
Stefan Nikolaus 2006-04-22 14:59:38
SVN commit 532664 by nikolaus: value Fix '
Bug 125828
: Integer-valued cells unaffected by "Increase/decrease the decimal precision shown onscreen"' Note: '
Bug 118122
: Text numbers are modified during copy and paste' remains fixed. BUG: 125828 CCBUG: 118122 M +8 -51 branches/koffice/1.5/koffice/kspread/valueformatter.cc M +0 -2 branches/koffice/1.5/koffice/kspread/valueformatter.h M +8 -51 trunk/koffice/kspread/valueformatter.cc M +0 -2 trunk/koffice/kspread/valueformatter.h --- branches/koffice/1.5/koffice/kspread/valueformatter.cc #532663:532664 @@ -95,21 +95,8 @@ str = fractionFormat (value.asFloat(), fmtType); //another - else if (value.isInteger()) - { - long v = value.asInteger(); - // Always unsigned ? - if ((floatFormat == Format::AlwaysUnsigned) && (v < 0)) - v *= -1; - str = createNumberFormat (v, fmtType, - (floatFormat == Format::AlwaysSigned), currencySymbol); - } else { - QChar decimal_point = converter->locale()->decimalSymbol()[0]; - if ( decimal_point.isNull() ) - decimal_point = '.'; - //some cell parameters ... double v = converter->asFloat (value).asFloat(); @@ -124,7 +111,13 @@ // Remove trailing zeros and the decimal point if necessary // unless the number has no decimal point if (precision == -1) + { + QChar decimal_point = converter->locale()->decimalSymbol()[0]; + if ( decimal_point.isNull() ) + decimal_point = '.'; + removeTrailingZeros (str, decimal_point); + } } if (!prefix.isEmpty()) @@ -240,49 +233,13 @@ } } - -QString ValueFormatter::createNumberFormat ( long value, FormatType fmt, - bool alwaysSigned, const QString& currencySymbol) -{ - QString number; - - //multiply value by 100 for percentage format - if (fmt == Percentage_format) - value *= 100; - - switch (fmt) - { - case Number_format: - case Scientific_format: - number = QString::number(value); - break; - case Percentage_format: - number = QString::number(value) + " %"; - break; - case Money_format: - number = converter->locale()->formatMoney (value, currencySymbol.isEmpty() ? converter->locale()->currencySymbol() : currencySymbol); - break; - default : - //other formatting? - // This happens with Custom_format... - kdDebug(36001)<<"Wrong usage of ValueFormatter::createNumberFormat fmt=" << fmt << "\n"; - break; - } - - //prepend positive sign if needed - if (alwaysSigned && value >= 0 ) - if (converter->locale()->positiveSign().isEmpty()) - number='+'+number; - - return number; -} - QString ValueFormatter::createNumberFormat ( double value, int precision, FormatType fmt, bool alwaysSigned, const QString& currencySymbol) { // if precision is -1, ask for a huge number of decimals, we'll remove // the zeros later. Is 8 ok ? - int p = (precision == -1) ? 8 : precision; + // Stefan: No. Use maximum possible decimal precision (DBL_DIG) instead. + int p = (precision == -1) ? DBL_DIG : precision; QString localizedNumber; int pos = 0; --- branches/koffice/1.5/koffice/kspread/valueformatter.h #532663:532664 @@ -67,8 +67,6 @@ FormatType fmtType); /** create a number format */ - QString createNumberFormat (long value, FormatType fmt, bool alwaysSigned, - const QString& currencySymbol); QString createNumberFormat (double value, int precision, FormatType fmt, bool alwaysSigned, const QString& currencySymbol); --- trunk/koffice/kspread/valueformatter.cc #532663:532664 @@ -95,21 +95,8 @@ str = fractionFormat (value.asFloat(), fmtType); //another - else if (value.isInteger()) - { - long v = value.asInteger(); - // Always unsigned ? - if ((floatFormat == Style::AlwaysUnsigned) && (v < 0)) - v *= -1; - str = createNumberFormat (v, fmtType, - (floatFormat == Style::AlwaysSigned), currencySymbol); - } else { - QChar decimal_point = converter->locale()->decimalSymbol()[0]; - if ( decimal_point.isNull() ) - decimal_point = '.'; - //some cell parameters ... double v = converter->asFloat (value).asFloat(); @@ -124,7 +111,13 @@ // Remove trailing zeros and the decimal point if necessary // unless the number has no decimal point if (precision == -1) + { + QChar decimal_point = converter->locale()->decimalSymbol()[0]; + if ( decimal_point.isNull() ) + decimal_point = '.'; + removeTrailingZeros (str, decimal_point); + } } if (!prefix.isEmpty()) @@ -240,49 +233,13 @@ } } - -QString ValueFormatter::createNumberFormat ( long value, FormatType fmt, - bool alwaysSigned, const QString& currencySymbol) -{ - QString number; - - //multiply value by 100 for percentage format - if (fmt == Percentage_format) - value *= 100; - - switch (fmt) - { - case Number_format: - case Scientific_format: - number = QString::number(value); - break; - case Percentage_format: - number = QString::number(value) + " %"; - break; - case Money_format: - number = converter->locale()->formatMoney (value, currencySymbol.isEmpty() ? converter->locale()->currencySymbol() : currencySymbol); - break; - default : - //other formatting? - // This happens with Custom_format... - kDebug(36001)<<"Wrong usage of ValueFormatter::createNumberFormat fmt=" << fmt << "\n"; - break; - } - - //prepend positive sign if needed - if (alwaysSigned && value >= 0 ) - if (converter->locale()->positiveSign().isEmpty()) - number='+'+number; - - return number; -} - QString ValueFormatter::createNumberFormat ( double value, int precision, FormatType fmt, bool alwaysSigned, const QString& currencySymbol) { // if precision is -1, ask for a huge number of decimals, we'll remove // the zeros later. Is 8 ok ? - int p = (precision == -1) ? 8 : precision; + // Stefan: No. Use maximum possible decimal precision (DBL_DIG) instead. + int p = (precision == -1) ? DBL_DIG : precision; QString localizedNumber; int pos = 0; --- trunk/koffice/kspread/valueformatter.h #532663:532664 @@ -67,8 +67,6 @@ FormatType fmtType); /** create a number format */ - QString createNumberFormat (long value, FormatType fmt, bool alwaysSigned, - const QString& currencySymbol); QString createNumberFormat (double value, int precision, FormatType fmt, bool alwaysSigned, const QString& currencySymbol);
P
latform
:
Fedora RPMs
O
S
:
Linux
K
eywords
:
People
Reporter
:
Assigned To
:
Raphael Langerhorst
Related actions
View Bug Activity
Format For Printing
XML
Clone This Bug
Note
You need to
log in
before you can comment on or make changes to this bug.
Attachments
Add an attachment
(proposed patch, testcase, etc.)
Depends on
:
B
locks
:
Show dependency tree
-
Show dependency graph
First
Last
Prev
Next
No search results available
Search page
Actions
Reports
Requests
Reports
Bugs reported today
Bugs reported in the last 3 days
Bug reports with patches
Weekly Bug statistics
The most hated bugs
The most severe bugs
The most frequently reported bugs
The most wanted features
Junior Jobs
Report ownership counts and charts
My Account
New Account
Log In