author | zautrix <zautrix> | 2004-10-28 11:37:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-28 11:37:28 (UTC) |
commit | af21c3d45173ece8492850b8c2c5019e7c25d59c (patch) (unidiff) | |
tree | 52e60b226372bbe37987df07495b02de321410fe | |
parent | 01cd4ef94b8604532181c390e9abd560aebaf372 (diff) | |
download | kdepimpi-af21c3d45173ece8492850b8c2c5019e7c25d59c.zip kdepimpi-af21c3d45173ece8492850b8c2c5019e7c25d59c.tar.gz kdepimpi-af21c3d45173ece8492850b8c2c5019e7c25d59c.tar.bz2 |
dtm sync fixes
-rw-r--r-- | kaddressbook/kabcore.cpp | 14 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 10 |
2 files changed, 15 insertions, 9 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index bdc5bd8..c75b4bc 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2631,17 +2631,17 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2631 | //inL.setResource( 0 ); | 2631 | //inL.setResource( 0 ); |
2632 | //inR.setResource( 0 ); | 2632 | //inR.setResource( 0 ); |
2633 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars | 2633 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars |
2634 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 2634 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
2635 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { | 2635 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { |
2636 | //qDebug("take %d %s ", take, inL.summary().latin1()); | 2636 | //qDebug("take %d %s ", take, inL.summary().latin1()); |
2637 | if ( take == 3 ) | 2637 | if ( take == 3 ) |
2638 | return false; | 2638 | return false; |
2639 | if ( take == 1 ) {// take local | 2639 | if ( take == 1 ) {// take local ********************** |
2640 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2640 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2641 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2641 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2642 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2642 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2643 | local->insertAddressee( inL, false ); | 2643 | local->insertAddressee( inL, false ); |
2644 | idS = inR.externalUID(); | 2644 | idS = inR.externalUID(); |
2645 | OidS = inR.originalExternalUID(); | 2645 | OidS = inR.originalExternalUID(); |
2646 | } | 2646 | } |
2647 | else | 2647 | else |
@@ -2656,17 +2656,17 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2656 | inR.setIDStr("changed" ); | 2656 | inR.setIDStr("changed" ); |
2657 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); | 2657 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); |
2658 | } else { | 2658 | } else { |
2659 | inR.setIDStr( idS ); | 2659 | inR.setIDStr( idS ); |
2660 | } | 2660 | } |
2661 | inR.setResource( 0 ); | 2661 | inR.setResource( 0 ); |
2662 | remote->insertAddressee( inR , false); | 2662 | remote->insertAddressee( inR , false); |
2663 | ++changedRemote; | 2663 | ++changedRemote; |
2664 | } else { // take == 2 take remote | 2664 | } else { // take == 2 take remote ********************** |
2665 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2665 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2666 | if ( inR.revision().date().year() < 2004 ) | 2666 | if ( inR.revision().date().year() < 2004 ) |
2667 | inR.setRevision( modifiedCalendar ); | 2667 | inR.setRevision( modifiedCalendar ); |
2668 | } | 2668 | } |
2669 | idS = inL.IDStr(); | 2669 | idS = inL.IDStr(); |
2670 | local->removeAddressee( inL ); | 2670 | local->removeAddressee( inL ); |
2671 | inL = inR; | 2671 | inL = inR; |
2672 | inL.setIDStr( idS ); | 2672 | inL.setIDStr( idS ); |
@@ -2675,27 +2675,30 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2675 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2675 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2676 | } | 2676 | } |
2677 | inL.setResource( 0 ); | 2677 | inL.setResource( 0 ); |
2678 | local->insertAddressee( inL , false ); | 2678 | local->insertAddressee( inL , false ); |
2679 | ++changedLocal; | 2679 | ++changedLocal; |
2680 | } | 2680 | } |
2681 | } | 2681 | } |
2682 | } | 2682 | } |
2683 | } else { // no conflict | 2683 | } else { // no conflict ********** add or delete remote |
2684 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2684 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2685 | QString des = addresseeLSync.note(); | 2685 | QString des = addresseeLSync.note(); |
2686 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 2686 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
2687 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 2687 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
2688 | remote->insertAddressee( inR, false ); | 2688 | remote->insertAddressee( inR, false ); |
2689 | ++deletedAddresseeR; | 2689 | ++deletedAddresseeR; |
2690 | } else { | 2690 | } else { |
2691 | inR.setRevision( modifiedCalendar ); | 2691 | inR.setRevision( modifiedCalendar ); |
2692 | remote->insertAddressee( inR, false ); | 2692 | remote->insertAddressee( inR, false ); |
2693 | inL = inR; | 2693 | inL = inR; |
2694 | inL.setIDStr( ":" ); | ||
2695 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | ||
2696 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | ||
2694 | inL.setResource( 0 ); | 2697 | inL.setResource( 0 ); |
2695 | local->insertAddressee( inL , false); | 2698 | local->insertAddressee( inL , false); |
2696 | ++addedAddressee; | 2699 | ++addedAddressee; |
2697 | } | 2700 | } |
2698 | } else { | 2701 | } else { |
2699 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { | 2702 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { |
2700 | inR.setRevision( modifiedCalendar ); | 2703 | inR.setRevision( modifiedCalendar ); |
2701 | remote->insertAddressee( inR, false ); | 2704 | remote->insertAddressee( inR, false ); |
@@ -2727,17 +2730,17 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2727 | uid = el[ incCounter ]; | 2730 | uid = el[ incCounter ]; |
2728 | bool skipIncidence = false; | 2731 | bool skipIncidence = false; |
2729 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 2732 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
2730 | skipIncidence = true; | 2733 | skipIncidence = true; |
2731 | if ( !skipIncidence ) { | 2734 | if ( !skipIncidence ) { |
2732 | inL = local->findByUid( uid ); | 2735 | inL = local->findByUid( uid ); |
2733 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 2736 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
2734 | inR = remote->findByUid( uid ); | 2737 | inR = remote->findByUid( uid ); |
2735 | if ( inR.isEmpty() ) { | 2738 | if ( inR.isEmpty() ) { / no conflict ********** add or delete local |
2736 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2739 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2737 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 2740 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
2738 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 2741 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
2739 | local->removeAddressee( inL ); | 2742 | local->removeAddressee( inL ); |
2740 | ++deletedAddresseeL; | 2743 | ++deletedAddresseeL; |
2741 | } else { | 2744 | } else { |
2742 | if ( ! syncManager->mWriteBackExistingOnly ) { | 2745 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2743 | inL.removeID(mCurrentSyncDevice ); | 2746 | inL.removeID(mCurrentSyncDevice ); |
@@ -2756,16 +2759,17 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2756 | local->removeAddressee( inL ); | 2759 | local->removeAddressee( inL ); |
2757 | ++deletedAddresseeL; | 2760 | ++deletedAddresseeL; |
2758 | } else { | 2761 | } else { |
2759 | if ( ! syncManager->mWriteBackExistingOnly ) { | 2762 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2760 | ++addedAddresseeR; | 2763 | ++addedAddresseeR; |
2761 | inL.setRevision( modifiedCalendar ); | 2764 | inL.setRevision( modifiedCalendar ); |
2762 | local->insertAddressee( inL, false ); | 2765 | local->insertAddressee( inL, false ); |
2763 | inR = inL; | 2766 | inR = inL; |
2767 | inR.setIDStr( ":" ); | ||
2764 | inR.setResource( 0 ); | 2768 | inR.setResource( 0 ); |
2765 | remote->insertAddressee( inR, false ); | 2769 | remote->insertAddressee( inR, false ); |
2766 | } | 2770 | } |
2767 | } | 2771 | } |
2768 | } | 2772 | } |
2769 | } | 2773 | } |
2770 | } | 2774 | } |
2771 | } | 2775 | } |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 4667918..4e29d6f 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1011,60 +1011,62 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1011 | qApp->processEvents(); | 1011 | qApp->processEvents(); |
1012 | if ( !skipIncidence ) { | 1012 | if ( !skipIncidence ) { |
1013 | inL = local->incidence( uid ); | 1013 | inL = local->incidence( uid ); |
1014 | if ( inL ) { // maybe conflict - same uid in both calendars | 1014 | if ( inL ) { // maybe conflict - same uid in both calendars |
1015 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1015 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1016 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1016 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1017 | if ( take == 3 ) | 1017 | if ( take == 3 ) |
1018 | return false; | 1018 | return false; |
1019 | if ( take == 1 ) {// take local | 1019 | if ( take == 1 ) {// take local ********************** |
1020 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1020 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1021 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1021 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1022 | else | 1022 | else |
1023 | idS = inR->IDStr(); | 1023 | idS = inR->IDStr(); |
1024 | remote->deleteIncidence( inR ); | 1024 | remote->deleteIncidence( inR ); |
1025 | inR = inL->clone(); | 1025 | inR = inL->clone(); |
1026 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1026 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1027 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1027 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1028 | inR->setIDStr( idS ); | 1028 | inR->setIDStr( idS ); |
1029 | remote->addIncidence( inR ); | 1029 | remote->addIncidence( inR ); |
1030 | if ( mSyncManager->syncWithDesktop() ) | 1030 | if ( mSyncManager->syncWithDesktop() ) |
1031 | inR->setPilotId( 2 ); | 1031 | inR->setPilotId( 2 ); |
1032 | ++changedRemote; | 1032 | ++changedRemote; |
1033 | } else { | 1033 | } else {// take remote ********************** |
1034 | idS = inL->IDStr(); | 1034 | idS = inL->IDStr(); |
1035 | int pid = inL->pilotId(); | 1035 | int pid = inL->pilotId(); |
1036 | local->deleteIncidence( inL ); | 1036 | local->deleteIncidence( inL ); |
1037 | inL = inR->clone(); | 1037 | inL = inR->clone(); |
1038 | if ( mSyncManager->syncWithDesktop() ) | 1038 | if ( mSyncManager->syncWithDesktop() ) |
1039 | inL->setPilotId( pid ); | 1039 | inL->setPilotId( pid ); |
1040 | inL->setIDStr( idS ); | 1040 | inL->setIDStr( idS ); |
1041 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1041 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1042 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1042 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1043 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1043 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1044 | } | 1044 | } |
1045 | local->addIncidence( inL ); | 1045 | local->addIncidence( inL ); |
1046 | ++changedLocal; | 1046 | ++changedLocal; |
1047 | } | 1047 | } |
1048 | } | 1048 | } |
1049 | } else { // no conflict | 1049 | } else { // no conflict ********** add or delete remote |
1050 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1050 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1051 | QString des = eventLSync->description(); | 1051 | QString des = eventLSync->description(); |
1052 | QString pref = "e"; | 1052 | QString pref = "e"; |
1053 | if ( inR->type() == "Todo" ) | 1053 | if ( inR->type() == "Todo" ) |
1054 | pref = "t"; | 1054 | pref = "t"; |
1055 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1055 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1056 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1056 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1057 | //remote->deleteIncidence( inR ); | 1057 | //remote->deleteIncidence( inR ); |
1058 | ++deletedEventR; | 1058 | ++deletedEventR; |
1059 | } else { | 1059 | } else { |
1060 | inR->setLastModified( modifiedCalendar ); | 1060 | inR->setLastModified( modifiedCalendar ); |
1061 | inL = inR->clone(); | 1061 | inL = inR->clone(); |
1062 | inL->setIDStr( ":" ); | 1062 | inL->setIDStr( ":" ); |
1063 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | ||
1064 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | ||
1063 | local->addIncidence( inL ); | 1065 | local->addIncidence( inL ); |
1064 | ++addedEvent; | 1066 | ++addedEvent; |
1065 | } | 1067 | } |
1066 | } else { | 1068 | } else { |
1067 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1069 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1068 | inR->setLastModified( modifiedCalendar ); | 1070 | inR->setLastModified( modifiedCalendar ); |
1069 | inL = inR->clone(); | 1071 | inL = inR->clone(); |
1070 | inL->setIDStr( ":" ); | 1072 | inL->setIDStr( ":" ); |
@@ -1099,17 +1101,17 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1099 | uid = inL->uid(); | 1101 | uid = inL->uid(); |
1100 | bool skipIncidence = false; | 1102 | bool skipIncidence = false; |
1101 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1103 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1102 | skipIncidence = true; | 1104 | skipIncidence = true; |
1103 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) | 1105 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1104 | skipIncidence = true; | 1106 | skipIncidence = true; |
1105 | if ( !skipIncidence ) { | 1107 | if ( !skipIncidence ) { |
1106 | inR = remote->incidence( uid ); | 1108 | inR = remote->incidence( uid ); |
1107 | if ( ! inR ) { | 1109 | if ( ! inR ) { // no conflict ********** add or delete local |
1108 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1110 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1109 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1111 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1110 | checkExternSyncEvent(eventLSyncSharp, inL); | 1112 | checkExternSyncEvent(eventLSyncSharp, inL); |
1111 | local->deleteIncidence( inL ); | 1113 | local->deleteIncidence( inL ); |
1112 | ++deletedEventL; | 1114 | ++deletedEventL; |
1113 | } else { | 1115 | } else { |
1114 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1116 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1115 | inL->removeID(mCurrentSyncDevice ); | 1117 | inL->removeID(mCurrentSyncDevice ); |