-rw-r--r-- | korganizer/calendarview.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index bbed05b..7fae4a9 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1020,64 +1020,68 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1020 | qApp->processEvents(); | 1020 | qApp->processEvents(); |
1021 | if ( !skipIncidence ) { | 1021 | if ( !skipIncidence ) { |
1022 | inL = local->incidence( uid ); | 1022 | inL = local->incidence( uid ); |
1023 | if ( inL ) { // maybe conflict - same uid in both calendars | 1023 | if ( inL ) { // maybe conflict - same uid in both calendars |
1024 | int maxrev = inL->revision(); | 1024 | int maxrev = inL->revision(); |
1025 | if ( maxrev < inR->revision() ) | 1025 | if ( maxrev < inR->revision() ) |
1026 | maxrev = inR->revision(); | 1026 | maxrev = inR->revision(); |
1027 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1027 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1028 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1028 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1029 | if ( take == 3 ) | 1029 | if ( take == 3 ) |
1030 | return false; | 1030 | return false; |
1031 | if ( take == 1 ) {// take local | 1031 | if ( take == 1 ) {// take local |
1032 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1032 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1033 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1033 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1034 | else | 1034 | else |
1035 | idS = inR->IDStr(); | 1035 | idS = inR->IDStr(); |
1036 | remote->deleteIncidence( inR ); | 1036 | remote->deleteIncidence( inR ); |
1037 | if ( inL->revision() < maxrev ) | 1037 | if ( inL->revision() < maxrev ) |
1038 | inL->setRevision( maxrev ); | 1038 | inL->setRevision( maxrev ); |
1039 | inR = inL->clone(); | 1039 | inR = inL->clone(); |
1040 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1040 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1041 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1041 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1042 | inR->setIDStr( idS ); | 1042 | inR->setIDStr( idS ); |
1043 | remote->addIncidence( inR ); | 1043 | remote->addIncidence( inR ); |
1044 | ++changedRemote; | 1044 | ++changedRemote; |
1045 | } else { | 1045 | } else { |
1046 | if ( inR->revision() < maxrev ) | 1046 | if ( inR->revision() < maxrev ) |
1047 | inR->setRevision( maxrev ); | 1047 | inR->setRevision( maxrev ); |
1048 | idS = inL->IDStr(); | 1048 | idS = inL->IDStr(); |
1049 | local->deleteIncidence( inL ); | 1049 | local->deleteIncidence( inL ); |
1050 | inL = inR->clone(); | 1050 | inL = inR->clone(); |
1051 | inL->setIDStr( idS ); | 1051 | inL->setIDStr( idS ); |
1052 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | ||
1053 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | ||
1054 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | ||
1055 | } | ||
1052 | local->addIncidence( inL ); | 1056 | local->addIncidence( inL ); |
1053 | ++changedLocal; | 1057 | ++changedLocal; |
1054 | } | 1058 | } |
1055 | } | 1059 | } |
1056 | } else { // no conflict | 1060 | } else { // no conflict |
1057 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1061 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1058 | QString des = eventLSync->description(); | 1062 | QString des = eventLSync->description(); |
1059 | QString pref = "e"; | 1063 | QString pref = "e"; |
1060 | if ( inR->type() == "Todo" ) | 1064 | if ( inR->type() == "Todo" ) |
1061 | pref = "t"; | 1065 | pref = "t"; |
1062 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1066 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1063 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1067 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1064 | //remote->deleteIncidence( inR ); | 1068 | //remote->deleteIncidence( inR ); |
1065 | ++deletedEventR; | 1069 | ++deletedEventR; |
1066 | } else { | 1070 | } else { |
1067 | inR->setLastModified( modifiedCalendar ); | 1071 | inR->setLastModified( modifiedCalendar ); |
1068 | inL = inR->clone(); | 1072 | inL = inR->clone(); |
1069 | local->addIncidence( inL ); | 1073 | local->addIncidence( inL ); |
1070 | ++addedEvent; | 1074 | ++addedEvent; |
1071 | } | 1075 | } |
1072 | } else { | 1076 | } else { |
1073 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1077 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1074 | inR->setLastModified( modifiedCalendar ); | 1078 | inR->setLastModified( modifiedCalendar ); |
1075 | local->addIncidence( inR->clone() ); | 1079 | local->addIncidence( inR->clone() ); |
1076 | ++addedEvent; | 1080 | ++addedEvent; |
1077 | } else { | 1081 | } else { |
1078 | checkExternSyncEvent(eventRSyncSharp, inR); | 1082 | checkExternSyncEvent(eventRSyncSharp, inR); |
1079 | remote->deleteIncidence( inR ); | 1083 | remote->deleteIncidence( inR ); |
1080 | ++deletedEventR; | 1084 | ++deletedEventR; |
1081 | } | 1085 | } |
1082 | } | 1086 | } |
1083 | } | 1087 | } |