summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.cpp
authorzautrix <zautrix>2004-09-19 09:00:55 (UTC)
committer zautrix <zautrix>2004-09-19 09:00:55 (UTC)
commit787181d34f0d195ad72c9cf6aedbc317b6dd713e (patch) (side-by-side diff)
treeac49d2b1d7887f96f3834458071b89e77b59218b /kabc/addressbook.cpp
parentf370d0f89bcaeeb68bd60152a9812a9cd55e5d8a (diff)
downloadkdepimpi-787181d34f0d195ad72c9cf6aedbc317b6dd713e.zip
kdepimpi-787181d34f0d195ad72c9cf6aedbc317b6dd713e.tar.gz
kdepimpi-787181d34f0d195ad72c9cf6aedbc317b6dd713e.tar.bz2
more AB sync
Diffstat (limited to 'kabc/addressbook.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressbook.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index ec9f893..46a9cf4 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -345,5 +345,10 @@ bool AddressBook::load()
Addressee::List::Iterator addrIt;
- for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt )
+ for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) {
(*addrIt).setChanged( false );
-
+ QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" );
+ if ( !id.isEmpty() ) {
+ //qDebug("setId aa %s ", id.latin1());
+ (*addrIt).setIDStr(id );
+ }
+ }
blockLSEchange = true;
@@ -368,3 +373,8 @@ bool AddressBook::saveAB()
deleteRemovedAddressees();
-
+ Iterator ait;
+ for ( ait = begin(); ait != end(); ++ait ) {
+ if ( !(*ait).IDStr().isEmpty() ) {
+ (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() );
+ }
+ }
KRES::Manager<Resource>::ActiveIterator it;
@@ -452,4 +462,6 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev )
if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) {
+ //qDebug("block insert ");
return;
}
+ //qDebug("inserting.... %s ",a.uid().latin1() );
bool found = false;
@@ -482,3 +494,3 @@ void AddressBook::insertAddressee( const Addressee &a, bool setRev )
} else {
- if ( (*it).uid() == QString("last-syncAddressee-") ) {
+ if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
QString name = (*it).uid().mid( 19 );
@@ -518,3 +530,3 @@ void AddressBook::removeAddressee( const Addressee &a )
} else {
- if ( (*it).uid() == QString("last-syncAddressee-") ) {
+ if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) {
QString name = (*it).uid().mid( 19 );
@@ -547,9 +559,14 @@ void AddressBook::removeDeletedAddressees()
(*it).setRevision( dt );
- if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
+ (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" );
+ (*it).setIDStr("");
+ if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE || (*it).uid().left( 19 ) == QString("last-syncAddressee-")) {
it2 = it;
+ //qDebug("removing %s ",(*it).uid().latin1() );
++it;
removeAddressee( it2 );
- } else
+ } else {
+ //qDebug("skipping %s ",(*it).uid().latin1() );
++it;
}
+ }
deleteRemovedAddressees();