author | zautrix <zautrix> | 2004-09-19 09:00:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-19 09:00:55 (UTC) |
commit | 787181d34f0d195ad72c9cf6aedbc317b6dd713e (patch) (side-by-side diff) | |
tree | ac49d2b1d7887f96f3834458071b89e77b59218b /kaddressbook | |
parent | f370d0f89bcaeeb68bd60152a9812a9cd55e5d8a (diff) | |
download | kdepimpi-787181d34f0d195ad72c9cf6aedbc317b6dd713e.zip kdepimpi-787181d34f0d195ad72c9cf6aedbc317b6dd713e.tar.gz kdepimpi-787181d34f0d195ad72c9cf6aedbc317b6dd713e.tar.bz2 |
more AB sync
-rw-r--r-- | kaddressbook/kabcore.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 8776b53..56f6af2 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2526,7 +2526,7 @@ KABC::Addressee KABCore::getLastSyncAddressee() qDebug("Creating new last-syncAddressee "); lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); QString sum = ""; - if ( KABPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) sum = "E: "; lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); lse.setRevision( mLastAddressbookSync ); @@ -2552,15 +2552,17 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { bool remCh, locCh; remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); - //if ( remCh ) - //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); + if ( remCh ) + qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); locCh = ( local->revision() > mLastAddressbookSync ); if ( !remCh && ! locCh ) { - //qDebug("both not changed "); + qDebug("both not changed "); lastSync = local->revision().addDays(1); + if ( mode <= SYNC_PREF_ASK ) + return 0; } else { if ( locCh ) { - //qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1()); + qDebug("loc changed %s %s", local->revision().toString().latin1(), mLastAddressbookSync.toString().latin1()); lastSync = local->revision().addDays( -1 ); if ( !remCh ) remote->setRevision( lastSync.addDays( -1 ) ); @@ -2790,9 +2792,9 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo } else { // no conflict if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { QString des = addresseeLSync.note(); - QString pref = "a"; - if ( des.find(pref+ inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it + if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); + remote->insertAddressee( inR, false ); ++deletedAddresseeR; } else { inR.setRevision( modifiedCalendar ); @@ -2820,14 +2822,13 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo ++incCounter; } er.clear(); - QStringList el = remote->uidList(); + QStringList el = local->uidList(); modulo = (el.count()/10)+1; bar.setCaption (i18n("Add / remove addressees") ); bar.setTotalSteps ( el.count() ) ; bar.show(); incCounter = 0; while ( incCounter < el.count()) { - qApp->processEvents(); if ( ! bar.isVisible() ) return false; @@ -2837,8 +2838,6 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo bool skipIncidence = false; if ( uid.left(19) == QString("last-syncAddressee-") ) skipIncidence = true; - if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) - skipIncidence = true; if ( !skipIncidence ) { inL = local->findByUid( uid ); inR = remote->findByUid( uid ); @@ -2852,7 +2851,6 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo if ( ! KABPrefs::instance()->mWriteBackExistingOnly ) { inL.removeID(mCurrentSyncDevice ); ++addedAddresseeR; - //qDebug("remote added Incidence %s ", inL.summary().latin1()); inL.setRevision( modifiedCalendar ); local->insertAddressee( inL, false ); inR = inL; @@ -2895,6 +2893,8 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); + addresseeRSync.setNote( "" ) ; + addresseeLSync.setNote( "" ); if ( mGlobalSyncMode == SYNC_MODE_NORMAL) remote->insertAddressee( addresseeRSync, false ); @@ -2937,6 +2937,7 @@ bool KABCore::syncAB(QString filename, int mode) } if ( external ) { + qDebug("**********Setting vcf mode to external "); mGlobalSyncMode = SYNC_MODE_EXTERNAL; AddressBook::Iterator it; for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |