-rw-r--r-- | korganizer/calendarview.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index fab4540..5150455 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -724,13 +724,13 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
724 | // 1 take local | 724 | // 1 take local |
725 | // 2 take remote | 725 | // 2 take remote |
726 | // 3 cancel | 726 | // 3 cancel |
727 | QDateTime lastSync = mLastCalendarSync; | 727 | QDateTime lastSync = mLastCalendarSync; |
728 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 728 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
729 | bool remCh, locCh; | 729 | bool remCh, locCh; |
730 | remCh = ( remote->zaurusUid() != local->zaurusUid() ); | 730 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
731 | locCh = ( local->lastModified() > mLastCalendarSync ); | 731 | locCh = ( local->lastModified() > mLastCalendarSync ); |
732 | //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); | 732 | //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); |
733 | if ( !remCh && ! locCh ) { | 733 | if ( !remCh && ! locCh ) { |
734 | //qDebug("both not changed "); | 734 | //qDebug("both not changed "); |
735 | lastSync = local->lastModified().addDays(1); | 735 | lastSync = local->lastModified().addDays(1); |
736 | } else { | 736 | } else { |
@@ -770,13 +770,13 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
770 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 770 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
771 | else if ( local->type() =="Journal" ) | 771 | else if ( local->type() =="Journal" ) |
772 | equ = (*((Journal*) local) == *((Journal*) remote)); | 772 | equ = (*((Journal*) local) == *((Journal*) remote)); |
773 | if ( equ ) { | 773 | if ( equ ) { |
774 | //qDebug("equal "); | 774 | //qDebug("equal "); |
775 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 775 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
776 | local->setZaurusUid( remote->zaurusUid() ); | 776 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
777 | } | 777 | } |
778 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 778 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
779 | return 0; | 779 | return 0; |
780 | 780 | ||
781 | }//else //debug only | 781 | }//else //debug only |
782 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 782 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
@@ -892,19 +892,19 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t | |||
892 | if ( toDelete->type() == "Journal" ) | 892 | if ( toDelete->type() == "Journal" ) |
893 | return; | 893 | return; |
894 | 894 | ||
895 | Event* eve = lastSync.first(); | 895 | Event* eve = lastSync.first(); |
896 | 896 | ||
897 | while ( eve ) { | 897 | while ( eve ) { |
898 | int id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 898 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
899 | if ( id >= 0 ) { | 899 | if ( !id.isEmpty() ) { |
900 | QString des = eve->description(); | 900 | QString des = eve->description(); |
901 | QString pref = "e"; | 901 | QString pref = "e"; |
902 | if ( toDelete->type() == "Todo" ) | 902 | if ( toDelete->type() == "Todo" ) |
903 | pref = "t"; | 903 | pref = "t"; |
904 | des += pref+ QString::number ( id ) + ","; | 904 | des += pref+ id + ","; |
905 | eve->setReadOnly( false ); | 905 | eve->setReadOnly( false ); |
906 | eve->setDescription( des ); | 906 | eve->setDescription( des ); |
907 | eve->setReadOnly( true ); | 907 | eve->setReadOnly( true ); |
908 | } | 908 | } |
909 | eve = lastSync.next(); | 909 | eve = lastSync.next(); |
910 | } | 910 | } |
@@ -1010,13 +1010,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1010 | maxrev = inR->revision(); | 1010 | maxrev = inR->revision(); |
1011 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1011 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1012 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1012 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1013 | if ( take == 3 ) | 1013 | if ( take == 3 ) |
1014 | return false; | 1014 | return false; |
1015 | if ( take == 1 ) {// take local | 1015 | if ( take == 1 ) {// take local |
1016 | inL->setZaurusUid( inR->zaurusUid() ); | 1016 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1017 | remote->deleteIncidence( inR ); | 1017 | remote->deleteIncidence( inR ); |
1018 | if ( inL->revision() < maxrev ) | 1018 | if ( inL->revision() < maxrev ) |
1019 | inL->setRevision( maxrev ); | 1019 | inL->setRevision( maxrev ); |
1020 | remote->addIncidence( inL->clone() ); | 1020 | remote->addIncidence( inL->clone() ); |
1021 | ++changedRemote; | 1021 | ++changedRemote; |
1022 | } else { | 1022 | } else { |
@@ -1030,13 +1030,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1030 | } else { // no conflict | 1030 | } else { // no conflict |
1031 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1031 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1032 | QString des = eventLSync->description(); | 1032 | QString des = eventLSync->description(); |
1033 | QString pref = "e"; | 1033 | QString pref = "e"; |
1034 | if ( inR->type() == "Todo" ) | 1034 | if ( inR->type() == "Todo" ) |
1035 | pref = "t"; | 1035 | pref = "t"; |
1036 | if ( des.find(pref+QString::number( inR->getID(mCurrentSyncDevice) ) +"," ) >= 0 && mode != 5) { // delete it | 1036 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1037 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1037 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1038 | //remote->deleteIncidence( inR ); | 1038 | //remote->deleteIncidence( inR ); |
1039 | ++deletedEventR; | 1039 | ++deletedEventR; |
1040 | } else { | 1040 | } else { |
1041 | inR->setLastModified( modifiedCalendar ); | 1041 | inR->setLastModified( modifiedCalendar ); |
1042 | local->addIncidence( inR->clone() ); | 1042 | local->addIncidence( inR->clone() ); |
@@ -1080,18 +1080,18 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1080 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) | 1080 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1081 | skipIncidence = true; | 1081 | skipIncidence = true; |
1082 | if ( !skipIncidence ) { | 1082 | if ( !skipIncidence ) { |
1083 | inR = remote->incidence( uid ); | 1083 | inR = remote->incidence( uid ); |
1084 | if ( ! inR ) { | 1084 | if ( ! inR ) { |
1085 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1085 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1086 | if ( inL->getID(mCurrentSyncDevice) >= 0 && mode != 4 ) { | 1086 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1087 | local->deleteIncidence( inL ); | 1087 | local->deleteIncidence( inL ); |
1088 | ++deletedEventL; | 1088 | ++deletedEventL; |
1089 | } else { | 1089 | } else { |
1090 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1090 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1091 | inL->setID(mCurrentSyncDevice, -1 ); | 1091 | inL->removeID(mCurrentSyncDevice ); |
1092 | ++addedEventR; | 1092 | ++addedEventR; |
1093 | inL->setLastModified( modifiedCalendar ); | 1093 | inL->setLastModified( modifiedCalendar ); |
1094 | remote->addIncidence( inL->clone() ); | 1094 | remote->addIncidence( inL->clone() ); |
1095 | } | 1095 | } |
1096 | } | 1096 | } |
1097 | } else { | 1097 | } else { |
@@ -1205,13 +1205,13 @@ void CalendarView::syncSharp() | |||
1205 | Incidence* loc; | 1205 | Incidence* loc; |
1206 | while ( inc ) { | 1206 | while ( inc ) { |
1207 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1207 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1208 | loc = mCalendar->incidence(inc->uid() ); | 1208 | loc = mCalendar->incidence(inc->uid() ); |
1209 | if ( loc ) { | 1209 | if ( loc ) { |
1210 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1210 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1211 | loc->setZaurusUid( inc->zaurusUid() ); | 1211 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1212 | } | 1212 | } |
1213 | } | 1213 | } |
1214 | inc = iL.next(); | 1214 | inc = iL.next(); |
1215 | } | 1215 | } |
1216 | Incidence* lse = getLastSyncEvent(); | 1216 | Incidence* lse = getLastSyncEvent(); |
1217 | if ( lse ) { | 1217 | if ( lse ) { |