-rw-r--r-- | korganizer/calendarview.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1f8ad5b..f727cd4 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -839,286 +839,294 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
839 | result = getEventViewerDialog()->executeS( localIsNew ); | 839 | result = getEventViewerDialog()->executeS( localIsNew ); |
840 | return result; | 840 | return result; |
841 | 841 | ||
842 | break; | 842 | break; |
843 | case SYNC_PREF_FORCE_LOCAL: | 843 | case SYNC_PREF_FORCE_LOCAL: |
844 | return 1; | 844 | return 1; |
845 | break; | 845 | break; |
846 | case SYNC_PREF_FORCE_REMOTE: | 846 | case SYNC_PREF_FORCE_REMOTE: |
847 | return 2; | 847 | return 2; |
848 | break; | 848 | break; |
849 | 849 | ||
850 | default: | 850 | default: |
851 | // SYNC_PREF_TAKE_BOTH not implemented | 851 | // SYNC_PREF_TAKE_BOTH not implemented |
852 | break; | 852 | break; |
853 | } | 853 | } |
854 | return 0; | 854 | return 0; |
855 | } | 855 | } |
856 | Event* CalendarView::getLastSyncEvent() | 856 | Event* CalendarView::getLastSyncEvent() |
857 | { | 857 | { |
858 | Event* lse; | 858 | Event* lse; |
859 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 859 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
860 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 860 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
861 | if (!lse) { | 861 | if (!lse) { |
862 | lse = new Event(); | 862 | lse = new Event(); |
863 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 863 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
864 | QString sum = ""; | 864 | QString sum = ""; |
865 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 865 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
866 | sum = "E: "; | 866 | sum = "E: "; |
867 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 867 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
868 | lse->setDtStart( mLastCalendarSync ); | 868 | lse->setDtStart( mLastCalendarSync ); |
869 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 869 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
870 | lse->setCategories( i18n("SyncEvent") ); | 870 | lse->setCategories( i18n("SyncEvent") ); |
871 | lse->setReadOnly( true ); | 871 | lse->setReadOnly( true ); |
872 | mCalendar->addEvent( lse ); | 872 | mCalendar->addEvent( lse ); |
873 | } | 873 | } |
874 | 874 | ||
875 | return lse; | 875 | return lse; |
876 | 876 | ||
877 | } | 877 | } |
878 | 878 | ||
879 | // we check, if the to delete event has a id for a profile | 879 | // we check, if the to delete event has a id for a profile |
880 | // if yes, we set this id in the profile to delete | 880 | // if yes, we set this id in the profile to delete |
881 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 881 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
882 | { | 882 | { |
883 | if ( lastSync.count() == 0 ) { | 883 | if ( lastSync.count() == 0 ) { |
884 | //qDebug(" lastSync.count() == 0"); | 884 | //qDebug(" lastSync.count() == 0"); |
885 | return; | 885 | return; |
886 | } | 886 | } |
887 | if ( toDelete->type() == "Journal" ) | 887 | if ( toDelete->type() == "Journal" ) |
888 | return; | 888 | return; |
889 | 889 | ||
890 | Event* eve = lastSync.first(); | 890 | Event* eve = lastSync.first(); |
891 | 891 | ||
892 | while ( eve ) { | 892 | while ( eve ) { |
893 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 893 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
894 | if ( !id.isEmpty() ) { | 894 | if ( !id.isEmpty() ) { |
895 | QString des = eve->description(); | 895 | QString des = eve->description(); |
896 | QString pref = "e"; | 896 | QString pref = "e"; |
897 | if ( toDelete->type() == "Todo" ) | 897 | if ( toDelete->type() == "Todo" ) |
898 | pref = "t"; | 898 | pref = "t"; |
899 | des += pref+ id + ","; | 899 | des += pref+ id + ","; |
900 | eve->setReadOnly( false ); | 900 | eve->setReadOnly( false ); |
901 | eve->setDescription( des ); | 901 | eve->setDescription( des ); |
902 | //qDebug("setdes %s ", des.latin1()); | 902 | //qDebug("setdes %s ", des.latin1()); |
903 | eve->setReadOnly( true ); | 903 | eve->setReadOnly( true ); |
904 | } | 904 | } |
905 | eve = lastSync.next(); | 905 | eve = lastSync.next(); |
906 | } | 906 | } |
907 | 907 | ||
908 | } | 908 | } |
909 | void CalendarView::checkExternalId( Incidence * inc ) | 909 | void CalendarView::checkExternalId( Incidence * inc ) |
910 | { | 910 | { |
911 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 911 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
912 | checkExternSyncEvent( lastSync, inc ); | 912 | checkExternSyncEvent( lastSync, inc ); |
913 | 913 | ||
914 | } | 914 | } |
915 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 915 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
916 | { | 916 | { |
917 | bool syncOK = true; | 917 | bool syncOK = true; |
918 | int addedEvent = 0; | 918 | int addedEvent = 0; |
919 | int addedEventR = 0; | 919 | int addedEventR = 0; |
920 | int deletedEventR = 0; | 920 | int deletedEventR = 0; |
921 | int deletedEventL = 0; | 921 | int deletedEventL = 0; |
922 | int changedLocal = 0; | 922 | int changedLocal = 0; |
923 | int changedRemote = 0; | 923 | int changedRemote = 0; |
924 | //QPtrList<Event> el = local->rawEvents(); | 924 | //QPtrList<Event> el = local->rawEvents(); |
925 | Event* eventR; | 925 | Event* eventR; |
926 | QString uid; | 926 | QString uid; |
927 | int take; | 927 | int take; |
928 | Event* eventL; | 928 | Event* eventL; |
929 | Event* eventRSync; | 929 | Event* eventRSync; |
930 | Event* eventLSync; | 930 | Event* eventLSync; |
931 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 931 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
932 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 932 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
933 | bool fullDateRange = false; | 933 | bool fullDateRange = false; |
934 | local->resetTempSyncStat(); | 934 | local->resetTempSyncStat(); |
935 | #ifdef DESKTOP_VERSION | ||
936 | //Needed for KDE - OL sync | ||
937 | local->resetPilotStat(); | ||
938 | remote->resetPilotStat(); | ||
939 | #endif | ||
935 | mLastCalendarSync = QDateTime::currentDateTime(); | 940 | mLastCalendarSync = QDateTime::currentDateTime(); |
936 | QDateTime modifiedCalendar = mLastCalendarSync;; | 941 | QDateTime modifiedCalendar = mLastCalendarSync;; |
937 | eventLSync = getLastSyncEvent(); | 942 | eventLSync = getLastSyncEvent(); |
938 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 943 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
939 | if ( eventR ) { | 944 | if ( eventR ) { |
940 | eventRSync = (Event*) eventR->clone(); | 945 | eventRSync = (Event*) eventR->clone(); |
941 | remote->deleteEvent(eventR ); | 946 | remote->deleteEvent(eventR ); |
942 | 947 | ||
943 | } else { | 948 | } else { |
944 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 949 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
945 | eventRSync = (Event*)eventLSync->clone(); | 950 | eventRSync = (Event*)eventLSync->clone(); |
946 | } else { | 951 | } else { |
947 | fullDateRange = true; | 952 | fullDateRange = true; |
948 | eventRSync = new Event(); | 953 | eventRSync = new Event(); |
949 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 954 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
950 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 955 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
951 | eventRSync->setDtStart( mLastCalendarSync ); | 956 | eventRSync->setDtStart( mLastCalendarSync ); |
952 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 957 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
953 | eventRSync->setCategories( i18n("SyncEvent") ); | 958 | eventRSync->setCategories( i18n("SyncEvent") ); |
954 | } | 959 | } |
955 | } | 960 | } |
956 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 961 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
957 | fullDateRange = true; | 962 | fullDateRange = true; |
958 | 963 | ||
959 | if ( ! fullDateRange ) { | 964 | if ( ! fullDateRange ) { |
960 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 965 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
961 | 966 | ||
962 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 967 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
963 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 968 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
964 | fullDateRange = true; | 969 | fullDateRange = true; |
965 | } | 970 | } |
966 | } | 971 | } |
967 | if ( fullDateRange ) | 972 | if ( fullDateRange ) |
968 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 973 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
969 | else | 974 | else |
970 | mLastCalendarSync = eventLSync->dtStart(); | 975 | mLastCalendarSync = eventLSync->dtStart(); |
971 | // for resyncing if own file has changed | 976 | // for resyncing if own file has changed |
972 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 977 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
973 | mLastCalendarSync = loadedFileVersion; | 978 | mLastCalendarSync = loadedFileVersion; |
974 | qDebug("setting mLastCalendarSync "); | 979 | qDebug("setting mLastCalendarSync "); |
975 | } | 980 | } |
976 | //qDebug("*************************** "); | 981 | //qDebug("*************************** "); |
977 | qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); | 982 | qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); |
978 | QPtrList<Incidence> er = remote->rawIncidences(); | 983 | QPtrList<Incidence> er = remote->rawIncidences(); |
979 | Incidence* inR = er.first(); | 984 | Incidence* inR = er.first(); |
980 | Incidence* inL; | 985 | Incidence* inL; |
981 | QProgressBar bar( er.count(),0 ); | 986 | QProgressBar bar( er.count(),0 ); |
982 | bar.setCaption (i18n("Syncing - close to abort!") ); | 987 | bar.setCaption (i18n("Syncing - close to abort!") ); |
983 | 988 | ||
984 | int w = 300; | 989 | int w = 300; |
985 | if ( QApplication::desktop()->width() < 320 ) | 990 | if ( QApplication::desktop()->width() < 320 ) |
986 | w = 220; | 991 | w = 220; |
987 | int h = bar.sizeHint().height() ; | 992 | int h = bar.sizeHint().height() ; |
988 | int dw = QApplication::desktop()->width(); | 993 | int dw = QApplication::desktop()->width(); |
989 | int dh = QApplication::desktop()->height(); | 994 | int dh = QApplication::desktop()->height(); |
990 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 995 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
991 | bar.show(); | 996 | bar.show(); |
992 | int modulo = (er.count()/10)+1; | 997 | int modulo = (er.count()/10)+1; |
993 | int incCounter = 0; | 998 | int incCounter = 0; |
994 | while ( inR ) { | 999 | while ( inR ) { |
995 | if ( ! bar.isVisible() ) | 1000 | if ( ! bar.isVisible() ) |
996 | return false; | 1001 | return false; |
997 | if ( incCounter % modulo == 0 ) | 1002 | if ( incCounter % modulo == 0 ) |
998 | bar.setProgress( incCounter ); | 1003 | bar.setProgress( incCounter ); |
999 | ++incCounter; | 1004 | ++incCounter; |
1000 | uid = inR->uid(); | 1005 | uid = inR->uid(); |
1001 | bool skipIncidence = false; | 1006 | bool skipIncidence = false; |
1002 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1007 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1003 | skipIncidence = true; | 1008 | skipIncidence = true; |
1004 | QString idS; | 1009 | QString idS; |
1005 | qApp->processEvents(); | 1010 | qApp->processEvents(); |
1006 | if ( !skipIncidence ) { | 1011 | if ( !skipIncidence ) { |
1007 | inL = local->incidence( uid ); | 1012 | inL = local->incidence( uid ); |
1008 | if ( inL ) { // maybe conflict - same uid in both calendars | 1013 | if ( inL ) { // maybe conflict - same uid in both calendars |
1009 | int maxrev = inL->revision(); | 1014 | int maxrev = inL->revision(); |
1010 | if ( maxrev < inR->revision() ) | 1015 | if ( maxrev < inR->revision() ) |
1011 | maxrev = inR->revision(); | 1016 | maxrev = inR->revision(); |
1012 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1017 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1013 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1018 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1014 | if ( take == 3 ) | 1019 | if ( take == 3 ) |
1015 | return false; | 1020 | return false; |
1016 | if ( take == 1 ) {// take local | 1021 | if ( take == 1 ) {// take local |
1017 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1022 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1018 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1023 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1019 | else | 1024 | else |
1020 | idS = inR->IDStr(); | 1025 | idS = inR->IDStr(); |
1021 | remote->deleteIncidence( inR ); | 1026 | remote->deleteIncidence( inR ); |
1022 | if ( inL->revision() < maxrev ) | 1027 | if ( inL->revision() < maxrev ) |
1023 | inL->setRevision( maxrev ); | 1028 | inL->setRevision( maxrev ); |
1024 | inR = inL->clone(); | 1029 | inR = inL->clone(); |
1025 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1030 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1026 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1031 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1027 | inR->setIDStr( idS ); | 1032 | inR->setIDStr( idS ); |
1028 | remote->addIncidence( inR ); | 1033 | remote->addIncidence( inR ); |
1034 | #ifdef DESKTOP_VERSION | ||
1035 | inR->setPilotId( 1 ); | ||
1036 | #endif | ||
1029 | ++changedRemote; | 1037 | ++changedRemote; |
1030 | } else { | 1038 | } else { |
1031 | if ( inR->revision() < maxrev ) | 1039 | if ( inR->revision() < maxrev ) |
1032 | inR->setRevision( maxrev ); | 1040 | inR->setRevision( maxrev ); |
1033 | idS = inL->IDStr(); | 1041 | idS = inL->IDStr(); |
1034 | local->deleteIncidence( inL ); | 1042 | local->deleteIncidence( inL ); |
1035 | inL = inR->clone(); | 1043 | inL = inR->clone(); |
1036 | inL->setIDStr( idS ); | 1044 | inL->setIDStr( idS ); |
1037 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1045 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1038 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1046 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1039 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1047 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1040 | } | 1048 | } |
1041 | local->addIncidence( inL ); | 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" ) |
1050 | pref = "t"; | 1058 | pref = "t"; |
1051 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1059 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1052 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1060 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1053 | //remote->deleteIncidence( inR ); | 1061 | //remote->deleteIncidence( inR ); |
1054 | ++deletedEventR; | 1062 | ++deletedEventR; |
1055 | } else { | 1063 | } else { |
1056 | inR->setLastModified( modifiedCalendar ); | 1064 | inR->setLastModified( modifiedCalendar ); |
1057 | inL = inR->clone(); | 1065 | inL = inR->clone(); |
1058 | local->addIncidence( inL ); | 1066 | local->addIncidence( inL ); |
1059 | ++addedEvent; | 1067 | ++addedEvent; |
1060 | } | 1068 | } |
1061 | } else { | 1069 | } else { |
1062 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1070 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1063 | inR->setLastModified( modifiedCalendar ); | 1071 | inR->setLastModified( modifiedCalendar ); |
1064 | local->addIncidence( inR->clone() ); | 1072 | local->addIncidence( inR->clone() ); |
1065 | ++addedEvent; | 1073 | ++addedEvent; |
1066 | } else { | 1074 | } else { |
1067 | checkExternSyncEvent(eventRSyncSharp, inR); | 1075 | checkExternSyncEvent(eventRSyncSharp, inR); |
1068 | remote->deleteIncidence( inR ); | 1076 | remote->deleteIncidence( inR ); |
1069 | ++deletedEventR; | 1077 | ++deletedEventR; |
1070 | } | 1078 | } |
1071 | } | 1079 | } |
1072 | } | 1080 | } |
1073 | } | 1081 | } |
1074 | inR = er.next(); | 1082 | inR = er.next(); |
1075 | } | 1083 | } |
1076 | QPtrList<Incidence> el = local->rawIncidences(); | 1084 | QPtrList<Incidence> el = local->rawIncidences(); |
1077 | inL = el.first(); | 1085 | inL = el.first(); |
1078 | modulo = (el.count()/10)+1; | 1086 | modulo = (el.count()/10)+1; |
1079 | bar.setCaption (i18n("Add / remove events") ); | 1087 | bar.setCaption (i18n("Add / remove events") ); |
1080 | bar.setTotalSteps ( el.count() ) ; | 1088 | bar.setTotalSteps ( el.count() ) ; |
1081 | bar.show(); | 1089 | bar.show(); |
1082 | incCounter = 0; | 1090 | incCounter = 0; |
1083 | 1091 | ||
1084 | while ( inL ) { | 1092 | while ( inL ) { |
1085 | 1093 | ||
1086 | qApp->processEvents(); | 1094 | qApp->processEvents(); |
1087 | if ( ! bar.isVisible() ) | 1095 | if ( ! bar.isVisible() ) |
1088 | return false; | 1096 | return false; |
1089 | if ( incCounter % modulo == 0 ) | 1097 | if ( incCounter % modulo == 0 ) |
1090 | bar.setProgress( incCounter ); | 1098 | bar.setProgress( incCounter ); |
1091 | ++incCounter; | 1099 | ++incCounter; |
1092 | uid = inL->uid(); | 1100 | uid = inL->uid(); |
1093 | bool skipIncidence = false; | 1101 | bool skipIncidence = false; |
1094 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1102 | if ( uid.left(15) == QString("last-syncEvent-") ) |
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 ) { |
1103 | checkExternSyncEvent(eventLSyncSharp, inL); | 1111 | checkExternSyncEvent(eventLSyncSharp, inL); |
1104 | local->deleteIncidence( inL ); | 1112 | local->deleteIncidence( inL ); |
1105 | ++deletedEventL; | 1113 | ++deletedEventL; |
1106 | } else { | 1114 | } else { |
1107 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1115 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1108 | inL->removeID(mCurrentSyncDevice ); | 1116 | inL->removeID(mCurrentSyncDevice ); |
1109 | ++addedEventR; | 1117 | ++addedEventR; |
1110 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1118 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1111 | inL->setLastModified( modifiedCalendar ); | 1119 | inL->setLastModified( modifiedCalendar ); |
1112 | inR = inL->clone(); | 1120 | inR = inL->clone(); |
1113 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1121 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1114 | remote->addIncidence( inR ); | 1122 | remote->addIncidence( inR ); |
1115 | } | 1123 | } |
1116 | } | 1124 | } |
1117 | } else { | 1125 | } else { |
1118 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1126 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1119 | checkExternSyncEvent(eventLSyncSharp, inL); | 1127 | checkExternSyncEvent(eventLSyncSharp, inL); |
1120 | local->deleteIncidence( inL ); | 1128 | local->deleteIncidence( inL ); |
1121 | ++deletedEventL; | 1129 | ++deletedEventL; |
1122 | } else { | 1130 | } else { |
1123 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1131 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1124 | ++addedEventR; | 1132 | ++addedEventR; |