[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kexi/tableview
From:       Jaroslaw Staniek <js () iidea ! pl>
Date:       2004-11-03 16:05:34
Message-ID: 20041103160534.C728716D37 () office ! kde ! org
[Download RAW message or body]

CVS commit by staniek: 

TableView
- fixed editing large FP numbers (removed scientific mode)


  M +29 -14    kexiinputtableedit.cpp   1.41


--- koffice/kexi/tableview/kexiinputtableedit.cpp  #1.40:1.41
@@ -147,7 +147,9 @@ void KexiInputTableEdit::init(const QStr
                 if (!removeOld)
                         origValue = m_origValue;
-                QString tmp_val = origValue.toString();
+                QString tmp_val;
 
                 if (field()->isFPNumericType()) {
+//TODO: precision!
+                        tmp_val = QString::number(origValue.toDouble(), 'f', \
2/*prec*/);  if (origValue.toDouble() == 0.0) {
                                 tmp_val=add; //eat 0
@@ -160,5 +162,15 @@ void KexiInputTableEdit::init(const QStr
                                 else if (sl.count()==2) {
                                         kdDebug() << "sl.count()=="<<sl.count()<< " \
                " <<sl[0] << " | " << sl[1] << endl;
-                                        tmp_val = sl[0] + m_decsym + sl[1];
+                                        const QString sl1 = sl[1];
+                                        int pos = sl1.length()-1;
+                                        if (pos>=1) {
+                                                for (;pos>=0 && sl1[pos]=='0';pos--)
+                                                        ;
+                                                pos++;
+                                        }
+                                        if (pos>0)
+                                                tmp_val = sl[0] + m_decsym + \
sl1.left(pos); +                                        else
+                                                tmp_val = sl[0]; //no decimal point
                                 }
                                 tmp_val+=add;
@@ -168,5 +180,7 @@ void KexiInputTableEdit::init(const QStr
                         m_lineedit->setValidator( validator );
                 }
-                else if (field()->isIntegerType()) {
+                else {
+                        tmp_val = origValue.toString();
+                        if (field()->isIntegerType()) {
                         if (origValue.toInt() == 0) {
                                 tmp_val=add; //eat 0
@@ -184,4 +198,5 @@ void KexiInputTableEdit::init(const QStr
 //                      m_lineedit->setText(tmp_val);
                 }
+                }
 
                 if (tmp_val.isEmpty()) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic