author | zautrix <zautrix> | 2004-09-19 09:11:04 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-19 09:11:04 (UTC) |
commit | 953277a85e6ec5630ab0d64b4d68815e4e4f9906 (patch) (unidiff) | |
tree | 0a6acbc3ecd65784c1e875159b720849bc27dc48 | |
parent | 787181d34f0d195ad72c9cf6aedbc317b6dd713e (diff) | |
download | kdepimpi-953277a85e6ec5630ab0d64b4d68815e4e4f9906.zip kdepimpi-953277a85e6ec5630ab0d64b4d68815e4e4f9906.tar.gz kdepimpi-953277a85e6ec5630ab0d64b4d68815e4e4f9906.tar.bz2 |
More AB sync
-rw-r--r-- | kabc/addressee.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 16 |
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 | |||
@@ -267,9 +267,9 @@ void Addressee::computeCsum(const QString &dev) | |||
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 | } |
274 | void Addressee::removeID(const QString &prof) | 274 | void Addressee::removeID(const QString &prof) |
275 | { | 275 | { |
@@ -279,11 +279,10 @@ void Addressee::removeID(const QString &prof) | |||
279 | } | 279 | } |
280 | void Addressee::setID( const QString & prof , const QString & id ) | 280 | void 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 | } |
287 | void Addressee::setTempSyncStat( int id ) | 286 | void Addressee::setTempSyncStat( int id ) |
288 | { | 287 | { |
289 | if ( mData->mTempSyncStat == id ) return; | 288 | if ( mData->mTempSyncStat == id ) return; |
@@ -302,11 +301,11 @@ QString Addressee::getID( const QString & prof) | |||
302 | 301 | ||
303 | void Addressee::setCsum( const QString & prof , const QString & id ) | 302 | void 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 | ||
311 | QString Addressee::getCsum( const QString & prof) | 310 | QString Addressee::getCsum( const QString & prof) |
312 | { | 311 | { |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 56f6af2..fa0c51f 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2551,19 +2551,19 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i | |||
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 { |
@@ -2725,9 +2725,9 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
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 ); |
@@ -2916,9 +2916,9 @@ bool KABCore::syncAB(QString filename, int mode) | |||
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: " ) |
@@ -2936,9 +2936,9 @@ bool KABCore::syncAB(QString filename, int mode) | |||
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() ); |
@@ -2955,9 +2955,9 @@ bool KABCore::syncAB(QString filename, int mode) | |||
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(); |