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

List:       kde-commits
Subject:    koffice/kspread
From:       Christoph Schleifenbaum <christoph () kdab ! net>
Date:       2010-03-15 16:17:04
Message-ID: 1268669824.788132.5470.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1103666 by cschleifenbaum:

Same for times, use the format string, if given


 M  +6 -2      ValueFormatter.cpp  
 M  +1 -1      ValueFormatter.h  


--- trunk/koffice/kspread/ValueFormatter.cpp #1103665:1103666
@@ -96,7 +96,7 @@
     else if (Format::isTime(fmtType)) {
         Value timeValue = m_converter->asDateTime(value, &ok);
         if (ok) {
-            result = Value(timeFormat(timeValue.asDateTime(settings()), fmtType));
+            result = Value(timeFormat(timeValue.asDateTime(settings()), fmtType, \
formatString));  result.setFormat(Value::fmt_Time);
         }
     }
@@ -447,8 +447,12 @@
     }
 }
 
-QString ValueFormatter::timeFormat(const QDateTime &_dt, Format::Type fmtType)
+QString ValueFormatter::timeFormat(const QDateTime &_dt, Format::Type fmtType, const \
QString& formatString)  {
+    if (!formatString.isEmpty()) {
+        return _dt.toString( formatString );
+    }
+
     const QDateTime dt(_dt.toUTC());
     QString result;
     if (fmtType == Format::Time)
--- trunk/koffice/kspread/ValueFormatter.h #1103665:1103666
@@ -76,7 +76,7 @@
      * Creates a time format.
      * \param formatType the value format, e.g. number, date
      */
-    QString timeFormat(const QDateTime& time, Format::Type formatType);
+    QString timeFormat(const QDateTime& time, Format::Type formatType, const \
QString& formatString = QString() );  
     /**
      * Creates a date and time format.


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

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