summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index f727cd4..ff1db2c 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -757,7 +757,7 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
757 mode = SYNC_PREF_ASK; 757 mode = SYNC_PREF_ASK;
758 } else { 758 } else {
759 if ( localMod == remoteMod ) 759 if ( localMod == remoteMod )
760 if ( local->revision() == remote->revision() ) 760 // if ( local->revision() == remote->revision() )
761 return 0; 761 return 0;
762 762
763 } 763 }
@@ -932,11 +932,8 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
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 935 if ( mSyncKDE )
936 //Needed for KDE - OL sync 936 remote->resetPilotStat(1);
937 local->resetPilotStat();
938 remote->resetPilotStat();
939#endif
940 mLastCalendarSync = QDateTime::currentDateTime(); 937 mLastCalendarSync = QDateTime::currentDateTime();
941 QDateTime modifiedCalendar = mLastCalendarSync;; 938 QDateTime modifiedCalendar = mLastCalendarSync;;
942 eventLSync = getLastSyncEvent(); 939 eventLSync = getLastSyncEvent();
@@ -969,7 +966,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
969 fullDateRange = true; 966 fullDateRange = true;
970 } 967 }
971 } 968 }
972 if ( fullDateRange ) 969 if ( fullDateRange && !mSyncKDE )
973 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 970 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
974 else 971 else
975 mLastCalendarSync = eventLSync->dtStart(); 972 mLastCalendarSync = eventLSync->dtStart();
@@ -1031,16 +1028,18 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1031 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1028 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1032 inR->setIDStr( idS ); 1029 inR->setIDStr( idS );
1033 remote->addIncidence( inR ); 1030 remote->addIncidence( inR );
1034#ifdef DESKTOP_VERSION 1031 if ( mSyncKDE )
1035 inR->setPilotId( 1 ); 1032 inR->setPilotId( 2 );
1036#endif
1037 ++changedRemote; 1033 ++changedRemote;
1038 } else { 1034 } else {
1039 if ( inR->revision() < maxrev ) 1035 if ( inR->revision() < maxrev )
1040 inR->setRevision( maxrev ); 1036 inR->setRevision( maxrev );
1041 idS = inL->IDStr(); 1037 idS = inL->IDStr();
1038 int pid = inL->pilotId();
1042 local->deleteIncidence( inL ); 1039 local->deleteIncidence( inL );
1043 inL = inR->clone(); 1040 inL = inR->clone();
1041 if ( mSyncKDE )
1042 inL->setPilotId( pid );
1044 inL->setIDStr( idS ); 1043 inL->setIDStr( idS );
1045 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1044 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1046 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1045 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
@@ -1181,8 +1180,10 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1181 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1180 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1182 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1181 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1183 eventLSync->setReadOnly( true ); 1182 eventLSync->setReadOnly( true );
1184 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 1183 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal...
1185 remote->addEvent( eventRSync ); 1184 remote->addEvent( eventRSync );
1185 else
1186 delete eventRSync;
1186 QString mes; 1187 QString mes;
1187 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1188 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1188 QString delmess; 1189 QString delmess;
@@ -3734,12 +3735,18 @@ void CalendarView::keyPressEvent ( QKeyEvent *e)
3734bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3735bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
3735{ 3736{
3736 // mSyncManager = manager; 3737 // mSyncManager = manager;
3738 mSyncKDE = false;
3739 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
3740 qDebug("SyncKDE request detected!");
3741 mSyncKDE = true;
3742 }
3737 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3743 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3738 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3744 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3739 return syncCalendar( filename, mode ); 3745 return syncCalendar( filename, mode );
3740} 3746}
3741bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 3747bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
3742{ 3748{
3749 mSyncKDE = false;
3743 //mSyncManager = manager; 3750 //mSyncManager = manager;
3744 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3751 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3745 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3752 mCurrentSyncName = mSyncManager->getCurrentSyncName();