author | zautrix <zautrix> | 2004-10-17 18:08:43 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-17 18:08:43 (UTC) |
commit | 6f6d1d58938539215bb4fcb5b97cf9fb089a11ef (patch) (side-by-side diff) | |
tree | 9937fe24c3fa3f29421b39a58b393e893a11636a | |
parent | d92f58ffa1937af8a4240b9d235da15f5f352769 (diff) | |
download | kdepimpi-6f6d1d58938539215bb4fcb5b97cf9fb089a11ef.zip kdepimpi-6f6d1d58938539215bb4fcb5b97cf9fb089a11ef.tar.gz kdepimpi-6f6d1d58938539215bb4fcb5b97cf9fb089a11ef.tar.bz2 |
more KDE sync fixes
-rw-r--r-- | kde2file/caldump/main.cpp | 38 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 29 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | libkcal/calendar.cpp | 8 | ||||
-rw-r--r-- | libkcal/calendar.h | 2 |
5 files changed, 42 insertions, 36 deletions
diff --git a/kde2file/caldump/main.cpp b/kde2file/caldump/main.cpp index 755e792..be1735b 100644 --- a/kde2file/caldump/main.cpp +++ b/kde2file/caldump/main.cpp @@ -57,2 +57,3 @@ #include <qdir.h> +#include <qapplication.h> @@ -154,3 +155,3 @@ int main( int argc, char *argv[] ) } else { - qDebug("*************************load"); + qDebug("************load"); localCalendar = new CalendarLocal(); @@ -163,3 +164,3 @@ int main( int argc, char *argv[] ) if ( storage->load() ) { - qDebug("*************************loaded!"); + qDebug("***********loaded!"); KCal::Incidence::List newInc = localCalendar->rawIncidences(); @@ -167,5 +168,5 @@ int main( int argc, char *argv[] ) for( it = newInc.begin(); it != newInc.end(); ++it ) { - if ( (*it)->pilotId() > 0 ) { //changed - Incidence* cl = (*it)->clone(); - Incidence *incOld = calendarResource->incidence( cl->uid() ); + if ( (*it)->pilotId() > 1 ) { //changed + qDebug("*********pilot id %d %s ",(*it)->pilotId() ,(*it)->summary().latin1()); + Incidence *incOld = calendarResource->incidence( (*it)->uid() ); ResourceCalendar * res = 0; @@ -174,2 +175,3 @@ int main( int argc, char *argv[] ) if ( res ) { + Incidence* cl = (*it)->clone(); cl->setPilotId( incOld->pilotId() ); @@ -182,3 +184,3 @@ int main( int argc, char *argv[] ) calendarResource->deleteEvent( (Event *) incOld ); - + qDebug("*********change incidence %s ",cl->summary().latin1()); if ( cl->type() == "Journal" ) @@ -191,12 +193,12 @@ int main( int argc, char *argv[] ) } else { - if ( incOld ) { - qDebug("ERROR: no resource found for old incidence "); - if ( incOld->type() == "Journal" ) - calendarResource->deleteJournal( (Journal *) incOld ); - else if ( incOld->type() == "Todo" ) - calendarResource->deleteTodo( (Todo *) incOld ); - else if ( incOld->type() == "Event" ) - calendarResource->deleteEvent( (Event *) incOld ); - - } + Incidence* cl = (*it)->clone(); + qDebug("*********add incidence %s ",cl->summary().latin1()); + calendarResource->addIncidence( cl ); + ++add; + } + } else { // maybe added + Incidence *incOld = calendarResource->incidence( (*it)->uid() ); + if ( !incOld ) { //added + Incidence* cl = (*it)->clone(); + qDebug("*********add incidence %s ",cl->summary().latin1()); calendarResource->addIncidence( cl ); @@ -204,6 +206,2 @@ int main( int argc, char *argv[] ) } - } else { // added - Incidence* cl = (*it)->clone(); - calendarResource->addIncidence( cl ); - ++add; } diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index f727cd4..ff1db2c 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -759,3 +759,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b if ( localMod == remoteMod ) - if ( local->revision() == remote->revision() ) + // if ( local->revision() == remote->revision() ) return 0; @@ -934,7 +934,4 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int local->resetTempSyncStat(); -#ifdef DESKTOP_VERSION - //Needed for KDE - OL sync - local->resetPilotStat(); - remote->resetPilotStat(); -#endif + if ( mSyncKDE ) + remote->resetPilotStat(1); mLastCalendarSync = QDateTime::currentDateTime(); @@ -971,3 +968,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int } - if ( fullDateRange ) + if ( fullDateRange && !mSyncKDE ) mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); @@ -1033,5 +1030,4 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int remote->addIncidence( inR ); -#ifdef DESKTOP_VERSION - inR->setPilotId( 1 ); -#endif + if ( mSyncKDE ) + inR->setPilotId( 2 ); ++changedRemote; @@ -1041,4 +1037,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int idS = inL->IDStr(); + int pid = inL->pilotId(); local->deleteIncidence( inL ); inL = inR->clone(); + if ( mSyncKDE ) + inL->setPilotId( pid ); inL->setIDStr( idS ); @@ -1183,4 +1182,6 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int eventLSync->setReadOnly( true ); - if ( mGlobalSyncMode == SYNC_MODE_NORMAL) + if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal... remote->addEvent( eventRSync ); + else + delete eventRSync; QString mes; @@ -3736,2 +3737,7 @@ bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) // mSyncManager = manager; + mSyncKDE = false; + if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { + qDebug("SyncKDE request detected!"); + mSyncKDE = true; + } mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); @@ -3742,2 +3748,3 @@ bool CalendarView::syncExternal(KSyncManager* manager, QString resource) { + mSyncKDE = false; //mSyncManager = manager; diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 9f56cc8..1cd896d 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -489,2 +489,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser private: + bool mSyncKDE; KSyncManager* mSyncManager; diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index eeb5f48..52daaaa 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp @@ -251,3 +251,3 @@ QPtrList<Incidence> Calendar::incidences() -void Calendar::resetPilotStat() +void Calendar::resetPilotStat(int id ) { @@ -258,9 +258,9 @@ void Calendar::resetPilotStat() QPtrList<Event> e = rawEvents(); - for( i = e.first(); i; i = e.next() ) i->setPilotId( 0 ); + for( i = e.first(); i; i = e.next() ) i->setPilotId( id ); QPtrList<Todo> t = rawTodos(); - for( i = t.first(); i; i = t.next() ) i->setPilotId( 0 ); + for( i = t.first(); i; i = t.next() ) i->setPilotId( id ); QPtrList<Journal> j = journals(); - for( i = j.first(); i; i = j.next() ) i->setPilotId( 0 ); + for( i = j.first(); i; i = j.next() ) i->setPilotId( id ); } diff --git a/libkcal/calendar.h b/libkcal/calendar.h index d5294eb..b801186 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -69,3 +69,3 @@ public: void resetTempSyncStat(); - void resetPilotStat(); + void resetPilotStat(int id); /** |