-rw-r--r-- | kaddressbook/kabcore.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index b014cba..9041e45 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2596,42 +2596,42 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2596 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 2596 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
2597 | skipIncidence = true; | 2597 | skipIncidence = true; |
2598 | if ( !skipIncidence ) { | 2598 | if ( !skipIncidence ) { |
2599 | inL = local->findByUid( uid ); | 2599 | inL = local->findByUid( uid ); |
2600 | inR = remote->findByUid( uid ); | 2600 | inR = remote->findByUid( uid ); |
2601 | if ( inR.isEmpty() ) { | 2601 | if ( inR.isEmpty() ) { |
2602 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2602 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2603 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 2603 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
2604 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 2604 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
2605 | local->removeAddressee( inL ); | 2605 | local->removeAddressee( inL ); |
2606 | ++deletedAddresseeL; | 2606 | ++deletedAddresseeL; |
2607 | } else { | 2607 | } else { |
2608 | if ( ! KABPrefs::instance()->mWriteBackExistingOnly ) { | 2608 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2609 | inL.removeID(mCurrentSyncDevice ); | 2609 | inL.removeID(mCurrentSyncDevice ); |
2610 | ++addedAddresseeR; | 2610 | ++addedAddresseeR; |
2611 | inL.setRevision( modifiedCalendar ); | 2611 | inL.setRevision( modifiedCalendar ); |
2612 | local->insertAddressee( inL, false ); | 2612 | local->insertAddressee( inL, false ); |
2613 | inR = inL; | 2613 | inR = inL; |
2614 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); | 2614 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); |
2615 | inR.setResource( 0 ); | 2615 | inR.setResource( 0 ); |
2616 | remote->insertAddressee( inR, false ); | 2616 | remote->insertAddressee( inR, false ); |
2617 | } | 2617 | } |
2618 | } | 2618 | } |
2619 | } else { | 2619 | } else { |
2620 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { | 2620 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { |
2621 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 2621 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
2622 | local->removeAddressee( inL ); | 2622 | local->removeAddressee( inL ); |
2623 | ++deletedAddresseeL; | 2623 | ++deletedAddresseeL; |
2624 | } else { | 2624 | } else { |
2625 | if ( ! KABPrefs::instance()->mWriteBackExistingOnly ) { | 2625 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2626 | ++addedAddresseeR; | 2626 | ++addedAddresseeR; |
2627 | inL.setRevision( modifiedCalendar ); | 2627 | inL.setRevision( modifiedCalendar ); |
2628 | local->insertAddressee( inL, false ); | 2628 | local->insertAddressee( inL, false ); |
2629 | inR = inL; | 2629 | inR = inL; |
2630 | inR.setResource( 0 ); | 2630 | inR.setResource( 0 ); |
2631 | remote->insertAddressee( inR, false ); | 2631 | remote->insertAddressee( inR, false ); |
2632 | } | 2632 | } |
2633 | } | 2633 | } |
2634 | } | 2634 | } |
2635 | } | 2635 | } |
2636 | } | 2636 | } |
2637 | ++incCounter; | 2637 | ++incCounter; |
@@ -2649,35 +2649,35 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2649 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; | 2649 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; |
2650 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); | 2650 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); |
2651 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; | 2651 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; |
2652 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); | 2652 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); |
2653 | addresseeRSync.setNote( "" ) ; | 2653 | addresseeRSync.setNote( "" ) ; |
2654 | addresseeLSync.setNote( "" ); | 2654 | addresseeLSync.setNote( "" ); |
2655 | 2655 | ||
2656 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 2656 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
2657 | remote->insertAddressee( addresseeRSync, false ); | 2657 | remote->insertAddressee( addresseeRSync, false ); |
2658 | local->insertAddressee( addresseeLSync, false ); | 2658 | local->insertAddressee( addresseeLSync, false ); |
2659 | QString mes; | 2659 | QString mes; |
2660 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); | 2660 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); |
2661 | if ( KABPrefs::instance()->mShowSyncSummary ) { | 2661 | if ( syncManager->mShowSyncSummary ) { |
2662 | KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); | 2662 | KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); |
2663 | } | 2663 | } |
2664 | qDebug( mes ); | 2664 | qDebug( mes ); |
2665 | return syncOK; | 2665 | return syncOK; |
2666 | } | 2666 | } |
2667 | 2667 | ||
2668 | 2668 | ||
2669 | //this is a overwritten callbackmethods from the syncinterface | 2669 | //this is a overwritten callbackmethods from the syncinterface |
2670 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | 2670 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) |
2671 | { | 2671 | { |
2672 | 2672 | ||
2673 | //pending prepare addresseeview for output | 2673 | //pending prepare addresseeview for output |
2674 | //pending detect, if remote file has REV field. if not switch to external sync | 2674 | //pending detect, if remote file has REV field. if not switch to external sync |
2675 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 2675 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
2676 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2676 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2677 | 2677 | ||
2678 | AddressBook abLocal(filename,"syncContact"); | 2678 | AddressBook abLocal(filename,"syncContact"); |
2679 | bool syncOK = false; | 2679 | bool syncOK = false; |
2680 | if ( abLocal.load() ) { | 2680 | if ( abLocal.load() ) { |
2681 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); | 2681 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); |
2682 | bool external = false; | 2682 | bool external = false; |
2683 | bool isXML = false; | 2683 | bool isXML = false; |
@@ -2710,25 +2710,25 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
2710 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 2710 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
2711 | (*it).computeCsum( mCurrentSyncDevice ); | 2711 | (*it).computeCsum( mCurrentSyncDevice ); |
2712 | } | 2712 | } |
2713 | } | 2713 | } |
2714 | } | 2714 | } |
2715 | //AddressBook::Iterator it; | 2715 | //AddressBook::Iterator it; |
2716 | //QStringList vcards; | 2716 | //QStringList vcards; |
2717 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 2717 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
2718 | // qDebug("Name %s ", (*it).familyName().latin1()); | 2718 | // qDebug("Name %s ", (*it).familyName().latin1()); |
2719 | //} | 2719 | //} |
2720 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 2720 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
2721 | if ( syncOK ) { | 2721 | if ( syncOK ) { |
2722 | if ( KABPrefs::instance()->mWriteBackFile ) | 2722 | if ( syncManager->mWriteBackFile ) |
2723 | { | 2723 | { |
2724 | if ( external ) | 2724 | if ( external ) |
2725 | abLocal.removeSyncAddressees( !isXML); | 2725 | abLocal.removeSyncAddressees( !isXML); |
2726 | qDebug("Saving remote AB "); | 2726 | qDebug("Saving remote AB "); |
2727 | abLocal.saveAB(); | 2727 | abLocal.saveAB(); |
2728 | if ( isXML ) { | 2728 | if ( isXML ) { |
2729 | // afterwrite processing | 2729 | // afterwrite processing |
2730 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2730 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2731 | } | 2731 | } |
2732 | } | 2732 | } |
2733 | } | 2733 | } |
2734 | setModified(); | 2734 | setModified(); |
@@ -2760,27 +2760,27 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
2760 | //this is a overwritten callbackmethods from the syncinterface | 2760 | //this is a overwritten callbackmethods from the syncinterface |
2761 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 2761 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
2762 | { | 2762 | { |
2763 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2763 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2764 | 2764 | ||
2765 | AddressBook abLocal( resource,"syncContact"); | 2765 | AddressBook abLocal( resource,"syncContact"); |
2766 | bool syncOK = false; | 2766 | bool syncOK = false; |
2767 | if ( abLocal.load() ) { | 2767 | if ( abLocal.load() ) { |
2768 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2768 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2769 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2769 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2770 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); | 2770 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); |
2771 | qDebug("KABCore::syncExternal: why do we acces here KABPrefs and not somehow KSyncProfile? "); | 2771 | qDebug("KABCore::syncExternal: why do we acces here KABPrefs and not somehow KSyncProfile? "); |
2772 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, KABPrefs::instance()->mSyncAlgoPrefs ); | 2772 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2773 | if ( syncOK ) { | 2773 | if ( syncOK ) { |
2774 | if ( KABPrefs::instance()->mWriteBackFile ) { | 2774 | if ( syncManager->mWriteBackFile ) { |
2775 | abLocal.saveAB(); | 2775 | abLocal.saveAB(); |
2776 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2776 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2777 | } | 2777 | } |
2778 | } | 2778 | } |
2779 | setModified(); | 2779 | setModified(); |
2780 | } | 2780 | } |
2781 | if ( syncOK ) | 2781 | if ( syncOK ) |
2782 | mViewManager->refreshView(); | 2782 | mViewManager->refreshView(); |
2783 | return syncOK; | 2783 | return syncOK; |
2784 | 2784 | ||
2785 | } | 2785 | } |
2786 | 2786 | ||