summaryrefslogtreecommitdiffabout
path: root/kde2file/caldump
authorzautrix <zautrix>2004-10-17 18:08:43 (UTC)
committer zautrix <zautrix>2004-10-17 18:08:43 (UTC)
commit6f6d1d58938539215bb4fcb5b97cf9fb089a11ef (patch) (side-by-side diff)
tree9937fe24c3fa3f29421b39a58b393e893a11636a /kde2file/caldump
parentd92f58ffa1937af8a4240b9d235da15f5f352769 (diff)
downloadkdepimpi-6f6d1d58938539215bb4fcb5b97cf9fb089a11ef.zip
kdepimpi-6f6d1d58938539215bb4fcb5b97cf9fb089a11ef.tar.gz
kdepimpi-6f6d1d58938539215bb4fcb5b97cf9fb089a11ef.tar.bz2
more KDE sync fixes
Diffstat (limited to 'kde2file/caldump') (more/less context) (show whitespace changes)
-rw-r--r--kde2file/caldump/main.cpp32
1 files changed, 15 insertions, 17 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
@@ -55,6 +55,7 @@
#include <qdatetime.h>
#include <qfile.h>
#include <qdir.h>
+#include <qapplication.h>
#include <stdlib.h>
#include <iostream>
@@ -152,7 +153,7 @@ int main( int argc, char *argv[] )
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 );
@@ -161,17 +162,18 @@ int main( int argc, char *argv[] )
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" )
@@ -180,7 +182,7 @@ int main( int argc, char *argv[] )
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" )
@@ -189,25 +191,21 @@ int main( int argc, char *argv[] )
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 { // added
+ } 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;
}
}
+ }
KCal::Incidence::List allInc = calendarResource->rawIncidences();
for( it = allInc.begin(); it != allInc.end(); ++it ) {