author | zautrix <zautrix> | 2004-09-18 16:07:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-18 16:07:07 (UTC) |
commit | bf18a7b4edb4121fd2ea974ac1ec634167c9b993 (patch) (unidiff) | |
tree | 056e62659f8bc5a5b20dc24dcaa73c38f4515cd5 /kabc | |
parent | ca8fcf3fd4dc068747d8f31e2189145b22853d55 (diff) | |
download | kdepimpi-bf18a7b4edb4121fd2ea974ac1ec634167c9b993.zip kdepimpi-bf18a7b4edb4121fd2ea974ac1ec634167c9b993.tar.gz kdepimpi-bf18a7b4edb4121fd2ea974ac1ec634167c9b993.tar.bz2 |
more AB sync
-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 ) | |||
436 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { | 436 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { |
437 | if ( (*it) == resource ) { | 437 | if ( (*it) == resource ) { |
438 | if ( (*it)->readOnly() || !(*it)->isOpen() ) | 438 | if ( (*it)->readOnly() || !(*it)->isOpen() ) |
439 | return 0; | 439 | return 0; |
440 | else | 440 | else |
441 | return (*it)->requestSaveTicket(); | 441 | return (*it)->requestSaveTicket(); |
442 | } | 442 | } |
443 | } | 443 | } |
444 | 444 | ||
445 | return 0; | 445 | return 0; |
446 | } | 446 | } |
447 | 447 | ||
448 | void AddressBook::insertAddressee( const Addressee &a ) | 448 | void AddressBook::insertAddressee( const Addressee &a, bool setRev ) |
449 | { | 449 | { |
450 | Addressee::List::Iterator it; | 450 | Addressee::List::Iterator it; |
451 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { | 451 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { |
452 | if ( a.uid() == (*it).uid() ) { | 452 | if ( a.uid() == (*it).uid() ) { |
453 | bool changed = false; | 453 | bool changed = false; |
454 | Addressee addr = a; | 454 | Addressee addr = a; |
455 | if ( addr != (*it) ) | 455 | if ( addr != (*it) ) |
456 | changed = true; | 456 | changed = true; |
457 | 457 | ||
458 | (*it) = a; | 458 | (*it) = a; |
459 | if ( (*it).resource() == 0 ) | 459 | if ( (*it).resource() == 0 ) |
460 | (*it).setResource( standardResource() ); | 460 | (*it).setResource( standardResource() ); |
461 | 461 | ||
462 | if ( changed ) { | 462 | if ( changed ) { |
463 | (*it).setRevision( QDateTime::currentDateTime() ); | 463 | if ( setRev ) |
464 | (*it).setRevision( QDateTime::currentDateTime() ); | ||
464 | (*it).setChanged( true ); | 465 | (*it).setChanged( true ); |
465 | } | 466 | } |
466 | 467 | ||
467 | return; | 468 | return; |
468 | } | 469 | } |
469 | } | 470 | } |
470 | d->mAddressees.append( a ); | 471 | d->mAddressees.append( a ); |
471 | Addressee& addr = d->mAddressees.last(); | 472 | Addressee& addr = d->mAddressees.last(); |
472 | if ( addr.resource() == 0 ) | 473 | if ( addr.resource() == 0 ) |
473 | addr.setResource( standardResource() ); | 474 | addr.setResource( standardResource() ); |
474 | 475 | ||
475 | addr.setChanged( true ); | 476 | 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 | |||
164 | ConstIterator end() const; | 164 | ConstIterator end() const; |
165 | 165 | ||
166 | /** | 166 | /** |
167 | Removes all entries from address book. | 167 | Removes all entries from address book. |
168 | */ | 168 | */ |
169 | void clear(); | 169 | void clear(); |
170 | 170 | ||
171 | /** | 171 | /** |
172 | Insert an Addressee object into address book. If an object with the same | 172 | Insert an Addressee object into address book. If an object with the same |
173 | unique id already exists in the address book it it replaced by the new | 173 | unique id already exists in the address book it it replaced by the new |
174 | one. If not the new object is appended to the address book. | 174 | one. If not the new object is appended to the address book. |
175 | */ | 175 | */ |
176 | void insertAddressee( const Addressee & ); | 176 | void insertAddressee( const Addressee &, bool setRev = true ); |
177 | 177 | ||
178 | /** | 178 | /** |
179 | Removes entry from the address book. | 179 | Removes entry from the address book. |
180 | */ | 180 | */ |
181 | void removeAddressee( const Addressee & ); | 181 | void removeAddressee( const Addressee & ); |
182 | 182 | ||
183 | /** | 183 | /** |
184 | This is like @ref removeAddressee() just above, with the difference that | 184 | This is like @ref removeAddressee() just above, with the difference that |
185 | the first element is a iterator, returned by @ref begin(). | 185 | the first element is a iterator, returned by @ref begin(). |
186 | */ | 186 | */ |
187 | void removeAddressee( const Iterator & ); | 187 | void removeAddressee( const Iterator & ); |
188 | 188 | ||
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 | |||
84 | 84 | ||
85 | bool empty :1; | 85 | bool empty :1; |
86 | bool changed :1; | 86 | bool changed :1; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | Addressee::Addressee() | 89 | Addressee::Addressee() |
90 | { | 90 | { |
91 | mData = new AddresseeData; | 91 | mData = new AddresseeData; |
92 | mData->empty = true; | 92 | mData->empty = true; |
93 | mData->changed = false; | 93 | mData->changed = false; |
94 | mData->resource = 0; | 94 | mData->resource = 0; |
95 | mData->mExternalId = ":"; | 95 | mData->mExternalId = ":"; |
96 | mData->revision = QDateTime ( QDate( 2004,1,1)); | ||
96 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 97 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
97 | } | 98 | } |
98 | 99 | ||
99 | Addressee::~Addressee() | 100 | Addressee::~Addressee() |
100 | { | 101 | { |
101 | } | 102 | } |
102 | 103 | ||
103 | Addressee::Addressee( const Addressee &a ) | 104 | Addressee::Addressee( const Addressee &a ) |
104 | { | 105 | { |
105 | mData = a.mData; | 106 | mData = a.mData; |
106 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 107 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
107 | } | 108 | } |