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) (unidiff)
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) (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
@@ -55,6 +55,7 @@
55#include <qdatetime.h> 55#include <qdatetime.h>
56#include <qfile.h> 56#include <qfile.h>
57#include <qdir.h> 57#include <qdir.h>
58#include <qapplication.h>
58 59
59#include <stdlib.h> 60#include <stdlib.h>
60#include <iostream> 61#include <iostream>
@@ -152,7 +153,7 @@ int main( int argc, char *argv[] )
152 qDebug("%d calendar entries dumped to file %s", num, fileName.latin1()); 153 qDebug("%d calendar entries dumped to file %s", num, fileName.latin1());
153 154
154 } else { 155 } else {
155 qDebug("*************************load"); 156 qDebug("************load");
156 localCalendar = new CalendarLocal(); 157 localCalendar = new CalendarLocal();
157 localCalendar->setTimeZoneId( calendarResource->timeZoneId()); 158 localCalendar->setTimeZoneId( calendarResource->timeZoneId());
158 FileStorage* storage = new FileStorage( localCalendar ); 159 FileStorage* storage = new FileStorage( localCalendar );
@@ -161,17 +162,18 @@ int main( int argc, char *argv[] )
161 int del = 0; 162 int del = 0;
162 int add = 0; 163 int add = 0;
163 if ( storage->load() ) { 164 if ( storage->load() ) {
164 qDebug("*************************loaded!"); 165 qDebug("***********loaded!");
165 KCal::Incidence::List newInc = localCalendar->rawIncidences(); 166 KCal::Incidence::List newInc = localCalendar->rawIncidences();
166 Incidence::List::ConstIterator it; 167 Incidence::List::ConstIterator it;
167 for( it = newInc.begin(); it != newInc.end(); ++it ) { 168 for( it = newInc.begin(); it != newInc.end(); ++it ) {
168 if ( (*it)->pilotId() > 0 ) { //changed 169 if ( (*it)->pilotId() > 1 ) { //changed
169 Incidence* cl = (*it)->clone(); 170 qDebug("*********pilot id %d %s ",(*it)->pilotId() ,(*it)->summary().latin1());
170 Incidence *incOld = calendarResource->incidence( cl->uid() ); 171 Incidence *incOld = calendarResource->incidence( (*it)->uid() );
171 ResourceCalendar * res = 0; 172 ResourceCalendar * res = 0;
172 if ( incOld ) 173 if ( incOld )
173 res = calendarResource->resource( incOld ); 174 res = calendarResource->resource( incOld );
174 if ( res ) { 175 if ( res ) {
176 Incidence* cl = (*it)->clone();
175 cl->setPilotId( incOld->pilotId() ); 177 cl->setPilotId( incOld->pilotId() );
176 ++num; 178 ++num;
177 if ( incOld->type() == "Journal" ) 179 if ( incOld->type() == "Journal" )
@@ -180,7 +182,7 @@ int main( int argc, char *argv[] )
180 calendarResource->deleteTodo( (Todo *) incOld ); 182 calendarResource->deleteTodo( (Todo *) incOld );
181 else if ( incOld->type() == "Event" ) 183 else if ( incOld->type() == "Event" )
182 calendarResource->deleteEvent( (Event *) incOld ); 184 calendarResource->deleteEvent( (Event *) incOld );
183 185 qDebug("*********change incidence %s ",cl->summary().latin1());
184 if ( cl->type() == "Journal" ) 186 if ( cl->type() == "Journal" )
185 calendarResource->addJournal( (Journal *) cl, res ); 187 calendarResource->addJournal( (Journal *) cl, res );
186 else if ( cl->type() == "Todo" ) 188 else if ( cl->type() == "Todo" )
@@ -189,23 +191,19 @@ int main( int argc, char *argv[] )
189 calendarResource->addEvent( (Event *) cl, res ); 191 calendarResource->addEvent( (Event *) cl, res );
190 192
191 } else { 193 } else {
192 if ( incOld ) { 194 Incidence* cl = (*it)->clone();
193 qDebug("ERROR: no resource found for old incidence "); 195 qDebug("*********add incidence %s ",cl->summary().latin1());
194 if ( incOld->type() == "Journal" ) 196 calendarResource->addIncidence( cl );
195 calendarResource->deleteJournal( (Journal *) incOld ); 197 ++add;
196 else if ( incOld->type() == "Todo" ) 198 }
197 calendarResource->deleteTodo( (Todo *) incOld ); 199 } else { // maybe added
198 else if ( incOld->type() == "Event" ) 200 Incidence *incOld = calendarResource->incidence( (*it)->uid() );
199 calendarResource->deleteEvent( (Event *) incOld ); 201 if ( !incOld ) { //added
200 202 Incidence* cl = (*it)->clone();
201 } 203 qDebug("*********add incidence %s ",cl->summary().latin1());
202 calendarResource->addIncidence( cl ); 204 calendarResource->addIncidence( cl );
203 ++add; 205 ++add;
204 } 206 }
205 } else { // added
206 Incidence* cl = (*it)->clone();
207 calendarResource->addIncidence( cl );
208 ++add;
209 } 207 }
210 } 208 }
211 KCal::Incidence::List allInc = calendarResource->rawIncidences(); 209 KCal::Incidence::List allInc = calendarResource->rawIncidences();