summaryrefslogtreecommitdiffabout
path: root/kde2file
Side-by-side diff
Diffstat (limited to 'kde2file') (more/less context) (ignore whitespace changes)
-rw-r--r--kde2file/caldump/main.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/kde2file/caldump/main.cpp b/kde2file/caldump/main.cpp
index 95ae29e..76bfad3 100644
--- a/kde2file/caldump/main.cpp
+++ b/kde2file/caldump/main.cpp
@@ -118,24 +118,25 @@ int main( int argc, char *argv[] )
if ( !read ) {
localCalendar = new CalendarLocal();
localCalendar->setTimeZoneId( calendarResource->timeZoneId());
KCal::Incidence::List allInc = calendarResource->rawIncidences();
Incidence::List::ConstIterator it;
int num = 0;
for( it = allInc.begin(); it != allInc.end(); ++it ) {
ResourceCalendar * re = calendarResource->resource( (*it) );
if ( re && !re->readOnly() ) {
++num;
Incidence* cl = (*it)->clone();
+ cl->setLastModified( (*it)->lastModified() );
if ( cl->type() == "Journal" )
localCalendar->addJournal( (Journal *) cl );
else if ( cl->type() == "Todo" )
localCalendar->addTodo( (Todo *) cl );
else if ( cl->type() == "Event" )
localCalendar->addEvent( (Event *) cl );
}
}
FileStorage* storage = new FileStorage( calendarResource );
storage->setFileName( "/tmp/kdedumpall.ics" );
storage->setSaveFormat( new ICalFormat() );
@@ -153,40 +154,43 @@ int main( int argc, char *argv[] )
storage->setFileName( "/tmp/kdedumpall.ics" );
int num = 0;
int del = 0;
if ( storage->load() ) {
KCal::Incidence::List allInc = calendarResource->rawIncidences();
KCal::Incidence::List newInc = localCalendar->rawIncidences();
Incidence::List::ConstIterator it;
for( it = allInc.begin(); it != allInc.end(); ++it ) {
ResourceCalendar * re = calendarResource->resource( (*it) );
if ( re && !re->readOnly() ) {
Incidence* cl = localCalendar->incidence( (*it)->uid() );
if ( cl ) {
+ QDateTime lm = cl->lastModified();
cl->setResources( (*it)->resources() );
+ cl->setLastModified(lm);
}
++del;
cl = (*it);
if ( cl->type() == "Journal" )
calendarResource->deleteJournal( (Journal *) cl );
else if ( cl->type() == "Todo" )
calendarResource->deleteTodo( (Todo *) cl );
else if ( cl->type() == "Event" )
calendarResource->deleteEvent( (Event *) cl );
}
}
for( it = newInc.begin(); it != newInc.end(); ++it ) {
Incidence* cl = (*it)->clone();
++num;
calendarResource->addIncidence( cl );
+ //cl->setLastModified( (*it)->lastModified() );
}
calendarResource->save();
qDebug("************************************* ");
qDebug("************************************* ");
qDebug("************************************* ");
qDebug("%d calendar entries deleted/ %d added from file /tmp/kdedumpall.ics", del, num);
} else
qDebug("error loading file /tmp/kdedumpall.ics");
}