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

List:       kde-commits
Subject:    koffice/filters/kword/rtf/export
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2003-09-17 23:11:29
[Download RAW message or body]

CVS commit by goutte: 

Prepare for locale default formats.
(However KLocale seems to have some little differences, so the code is
neutralized for now.)


  M +32 -7     ExportFilter.cc   2.84


--- koffice/filters/kword/rtf/export/ExportFilter.cc  #2.83:2.84
@@ -36,4 +36,5 @@
 
 #include <klocale.h>
+#include <kglobal.h>
 #include <kdebug.h>
 #include <kdebugclasses.h>
@@ -433,7 +434,4 @@ QString RTFWorker::ProcessParagraphData 
                 {
                     // ### TODO: fixed/variable date
-                    QString key((*paraFormatDataIt).variable.m_key.mid(4));
-                    if (key.startsWith("locale"))
-                        key = QString::null; // ###TODO: exact locale formats
                     str += "{\\field{\\*\\fldinst ";
                     if (0==(*paraFormatDataIt).variable.m_type)
@@ -441,7 +439,34 @@ QString RTFWorker::ProcessParagraphData 
                     else
                         str += "TIME ";
+                    QString key((*paraFormatDataIt).variable.m_key.mid(4));
+                    kdDebug(30515) << "Time format: " << key << endl;
+                    if (key.startsWith("locale"))
+                    {
+                        if (key == "locale" )
+                        {
+                            if (0==(*paraFormatDataIt).variable.m_type)
+                                key = KGlobal::locale()->dateFormat();
+                            else
+                                key = KGlobal::locale()->timeFormat();
+                        }
+                        else if ( key == "localeshort" )
+                            key = KGlobal::locale()->dateFormatShort();
+                        else if ( key == "localedatetime" )
+                        {
+                            key = KGlobal::locale()->dateFormat();
+                            key += ' ';
+                            key += KGlobal::locale()->timeFormat();
+                        }
+                        else if ( key == "localedatetimeshort" )
+                        {
+                            key = KGlobal::locale()->dateFormat();
+                            key += ' ';
+                            key += KGlobal::locale()->timeFormat();
+                        }
+                        kdDebug(30515) << "KDE format:  " << key << endl;
+                        key=QString::null; // ### FIXME: KControl's key seems to differ from KWord :-(
+                    }
                    if (!key.isEmpty())
                     {
-                        kdDebug(30515) << "Time format: " << key << endl;
                         QRegExp regexp("AP");
                         regexp.setCaseSensitive(false);


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

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