-rw-r--r-- | libkcal/calendarlocal.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 2a57724..c33581c 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -162,97 +162,98 @@ bool CalendarLocal::mergeCalendar( Calendar* remote ) | |||
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 | } |
174 | return false; | 174 | return false; |
175 | } | 175 | } |
176 | void CalendarLocal::setSyncEventsEnabled() | 176 | void CalendarLocal::setSyncEventsEnabled() |
177 | { | 177 | { |
178 | Event * ev; | 178 | Event * ev; |
179 | ev = mEventList.first(); | 179 | ev = mEventList.first(); |
180 | while ( ev ) { | 180 | while ( ev ) { |
181 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 181 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
182 | ev->setCalEnabled( true ); | 182 | ev->setCalEnabled( true ); |
183 | ev = mEventList.next(); | 183 | ev = mEventList.next(); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | void CalendarLocal::setSyncEventsReadOnly() | 186 | void CalendarLocal::setSyncEventsReadOnly() |
187 | { | 187 | { |
188 | Event * ev; | 188 | Event * ev; |
189 | ev = mEventList.first(); | 189 | ev = mEventList.first(); |
190 | while ( ev ) { | 190 | while ( ev ) { |
191 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) { | 191 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) { |
192 | ev->setReadOnly( true ); | 192 | ev->setReadOnly( true ); |
193 | } | 193 | } |
194 | ev = mEventList.next(); | 194 | ev = mEventList.next(); |
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 | } | 212 | } |
212 | ev->unRegisterObserver( cal ); | 213 | ev->unRegisterObserver( cal ); |
213 | ev->registerObserver( this ); | 214 | ev->registerObserver( this ); |
214 | mEventList.append( ev ); | 215 | mEventList.append( ev ); |
215 | ev = EventList.next(); | 216 | ev = EventList.next(); |
216 | } | 217 | } |
217 | for ( ev = el.first(); ev; ev = el.next() ) { | 218 | for ( ev = el.first(); ev; ev = el.next() ) { |
218 | deleteIncidence ( ev ); | 219 | deleteIncidence ( ev ); |
219 | } | 220 | } |
220 | } | 221 | } |
221 | { | 222 | { |
222 | 223 | ||
223 | QPtrList<Todo> TodoList = cal->rawTodos(); | 224 | QPtrList<Todo> TodoList = cal->rawTodos(); |
224 | Todo * ev = TodoList.first(); | 225 | Todo * ev = TodoList.first(); |
225 | while ( ev ) { | 226 | while ( ev ) { |
226 | QString rel = ev->relatedToUid(); | 227 | QString rel = ev->relatedToUid(); |
227 | if ( !rel.isEmpty() ){ | 228 | if ( !rel.isEmpty() ){ |
228 | ev->setRelatedTo ( 0 ); | 229 | ev->setRelatedTo ( 0 ); |
229 | ev->setRelatedToUid( rel ); | 230 | ev->setRelatedToUid( rel ); |
230 | } | 231 | } |
231 | ev = TodoList.next(); | 232 | ev = TodoList.next(); |
232 | } | 233 | } |
233 | //TodoList = cal->rawTodos(); | 234 | //TodoList = cal->rawTodos(); |
234 | ev = TodoList.first(); | 235 | ev = TodoList.first(); |
235 | while ( ev ) { | 236 | while ( ev ) { |
236 | ev->unRegisterObserver( cal ); | 237 | ev->unRegisterObserver( cal ); |
237 | ev->registerObserver( this ); | 238 | ev->registerObserver( this ); |
238 | mTodoList.append( ev ); | 239 | mTodoList.append( ev ); |
239 | setupRelations( ev ); | 240 | setupRelations( ev ); |
240 | ev = TodoList.next(); | 241 | ev = TodoList.next(); |
241 | } | 242 | } |
242 | } | 243 | } |
243 | { | 244 | { |
244 | QPtrList<Journal> JournalList = cal->journals(); | 245 | QPtrList<Journal> JournalList = cal->journals(); |
245 | Journal * ev = JournalList.first(); | 246 | Journal * ev = JournalList.first(); |
246 | while ( ev ) { | 247 | while ( ev ) { |
247 | ev->unRegisterObserver( cal ); | 248 | ev->unRegisterObserver( cal ); |
248 | ev->registerObserver( this ); | 249 | ev->registerObserver( this ); |
249 | mJournalList.append( ev ); | 250 | mJournalList.append( ev ); |
250 | ev = JournalList.next(); | 251 | ev = JournalList.next(); |
251 | } | 252 | } |
252 | } | 253 | } |
253 | setModified( true ); | 254 | setModified( true ); |
254 | } | 255 | } |
255 | bool CalendarLocal::load( const QString &fileName ) | 256 | bool CalendarLocal::load( const QString &fileName ) |
256 | { | 257 | { |
257 | FileStorage storage( this, fileName ); | 258 | FileStorage storage( this, fileName ); |
258 | return storage.load(); | 259 | return storage.load(); |