author | zautrix <zautrix> | 2004-09-14 01:59:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-14 01:59:37 (UTC) |
commit | 739fec31c8cea89dd40ff1ce7dd7b84b05e4e973 (patch) (unidiff) | |
tree | e632528a6825911b1b7ae9db9af4e4c8984e6dbf /korganizer | |
parent | 30762fe125216362e1a6c1d5ec5d22d9525aa336 (diff) | |
download | kdepimpi-739fec31c8cea89dd40ff1ce7dd7b84b05e4e973.zip kdepimpi-739fec31c8cea89dd40ff1ce7dd7b84b05e4e973.tar.gz kdepimpi-739fec31c8cea89dd40ff1ce7dd7b84b05e4e973.tar.bz2 |
Sync fixes
-rw-r--r-- | korganizer/calendarview.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 94cc97d..ce41fbd 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1008,42 +1008,50 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1008 | return false; | 1008 | return false; |
1009 | if ( incCounter % modulo == 0 ) | 1009 | if ( incCounter % modulo == 0 ) |
1010 | bar.setProgress( incCounter ); | 1010 | bar.setProgress( incCounter ); |
1011 | ++incCounter; | 1011 | ++incCounter; |
1012 | uid = inR->uid(); | 1012 | uid = inR->uid(); |
1013 | bool skipIncidence = false; | 1013 | bool skipIncidence = false; |
1014 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1014 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1015 | skipIncidence = true; | 1015 | skipIncidence = true; |
1016 | 1016 | QString idS; | |
1017 | qApp->processEvents(); | 1017 | qApp->processEvents(); |
1018 | if ( !skipIncidence ) { | 1018 | if ( !skipIncidence ) { |
1019 | inL = local->incidence( uid ); | 1019 | inL = local->incidence( uid ); |
1020 | if ( inL ) { // maybe conflict - same uid in both calendars | 1020 | if ( inL ) { // maybe conflict - same uid in both calendars |
1021 | int maxrev = inL->revision(); | 1021 | int maxrev = inL->revision(); |
1022 | if ( maxrev < inR->revision() ) | 1022 | if ( maxrev < inR->revision() ) |
1023 | maxrev = inR->revision(); | 1023 | maxrev = inR->revision(); |
1024 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1024 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1025 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1025 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1026 | if ( take == 3 ) | 1026 | if ( take == 3 ) |
1027 | return false; | 1027 | return false; |
1028 | if ( take == 1 ) {// take local | 1028 | if ( take == 1 ) {// take local |
1029 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1029 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1030 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | ||
1031 | else | ||
1032 | idS = inR->IDStr(); | ||
1030 | remote->deleteIncidence( inR ); | 1033 | remote->deleteIncidence( inR ); |
1031 | if ( inL->revision() < maxrev ) | 1034 | if ( inL->revision() < maxrev ) |
1032 | inL->setRevision( maxrev ); | 1035 | inL->setRevision( maxrev ); |
1033 | inR = inL->clone(); | 1036 | inR = inL->clone(); |
1034 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1037 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1038 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | ||
1039 | inR->setIDStr( idS ); | ||
1035 | remote->addIncidence( inR ); | 1040 | remote->addIncidence( inR ); |
1036 | ++changedRemote; | 1041 | ++changedRemote; |
1037 | } else { | 1042 | } else { |
1038 | if ( inR->revision() < maxrev ) | 1043 | if ( inR->revision() < maxrev ) |
1039 | inR->setRevision( maxrev ); | 1044 | inR->setRevision( maxrev ); |
1045 | idS = inL->IDStr(); | ||
1040 | local->deleteIncidence( inL ); | 1046 | local->deleteIncidence( inL ); |
1041 | local->addIncidence( inR->clone() ); | 1047 | inL = inR->clone(); |
1048 | inL->setIDStr( idS ); | ||
1049 | local->addIncidence( inL ); | ||
1042 | ++changedLocal; | 1050 | ++changedLocal; |
1043 | } | 1051 | } |
1044 | } | 1052 | } |
1045 | } else { // no conflict | 1053 | } else { // no conflict |
1046 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1054 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1047 | QString des = eventLSync->description(); | 1055 | QString des = eventLSync->description(); |
1048 | QString pref = "e"; | 1056 | QString pref = "e"; |
1049 | if ( inR->type() == "Todo" ) | 1057 | if ( inR->type() == "Todo" ) |
@@ -1095,16 +1103,17 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1095 | skipIncidence = true; | 1103 | skipIncidence = true; |
1096 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) | 1104 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1097 | skipIncidence = true; | 1105 | skipIncidence = true; |
1098 | if ( !skipIncidence ) { | 1106 | if ( !skipIncidence ) { |
1099 | inR = remote->incidence( uid ); | 1107 | inR = remote->incidence( uid ); |
1100 | if ( ! inR ) { | 1108 | if ( ! inR ) { |
1101 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1109 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1102 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1110 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1111 | checkExternSyncEvent(eventLSyncSharp, inL); | ||
1103 | local->deleteIncidence( inL ); | 1112 | local->deleteIncidence( inL ); |
1104 | ++deletedEventL; | 1113 | ++deletedEventL; |
1105 | } else { | 1114 | } else { |
1106 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1115 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1107 | inL->removeID(mCurrentSyncDevice ); | 1116 | inL->removeID(mCurrentSyncDevice ); |
1108 | ++addedEventR; | 1117 | ++addedEventR; |
1109 | qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1118 | qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1110 | inL->setLastModified( modifiedCalendar ); | 1119 | inL->setLastModified( modifiedCalendar ); |