author | zautrix <zautrix> | 2005-11-25 23:24:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 23:24:37 (UTC) |
commit | 3cd0013c04172b312ee21e80224a3b7734b4d413 (patch) (unidiff) | |
tree | 9c5557ecfe874a8a4901a674c5eddcc91f585b0c /libkcal/calendarlocal.cpp | |
parent | 0e18027f386280bf427ef9d0ffec61a5516cebda (diff) | |
download | kdepimpi-3cd0013c04172b312ee21e80224a3b7734b4d413.zip kdepimpi-3cd0013c04172b312ee21e80224a3b7734b4d413.tar.gz kdepimpi-3cd0013c04172b312ee21e80224a3b7734b4d413.tar.bz2 |
sync
-rw-r--r-- | libkcal/calendarlocal.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index c82ea92..b02f706 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -136,38 +136,38 @@ bool CalendarLocal::mergeCalendar( Calendar* remote ) | |||
136 | Incidence* inL = localInc.first(); | 136 | Incidence* inL = localInc.first(); |
137 | while ( inL ) { | 137 | while ( inL ) { |
138 | if ( ! inL->isReadOnly () ) | 138 | if ( ! inL->isReadOnly () ) |
139 | if ( !remote->incidenceForUid( inL->uid(), true )) | 139 | if ( !remote->incidenceForUid( inL->uid(), true )) |
140 | deleteIncidence( inL ); | 140 | deleteIncidence( inL ); |
141 | inL = localInc.next(); | 141 | inL = localInc.next(); |
142 | } | 142 | } |
143 | QPtrList<Incidence> er = remote->rawIncidences(); | 143 | QPtrList<Incidence> er = remote->rawIncidences(); |
144 | Incidence* inR = er.first(); | 144 | Incidence* inR = er.first(); |
145 | while ( inR ) { | 145 | while ( inR ) { |
146 | inL = incidenceForUid( inR->uid(),false ); | 146 | inL = incidenceForUid( inR->uid(),false ); |
147 | if ( inL ) { | 147 | if ( inL ) { |
148 | if ( ! inL->isReadOnly () || inL->uid().left(15) == QString("last-syncEvent-") ) { | 148 | if ( ! inL->isReadOnly () || inL->uid().left(15) == QString("last-syncEvent-") ) { |
149 | int calID = inL->calID(); | 149 | int calID = inL->calID(); |
150 | deleteIncidence( inL ); | 150 | deleteIncidence( inL ); |
151 | inL = inR->clone(); | 151 | inL = inR->clone(); |
152 | inL->setCalID( calID ); | 152 | inL->setCalID_block( calID ); |
153 | addIncidence( inL ); | 153 | addIncidence( inL ); |
154 | } | 154 | } |
155 | } else { | 155 | } else { |
156 | inL = inR->clone(); | 156 | inL = inR->clone(); |
157 | inL->setCalID( 0 );// add to default cal | 157 | inL->setCalID_block( 0 );// add to default cal |
158 | addIncidence( inL ); | 158 | addIncidence( inL ); |
159 | } | 159 | } |
160 | inR = er.next(); | 160 | inR = er.next(); |
161 | } | 161 | } |
162 | return true; | 162 | return true; |
163 | } | 163 | } |
164 | 164 | ||
165 | 165 | ||
166 | bool CalendarLocal::addCalendarFile( QString name, int id ) | 166 | bool CalendarLocal::addCalendarFile( QString name, int id ) |
167 | { | 167 | { |
168 | CalendarLocal calendar( timeZoneId() ); | 168 | CalendarLocal calendar( timeZoneId() ); |
169 | calendar.setDefaultCalendar( id ); | 169 | calendar.setDefaultCalendar( id ); |
170 | if ( calendar.load( name ) ) { | 170 | if ( calendar.load( name ) ) { |
171 | addCalendar( &calendar ); | 171 | addCalendar( &calendar ); |
172 | return true; | 172 | return true; |
173 | } | 173 | } |
@@ -195,33 +195,33 @@ void CalendarLocal::setSyncEventsReadOnly() | |||
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | void CalendarLocal::addCalendar( Calendar* cal ) | 198 | void CalendarLocal::addCalendar( Calendar* cal ) |
199 | { | 199 | { |
200 | cal->setDontDeleteIncidencesOnClose(); | 200 | cal->setDontDeleteIncidencesOnClose(); |
201 | setSyncEventsEnabled(); | 201 | setSyncEventsEnabled(); |
202 | { | 202 | { |
203 | QPtrList<Event> EventList = cal->rawEvents(); | 203 | QPtrList<Event> EventList = cal->rawEvents(); |
204 | QPtrList<Event> el; | 204 | QPtrList<Event> el; |
205 | Event * ev = EventList.first(); | 205 | Event * ev = EventList.first(); |
206 | while ( ev ) { | 206 | while ( ev ) { |
207 | if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) { | 207 | if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) { |
208 | Event * se = event( ev->uid() ); | 208 | Event * se = event( ev->uid() ); |
209 | if ( se ) | 209 | if ( se ) |
210 | el.append( se ); | 210 | el.append( se ); |
211 | ev->setCalID( 1 ); | 211 | ev->setCalID_block( 1 ); |
212 | } | 212 | } |
213 | ev->unRegisterObserver( cal ); | 213 | ev->unRegisterObserver( cal ); |
214 | ev->registerObserver( this ); | 214 | ev->registerObserver( this ); |
215 | mEventList.append( ev ); | 215 | mEventList.append( ev ); |
216 | ev = EventList.next(); | 216 | ev = EventList.next(); |
217 | } | 217 | } |
218 | for ( ev = el.first(); ev; ev = el.next() ) { | 218 | for ( ev = el.first(); ev; ev = el.next() ) { |
219 | deleteIncidence ( ev ); | 219 | deleteIncidence ( ev ); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | { | 222 | { |
223 | 223 | ||
224 | QPtrList<Todo> TodoList = cal->rawTodos(); | 224 | QPtrList<Todo> TodoList = cal->rawTodos(); |
225 | Todo * ev = TodoList.first(); | 225 | Todo * ev = TodoList.first(); |
226 | while ( ev ) { | 226 | while ( ev ) { |
227 | QString rel = ev->relatedToUid(); | 227 | QString rel = ev->relatedToUid(); |
@@ -329,33 +329,33 @@ bool CalendarLocal::addEventNoDup( Event *event ) | |||
329 | if ( *eve == *event ) { | 329 | if ( *eve == *event ) { |
330 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); | 330 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); |
331 | return false; | 331 | return false; |
332 | } | 332 | } |
333 | } | 333 | } |
334 | return addEvent( event ); | 334 | return addEvent( event ); |
335 | } | 335 | } |
336 | 336 | ||
337 | bool CalendarLocal::addEvent( Event *event ) | 337 | bool CalendarLocal::addEvent( Event *event ) |
338 | { | 338 | { |
339 | insertEvent( event ); | 339 | insertEvent( event ); |
340 | 340 | ||
341 | event->registerObserver( this ); | 341 | event->registerObserver( this ); |
342 | 342 | ||
343 | setModified( true ); | 343 | setModified( true ); |
344 | if ( event->calID() == 0 ) | 344 | if ( event->calID() == 0 ) |
345 | event->setCalID( mDefaultCalendar ); | 345 | event->setCalID_block( mDefaultCalendar ); |
346 | event->setCalEnabled( true ); | 346 | event->setCalEnabled( true ); |
347 | 347 | ||
348 | return true; | 348 | return true; |
349 | } | 349 | } |
350 | 350 | ||
351 | void CalendarLocal::deleteEvent( Event *event ) | 351 | void CalendarLocal::deleteEvent( Event *event ) |
352 | { | 352 | { |
353 | clearUndo(event); | 353 | clearUndo(event); |
354 | if ( mEventList.removeRef( event ) ) { | 354 | if ( mEventList.removeRef( event ) ) { |
355 | setModified( true ); | 355 | setModified( true ); |
356 | } | 356 | } |
357 | } | 357 | } |
358 | 358 | ||
359 | 359 | ||
360 | Event *CalendarLocal::event( const QString &uid ) | 360 | Event *CalendarLocal::event( const QString &uid ) |
361 | { | 361 | { |
@@ -383,33 +383,33 @@ bool CalendarLocal::addTodoNoDup( Todo *todo ) | |||
383 | return false; | 383 | return false; |
384 | } | 384 | } |
385 | } | 385 | } |
386 | return addTodo( todo ); | 386 | return addTodo( todo ); |
387 | } | 387 | } |
388 | bool CalendarLocal::addTodo( Todo *todo ) | 388 | bool CalendarLocal::addTodo( Todo *todo ) |
389 | { | 389 | { |
390 | mTodoList.append( todo ); | 390 | mTodoList.append( todo ); |
391 | 391 | ||
392 | todo->registerObserver( this ); | 392 | todo->registerObserver( this ); |
393 | 393 | ||
394 | // Set up subtask relations | 394 | // Set up subtask relations |
395 | setupRelations( todo ); | 395 | setupRelations( todo ); |
396 | 396 | ||
397 | setModified( true ); | 397 | setModified( true ); |
398 | if ( todo->calID() == 0 ) | 398 | if ( todo->calID() == 0 ) |
399 | todo->setCalID( mDefaultCalendar ); | 399 | todo->setCalID_block( mDefaultCalendar ); |
400 | todo->setCalEnabled( true ); | 400 | todo->setCalEnabled( true ); |
401 | return true; | 401 | return true; |
402 | } | 402 | } |
403 | 403 | ||
404 | void CalendarLocal::deleteTodo( Todo *todo ) | 404 | void CalendarLocal::deleteTodo( Todo *todo ) |
405 | { | 405 | { |
406 | // Handle orphaned children | 406 | // Handle orphaned children |
407 | removeRelations( todo ); | 407 | removeRelations( todo ); |
408 | clearUndo(todo); | 408 | clearUndo(todo); |
409 | 409 | ||
410 | if ( mTodoList.removeRef( todo ) ) { | 410 | if ( mTodoList.removeRef( todo ) ) { |
411 | setModified( true ); | 411 | setModified( true ); |
412 | } | 412 | } |
413 | } | 413 | } |
414 | 414 | ||
415 | QPtrList<Todo> CalendarLocal::rawTodos() | 415 | QPtrList<Todo> CalendarLocal::rawTodos() |
@@ -911,33 +911,33 @@ QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) | |||
911 | QPtrList<Event> CalendarLocal::rawEvents() | 911 | QPtrList<Event> CalendarLocal::rawEvents() |
912 | { | 912 | { |
913 | QPtrList<Event> el; | 913 | QPtrList<Event> el; |
914 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 914 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
915 | if ( it->calEnabled() ) el.append( it ); | 915 | if ( it->calEnabled() ) el.append( it ); |
916 | return el; | 916 | return el; |
917 | } | 917 | } |
918 | 918 | ||
919 | bool CalendarLocal::addJournal(Journal *journal) | 919 | bool CalendarLocal::addJournal(Journal *journal) |
920 | { | 920 | { |
921 | mJournalList.append(journal); | 921 | mJournalList.append(journal); |
922 | 922 | ||
923 | journal->registerObserver( this ); | 923 | journal->registerObserver( this ); |
924 | 924 | ||
925 | setModified( true ); | 925 | setModified( true ); |
926 | if ( journal->calID() == 0 ) | 926 | if ( journal->calID() == 0 ) |
927 | journal->setCalID( mDefaultCalendar ); | 927 | journal->setCalID_block( mDefaultCalendar ); |
928 | journal->setCalEnabled( true ); | 928 | journal->setCalEnabled( true ); |
929 | return true; | 929 | return true; |
930 | } | 930 | } |
931 | 931 | ||
932 | void CalendarLocal::deleteJournal( Journal *journal ) | 932 | void CalendarLocal::deleteJournal( Journal *journal ) |
933 | { | 933 | { |
934 | clearUndo(journal); | 934 | clearUndo(journal); |
935 | if ( mJournalList.removeRef(journal) ) { | 935 | if ( mJournalList.removeRef(journal) ) { |
936 | setModified( true ); | 936 | setModified( true ); |
937 | } | 937 | } |
938 | } | 938 | } |
939 | 939 | ||
940 | QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date ) | 940 | QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date ) |
941 | { | 941 | { |
942 | QPtrList<Journal> el; | 942 | QPtrList<Journal> el; |
943 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 943 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |