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

List:       koffice-devel
Subject:    Re: [PATCH] KoText: date variable
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2003-09-20 2:19:43
[Download RAW message or body]

H'm, that is what I meant, but not what my code did in case of old KWord 
files.

So I have changed the code a little (see attached patch.) Now the default for 
the print date is 1970-01-01. The other remain invalid as default. An invalid 
date triggers "no date set" entries.

The patch at the strat of this thread and this correction patch are both 
commit yet. (As the core of the patch was a bug fix. We can still discuss 
about the details.)

Have a nice day!

On Friday 19 September 2003 21:57, Thomas Zander wrote:
> On Fri, Sep 19, 2003 at 08:24:07PM +0200, Nicolas Goutte wrote:
> > I repeat: this will only show in an unprinted document for the print
> > date.
>
> Sorry, I did not understand that from your first email; in that case your
> solution seems fine to me.

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

Index: kovariable.cc
===================================================================
RCS file: /home/kde/koffice/lib/kotext/kovariable.cc,v
retrieving revision 1.127
diff -u -r1.127 kovariable.cc
--- kovariable.cc	20 Sep 2003 01:47:26 -0000	1.127
+++ kovariable.cc	20 Sep 2003 02:12:50 -0000
@@ -42,7 +42,10 @@
 class KoVariableSettings::KoVariableSettingPrivate
 {
 public:
-    KoVariableSettingPrivate() {}
+    KoVariableSettingPrivate() 
+    {
+        m_lastPrintingDate.setTime_t(0); // Default is 1970-01-01 midnight locale \
time +    }
     QDateTime m_lastPrintingDate;
     QDateTime m_creationDate;
     QDateTime m_modificationDate;
@@ -138,6 +141,8 @@
 
         if (e.hasAttribute("lastPrintingDate"))
             d->m_lastPrintingDate = QDateTime::fromString( e.attribute( \
"lastPrintingDate" ), Qt::ISODate ); +        else
+            d->m_lastPrintingDate.setTime_t(0); // 1970-01-01 00:00:00.000 locale \
time  
         if (e.hasAttribute("creationDate"))
             d->m_creationDate = QDateTime::fromString( e.attribute( "creationDate" \
), Qt::ISODate ); @@ -161,7 +166,7 @@
     }
     QDateTime dateTime ( data.toDateTime() );
     if ( !dateTime.isValid() )
-        dateTime.setTime_t(0); // 1970-01-01 00:00:00.000 local time
+        return i18n("No date set"); // e.g. old KWord documents
 
     if (m_strFormat.lower() == "locale" || m_strFormat.isEmpty())
         return KGlobal::locale()->formatDate( dateTime.date(), false );



_______________________________________________
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