-rw-r--r-- | kaddressbook/kabcore.cpp | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index cc8eb52..8776b53 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2670,6 +2670,6 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2670 | Addressee addresseeRSync; | 2670 | Addressee addresseeRSync; |
2671 | Addressee addresseeLSync; | 2671 | Addressee addresseeLSync; |
2672 | KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); | 2672 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); |
2673 | KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); | 2673 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); |
2674 | bool fullDateRange = false; | 2674 | bool fullDateRange = false; |
2675 | local->resetTempSyncStat(); | 2675 | local->resetTempSyncStat(); |
@@ -2710,5 +2710,5 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2710 | } | 2710 | } |
2711 | } | 2711 | } |
2712 | fullDateRange = true; // debug only! | 2712 | // fullDateRange = true; // debug only! |
2713 | if ( fullDateRange ) | 2713 | if ( fullDateRange ) |
2714 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); | 2714 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); |
@@ -2919,5 +2919,31 @@ bool KABCore::syncAB(QString filename, int mode) | |||
2919 | if ( abLocal.load() ) { | 2919 | if ( abLocal.load() ) { |
2920 | qDebug("AB loaded %s mode %d",filename.latin1(), mode ); | 2920 | qDebug("AB loaded %s mode %d",filename.latin1(), mode ); |
2921 | AddressBook::Iterator it; | 2921 | bool external = false; |
2922 | Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); | ||
2923 | if ( ! lse.isEmpty() ) { | ||
2924 | if ( lse.familyName().left(4) == "!E: " ) | ||
2925 | external = true; | ||
2926 | } else { | ||
2927 | bool found = false; | ||
2928 | QDateTime dt( QDate( 2004,1,1)); | ||
2929 | AddressBook::Iterator it; | ||
2930 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | ||
2931 | if ( (*it).revision() != dt ) { | ||
2932 | found = true; | ||
2933 | break; | ||
2934 | } | ||
2935 | } | ||
2936 | external = ! found; | ||
2937 | } | ||
2938 | |||
2939 | if ( external ) { | ||
2940 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | ||
2941 | AddressBook::Iterator it; | ||
2942 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | ||
2943 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | ||
2944 | (*it).computeCsum( mCurrentSyncDevice ); | ||
2945 | } | ||
2946 | } | ||
2947 | //AddressBook::Iterator it; | ||
2922 | //QStringList vcards; | 2948 | //QStringList vcards; |
2923 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 2949 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
@@ -2928,4 +2954,6 @@ bool KABCore::syncAB(QString filename, int mode) | |||
2928 | if ( KABPrefs::instance()->mWriteBackFile ) | 2954 | if ( KABPrefs::instance()->mWriteBackFile ) |
2929 | { | 2955 | { |
2956 | if ( external ) | ||
2957 | abLocal.removeDeletedAddressees(); | ||
2930 | qDebug("saving remote AB "); | 2958 | qDebug("saving remote AB "); |
2931 | abLocal.saveAB(); | 2959 | abLocal.saveAB(); |