-rw-r--r-- | kabc/addressbook.cpp | 5 | ||||
-rw-r--r-- | kabc/addressbook.h | 2 | ||||
-rw-r--r-- | kabc/addressee.cpp | 1 |
3 files changed, 5 insertions, 3 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 6e8d027..3ec0795 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -436,40 +436,41 @@ Ticket *AddressBook::requestSaveTicket( Resource *resource ) for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { if ( (*it) == resource ) { if ( (*it)->readOnly() || !(*it)->isOpen() ) return 0; else return (*it)->requestSaveTicket(); } } return 0; } -void AddressBook::insertAddressee( const Addressee &a ) +void AddressBook::insertAddressee( const Addressee &a, bool setRev ) { 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() ); + if ( setRev ) + (*it).setRevision( QDateTime::currentDateTime() ); (*it).setChanged( true ); } return; } } d->mAddressees.append( a ); Addressee& addr = d->mAddressees.last(); if ( addr.resource() == 0 ) addr.setResource( standardResource() ); addr.setChanged( true ); diff --git a/kabc/addressbook.h b/kabc/addressbook.h index 650a638..253de68 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h @@ -164,25 +164,25 @@ class AddressBook : public QObject ConstIterator end() const; /** Removes all entries from address book. */ void clear(); /** Insert an Addressee object into address book. If an object with the same unique id already exists in the address book it it replaced by the new one. If not the new object is appended to the address book. */ - void insertAddressee( const Addressee & ); + void insertAddressee( const Addressee &, bool setRev = true ); /** Removes entry from the address book. */ void removeAddressee( const Addressee & ); /** This is like @ref removeAddressee() just above, with the difference that the first element is a iterator, returned by @ref begin(). */ void removeAddressee( const Iterator & ); diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index fb32f6e..7f04d8f 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -84,24 +84,25 @@ struct Addressee::AddresseeData : public KShared bool empty :1; bool changed :1; }; Addressee::Addressee() { mData = new AddresseeData; mData->empty = true; mData->changed = false; mData->resource = 0; mData->mExternalId = ":"; + mData->revision = QDateTime ( QDate( 2004,1,1)); mTempSyncStat = SYNC_TEMPSTATE_INITIAL; } Addressee::~Addressee() { } Addressee::Addressee( const Addressee &a ) { mData = a.mData; mTempSyncStat = SYNC_TEMPSTATE_INITIAL; } |