summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp29
-rw-r--r--korganizer/calendarview.h1
2 files changed, 19 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
@@ -754,13 +754,13 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
754 } 754 }
755 full = true; 755 full = true;
756 if ( mode < SYNC_PREF_ASK ) 756 if ( mode < SYNC_PREF_ASK )
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 }
764 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 764 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
765 765
766 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 766 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
@@ -929,17 +929,14 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
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 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();
943 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 940 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
944 if ( eventR ) { 941 if ( eventR ) {
945 eventRSync = (Event*) eventR->clone(); 942 eventRSync = (Event*) eventR->clone();
@@ -966,13 +963,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
966 963
967 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 964 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
968 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 965 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
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();
976 // for resyncing if own file has changed 973 // for resyncing if own file has changed
977 if ( mCurrentSyncDevice == "deleteaftersync" ) { 974 if ( mCurrentSyncDevice == "deleteaftersync" ) {
978 mLastCalendarSync = loadedFileVersion; 975 mLastCalendarSync = loadedFileVersion;
@@ -1028,22 +1025,24 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1028 inL->setRevision( maxrev ); 1025 inL->setRevision( maxrev );
1029 inR = inL->clone(); 1026 inR = inL->clone();
1030 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1027 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
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) );
1047 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1046 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1048 } 1047 }
1049 local->addIncidence( inL ); 1048 local->addIncidence( inL );
@@ -1178,14 +1177,16 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1178 eventRSync->setDtStart( mLastCalendarSync ); 1177 eventRSync->setDtStart( mLastCalendarSync );
1179 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1178 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1180 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1179 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
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;
1189 if ( delFut ) { 1190 if ( delFut ) {
1190 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); 1191 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
1191 mes += delmess; 1192 mes += delmess;
@@ -3731,18 +3732,24 @@ void CalendarView::keyPressEvent ( QKeyEvent *e)
3731} 3732}
3732 3733
3733 3734
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();
3746 if ( resource == "sharp" ) 3753 if ( resource == "sharp" )
3747 syncExternal( 0 ); 3754 syncExternal( 0 );
3748 if ( resource == "phone" ) 3755 if ( resource == "phone" )
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 9f56cc8..1cd896d 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -484,12 +484,13 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
484 void showEventEditor(); 484 void showEventEditor();
485 void showTodoEditor(); 485 void showTodoEditor();
486 void writeLocale(); 486 void writeLocale();
487 Todo *selectedTodo(); 487 Todo *selectedTodo();
488 488
489 private: 489 private:
490 bool mSyncKDE;
490 KSyncManager* mSyncManager; 491 KSyncManager* mSyncManager;
491 AlarmDialog * mAlarmDialog; 492 AlarmDialog * mAlarmDialog;
492 QString mAlarmNotification; 493 QString mAlarmNotification;
493 QString mSuspendAlarmNotification; 494 QString mSuspendAlarmNotification;
494 QTimer* mSuspendTimer; 495 QTimer* mSuspendTimer;
495 QTimer* mAlarmTimer; 496 QTimer* mAlarmTimer;