summaryrefslogtreecommitdiffabout
path: root/kde2file/caldump/main.cpp
Side-by-side diff
Diffstat (limited to 'kde2file/caldump/main.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kde2file/caldump/main.cpp55
1 files changed, 31 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
@@ -165,38 +165,45 @@ int main( int argc, char *argv[] )
KCal::Incidence::List newInc = localCalendar->rawIncidences();
Incidence::List::ConstIterator it;
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" )
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 ( 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 );
++add;
}