-rw-r--r-- | kaddressbook/kabcore.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 8776b53..56f6af2 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2527,5 +2527,5 @@ KABC::Addressee KABCore::getLastSyncAddressee() lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); QString sum = ""; - if ( KABPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) sum = "E: "; lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); @@ -2553,13 +2553,15 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i bool remCh, locCh; remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); - //if ( remCh ) - //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); + if ( remCh ) + qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); locCh = ( local->revision() > mLastAddressbookSync ); if ( !remCh && ! locCh ) { - //qDebug("both not changed "); + qDebug("both not changed "); lastSync = local->revision().addDays(1); + if ( mode <= SYNC_PREF_ASK ) + return 0; } else { if ( locCh ) { - //qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1()); + qDebug("loc changed %s %s", local->revision().toString().latin1(), mLastAddressbookSync.toString().latin1()); lastSync = local->revision().addDays( -1 ); if ( !remCh ) @@ -2791,7 +2793,7 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { QString des = addresseeLSync.note(); - QString pref = "a"; - if ( des.find(pref+ inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it + if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); + remote->insertAddressee( inR, false ); ++deletedAddresseeR; } else { @@ -2821,5 +2823,5 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo } er.clear(); - QStringList el = remote->uidList(); + QStringList el = local->uidList(); modulo = (el.count()/10)+1; bar.setCaption (i18n("Add / remove addressees") ); @@ -2828,5 +2830,4 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo incCounter = 0; while ( incCounter < el.count()) { - qApp->processEvents(); if ( ! bar.isVisible() ) @@ -2838,6 +2839,4 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo if ( uid.left(19) == QString("last-syncAddressee-") ) skipIncidence = true; - if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) - skipIncidence = true; if ( !skipIncidence ) { inL = local->findByUid( uid ); @@ -2852,6 +2851,5 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo if ( ! KABPrefs::instance()->mWriteBackExistingOnly ) { inL.removeID(mCurrentSyncDevice ); - ++addedAddresseeR; - //qDebug("remote added Incidence %s ", inL.summary().latin1()); + ++addedAddresseeR; inL.setRevision( modifiedCalendar ); local->insertAddressee( inL, false ); @@ -2896,4 +2894,6 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); + addresseeRSync.setNote( "" ) ; + addresseeLSync.setNote( "" ); if ( mGlobalSyncMode == SYNC_MODE_NORMAL) @@ -2938,4 +2938,5 @@ bool KABCore::syncAB(QString filename, int mode) if ( external ) { + qDebug("**********Setting vcf mode to external "); mGlobalSyncMode = SYNC_MODE_EXTERNAL; AddressBook::Iterator it; |