summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 258bd43..94cc97d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -735,13 +735,13 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
735 //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); 735 //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() );
736 if ( !remCh && ! locCh ) { 736 if ( !remCh && ! locCh ) {
737 qDebug("both not changed "); 737 qDebug("both not changed ");
738 lastSync = local->lastModified().addDays(1); 738 lastSync = local->lastModified().addDays(1);
739 } else { 739 } else {
740 if ( locCh ) { 740 if ( locCh ) {
741 qDebug("loc changed %d", local->revision() ); 741 qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1());
742 lastSync = local->lastModified().addDays( -1 ); 742 lastSync = local->lastModified().addDays( -1 );
743 if ( !remCh ) 743 if ( !remCh )
744 remote->setLastModified( lastSync.addDays( -1 ) ); 744 remote->setLastModified( lastSync.addDays( -1 ) );
745 } else { 745 } else {
746 qDebug(" not loc changed "); 746 qDebug(" not loc changed ");
747 lastSync = local->lastModified().addDays( 1 ); 747 lastSync = local->lastModified().addDays( 1 );
@@ -783,13 +783,13 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
783 783
784 }//else //debug only 784 }//else //debug only
785 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 785 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
786 } 786 }
787 int result; 787 int result;
788 bool localIsNew; 788 bool localIsNew;
789 qDebug("mLastCalendarSync %s lastsync %s --- local %s remote %s ",mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); 789 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() );
790 790
791 if ( full && mode < SYNC_PREF_NEWEST ) 791 if ( full && mode < SYNC_PREF_NEWEST )
792 mode = SYNC_PREF_ASK; 792 mode = SYNC_PREF_ASK;
793 793
794 switch( mode ) { 794 switch( mode ) {
795 case SYNC_PREF_LOCAL: 795 case SYNC_PREF_LOCAL:
@@ -1027,13 +1027,15 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
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 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1030 remote->deleteIncidence( inR ); 1030 remote->deleteIncidence( inR );
1031 if ( inL->revision() < maxrev ) 1031 if ( inL->revision() < maxrev )
1032 inL->setRevision( maxrev ); 1032 inL->setRevision( maxrev );
1033 remote->addIncidence( inL->clone() ); 1033 inR = inL->clone();
1034 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1035 remote->addIncidence( inR );
1034 ++changedRemote; 1036 ++changedRemote;
1035 } else { 1037 } else {
1036 if ( inR->revision() < maxrev ) 1038 if ( inR->revision() < maxrev )
1037 inR->setRevision( maxrev ); 1039 inR->setRevision( maxrev );
1038 local->deleteIncidence( inL ); 1040 local->deleteIncidence( inL );
1039 local->addIncidence( inR->clone() ); 1041 local->addIncidence( inR->clone() );
@@ -1049,13 +1051,14 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1049 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1051 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1050 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1052 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1051 //remote->deleteIncidence( inR ); 1053 //remote->deleteIncidence( inR );
1052 ++deletedEventR; 1054 ++deletedEventR;
1053 } else { 1055 } else {
1054 inR->setLastModified( modifiedCalendar ); 1056 inR->setLastModified( modifiedCalendar );
1055 local->addIncidence( inR->clone() ); 1057 inL = inR->clone();
1058 local->addIncidence( inL );
1056 ++addedEvent; 1059 ++addedEvent;
1057 } 1060 }
1058 } else { 1061 } else {
1059 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1062 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1060 inR->setLastModified( modifiedCalendar ); 1063 inR->setLastModified( modifiedCalendar );
1061 local->addIncidence( inR->clone() ); 1064 local->addIncidence( inR->clone() );
@@ -1100,14 +1103,17 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1100 local->deleteIncidence( inL ); 1103 local->deleteIncidence( inL );
1101 ++deletedEventL; 1104 ++deletedEventL;
1102 } else { 1105 } else {
1103 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1106 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1104 inL->removeID(mCurrentSyncDevice ); 1107 inL->removeID(mCurrentSyncDevice );
1105 ++addedEventR; 1108 ++addedEventR;
1109 qDebug("remote added Incidence %s ", inL->summary().latin1());
1106 inL->setLastModified( modifiedCalendar ); 1110 inL->setLastModified( modifiedCalendar );
1107 remote->addIncidence( inL->clone() ); 1111 inR = inL->clone();
1112 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1113 remote->addIncidence( inR );
1108 } 1114 }
1109 } 1115 }
1110 } else { 1116 } else {
1111 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1117 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1112 checkExternSyncEvent(eventLSyncSharp, inL); 1118 checkExternSyncEvent(eventLSyncSharp, inL);
1113 local->deleteIncidence( inL ); 1119 local->deleteIncidence( inL );