Git commit 862e7bfe2128bcc8b51b1df1e5c5e8e74a4623e1 by Evan Teran. Committed on 30/04/2013 at 22:23. Pushed by teran into branch 'KDE/4.10'. back port of the fix for bug #319115 M +16 -3 kcalcdisplay.cpp M +1 -1 knumber/knumber.cpp http://commits.kde.org/kcalc/862e7bfe2128bcc8b51b1df1e5c5e8e74a4623e1 diff --git a/kcalcdisplay.cpp b/kcalcdisplay.cpp index 3081df3..a675e09 100644 --- a/kcalcdisplay.cpp +++ b/kcalcdisplay.cpp @@ -31,8 +31,10 @@ along with this program. If not, see . #include #include #include + #include "kcalc_core.h" #include "kcalc_settings.h" + #include "kcalcdisplay.moc" = //------------------------------------------------------------------------= ------ @@ -290,8 +292,11 @@ void KCalcDisplay::slotPaste(bool bClipboard) { tmp_num_base =3D NB_BINARY; tmp_str.remove(0, 2); } else if (tmp_str.startsWith(QLatin1String("0"))) { - tmp_num_base =3D NB_OCTAL; - tmp_str.remove(0, 1); + // we don't want this to trigger on "0.xxxxxx" cases + if(tmp_str.length() < 2 || QString(tmp_str[1]) !=3D KNumber::decimalSepa= rator()) { + tmp_num_base =3D NB_OCTAL; + tmp_str.remove(0, 1); + } } = if (tmp_num_base !=3D NB_DECIMAL) { @@ -537,7 +542,15 @@ void KCalcDisplay::setText(const QString &string) text_ =3D groupDigits(text_, hexadecimalGrouping_); break; } - } + } else if(special) { +#if 0 + // TODO: enable this code, it replaces the "inf" with an actual infinity + // symbol, but what should be put into the clip board when they co= py? + if(string.contains(QLatin1String("inf"))) { + text_.replace("inf", QChar(0x221e)); + } +#endif + } = update(); emit changedText(text_); diff --git a/knumber/knumber.cpp b/knumber/knumber.cpp index ac49573..752996b 100644 --- a/knumber/knumber.cpp +++ b/knumber/knumber.cpp @@ -278,7 +278,7 @@ KNumber::KNumber(const QString &s) : value_(0) { const QRegExp special_regex(QLatin1String("^(inf|-inf|nan)$")); const QRegExp integer_regex(QLatin1String("^[+-]?\\d+$")); const QRegExp fraction_regex(QLatin1String("^[+-]?\\d+/\\d+$")); - const QRegExp float_regex(QString(QLatin1String("^([+-]?\\d+)(%1\\d*)?(e(= [+-]?\\d+))?$")).arg(QRegExp::escape(DecimalSeparator))); + const QRegExp float_regex(QString(QLatin1String("^([+-]?\\d*)(%1\\d*)?(e(= [+-]?\\d+))?$")).arg(QRegExp::escape(DecimalSeparator))); = if (special_regex.exactMatch(s)) { value_ =3D new detail::knumber_error(s);