summaryrefslogtreecommitdiffabout
path: root/kde2file
Side-by-side diff
Diffstat (limited to 'kde2file') (more/less context) (ignore whitespace changes)
-rw-r--r--kde2file/caldump/main.cpp38
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
@@ -52,12 +52,13 @@
#include <libkcal/filestorage.h>
#include <libkcal/icalformat.h>
#include <qdatetime.h>
#include <qfile.h>
#include <qdir.h>
+#include <qapplication.h>
#include <stdlib.h>
#include <iostream>
using namespace KCal;
using namespace std;
@@ -149,66 +150,63 @@ int main( int argc, char *argv[] )
qDebug("************************************* ");
qDebug("************kdecaldump*************** ");
qDebug("************************************* ");
qDebug("%d calendar entries dumped to file %s", num, fileName.latin1());
} else {
- qDebug("*************************load");
+ qDebug("************load");
localCalendar = new CalendarLocal();
localCalendar->setTimeZoneId( calendarResource->timeZoneId());
FileStorage* storage = new FileStorage( localCalendar );
storage->setFileName( fileName );
int num = 0;
int del = 0;
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;
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 );
-
+ qDebug("*********change incidence %s ",cl->summary().latin1());
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 );
-
- }
+ 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;
}
}
KCal::Incidence::List allInc = calendarResource->rawIncidences();
for( it = allInc.begin(); it != allInc.end(); ++it ) {
ResourceCalendar * re = calendarResource->resource( (*it) );