-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 @@ -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; } |