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

List:       kde-pim
Subject:    Re: [Kde-pim] timestamps
From:       Tobias Koenig <tokoe82 () yahoo ! de>
Date:       2002-09-27 20:01:08
[Download RAW message or body]

On Thu, Sep 26, 2002 at 04:27:18AM +0200, Anders Lund wrote:
> Hi,
Hi Anders,

> I have noticed that the timestamp is set in all vcards in my .vcf file when I 
> change data in a single entry and saves the addressbook - isn't that wrong?
> 
> I would think that the timestamp should be updated whenever I change some
> data - even prior to saving, so that the timestamp for a single vcard would 
> reflect the time it was last changed.
With the current code it doesn't work. Atm in AddressBook::insertAddressee()
the addressee is tested if it is already included. If yes, and the new
addressee differs from the one in the addressbook the new is marked as
changed and the timestamp is set.

That behaviour seems to lack with the undo/redo stuff in kaddressbook.
We could change the code in the way you mentioned (I've it already on
my hard disc), but then we need some changes in KAddressBook and maybe some
other apps, because the apps has to take care if a Addressee has changed or
not.
If there are no objections I'll commit the attached patch during the next days.

Ciao,
Tobias
-- 
In a world without walls and fences who
needs Windows and Gates???

["libkabc.diff" (text/plain)]

? libkabc.diff
Index: addressbook.cpp
===================================================================
RCS file: /home/kde/kdelibs/kabc/addressbook.cpp,v
retrieving revision 1.45
diff -u -b -p -r1.45 addressbook.cpp
--- addressbook.cpp	2002/09/20 11:30:59	1.45
+++ addressbook.cpp	2002/09/27 19:32:00
@@ -312,19 +312,9 @@ void AddressBook::insertAddressee( const
   Addressee::List::Iterator it;
   for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) {
     if ( a.uid() == (*it).uid() ) {
-      bool changed = false;
-      Addressee addr = a;
-      if ( addr != (*it) )
-        changed = true;
-
       (*it) = a;
       if ( (*it).resource() == 0 )
         (*it).setResource( standardResource() );
-
-      if ( changed ) {
-        (*it).setRevision( QDateTime::currentDateTime() );
-        (*it).setChanged( true ); 
-      }
       return;
     }
   }

["kaddressbook.diff" (text/plain)]

Index: kaddressbook.cpp
===================================================================
RCS file: /home/kde/kdepim/kaddressbook/kaddressbook.cpp,v
retrieving revision 1.80
diff -u -b -p -r1.80 kaddressbook.cpp
--- kaddressbook.cpp	2002/09/20 00:03:48	1.80
+++ kaddressbook.cpp	2002/09/27 19:33:04
@@ -214,7 +214,6 @@ AddresseeEditorDialog *KAddressBook::cre
 
 void KAddressBook::slotEditorDestroyed( const QString &uid )
 {
-
   mEditorDict.remove( uid );
 }
 
@@ -501,10 +500,16 @@ void KAddressBook::addresseeModified(con
   KABC::Addressee origA = mDocument->findByUid(a.uid());
   if (origA.isEmpty()) {
     // Must be new
-    command = new PwNewCommand(mDocument, a);
+    KABC::Addressee addr = a;
+    addr.setRevision( QDateTime::currentDateTime() );
+    addr.setChanged( true );
+    command = new PwNewCommand(mDocument, addr);
   } else {
     // Must be an edit
-    command = new PwEditCommand(mDocument, origA, a);
+    KABC::Addressee addr = a;
+    addr.setRevision( QDateTime::currentDateTime() );
+    addr.setChanged( true );
+    command = new PwEditCommand(mDocument, origA, addr);
     uid = a.uid();
   }
   UndoStack::instance()->push(command);

_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/

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

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