-rw-r--r-- | kde2file/caldump/main.cpp | 38 |
1 files changed, 18 insertions, 20 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 @@ -56,4 +56,5 @@ #include <qfile.h> #include <qdir.h> +#include <qapplication.h> #include <stdlib.h> @@ -153,5 +154,5 @@ int main( int argc, char *argv[] ) } else { - qDebug("*************************load"); + qDebug("************load"); localCalendar = new CalendarLocal(); localCalendar->setTimeZoneId( calendarResource->timeZoneId()); @@ -162,15 +163,16 @@ int main( int argc, char *argv[] ) int add = 0; if ( storage->load() ) { - qDebug("*************************loaded!"); + qDebug("***********loaded!"); KCal::Incidence::List newInc = localCalendar->rawIncidences(); Incidence::List::ConstIterator it; 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; if ( incOld ) res = calendarResource->resource( incOld ); if ( res ) { + Incidence* cl = (*it)->clone(); cl->setPilotId( incOld->pilotId() ); ++num; @@ -181,5 +183,5 @@ int main( int argc, char *argv[] ) else if ( incOld->type() == "Event" ) calendarResource->deleteEvent( (Event *) incOld ); - + qDebug("*********change incidence %s ",cl->summary().latin1()); if ( cl->type() == "Journal" ) calendarResource->addJournal( (Journal *) cl, res ); @@ -190,21 +192,17 @@ 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 ); ++add; } - } else { // added - Incidence* cl = (*it)->clone(); - calendarResource->addIncidence( cl ); - ++add; } } |