summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
authorzautrix <zautrix>2004-09-20 00:12:42 (UTC)
committer zautrix <zautrix>2004-09-20 00:12:42 (UTC)
commitb01b669d88fa195261d29ecf73b1c69e608a5ebc (patch) (unidiff)
treec0e79d45242a764b49470d07a9c95be156c121cc /korganizer/calendarview.cpp
parent3da2cfeab2edbe64a17251662e56668fe143f7a3 (diff)
downloadkdepimpi-b01b669d88fa195261d29ecf73b1c69e608a5ebc.zip
kdepimpi-b01b669d88fa195261d29ecf73b1c69e608a5ebc.tar.gz
kdepimpi-b01b669d88fa195261d29ecf73b1c69e608a5ebc.tar.bz2
more AB sync
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp44
1 files changed, 23 insertions, 21 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 0c75632..8e83723 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -726,28 +726,30 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
726 // 2 take remote 726 // 2 take remote
727 // 3 cancel 727 // 3 cancel
728 QDateTime lastSync = mLastCalendarSync; 728 QDateTime lastSync = mLastCalendarSync;
729 QDateTime localMod = local->lastModified();
730 QDateTime remoteMod = remote->lastModified();
729 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 731 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
730 bool remCh, locCh; 732 bool remCh, locCh;
731 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 733 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
732 //if ( remCh ) 734 //if ( remCh )
733 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 735 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
734 locCh = ( local->lastModified() > mLastCalendarSync ); 736 locCh = ( localMod > mLastCalendarSync );
735 if ( !remCh && ! locCh ) { 737 if ( !remCh && ! locCh ) {
736 //qDebug("both not changed "); 738 //qDebug("both not changed ");
737 lastSync = local->lastModified().addDays(1); 739 lastSync = localMod.addDays(1);
738 if ( mode <= SYNC_PREF_ASK ) 740 if ( mode <= SYNC_PREF_ASK )
739 return 0; 741 return 0;
740 } else { 742 } else {
741 if ( locCh ) { 743 if ( locCh ) {
742 //qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1()); 744 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
743 lastSync = local->lastModified().addDays( -1 ); 745 lastSync = localMod.addDays( -1 );
744 if ( !remCh ) 746 if ( !remCh )
745 remote->setLastModified( lastSync.addDays( -1 ) ); 747 remoteMod = ( lastSync.addDays( -1 ) );
746 } else { 748 } else {
747 //qDebug(" not loc changed "); 749 //qDebug(" not loc changed ");
748 lastSync = local->lastModified().addDays( 1 ); 750 lastSync = localMod.addDays( 1 );
749 if ( remCh ) 751 if ( remCh )
750 remote->setLastModified( lastSync.addDays( 1 ) ); 752 remoteMod =( lastSync.addDays( 1 ) );
751 753
752 } 754 }
753 } 755 }
@@ -755,15 +757,15 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
755 if ( mode < SYNC_PREF_ASK ) 757 if ( mode < SYNC_PREF_ASK )
756 mode = SYNC_PREF_ASK; 758 mode = SYNC_PREF_ASK;
757 } else { 759 } else {
758 if ( local->lastModified() == remote->lastModified() ) 760 if ( localMod == remoteMod )
759 if ( local->revision() == remote->revision() ) 761 if ( local->revision() == remote->revision() )
760 return 0; 762 return 0;
761 763
762 } 764 }
763 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 765 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
764 766
765 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); 767 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
766 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 768 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
767 //full = true; //debug only 769 //full = true; //debug only
768 if ( full ) { 770 if ( full ) {
769 bool equ = false; 771 bool equ = false;
@@ -787,40 +789,40 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
787 } 789 }
788 int result; 790 int result;
789 bool localIsNew; 791 bool localIsNew;
790 //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() ); 792 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
791 793
792 if ( full && mode < SYNC_PREF_NEWEST ) 794 if ( full && mode < SYNC_PREF_NEWEST )
793 mode = SYNC_PREF_ASK; 795 mode = SYNC_PREF_ASK;
794 796
795 switch( mode ) { 797 switch( mode ) {
796 case SYNC_PREF_LOCAL: 798 case SYNC_PREF_LOCAL:
797 if ( lastSync > remote->lastModified() ) 799 if ( lastSync > remoteMod )
798 return 1; 800 return 1;
799 if ( lastSync > local->lastModified() ) 801 if ( lastSync > localMod )
800 return 2; 802 return 2;
801 return 1; 803 return 1;
802 break; 804 break;
803 case SYNC_PREF_REMOTE: 805 case SYNC_PREF_REMOTE:
804 if ( lastSync > remote->lastModified() ) 806 if ( lastSync > remoteMod )
805 return 1; 807 return 1;
806 if ( lastSync > local->lastModified() ) 808 if ( lastSync > localMod )
807 return 2; 809 return 2;
808 return 2; 810 return 2;
809 break; 811 break;
810 case SYNC_PREF_NEWEST: 812 case SYNC_PREF_NEWEST:
811 if ( local->lastModified() > remote->lastModified() ) 813 if ( localMod > remoteMod )
812 return 1; 814 return 1;
813 else 815 else
814 return 2; 816 return 2;
815 break; 817 break;
816 case SYNC_PREF_ASK: 818 case SYNC_PREF_ASK:
817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); 819 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
818 if ( lastSync > remote->lastModified() ) 820 if ( lastSync > remoteMod )
819 return 1; 821 return 1;
820 if ( lastSync > local->lastModified() ) 822 if ( lastSync > localMod )
821 return 2; 823 return 2;
822 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); 824 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
823 localIsNew = local->lastModified() >= remote->lastModified(); 825 localIsNew = localMod >= remoteMod;
824 if ( localIsNew ) 826 if ( localIsNew )
825 getEventViewerDialog()->setColorMode( 1 ); 827 getEventViewerDialog()->setColorMode( 1 );
826 else 828 else