-rw-r--r-- | kaddressbook/kabcore.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index ea87929..b0cb986 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2510,18 +2510,18 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2510 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); | 2510 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); |
2511 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); | 2511 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); |
2512 | bool fullDateRange = false; | 2512 | bool fullDateRange = false; |
2513 | local->resetTempSyncStat(); | 2513 | local->resetTempSyncStat(); |
2514 | mLastAddressbookSync = QDateTime::currentDateTime(); | 2514 | mLastAddressbookSync = QDateTime::currentDateTime(); |
2515 | if ( syncManager->syncWithDesktop() ) { | 2515 | if ( syncManager->syncWithDesktop() ) { |
2516 | remote->removeSyncInfo( QString());//remove all info | 2516 | // remote->removeSyncInfo( QString());//remove all info |
2517 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 2517 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
2518 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; | 2518 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; |
2519 | qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); | 2519 | qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); |
2520 | } else { | 2520 | } else { |
2521 | qDebug("ERROR: KSyncManager::mRequestedSyncEvent has invalid datatime "); | 2521 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); |
2522 | } | 2522 | } |
2523 | } | 2523 | } |
2524 | QDateTime modifiedCalendar = mLastAddressbookSync; | 2524 | QDateTime modifiedCalendar = mLastAddressbookSync; |
2525 | addresseeLSync = getLastSyncAddressee(); | 2525 | addresseeLSync = getLastSyncAddressee(); |
2526 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); | 2526 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); |
2527 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); | 2527 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); |
@@ -2617,13 +2617,14 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2617 | inR = inL; | 2617 | inR = inL; |
2618 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 2618 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
2619 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2619 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2620 | inR.setOriginalExternalUID( OidS ); | 2620 | inR.setOriginalExternalUID( OidS ); |
2621 | inR.setExternalUID( idS ); | 2621 | inR.setExternalUID( idS ); |
2622 | if ( syncManager->syncWithDesktop() ) | 2622 | if ( syncManager->syncWithDesktop() ) |
2623 | inR.setIDStr( "changed" ); | 2623 | inR.setIDStr("changed" ); |
2624 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); | ||
2624 | } else { | 2625 | } else { |
2625 | inR.setIDStr( idS ); | 2626 | inR.setIDStr( idS ); |
2626 | } | 2627 | } |
2627 | inR.setResource( 0 ); | 2628 | inR.setResource( 0 ); |
2628 | remote->insertAddressee( inR , false); | 2629 | remote->insertAddressee( inR , false); |
2629 | ++changedRemote; | 2630 | ++changedRemote; |
@@ -2809,15 +2810,15 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
2809 | { | 2810 | { |
2810 | if ( external ) | 2811 | if ( external ) |
2811 | abLocal.removeSyncAddressees( !isXML); | 2812 | abLocal.removeSyncAddressees( !isXML); |
2812 | qDebug("Saving remote AB "); | 2813 | qDebug("Saving remote AB "); |
2813 | if ( ! abLocal.saveAB()) | 2814 | if ( ! abLocal.saveAB()) |
2814 | qDebug("Error writing back AB to file "); | 2815 | qDebug("Error writing back AB to file "); |
2815 | if ( isXML ) { | 2816 | if ( external ) { |
2816 | // afterwrite processing | 2817 | // afterwrite processing |
2817 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2818 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); |
2818 | } | 2819 | } |
2819 | } | 2820 | } |
2820 | } | 2821 | } |
2821 | setModified(); | 2822 | setModified(); |
2822 | 2823 | ||
2823 | } | 2824 | } |
@@ -2827,12 +2828,13 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
2827 | 2828 | ||
2828 | } | 2829 | } |
2829 | void KABCore::removeSyncInfo( QString syncProfile) | 2830 | void KABCore::removeSyncInfo( QString syncProfile) |
2830 | { | 2831 | { |
2831 | qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); | 2832 | qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); |
2832 | mAddressBook->removeSyncInfo( syncProfile ); | 2833 | mAddressBook->removeSyncInfo( syncProfile ); |
2834 | setModified(); | ||
2833 | } | 2835 | } |
2834 | 2836 | ||
2835 | 2837 | ||
2836 | //this is a overwritten callbackmethods from the syncinterface | 2838 | //this is a overwritten callbackmethods from the syncinterface |
2837 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 2839 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
2838 | { | 2840 | { |
@@ -2849,13 +2851,13 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource) | |||
2849 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 2851 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
2850 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2852 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2851 | if ( syncOK ) { | 2853 | if ( syncOK ) { |
2852 | if ( syncManager->mWriteBackFile ) { | 2854 | if ( syncManager->mWriteBackFile ) { |
2853 | abLocal.removeSyncAddressees( false ); | 2855 | abLocal.removeSyncAddressees( false ); |
2854 | abLocal.saveAB(); | 2856 | abLocal.saveAB(); |
2855 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2857 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
2856 | } | 2858 | } |
2857 | } | 2859 | } |
2858 | setModified(); | 2860 | setModified(); |
2859 | } | 2861 | } |
2860 | if ( syncOK ) | 2862 | if ( syncOK ) |
2861 | mViewManager->refreshView(); | 2863 | mViewManager->refreshView(); |
@@ -2888,13 +2890,13 @@ bool KABCore::syncPhone() | |||
2888 | if ( syncOK ) { | 2890 | if ( syncOK ) { |
2889 | if ( syncManager->mWriteBackFile ) { | 2891 | if ( syncManager->mWriteBackFile ) { |
2890 | abLocal.removeSyncAddressees( true ); | 2892 | abLocal.removeSyncAddressees( true ); |
2891 | abLocal.saveABphone( fileName ); | 2893 | abLocal.saveABphone( fileName ); |
2892 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 2894 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
2893 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 2895 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
2894 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2896 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
2895 | } | 2897 | } |
2896 | } | 2898 | } |
2897 | setModified(); | 2899 | setModified(); |
2898 | } | 2900 | } |
2899 | if ( syncOK ) | 2901 | if ( syncOK ) |
2900 | mViewManager->refreshView(); | 2902 | mViewManager->refreshView(); |