summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-17 16:06:42 (UTC)
committer zautrix <zautrix>2004-10-17 16:06:42 (UTC)
commitd92f58ffa1937af8a4240b9d235da15f5f352769 (patch) (unidiff)
tree48768599988f33c7f20017a76d05e919fa77ac51
parent711c4c06a7d1a52b97fd24efa3586543f46cc6d7 (diff)
downloadkdepimpi-d92f58ffa1937af8a4240b9d235da15f5f352769.zip
kdepimpi-d92f58ffa1937af8a4240b9d235da15f5f352769.tar.gz
kdepimpi-d92f58ffa1937af8a4240b9d235da15f5f352769.tar.bz2
KDE sync fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kde2file/caldump/main.cpp55
-rw-r--r--korganizer/calendarview.cpp8
-rw-r--r--libkcal/calendar.cpp16
-rw-r--r--libkcal/calendar.h1
4 files changed, 56 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
@@ -167,26 +167,11 @@ int main( int argc, char *argv[] )
167 for( it = newInc.begin(); it != newInc.end(); ++it ) { 167 for( it = newInc.begin(); it != newInc.end(); ++it ) {
168 Incidence* cl = (*it)->clone(); 168 if ( (*it)->pilotId() > 0 ) { //changed
169 Incidence *incOld = calendarResource->incidence( cl->uid() ); 169 Incidence* cl = (*it)->clone();
170 ResourceCalendar * res = 0; 170 Incidence *incOld = calendarResource->incidence( cl->uid() );
171 if ( incOld ) 171 ResourceCalendar * res = 0;
172 res = calendarResource->resource( incOld ); 172 if ( incOld )
173 if ( res ) { 173 res = calendarResource->resource( incOld );
174 ++num; 174 if ( res ) {
175 if ( incOld->type() == "Journal" ) 175 cl->setPilotId( incOld->pilotId() );
176 calendarResource->deleteJournal( (Journal *) incOld ); 176 ++num;
177 else if ( incOld->type() == "Todo" )
178 calendarResource->deleteTodo( (Todo *) incOld );
179 else if ( incOld->type() == "Event" )
180 calendarResource->deleteEvent( (Event *) incOld );
181
182 if ( cl->type() == "Journal" )
183 calendarResource->addJournal( (Journal *) cl, res );
184 else if ( cl->type() == "Todo" )
185 calendarResource->addTodo( (Todo *) cl, res );
186 else if ( cl->type() == "Event" )
187 calendarResource->addEvent( (Event *) cl, res );
188
189 } else {
190 if ( incOld ) {
191 qDebug("ERROR: no resource found for old incidence ");
192 if ( incOld->type() == "Journal" ) 177 if ( incOld->type() == "Journal" )
@@ -197,4 +182,26 @@ int main( int argc, char *argv[] )
197 calendarResource->deleteEvent( (Event *) incOld ); 182 calendarResource->deleteEvent( (Event *) incOld );
183
184 if ( cl->type() == "Journal" )
185 calendarResource->addJournal( (Journal *) cl, res );
186 else if ( cl->type() == "Todo" )
187 calendarResource->addTodo( (Todo *) cl, res );
188 else if ( cl->type() == "Event" )
189 calendarResource->addEvent( (Event *) cl, res );
190
191 } else {
192 if ( incOld ) {
193 qDebug("ERROR: no resource found for old incidence ");
194 if ( incOld->type() == "Journal" )
195 calendarResource->deleteJournal( (Journal *) incOld );
196 else if ( incOld->type() == "Todo" )
197 calendarResource->deleteTodo( (Todo *) incOld );
198 else if ( incOld->type() == "Event" )
199 calendarResource->deleteEvent( (Event *) incOld );
198 200
201 }
202 calendarResource->addIncidence( cl );
203 ++add;
199 } 204 }
205 } else { // added
206 Incidence* cl = (*it)->clone();
200 calendarResource->addIncidence( cl ); 207 calendarResource->addIncidence( cl );
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 1f8ad5b..f727cd4 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -934,2 +934,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
934 local->resetTempSyncStat(); 934 local->resetTempSyncStat();
935#ifdef DESKTOP_VERSION
936 //Needed for KDE - OL sync
937 local->resetPilotStat();
938 remote->resetPilotStat();
939#endif
935 mLastCalendarSync = QDateTime::currentDateTime(); 940 mLastCalendarSync = QDateTime::currentDateTime();
@@ -1028,2 +1033,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1028 remote->addIncidence( inR ); 1033 remote->addIncidence( inR );
1034#ifdef DESKTOP_VERSION
1035 inR->setPilotId( 1 );
1036#endif
1029 ++changedRemote; 1037 ++changedRemote;
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index a3977d7..eeb5f48 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -250,2 +250,18 @@ QPtrList<Incidence> Calendar::incidences()
250} 250}
251
252void Calendar::resetPilotStat()
253{
254 QPtrList<Incidence> incidences;
255
256 Incidence *i;
257
258 QPtrList<Event> e = rawEvents();
259 for( i = e.first(); i; i = e.next() ) i->setPilotId( 0 );
260
261 QPtrList<Todo> t = rawTodos();
262 for( i = t.first(); i; i = t.next() ) i->setPilotId( 0 );
263
264 QPtrList<Journal> j = journals();
265 for( i = j.first(); i; i = j.next() ) i->setPilotId( 0 );
266}
251void Calendar::resetTempSyncStat() 267void Calendar::resetTempSyncStat()
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index c45d81f..d5294eb 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -69,2 +69,3 @@ public:
69 void resetTempSyncStat(); 69 void resetTempSyncStat();
70 void resetPilotStat();
70 /** 71 /**