summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp9
-rw-r--r--kaddressbook/kabcore.cpp16
2 files changed, 12 insertions, 13 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index d6b70c4..c34f671 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -265,27 +265,26 @@ void Addressee::computeCsum(const QString &dev)
265 t = (*addressIter).asList(); 265 t = (*addressIter).asList();
266 t.sort(); 266 t.sort();
267 for ( iii = 0; iii < t.count(); ++iii) 267 for ( iii = 0; iii < t.count(); ++iii)
268 l.append( t[iii] ); 268 l.append( t[iii] );
269 } 269 }
270 uint cs = getCsum4List(l); 270 uint cs = getCsum4List(l);
271 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); 271 // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
272 setCsum( dev, QString::number (cs )); 272 setCsum( dev, QString::number (cs ));
273} 273}
274void Addressee::removeID(const QString &prof) 274void Addressee::removeID(const QString &prof)
275{ 275{
276 detach(); 276 detach();
277 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 277 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
278 278
279} 279}
280void Addressee::setID( const QString & prof , const QString & id ) 280void Addressee::setID( const QString & prof , const QString & id )
281{ 281{
282 detach(); 282 detach();
283 qDebug("setID1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
284 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 283 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
285 qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 284 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
286} 285}
287void Addressee::setTempSyncStat( int id ) 286void Addressee::setTempSyncStat( int id )
288{ 287{
289 if ( mData->mTempSyncStat == id ) return; 288 if ( mData->mTempSyncStat == id ) return;
290 detach(); 289 detach();
291 mData->mTempSyncStat = id; 290 mData->mTempSyncStat = id;
@@ -300,15 +299,15 @@ QString Addressee::getID( const QString & prof)
300 return KIdManager::getId ( mData->mExternalId, prof ); 299 return KIdManager::getId ( mData->mExternalId, prof );
301} 300}
302 301
303void Addressee::setCsum( const QString & prof , const QString & id ) 302void Addressee::setCsum( const QString & prof , const QString & id )
304{ 303{
305 detach(); 304 detach();
306 qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 305 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
307 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); 306 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
308 qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); 307 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
309} 308}
310 309
311QString Addressee::getCsum( const QString & prof) 310QString Addressee::getCsum( const QString & prof)
312{ 311{
313 return KIdManager::getCsum ( mData->mExternalId, prof ); 312 return KIdManager::getCsum ( mData->mExternalId, prof );
314} 313}
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 56f6af2..fa0c51f 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2549,23 +2549,23 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2549 // 2 take remote 2549 // 2 take remote
2550 // 3 cancel 2550 // 3 cancel
2551 QDateTime lastSync = mLastAddressbookSync; 2551 QDateTime lastSync = mLastAddressbookSync;
2552 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2552 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2553 bool remCh, locCh; 2553 bool remCh, locCh;
2554 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2554 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2555 if ( remCh ) 2555
2556 qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2556 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2557 locCh = ( local->revision() > mLastAddressbookSync ); 2557 locCh = ( local->revision() > mLastAddressbookSync );
2558 if ( !remCh && ! locCh ) { 2558 if ( !remCh && ! locCh ) {
2559 qDebug("both not changed "); 2559 //qDebug("both not changed ");
2560 lastSync = local->revision().addDays(1); 2560 lastSync = local->revision().addDays(1);
2561 if ( mode <= SYNC_PREF_ASK ) 2561 if ( mode <= SYNC_PREF_ASK )
2562 return 0; 2562 return 0;
2563 } else { 2563 } else {
2564 if ( locCh ) { 2564 if ( locCh ) {
2565 qDebug("loc changed %s %s", local->revision().toString().latin1(), mLastAddressbookSync.toString().latin1()); 2565 //qDebug("loc changed %s %s", local->revision().toString().latin1(), mLastAddressbookSync.toString().latin1());
2566 lastSync = local->revision().addDays( -1 ); 2566 lastSync = local->revision().addDays( -1 );
2567 if ( !remCh ) 2567 if ( !remCh )
2568 remote->setRevision( lastSync.addDays( -1 ) ); 2568 remote->setRevision( lastSync.addDays( -1 ) );
2569 } else { 2569 } else {
2570 //qDebug(" not loc changed "); 2570 //qDebug(" not loc changed ");
2571 lastSync = local->revision().addDays( 1 ); 2571 lastSync = local->revision().addDays( 1 );
@@ -2723,13 +2723,13 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2723 mLastAddressbookSync = loadedFileVersion; 2723 mLastAddressbookSync = loadedFileVersion;
2724 qDebug("setting mLastAddressbookSync "); 2724 qDebug("setting mLastAddressbookSync ");
2725 } 2725 }
2726#endif 2726#endif
2727 2727
2728 //qDebug("*************************** "); 2728 //qDebug("*************************** ");
2729 qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 2729 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
2730 QStringList er = remote->uidList(); 2730 QStringList er = remote->uidList();
2731 Addressee inR ;//= er.first(); 2731 Addressee inR ;//= er.first();
2732 Addressee inL; 2732 Addressee inL;
2733 QProgressBar bar( er.count(),0 ); 2733 QProgressBar bar( er.count(),0 );
2734 bar.setCaption (i18n("Syncing - close to abort!") ); 2734 bar.setCaption (i18n("Syncing - close to abort!") );
2735 2735
@@ -2914,13 +2914,13 @@ bool KABCore::syncAB(QString filename, int mode)
2914 //pending prepare addresseeview for output 2914 //pending prepare addresseeview for output
2915 //pending detect, if remote file has REV field. if not switch to external sync 2915 //pending detect, if remote file has REV field. if not switch to external sync
2916 mGlobalSyncMode = SYNC_MODE_NORMAL; 2916 mGlobalSyncMode = SYNC_MODE_NORMAL;
2917 AddressBook abLocal(filename,"syncContact"); 2917 AddressBook abLocal(filename,"syncContact");
2918 bool syncOK = false; 2918 bool syncOK = false;
2919 if ( abLocal.load() ) { 2919 if ( abLocal.load() ) {
2920 qDebug("AB loaded %s mode %d",filename.latin1(), mode ); 2920 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
2921 bool external = false; 2921 bool external = false;
2922 Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2922 Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2923 if ( ! lse.isEmpty() ) { 2923 if ( ! lse.isEmpty() ) {
2924 if ( lse.familyName().left(4) == "!E: " ) 2924 if ( lse.familyName().left(4) == "!E: " )
2925 external = true; 2925 external = true;
2926 } else { 2926 } else {
@@ -2934,13 +2934,13 @@ bool KABCore::syncAB(QString filename, int mode)
2934 } 2934 }
2935 } 2935 }
2936 external = ! found; 2936 external = ! found;
2937 } 2937 }
2938 2938
2939 if ( external ) { 2939 if ( external ) {
2940 qDebug("**********Setting vcf mode to external "); 2940 qDebug("Setting vcf mode to external ");
2941 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2941 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2942 AddressBook::Iterator it; 2942 AddressBook::Iterator it;
2943 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2943 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2944 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 2944 (*it).setID( mCurrentSyncDevice, (*it).uid() );
2945 (*it).computeCsum( mCurrentSyncDevice ); 2945 (*it).computeCsum( mCurrentSyncDevice );
2946 } 2946 }
@@ -2953,13 +2953,13 @@ bool KABCore::syncAB(QString filename, int mode)
2953 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 2953 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
2954 if ( syncOK ) { 2954 if ( syncOK ) {
2955 if ( KABPrefs::instance()->mWriteBackFile ) 2955 if ( KABPrefs::instance()->mWriteBackFile )
2956 { 2956 {
2957 if ( external ) 2957 if ( external )
2958 abLocal.removeDeletedAddressees(); 2958 abLocal.removeDeletedAddressees();
2959 qDebug("saving remote AB "); 2959 qDebug("Saving remote AB ");
2960 abLocal.saveAB(); 2960 abLocal.saveAB();
2961 } 2961 }
2962 } 2962 }
2963 setModified(); 2963 setModified();
2964 2964
2965 } 2965 }