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

List:       koffice-devel
Subject:    Re: [PATCH] Fix display of text with qoutes in kspread
From:       Peter Simonsson <psn () linux ! se>
Date:       2003-10-30 11:23:11
[Download RAW message or body]

Ok here comes an updated patch...

On Thursday 30 October 2003 10.08, David Faure wrote:
> On Wednesday 29 October 2003 20:10, Peter Simonsson wrote:
> > This patch should fix the display of text that has a single qoute at the
> > beginning.
>
> My hero!
>
> >     if (!m_value.asString().isEmpty() && m_value.asString()[0]=='\'' )
> > +    {
> >        m_strOutText = m_value.asString().right(
> > m_value.asString().length()-1);
>
> This could me .mid(1)
>
Fixed
> > +      if(m_strOutText[m_strOutText.length() - 1] == '\'')
>
> This should first check for !m_strOutText.isEmpty(), otherwise a single
> quote as value will let this go out of bounds.
> Hmm, in fact, why did you add this? I thought this was only about
> '012345
> not about
> '012345'
> (but maybe the latter is supposed to do the same and I just didn't realize)
Ok I was wrong about this part.. removed
>
> > @@ -4405,6 +4412,7 @@ void KSpreadCell::checkTextInput()
> >          m_value = KSpreadValue::empty();
>
> This line can be removed then?
>
Done
> >          if(m_pTable->getFirstLetterUpper() && !m_strText.isEmpty())
> >            
> >  m_strText=m_strText[0].upper()+m_strText.right(m_strText.length()-1); +
> >        m_value.setValue(m_strText);
> >          //setFormatType(Text_format); // shouldn't be necessary. Won't
> > apply with StringData anyway. return;
> >      }
>
Hope you like this one better :)
-- 
LLaP
Peter Simonsson

Kivio - http://www.koffice.org/kivio/

["kspread.diff" (text/x-diff)]

Index: kspread_cell.cc
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_cell.cc,v
retrieving revision 1.521
diff -u -p -r1.521 kspread_cell.cc
--- kspread_cell.cc	23 Aug 2003 21:08:03 -0000	1.521
+++ kspread_cell.cc	30 Oct 2003 11:18:26 -0000
@@ -1290,7 +1290,7 @@ void KSpreadCell::setOutputText()
   else if( m_value.isString() )
   {
     if (!m_value.asString().isEmpty() && m_value.asString()[0]=='\'' )
-      m_strOutText = m_value.asString().right( m_value.asString().length()-1);
+      m_strOutText = m_value.asString().mid(1);
     else
       m_strOutText = m_value.asString();
   }
@@ -4402,10 +4402,11 @@ void KSpreadCell::checkTextInput()
     // then we don't parse as a value, but as string.
     if ( str.isEmpty() || formatType() == Text_format || str.at(0)=='\'' )
     {
-        m_value = KSpreadValue::empty();
         if(m_pTable->getFirstLetterUpper() && !m_strText.isEmpty())
             m_strText=m_strText[0].upper()+m_strText.right(m_strText.length()-1);
-        //setFormatType(Text_format); // shouldn't be necessary. Won't apply with \
StringData anyway. +        
+        m_value.setValue(m_strText);
+        //setFormatType(Text_formatsetValue(m_strText);); // shouldn't be necessary. \
Won't apply with StringData anyway.  return;
     }
 



_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel


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

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