-rw-r--r-- | korganizer/calendarview.cpp | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 58b3d70..fd68dc4 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -130,7 +130,5 @@ extern int globalFlagBlockAgenda; | |||
130 | extern int globalFlagBlockStartup; | 130 | extern int globalFlagBlockStartup; |
131 | 131 | ||
132 | #define SYNC_MODE_NORMAL 0 | 132 | |
133 | #define SYNC_MODE_SHARP 1 | ||
134 | #define SYNC_MODE_QTOPIA 2 | ||
135 | 133 | ||
136 | class KOBeamPrefs : public QDialog | 134 | class KOBeamPrefs : public QDialog |
@@ -728,8 +726,8 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
728 | // 3 cancel | 726 | // 3 cancel |
729 | QDateTime lastSync = mLastCalendarSync; | 727 | QDateTime lastSync = mLastCalendarSync; |
730 | if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { | 728 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
731 | bool remCh, locCh; | 729 | bool remCh, locCh; |
732 | remCh = ( remote->zaurusUid() != local->zaurusUid() ); | 730 | remCh = ( remote->zaurusUid() != local->zaurusUid() ); |
733 | locCh = ( local->zaurusStat() != local->revision() ); | 731 | locCh = ( local->lastModified() > mLastCalendarSync ); |
734 | //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() ); |
735 | if ( !remCh && ! locCh ) { | 733 | if ( !remCh && ! locCh ) { |
@@ -751,6 +749,6 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
751 | } | 749 | } |
752 | full = true; | 750 | full = true; |
753 | if ( mode < 3 ) | 751 | if ( mode < SYNC_PREF_ASK ) |
754 | mode = 3; | 752 | mode = SYNC_PREF_ASK; |
755 | } else { | 753 | } else { |
756 | if ( local->lastModified() == remote->lastModified() ) | 754 | if ( local->lastModified() == remote->lastModified() ) |
@@ -775,8 +773,8 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
775 | if ( equ ) { | 773 | if ( equ ) { |
776 | //qDebug("equal "); | 774 | //qDebug("equal "); |
777 | if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { | 775 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
778 | local->setZaurusUid( remote->zaurusUid() ); | 776 | local->setZaurusUid( remote->zaurusUid() ); |
779 | } | 777 | } |
780 | if ( mode < 4 ) | 778 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
781 | return 0; | 779 | return 0; |
782 | 780 | ||
@@ -786,9 +784,9 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
786 | int result; | 784 | int result; |
787 | bool localIsNew; | 785 | bool localIsNew; |
788 | if ( full && mode < 2 ) | 786 | if ( full && mode < SYNC_PREF_NEWEST ) |
789 | mode = 3; | 787 | mode = SYNC_PREF_ASK; |
790 | 788 | ||
791 | switch( mode ) { | 789 | switch( mode ) { |
792 | case 0: | 790 | case SYNC_PREF_LOCAL: |
793 | if ( lastSync > remote->lastModified() ) | 791 | if ( lastSync > remote->lastModified() ) |
794 | return 1; | 792 | return 1; |
@@ -797,5 +795,5 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
797 | return 1; | 795 | return 1; |
798 | break; | 796 | break; |
799 | case 1: | 797 | case SYNC_PREF_REMOTE: |
800 | if ( lastSync > remote->lastModified() ) | 798 | if ( lastSync > remote->lastModified() ) |
801 | return 1; | 799 | return 1; |
@@ -804,5 +802,5 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
804 | return 2; | 802 | return 2; |
805 | break; | 803 | break; |
806 | case 2: | 804 | case SYNC_PREF_NEWEST: |
807 | if ( local->lastModified() > remote->lastModified() ) | 805 | if ( local->lastModified() > remote->lastModified() ) |
808 | return 1; | 806 | return 1; |
@@ -810,5 +808,5 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
810 | return 2; | 808 | return 2; |
811 | break; | 809 | break; |
812 | case 3: | 810 | case SYNC_PREF_ASK: |
813 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); | 811 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); |
814 | if ( lastSync > remote->lastModified() ) | 812 | if ( lastSync > remote->lastModified() ) |
@@ -836,12 +834,13 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
836 | 834 | ||
837 | break; | 835 | break; |
838 | case 4: | 836 | case SYNC_PREF_FORCE_LOCAL: |
839 | return 1; | 837 | return 1; |
840 | break; | 838 | break; |
841 | case 5: | 839 | case SYNC_PREF_FORCE_REMOTE: |
842 | return 2; | 840 | return 2; |
843 | break; | 841 | break; |
844 | 842 | ||
845 | default: | 843 | default: |
844 | // SYNC_PREF_TAKE_BOTH not implemented | ||
846 | break; | 845 | break; |
847 | } | 846 | } |
@@ -997,5 +996,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
997 | } | 996 | } |
998 | } else { // no conflict | 997 | } else { // no conflict |
999 | if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { | 998 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1000 | QString des = eventLSync->description(); | 999 | QString des = eventLSync->description(); |
1001 | QString pref = "e"; | 1000 | QString pref = "e"; |
@@ -1003,5 +1002,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1003 | pref = "t"; | 1002 | pref = "t"; |
1004 | if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it | 1003 | if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it |
1005 | inR->setZaurusStat( -3 ); | 1004 | inR->setZaurusStat( SYNC_TEMPSTATE_DELETE ); |
1006 | //remote->deleteIncidence( inR ); | 1005 | //remote->deleteIncidence( inR ); |
1007 | ++deletedEventR; | 1006 | ++deletedEventR; |
@@ -1046,10 +1045,10 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1046 | if ( uid.left(21) == QString("last-syncEvent-device") ) | 1045 | if ( uid.left(21) == QString("last-syncEvent-device") ) |
1047 | skipIncidence = true; | 1046 | skipIncidence = true; |
1048 | if ( mGlobalSyncMode == SYNC_MODE_SHARP && inL->type() == "Journal" ) | 1047 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1049 | skipIncidence = true; | 1048 | skipIncidence = true; |
1050 | if ( !skipIncidence ) { | 1049 | if ( !skipIncidence ) { |
1051 | inR = remote->incidence( uid ); | 1050 | inR = remote->incidence( uid ); |
1052 | if ( ! inR ) { | 1051 | if ( ! inR ) { |
1053 | if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { | 1052 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1054 | if ( inL->zaurusId() >= 0 && mode != 4 ) { | 1053 | if ( inL->zaurusId() >= 0 && mode != 4 ) { |
1055 | local->deleteIncidence( inL ); | 1054 | local->deleteIncidence( inL ); |
@@ -1142,5 +1141,5 @@ void CalendarView::syncSharp() | |||
1142 | { | 1141 | { |
1143 | #ifndef DESKTOP_VERSION | 1142 | #ifndef DESKTOP_VERSION |
1144 | mGlobalSyncMode = SYNC_MODE_SHARP; | 1143 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1145 | //mCurrentSyncDevice = "sharp-DTM"; | 1144 | //mCurrentSyncDevice = "sharp-DTM"; |
1146 | if ( KOPrefs::instance()->mAskForPreferences ) | 1145 | if ( KOPrefs::instance()->mAskForPreferences ) |
@@ -1161,8 +1160,10 @@ void CalendarView::syncSharp() | |||
1161 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1160 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1162 | Incidence* inc = iL.first(); | 1161 | Incidence* inc = iL.first(); |
1162 | /* obsolete | ||
1163 | while ( inc ) { | 1163 | while ( inc ) { |
1164 | inc->setZaurusStat( inc->revision () ); | 1164 | inc->setZaurusStat( inc->revision () ); |
1165 | inc = iL.next(); | 1165 | inc = iL.next(); |
1166 | } | 1166 | } |
1167 | */ | ||
1167 | // pending: clean last sync event description | 1168 | // pending: clean last sync event description |
1168 | sharpFormat.save(calendar); | 1169 | sharpFormat.save(calendar); |
@@ -1171,5 +1172,5 @@ void CalendarView::syncSharp() | |||
1171 | Incidence* loc; | 1172 | Incidence* loc; |
1172 | while ( inc ) { | 1173 | while ( inc ) { |
1173 | if ( inc->zaurusStat() == -4 ) { | 1174 | if ( inc->zaurusStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1174 | loc = mCalendar->incidence(inc->uid() ); | 1175 | loc = mCalendar->incidence(inc->uid() ); |
1175 | if ( loc ) { | 1176 | if ( loc ) { |