-rw-r--r-- | kde2file/caldump/main.cpp | 55 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 8 | ||||
-rw-r--r-- | libkcal/calendar.cpp | 16 | ||||
-rw-r--r-- | libkcal/calendar.h | 1 |
4 files changed, 56 insertions, 24 deletions
diff --git a/kde2file/caldump/main.cpp b/kde2file/caldump/main.cpp index 03571b9..755e792 100644 --- a/kde2file/caldump/main.cpp +++ b/kde2file/caldump/main.cpp @@ -167,26 +167,11 @@ int main( int argc, char *argv[] ) for( it = newInc.begin(); it != newInc.end(); ++it ) { - Incidence* cl = (*it)->clone(); - Incidence *incOld = calendarResource->incidence( cl->uid() ); - ResourceCalendar * res = 0; - if ( incOld ) - res = calendarResource->resource( incOld ); - if ( res ) { - ++num; - 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 ); - - if ( cl->type() == "Journal" ) - calendarResource->addJournal( (Journal *) cl, res ); - else if ( cl->type() == "Todo" ) - calendarResource->addTodo( (Todo *) cl, res ); - else if ( cl->type() == "Event" ) - calendarResource->addEvent( (Event *) cl, res ); - - } else { - if ( incOld ) { - qDebug("ERROR: no resource found for old incidence "); + if ( (*it)->pilotId() > 0 ) { //changed + Incidence* cl = (*it)->clone(); + Incidence *incOld = calendarResource->incidence( cl->uid() ); + ResourceCalendar * res = 0; + if ( incOld ) + res = calendarResource->resource( incOld ); + if ( res ) { + cl->setPilotId( incOld->pilotId() ); + ++num; if ( incOld->type() == "Journal" ) @@ -197,4 +182,26 @@ int main( int argc, char *argv[] ) calendarResource->deleteEvent( (Event *) incOld ); + + if ( cl->type() == "Journal" ) + calendarResource->addJournal( (Journal *) cl, res ); + else if ( cl->type() == "Todo" ) + calendarResource->addTodo( (Todo *) cl, res ); + else if ( cl->type() == "Event" ) + calendarResource->addEvent( (Event *) cl, res ); + + } 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 ); + } + calendarResource->addIncidence( cl ); + ++add; } + } else { // added + Incidence* cl = (*it)->clone(); calendarResource->addIncidence( cl ); diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1f8ad5b..f727cd4 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -934,2 +934,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int local->resetTempSyncStat(); +#ifdef DESKTOP_VERSION + //Needed for KDE - OL sync + local->resetPilotStat(); + remote->resetPilotStat(); +#endif mLastCalendarSync = QDateTime::currentDateTime(); @@ -1028,2 +1033,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int remote->addIncidence( inR ); +#ifdef DESKTOP_VERSION + inR->setPilotId( 1 ); +#endif ++changedRemote; diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index a3977d7..eeb5f48 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp @@ -250,2 +250,18 @@ QPtrList<Incidence> Calendar::incidences() } + +void Calendar::resetPilotStat() +{ + QPtrList<Incidence> incidences; + + Incidence *i; + + QPtrList<Event> e = rawEvents(); + for( i = e.first(); i; i = e.next() ) i->setPilotId( 0 ); + + QPtrList<Todo> t = rawTodos(); + for( i = t.first(); i; i = t.next() ) i->setPilotId( 0 ); + + QPtrList<Journal> j = journals(); + for( i = j.first(); i; i = j.next() ) i->setPilotId( 0 ); +} void Calendar::resetTempSyncStat() diff --git a/libkcal/calendar.h b/libkcal/calendar.h index c45d81f..d5294eb 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -69,2 +69,3 @@ public: void resetTempSyncStat(); + void resetPilotStat(); /** |