author | zautrix <zautrix> | 2004-10-27 19:44:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-27 19:44:10 (UTC) |
commit | bb82cac85cc196b3f60921ab27e84204036b54b8 (patch) (side-by-side diff) | |
tree | 518629480b983b6b85a4cf1e5542f94fe1687e41 /kaddressbook | |
parent | 85a0e0d9b1d60805cb4947be1c296c18e73c82b8 (diff) | |
download | kdepimpi-bb82cac85cc196b3f60921ab27e84204036b54b8.zip kdepimpi-bb82cac85cc196b3f60921ab27e84204036b54b8.tar.gz kdepimpi-bb82cac85cc196b3f60921ab27e84204036b54b8.tar.bz2 |
sync fixes
-rw-r--r-- | kaddressbook/kabcore.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index ea87929..b0cb986 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2504,30 +2504,30 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo Addressee addresseeR; QString uid; int take; Addressee addresseeL; Addressee addresseeRSync; Addressee addresseeLSync; // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); bool fullDateRange = false; local->resetTempSyncStat(); mLastAddressbookSync = QDateTime::currentDateTime(); if ( syncManager->syncWithDesktop() ) { - remote->removeSyncInfo( QString());//remove all info + // remote->removeSyncInfo( QString());//remove all info if ( KSyncManager::mRequestedSyncEvent.isValid() ) { mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); } else { - qDebug("ERROR: KSyncManager::mRequestedSyncEvent has invalid datatime "); + qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); } } QDateTime modifiedCalendar = mLastAddressbookSync; addresseeLSync = getLastSyncAddressee(); qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); if ( !addresseeR.isEmpty() ) { addresseeRSync = addresseeR; remote->removeAddressee(addresseeR ); } else { if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { @@ -2612,24 +2612,25 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo OidS = inR.originalExternalUID(); } else idS = inR.IDStr(); remote->removeAddressee( inR ); inR = inL; inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { inR.setOriginalExternalUID( OidS ); inR.setExternalUID( idS ); if ( syncManager->syncWithDesktop() ) inR.setIDStr( "changed" ); + //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); } else { inR.setIDStr( idS ); } inR.setResource( 0 ); remote->insertAddressee( inR , false); ++changedRemote; } else { // take == 2 take remote if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { if ( inR.revision().date().year() < 2004 ) inR.setRevision( modifiedCalendar ); } idS = inL.IDStr(); @@ -2803,65 +2804,66 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { // qDebug("Name %s ", (*it).familyName().latin1()); //} syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); if ( syncOK ) { if ( syncManager->mWriteBackFile ) { if ( external ) abLocal.removeSyncAddressees( !isXML); qDebug("Saving remote AB "); if ( ! abLocal.saveAB()) qDebug("Error writing back AB to file "); - if ( isXML ) { + if ( external ) { // afterwrite processing - abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); + abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); } } } setModified(); } if ( syncOK ) mViewManager->refreshView(); return syncOK; } void KABCore::removeSyncInfo( QString syncProfile) { qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); mAddressBook->removeSyncInfo( syncProfile ); + setModified(); } //this is a overwritten callbackmethods from the syncinterface bool KABCore::syncExternal(KSyncManager* manager, QString resource) { if ( resource == "phone" ) return syncPhone(); disableBR( true ); QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); AddressBook abLocal( resource,"syncContact"); bool syncOK = false; if ( abLocal.load() ) { qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); mGlobalSyncMode = SYNC_MODE_EXTERNAL; abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); if ( syncOK ) { if ( syncManager->mWriteBackFile ) { abLocal.removeSyncAddressees( false ); abLocal.saveAB(); - abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); + abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); } } setModified(); } if ( syncOK ) mViewManager->refreshView(); disableBR( false ); return syncOK; } void KABCore::message( QString m ) { @@ -2882,25 +2884,25 @@ bool KABCore::syncPhone() abLocal.importFromFile( fileName ); qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); mGlobalSyncMode = SYNC_MODE_EXTERNAL; abLocal.preparePhoneSync( mCurrentSyncDevice, true ); abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); if ( syncOK ) { if ( syncManager->mWriteBackFile ) { abLocal.removeSyncAddressees( true ); abLocal.saveABphone( fileName ); abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); - abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); + abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); } } setModified(); } if ( syncOK ) mViewManager->refreshView(); return syncOK; } void KABCore::getFile( bool success ) { if ( ! success ) { message( i18n("Error receiving file. Nothing changed!") ); |