-rw-r--r-- | kaddressbook/kabcore.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index cc8eb52..8776b53 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2671,4 +2671,4 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo Addressee addresseeLSync; - KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); - KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); + // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); + //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); bool fullDateRange = false; @@ -2711,3 +2711,3 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo } - fullDateRange = true; // debug only! + // fullDateRange = true; // debug only! if ( fullDateRange ) @@ -2920,3 +2920,29 @@ bool KABCore::syncAB(QString filename, int mode) qDebug("AB loaded %s mode %d",filename.latin1(), mode ); + bool external = false; + Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); + if ( ! lse.isEmpty() ) { + if ( lse.familyName().left(4) == "!E: " ) + external = true; + } else { + bool found = false; + QDateTime dt( QDate( 2004,1,1)); AddressBook::Iterator it; + for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { + if ( (*it).revision() != dt ) { + found = true; + break; + } + } + external = ! found; + } + + if ( external ) { + mGlobalSyncMode = SYNC_MODE_EXTERNAL; + AddressBook::Iterator it; + for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { + (*it).setID( mCurrentSyncDevice, (*it).uid() ); + (*it).computeCsum( mCurrentSyncDevice ); + } + } + //AddressBook::Iterator it; //QStringList vcards; @@ -2929,2 +2955,4 @@ bool KABCore::syncAB(QString filename, int mode) { + if ( external ) + abLocal.removeDeletedAddressees(); qDebug("saving remote AB "); |