-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 25 |
2 files changed, 16 insertions, 13 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 012780b..3397e06 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp | |||
@@ -1057,13 +1057,15 @@ void AddresseeEditorWidget::load() | |||
1057 | 1057 | ||
1058 | void AddresseeEditorWidget::save() | 1058 | void AddresseeEditorWidget::save() |
1059 | { | 1059 | { |
1060 | if ( !dirty() ) { | 1060 | if ( !dirty() ) { |
1061 | return; | 1061 | return; |
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | mAddressee.setRevision( QDateTime::currentDateTime() ); | ||
1065 | |||
1064 | mAddressee.setRole( mRoleEdit->text() ); | 1066 | mAddressee.setRole( mRoleEdit->text() ); |
1065 | mAddressee.setOrganization( mOrgEdit->text() ); | 1067 | mAddressee.setOrganization( mOrgEdit->text() ); |
1066 | mAddressee.setUrl( KURL( mURLEdit->text() ) ); | 1068 | mAddressee.setUrl( KURL( mURLEdit->text() ) ); |
1067 | mAddressee.setNote( mNoteEdit->text() ); | 1069 | mAddressee.setNote( mNoteEdit->text() ); |
1068 | if ( mBirthdayPicker->inputIsValid() ) { | 1070 | if ( mBirthdayPicker->inputIsValid() ) { |
1069 | QDate da = mBirthdayPicker->date(); | 1071 | QDate da = mBirthdayPicker->date(); |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 273d435..6e482b5 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2403,51 +2403,50 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i | |||
2403 | 2403 | ||
2404 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2404 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2405 | 2405 | ||
2406 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2406 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2407 | bool remCh, locCh; | 2407 | bool remCh, locCh; |
2408 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 2408 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
2409 | 2409 | qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | |
2410 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | ||
2411 | locCh = ( localMod > mLastAddressbookSync ); | 2410 | locCh = ( localMod > mLastAddressbookSync ); |
2412 | if ( !remCh && ! locCh ) { | 2411 | if ( !remCh && ! locCh ) { |
2413 | //qDebug("both not changed "); | 2412 | qDebug("both not changed "); |
2414 | lastSync = localMod.addDays(1); | 2413 | lastSync = localMod.addDays(1); |
2415 | if ( mode <= SYNC_PREF_ASK ) | 2414 | if ( mode <= SYNC_PREF_ASK ) |
2416 | return 0; | 2415 | return 0; |
2417 | } else { | 2416 | } else { |
2418 | if ( locCh ) { | 2417 | if ( locCh ) { |
2419 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); | 2418 | qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); |
2420 | lastSync = localMod.addDays( -1 ); | 2419 | lastSync = localMod.addDays( -1 ); |
2421 | if ( !remCh ) | 2420 | if ( !remCh ) |
2422 | remoteMod =( lastSync.addDays( -1 ) ); | 2421 | remoteMod =( lastSync.addDays( -1 ) ); |
2423 | } else { | 2422 | } else { |
2424 | //qDebug(" not loc changed "); | 2423 | qDebug(" not loc changed "); |
2425 | lastSync = localMod.addDays( 1 ); | 2424 | lastSync = localMod.addDays( 1 ); |
2426 | if ( remCh ) | 2425 | if ( remCh ) { |
2426 | qDebug("rem changed "); | ||
2427 | remoteMod =( lastSync.addDays( 1 ) ); | 2427 | remoteMod =( lastSync.addDays( 1 ) ); |
2428 | } | ||
2428 | 2429 | ||
2429 | } | 2430 | } |
2430 | } | 2431 | } |
2431 | full = true; | 2432 | full = true; |
2432 | if ( mode < SYNC_PREF_ASK ) | 2433 | if ( mode < SYNC_PREF_ASK ) |
2433 | mode = SYNC_PREF_ASK; | 2434 | mode = SYNC_PREF_ASK; |
2434 | } else { | 2435 | } else { |
2435 | if ( localMod == remoteMod ) | 2436 | if ( localMod == remoteMod ) |
2436 | return 0; | 2437 | return 0; |
2437 | 2438 | ||
2438 | } | 2439 | } |
2439 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 2440 | qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); |
2440 | 2441 | qDebug("lastsync %s ", lastSync.toString().latin1() ); | |
2441 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod); | ||
2442 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); | ||
2443 | //full = true; //debug only | 2442 | //full = true; //debug only |
2444 | if ( full ) { | 2443 | if ( full ) { |
2445 | bool equ = ( (*local) == (*remote) ); | 2444 | bool equ = ( (*local) == (*remote) ); |
2446 | if ( equ ) { | 2445 | if ( equ ) { |
2447 | //qDebug("equal "); | 2446 | qDebug("equal "); |
2448 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2447 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2449 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 2448 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
2450 | } | 2449 | } |
2451 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 2450 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
2452 | return 0; | 2451 | return 0; |
2453 | 2452 | ||
@@ -2640,14 +2639,15 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2640 | remote->removeAddressee( inR ); | 2639 | remote->removeAddressee( inR ); |
2641 | inR = inL; | 2640 | inR = inL; |
2642 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 2641 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
2643 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2642 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2644 | inR.setOriginalExternalUID( OidS ); | 2643 | inR.setOriginalExternalUID( OidS ); |
2645 | inR.setExternalUID( idS ); | 2644 | inR.setExternalUID( idS ); |
2646 | if ( syncManager->syncWithDesktop() ) | 2645 | if ( syncManager->syncWithDesktop() ) { |
2647 | inR.setIDStr("changed" ); | 2646 | inR.setIDStr("changed" ); |
2647 | } | ||
2648 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); | 2648 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); |
2649 | } else { | 2649 | } else { |
2650 | inR.setIDStr( idS ); | 2650 | inR.setIDStr( idS ); |
2651 | } | 2651 | } |
2652 | inR.setResource( 0 ); | 2652 | inR.setResource( 0 ); |
2653 | remote->insertAddressee( inR , false); | 2653 | remote->insertAddressee( inR , false); |
@@ -2743,12 +2743,13 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2743 | inR.setResource( 0 ); | 2743 | inR.setResource( 0 ); |
2744 | remote->insertAddressee( inR, false ); | 2744 | remote->insertAddressee( inR, false ); |
2745 | } | 2745 | } |
2746 | } | 2746 | } |
2747 | } else { | 2747 | } else { |
2748 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { | 2748 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { |
2749 | //qDebug("data %s ", inL.revision().toString().latin1()); | ||
2749 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 2750 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
2750 | local->removeAddressee( inL ); | 2751 | local->removeAddressee( inL ); |
2751 | ++deletedAddresseeL; | 2752 | ++deletedAddresseeL; |
2752 | } else { | 2753 | } else { |
2753 | if ( ! syncManager->mWriteBackExistingOnly ) { | 2754 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2754 | ++addedAddresseeR; | 2755 | ++addedAddresseeR; |