-rw-r--r-- | libkcal/calendarlocal.cpp | 2 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 11 | ||||
-rw-r--r-- | libkcal/journal.cpp | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index eef8327..5baa7dc 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -67,385 +67,385 @@ CalendarLocal::~CalendarLocal() | |||
67 | { | 67 | { |
68 | registerObserver( 0 ); | 68 | registerObserver( 0 ); |
69 | if ( mDeleteIncidencesOnClose ) | 69 | if ( mDeleteIncidencesOnClose ) |
70 | close(); | 70 | close(); |
71 | } | 71 | } |
72 | bool CalendarLocal::mergeCalendarFile( QString name ) | 72 | bool CalendarLocal::mergeCalendarFile( QString name ) |
73 | { | 73 | { |
74 | CalendarLocal calendar( timeZoneId() ); | 74 | CalendarLocal calendar( timeZoneId() ); |
75 | calendar.setDefaultCalendar( 1 ); | 75 | calendar.setDefaultCalendar( 1 ); |
76 | if ( calendar.load( name ) ) { | 76 | if ( calendar.load( name ) ) { |
77 | mergeCalendar( &calendar ); | 77 | mergeCalendar( &calendar ); |
78 | return true; | 78 | return true; |
79 | } | 79 | } |
80 | return false; | 80 | return false; |
81 | } | 81 | } |
82 | 82 | ||
83 | Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates) | 83 | Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates) |
84 | { | 84 | { |
85 | Todo *todo;; | 85 | Todo *todo;; |
86 | Incidence *retVal = 0; | 86 | Incidence *retVal = 0; |
87 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 87 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
88 | if ( todo->uid() == uid ) { | 88 | if ( todo->uid() == uid ) { |
89 | if ( doNotCheckDuplicates ) return todo; | 89 | if ( doNotCheckDuplicates ) return todo; |
90 | if ( retVal ) { | 90 | if ( retVal ) { |
91 | if ( retVal->calID() > todo->calID() ) { | 91 | if ( retVal->calID() > todo->calID() ) { |
92 | retVal = todo; | 92 | retVal = todo; |
93 | } | 93 | } |
94 | } else { | 94 | } else { |
95 | retVal = todo; | 95 | retVal = todo; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | } | 98 | } |
99 | if ( retVal ) return retVal; | 99 | if ( retVal ) return retVal; |
100 | Event *event; | 100 | Event *event; |
101 | for ( event = mEventList.first(); event; event = mEventList.next() ) { | 101 | for ( event = mEventList.first(); event; event = mEventList.next() ) { |
102 | if ( event->uid() == uid ) { | 102 | if ( event->uid() == uid ) { |
103 | if ( doNotCheckDuplicates ) return event; | 103 | if ( doNotCheckDuplicates ) return event; |
104 | if ( retVal ) { | 104 | if ( retVal ) { |
105 | if ( retVal->calID() > event->calID() ) { | 105 | if ( retVal->calID() > event->calID() ) { |
106 | retVal = event; | 106 | retVal = event; |
107 | } | 107 | } |
108 | } else { | 108 | } else { |
109 | retVal = event; | 109 | retVal = event; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | } | 112 | } |
113 | if ( retVal ) return retVal; | 113 | if ( retVal ) return retVal; |
114 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 114 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
115 | if ( it->uid() == uid ) { | 115 | if ( it->uid() == uid ) { |
116 | if ( doNotCheckDuplicates ) return it; | 116 | if ( doNotCheckDuplicates ) return it; |
117 | if ( retVal ) { | 117 | if ( retVal ) { |
118 | if ( retVal->calID() > it->calID() ) { | 118 | if ( retVal->calID() > it->calID() ) { |
119 | retVal = it; | 119 | retVal = it; |
120 | } | 120 | } |
121 | } else { | 121 | } else { |
122 | retVal = it; | 122 | retVal = it; |
123 | } | 123 | } |
124 | } | 124 | } |
125 | return retVal; | 125 | return retVal; |
126 | } | 126 | } |
127 | 127 | ||
128 | bool CalendarLocal::mergeCalendar( Calendar* remote ) | 128 | bool CalendarLocal::mergeCalendar( Calendar* remote ) |
129 | { | 129 | { |
130 | // 1 look for raw inc in local | 130 | // 1 look for raw inc in local |
131 | // if inc not in remote, delete in local | 131 | // if inc not in remote, delete in local |
132 | // 2 look for raw inc in remote | 132 | // 2 look for raw inc in remote |
133 | // if inc in local, replace it | 133 | // if inc in local, replace it |
134 | // if not in local, add it to default calendar | 134 | // if not in local, add it to default calendar |
135 | QPtrList<Incidence> localInc = rawIncidences(); | 135 | QPtrList<Incidence> localInc = rawIncidences(); |
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( 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( 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 | } |
174 | return false; | 174 | return false; |
175 | } | 175 | } |
176 | void CalendarLocal::setSyncEventsReadOnly() | 176 | void CalendarLocal::setSyncEventsReadOnly() |
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->setReadOnly( true ); | 182 | ev->setReadOnly( true ); |
183 | ev = mEventList.next(); | 183 | ev = mEventList.next(); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | void CalendarLocal::addCalendar( Calendar* cal ) | 186 | void CalendarLocal::addCalendar( Calendar* cal ) |
187 | { | 187 | { |
188 | cal->setDontDeleteIncidencesOnClose(); | 188 | cal->setDontDeleteIncidencesOnClose(); |
189 | { | 189 | { |
190 | QPtrList<Event> EventList = cal->rawEvents(); | 190 | QPtrList<Event> EventList = cal->rawEvents(); |
191 | Event * ev = EventList.first(); | 191 | Event * ev = EventList.first(); |
192 | while ( ev ) { | 192 | while ( ev ) { |
193 | ev->unRegisterObserver( cal ); | 193 | ev->unRegisterObserver( cal ); |
194 | ev->registerObserver( this ); | 194 | ev->registerObserver( this ); |
195 | mEventList.append( ev ); | 195 | mEventList.append( ev ); |
196 | ev = EventList.next(); | 196 | ev = EventList.next(); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | { | 199 | { |
200 | 200 | ||
201 | QPtrList<Todo> TodoList = cal->rawTodos(); | 201 | QPtrList<Todo> TodoList = cal->rawTodos(); |
202 | Todo * ev = TodoList.first(); | 202 | Todo * ev = TodoList.first(); |
203 | while ( ev ) { | 203 | while ( ev ) { |
204 | QString rel = ev->relatedToUid(); | 204 | QString rel = ev->relatedToUid(); |
205 | if ( !rel.isEmpty() ){ | 205 | if ( !rel.isEmpty() ){ |
206 | ev->setRelatedTo ( 0 ); | 206 | ev->setRelatedTo ( 0 ); |
207 | ev->setRelatedToUid( rel ); | 207 | ev->setRelatedToUid( rel ); |
208 | } | 208 | } |
209 | ev = TodoList.next(); | 209 | ev = TodoList.next(); |
210 | } | 210 | } |
211 | //TodoList = cal->rawTodos(); | 211 | //TodoList = cal->rawTodos(); |
212 | ev = TodoList.first(); | 212 | ev = TodoList.first(); |
213 | while ( ev ) { | 213 | while ( ev ) { |
214 | ev->unRegisterObserver( cal ); | 214 | ev->unRegisterObserver( cal ); |
215 | ev->registerObserver( this ); | 215 | ev->registerObserver( this ); |
216 | mTodoList.append( ev ); | 216 | mTodoList.append( ev ); |
217 | setupRelations( ev ); | 217 | setupRelations( ev ); |
218 | ev = TodoList.next(); | 218 | ev = TodoList.next(); |
219 | } | 219 | } |
220 | } | 220 | } |
221 | { | 221 | { |
222 | QPtrList<Journal> JournalList = cal->journals(); | 222 | QPtrList<Journal> JournalList = cal->journals(); |
223 | Journal * ev = JournalList.first(); | 223 | Journal * ev = JournalList.first(); |
224 | while ( ev ) { | 224 | while ( ev ) { |
225 | ev->unRegisterObserver( cal ); | 225 | ev->unRegisterObserver( cal ); |
226 | ev->registerObserver( this ); | 226 | ev->registerObserver( this ); |
227 | mJournalList.append( ev ); | 227 | mJournalList.append( ev ); |
228 | ev = JournalList.next(); | 228 | ev = JournalList.next(); |
229 | } | 229 | } |
230 | } | 230 | } |
231 | setModified( true ); | 231 | setModified( true ); |
232 | } | 232 | } |
233 | bool CalendarLocal::load( const QString &fileName ) | 233 | bool CalendarLocal::load( const QString &fileName ) |
234 | { | 234 | { |
235 | FileStorage storage( this, fileName ); | 235 | FileStorage storage( this, fileName ); |
236 | return storage.load(); | 236 | return storage.load(); |
237 | } | 237 | } |
238 | 238 | ||
239 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) | 239 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) |
240 | { | 240 | { |
241 | FileStorage storage( this, fileName, format ); | 241 | FileStorage storage( this, fileName, format ); |
242 | return storage.save(); | 242 | return storage.save(); |
243 | } | 243 | } |
244 | 244 | ||
245 | void CalendarLocal::stopAllTodos() | 245 | void CalendarLocal::stopAllTodos() |
246 | { | 246 | { |
247 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 247 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
248 | it->setRunning( false ); | 248 | it->setRunning( false ); |
249 | 249 | ||
250 | } | 250 | } |
251 | void CalendarLocal::close() | 251 | void CalendarLocal::close() |
252 | { | 252 | { |
253 | 253 | ||
254 | Todo * i; | 254 | Todo * i; |
255 | for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); | 255 | for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); |
256 | 256 | ||
257 | mEventList.setAutoDelete( true ); | 257 | mEventList.setAutoDelete( true ); |
258 | mTodoList.setAutoDelete( true ); | 258 | mTodoList.setAutoDelete( true ); |
259 | mJournalList.setAutoDelete( false ); | 259 | mJournalList.setAutoDelete( true ); |
260 | 260 | ||
261 | mEventList.clear(); | 261 | mEventList.clear(); |
262 | mTodoList.clear(); | 262 | mTodoList.clear(); |
263 | mJournalList.clear(); | 263 | mJournalList.clear(); |
264 | 264 | ||
265 | mEventList.setAutoDelete( false ); | 265 | mEventList.setAutoDelete( false ); |
266 | mTodoList.setAutoDelete( false ); | 266 | mTodoList.setAutoDelete( false ); |
267 | mJournalList.setAutoDelete( false ); | 267 | mJournalList.setAutoDelete( false ); |
268 | 268 | ||
269 | setModified( false ); | 269 | setModified( false ); |
270 | } | 270 | } |
271 | 271 | ||
272 | bool CalendarLocal::addAnniversaryNoDup( Event *event ) | 272 | bool CalendarLocal::addAnniversaryNoDup( Event *event ) |
273 | { | 273 | { |
274 | QString cat; | 274 | QString cat; |
275 | bool isBirthday = true; | 275 | bool isBirthday = true; |
276 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { | 276 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { |
277 | isBirthday = false; | 277 | isBirthday = false; |
278 | cat = i18n( "Anniversary" ); | 278 | cat = i18n( "Anniversary" ); |
279 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { | 279 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { |
280 | isBirthday = true; | 280 | isBirthday = true; |
281 | cat = i18n( "Birthday" ); | 281 | cat = i18n( "Birthday" ); |
282 | } else { | 282 | } else { |
283 | qDebug("addAnniversaryNoDup called without fitting category! "); | 283 | qDebug("addAnniversaryNoDup called without fitting category! "); |
284 | return false; | 284 | return false; |
285 | } | 285 | } |
286 | Event * eve; | 286 | Event * eve; |
287 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { | 287 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { |
288 | if ( !(eve->categories().contains( cat ) )) | 288 | if ( !(eve->categories().contains( cat ) )) |
289 | continue; | 289 | continue; |
290 | // now we have an event with fitting category | 290 | // now we have an event with fitting category |
291 | if ( eve->dtStart().date() != event->dtStart().date() ) | 291 | if ( eve->dtStart().date() != event->dtStart().date() ) |
292 | continue; | 292 | continue; |
293 | // now we have an event with fitting category+date | 293 | // now we have an event with fitting category+date |
294 | if ( eve->summary() != event->summary() ) | 294 | if ( eve->summary() != event->summary() ) |
295 | continue; | 295 | continue; |
296 | // now we have an event with fitting category+date+summary | 296 | // now we have an event with fitting category+date+summary |
297 | return false; | 297 | return false; |
298 | } | 298 | } |
299 | return addEvent( event ); | 299 | return addEvent( event ); |
300 | 300 | ||
301 | } | 301 | } |
302 | bool CalendarLocal::addEventNoDup( Event *event ) | 302 | bool CalendarLocal::addEventNoDup( Event *event ) |
303 | { | 303 | { |
304 | Event * eve; | 304 | Event * eve; |
305 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { | 305 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { |
306 | if ( *eve == *event ) { | 306 | if ( *eve == *event ) { |
307 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); | 307 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); |
308 | return false; | 308 | return false; |
309 | } | 309 | } |
310 | } | 310 | } |
311 | return addEvent( event ); | 311 | return addEvent( event ); |
312 | } | 312 | } |
313 | 313 | ||
314 | bool CalendarLocal::addEvent( Event *event ) | 314 | bool CalendarLocal::addEvent( Event *event ) |
315 | { | 315 | { |
316 | insertEvent( event ); | 316 | insertEvent( event ); |
317 | 317 | ||
318 | event->registerObserver( this ); | 318 | event->registerObserver( this ); |
319 | 319 | ||
320 | setModified( true ); | 320 | setModified( true ); |
321 | if ( event->calID() == 0 ) | 321 | if ( event->calID() == 0 ) |
322 | event->setCalID( mDefaultCalendar ); | 322 | event->setCalID( mDefaultCalendar ); |
323 | event->setCalEnabled( true ); | 323 | event->setCalEnabled( true ); |
324 | 324 | ||
325 | return true; | 325 | return true; |
326 | } | 326 | } |
327 | 327 | ||
328 | void CalendarLocal::deleteEvent( Event *event ) | 328 | void CalendarLocal::deleteEvent( Event *event ) |
329 | { | 329 | { |
330 | if ( mUndoIncidence ) delete mUndoIncidence; | 330 | if ( mUndoIncidence ) delete mUndoIncidence; |
331 | mUndoIncidence = event->clone(); | 331 | mUndoIncidence = event->clone(); |
332 | if ( mEventList.removeRef( event ) ) { | 332 | if ( mEventList.removeRef( event ) ) { |
333 | setModified( true ); | 333 | setModified( true ); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | 336 | ||
337 | 337 | ||
338 | Event *CalendarLocal::event( const QString &uid ) | 338 | Event *CalendarLocal::event( const QString &uid ) |
339 | { | 339 | { |
340 | Event *event; | 340 | Event *event; |
341 | Event *retVal = 0; | 341 | Event *retVal = 0; |
342 | for ( event = mEventList.first(); event; event = mEventList.next() ) { | 342 | for ( event = mEventList.first(); event; event = mEventList.next() ) { |
343 | if ( event->calEnabled() && event->uid() == uid ) { | 343 | if ( event->calEnabled() && event->uid() == uid ) { |
344 | if ( retVal ) { | 344 | if ( retVal ) { |
345 | if ( retVal->calID() > event->calID() ) { | 345 | if ( retVal->calID() > event->calID() ) { |
346 | retVal = event; | 346 | retVal = event; |
347 | } | 347 | } |
348 | } else { | 348 | } else { |
349 | retVal = event; | 349 | retVal = event; |
350 | } | 350 | } |
351 | } | 351 | } |
352 | } | 352 | } |
353 | return retVal; | 353 | return retVal; |
354 | } | 354 | } |
355 | bool CalendarLocal::addTodoNoDup( Todo *todo ) | 355 | bool CalendarLocal::addTodoNoDup( Todo *todo ) |
356 | { | 356 | { |
357 | Todo * eve; | 357 | Todo * eve; |
358 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { | 358 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { |
359 | if ( *eve == *todo ) { | 359 | if ( *eve == *todo ) { |
360 | //qDebug("duplicate todo found! not inserted! "); | 360 | //qDebug("duplicate todo found! not inserted! "); |
361 | return false; | 361 | return false; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | return addTodo( todo ); | 364 | return addTodo( todo ); |
365 | } | 365 | } |
366 | bool CalendarLocal::addTodo( Todo *todo ) | 366 | bool CalendarLocal::addTodo( Todo *todo ) |
367 | { | 367 | { |
368 | mTodoList.append( todo ); | 368 | mTodoList.append( todo ); |
369 | 369 | ||
370 | todo->registerObserver( this ); | 370 | todo->registerObserver( this ); |
371 | 371 | ||
372 | // Set up subtask relations | 372 | // Set up subtask relations |
373 | setupRelations( todo ); | 373 | setupRelations( todo ); |
374 | 374 | ||
375 | setModified( true ); | 375 | setModified( true ); |
376 | if ( todo->calID() == 0 ) | 376 | if ( todo->calID() == 0 ) |
377 | todo->setCalID( mDefaultCalendar ); | 377 | todo->setCalID( mDefaultCalendar ); |
378 | todo->setCalEnabled( true ); | 378 | todo->setCalEnabled( true ); |
379 | return true; | 379 | return true; |
380 | } | 380 | } |
381 | 381 | ||
382 | void CalendarLocal::deleteTodo( Todo *todo ) | 382 | void CalendarLocal::deleteTodo( Todo *todo ) |
383 | { | 383 | { |
384 | // Handle orphaned children | 384 | // Handle orphaned children |
385 | if ( mUndoIncidence ) delete mUndoIncidence; | 385 | if ( mUndoIncidence ) delete mUndoIncidence; |
386 | removeRelations( todo ); | 386 | removeRelations( todo ); |
387 | mUndoIncidence = todo->clone(); | 387 | mUndoIncidence = todo->clone(); |
388 | 388 | ||
389 | if ( mTodoList.removeRef( todo ) ) { | 389 | if ( mTodoList.removeRef( todo ) ) { |
390 | setModified( true ); | 390 | setModified( true ); |
391 | } | 391 | } |
392 | } | 392 | } |
393 | 393 | ||
394 | QPtrList<Todo> CalendarLocal::rawTodos() | 394 | QPtrList<Todo> CalendarLocal::rawTodos() |
395 | { | 395 | { |
396 | QPtrList<Todo> el; | 396 | QPtrList<Todo> el; |
397 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 397 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
398 | if ( it->calEnabled() ) el.append( it ); | 398 | if ( it->calEnabled() ) el.append( it ); |
399 | return el; | 399 | return el; |
400 | } | 400 | } |
401 | Todo *CalendarLocal::todo( QString syncProf, QString id ) | 401 | Todo *CalendarLocal::todo( QString syncProf, QString id ) |
402 | { | 402 | { |
403 | Todo *todo; | 403 | Todo *todo; |
404 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 404 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
405 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; | 405 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; |
406 | } | 406 | } |
407 | 407 | ||
408 | return 0; | 408 | return 0; |
409 | } | 409 | } |
410 | void CalendarLocal::removeSyncInfo( QString syncProfile) | 410 | void CalendarLocal::removeSyncInfo( QString syncProfile) |
411 | { | 411 | { |
412 | QPtrList<Incidence> all = rawIncidences() ; | 412 | QPtrList<Incidence> all = rawIncidences() ; |
413 | Incidence *inc; | 413 | Incidence *inc; |
414 | for ( inc = all.first(); inc; inc = all.next() ) { | 414 | for ( inc = all.first(); inc; inc = all.next() ) { |
415 | inc->removeID( syncProfile ); | 415 | inc->removeID( syncProfile ); |
416 | } | 416 | } |
417 | if ( syncProfile.isEmpty() ) { | 417 | if ( syncProfile.isEmpty() ) { |
418 | QPtrList<Event> el; | 418 | QPtrList<Event> el; |
419 | Event *todo; | 419 | Event *todo; |
420 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 420 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
421 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 421 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
422 | el.append( todo ); | 422 | el.append( todo ); |
423 | } | 423 | } |
424 | for ( todo = el.first(); todo; todo = el.next() ) { | 424 | for ( todo = el.first(); todo; todo = el.next() ) { |
425 | deleteIncidence ( todo ); | 425 | deleteIncidence ( todo ); |
426 | } | 426 | } |
427 | } else { | 427 | } else { |
428 | Event *lse = event( "last-syncEvent-"+ syncProfile); | 428 | Event *lse = event( "last-syncEvent-"+ syncProfile); |
429 | if ( lse ) | 429 | if ( lse ) |
430 | deleteIncidence ( lse ); | 430 | deleteIncidence ( lse ); |
431 | } | 431 | } |
432 | } | 432 | } |
433 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() | 433 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() |
434 | { | 434 | { |
435 | QPtrList<Event> el; | 435 | QPtrList<Event> el; |
436 | Event *todo; | 436 | Event *todo; |
437 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 437 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
438 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 438 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
439 | if ( todo->summary().left(3) == "E: " ) | 439 | if ( todo->summary().left(3) == "E: " ) |
440 | el.append( todo ); | 440 | el.append( todo ); |
441 | } | 441 | } |
442 | 442 | ||
443 | return el; | 443 | return el; |
444 | 444 | ||
445 | } | 445 | } |
446 | Event *CalendarLocal::event( QString syncProf, QString id ) | 446 | Event *CalendarLocal::event( QString syncProf, QString id ) |
447 | { | 447 | { |
448 | Event *todo; | 448 | Event *todo; |
449 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 449 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
450 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; | 450 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; |
451 | } | 451 | } |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index f349681..53aa039 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -813,385 +813,385 @@ Todo *ICalFormatImpl::readTodo(icalcomponent *vtodo) | |||
813 | break; | 813 | break; |
814 | 814 | ||
815 | case ICAL_RELATEDTO_PROPERTY: // related todo (parent) | 815 | case ICAL_RELATEDTO_PROPERTY: // related todo (parent) |
816 | todo->setRelatedToUid(QString::fromUtf8(icalproperty_get_relatedto(p))); | 816 | todo->setRelatedToUid(QString::fromUtf8(icalproperty_get_relatedto(p))); |
817 | mTodosRelate.append(todo); | 817 | mTodosRelate.append(todo); |
818 | break; | 818 | break; |
819 | 819 | ||
820 | case ICAL_DTSTART_PROPERTY: | 820 | case ICAL_DTSTART_PROPERTY: |
821 | // Flag that todo has start date. Value is read in by readIncidence(). | 821 | // Flag that todo has start date. Value is read in by readIncidence(). |
822 | todo->setHasStartDate(true); | 822 | todo->setHasStartDate(true); |
823 | break; | 823 | break; |
824 | 824 | ||
825 | default: | 825 | default: |
826 | // kdDebug(5800) << "ICALFormat::readTodo(): Unknown property: " << kind | 826 | // kdDebug(5800) << "ICALFormat::readTodo(): Unknown property: " << kind |
827 | // << endl; | 827 | // << endl; |
828 | break; | 828 | break; |
829 | } | 829 | } |
830 | 830 | ||
831 | p = icalcomponent_get_next_property(vtodo,ICAL_ANY_PROPERTY); | 831 | p = icalcomponent_get_next_property(vtodo,ICAL_ANY_PROPERTY); |
832 | } | 832 | } |
833 | 833 | ||
834 | return todo; | 834 | return todo; |
835 | } | 835 | } |
836 | 836 | ||
837 | Event *ICalFormatImpl::readEvent(icalcomponent *vevent) | 837 | Event *ICalFormatImpl::readEvent(icalcomponent *vevent) |
838 | { | 838 | { |
839 | Event *event = new Event; | 839 | Event *event = new Event; |
840 | event->setFloats(false); | 840 | event->setFloats(false); |
841 | 841 | ||
842 | readIncidence(vevent,event); | 842 | readIncidence(vevent,event); |
843 | 843 | ||
844 | icalproperty *p = icalcomponent_get_first_property(vevent,ICAL_ANY_PROPERTY); | 844 | icalproperty *p = icalcomponent_get_first_property(vevent,ICAL_ANY_PROPERTY); |
845 | 845 | ||
846 | // int intvalue; | 846 | // int intvalue; |
847 | icaltimetype icaltime; | 847 | icaltimetype icaltime; |
848 | 848 | ||
849 | QStringList categories; | 849 | QStringList categories; |
850 | QString transparency; | 850 | QString transparency; |
851 | 851 | ||
852 | while (p) { | 852 | while (p) { |
853 | icalproperty_kind kind = icalproperty_isa(p); | 853 | icalproperty_kind kind = icalproperty_isa(p); |
854 | switch (kind) { | 854 | switch (kind) { |
855 | 855 | ||
856 | case ICAL_DTEND_PROPERTY: // start date and time | 856 | case ICAL_DTEND_PROPERTY: // start date and time |
857 | icaltime = icalproperty_get_dtend(p); | 857 | icaltime = icalproperty_get_dtend(p); |
858 | if (icaltime.is_date) { | 858 | if (icaltime.is_date) { |
859 | event->setFloats( true ); | 859 | event->setFloats( true ); |
860 | // End date is non-inclusive | 860 | // End date is non-inclusive |
861 | QDate endDate = readICalDate( icaltime ).addDays( -1 ); | 861 | QDate endDate = readICalDate( icaltime ).addDays( -1 ); |
862 | mCompat->fixFloatingEnd( endDate ); | 862 | mCompat->fixFloatingEnd( endDate ); |
863 | if ( endDate < event->dtStart().date() ) { | 863 | if ( endDate < event->dtStart().date() ) { |
864 | endDate = event->dtStart().date(); | 864 | endDate = event->dtStart().date(); |
865 | } | 865 | } |
866 | event->setDtEnd( QDateTime( endDate, QTime( 0, 0, 0 ) ) ); | 866 | event->setDtEnd( QDateTime( endDate, QTime( 0, 0, 0 ) ) ); |
867 | } else { | 867 | } else { |
868 | event->setDtEnd(readICalDateTime(icaltime)); | 868 | event->setDtEnd(readICalDateTime(icaltime)); |
869 | } | 869 | } |
870 | break; | 870 | break; |
871 | 871 | ||
872 | // TODO: | 872 | // TODO: |
873 | // at this point, there should be at least a start or end time. | 873 | // at this point, there should be at least a start or end time. |
874 | // fix up for events that take up no time but have a time associated | 874 | // fix up for events that take up no time but have a time associated |
875 | #if 0 | 875 | #if 0 |
876 | if (!(vo = isAPropertyOf(vevent, VCDTstartProp))) | 876 | if (!(vo = isAPropertyOf(vevent, VCDTstartProp))) |
877 | anEvent->setDtStart(anEvent->dtEnd()); | 877 | anEvent->setDtStart(anEvent->dtEnd()); |
878 | if (!(vo = isAPropertyOf(vevent, VCDTendProp))) | 878 | if (!(vo = isAPropertyOf(vevent, VCDTendProp))) |
879 | anEvent->setDtEnd(anEvent->dtStart()); | 879 | anEvent->setDtEnd(anEvent->dtStart()); |
880 | #endif | 880 | #endif |
881 | 881 | ||
882 | // TODO: exdates | 882 | // TODO: exdates |
883 | #if 0 | 883 | #if 0 |
884 | // recurrence exceptions | 884 | // recurrence exceptions |
885 | if ((vo = isAPropertyOf(vevent, VCExDateProp)) != 0) { | 885 | if ((vo = isAPropertyOf(vevent, VCExDateProp)) != 0) { |
886 | anEvent->setExDates(s = fakeCString(vObjectUStringZValue(vo))); | 886 | anEvent->setExDates(s = fakeCString(vObjectUStringZValue(vo))); |
887 | deleteStr(s); | 887 | deleteStr(s); |
888 | } | 888 | } |
889 | #endif | 889 | #endif |
890 | 890 | ||
891 | #if 0 | 891 | #if 0 |
892 | // secrecy | 892 | // secrecy |
893 | if ((vo = isAPropertyOf(vevent, VCClassProp)) != 0) { | 893 | if ((vo = isAPropertyOf(vevent, VCClassProp)) != 0) { |
894 | anEvent->setSecrecy(s = fakeCString(vObjectUStringZValue(vo))); | 894 | anEvent->setSecrecy(s = fakeCString(vObjectUStringZValue(vo))); |
895 | deleteStr(s); | 895 | deleteStr(s); |
896 | } | 896 | } |
897 | else | 897 | else |
898 | anEvent->setSecrecy("PUBLIC"); | 898 | anEvent->setSecrecy("PUBLIC"); |
899 | 899 | ||
900 | // attachments | 900 | // attachments |
901 | tmpStrList.clear(); | 901 | tmpStrList.clear(); |
902 | initPropIterator(&voi, vevent); | 902 | initPropIterator(&voi, vevent); |
903 | while (moreIteration(&voi)) { | 903 | while (moreIteration(&voi)) { |
904 | vo = nextVObject(&voi); | 904 | vo = nextVObject(&voi); |
905 | if (strcmp(vObjectName(vo), VCAttachProp) == 0) { | 905 | if (strcmp(vObjectName(vo), VCAttachProp) == 0) { |
906 | tmpStrList.append(s = fakeCString(vObjectUStringZValue(vo))); | 906 | tmpStrList.append(s = fakeCString(vObjectUStringZValue(vo))); |
907 | deleteStr(s); | 907 | deleteStr(s); |
908 | } | 908 | } |
909 | } | 909 | } |
910 | anEvent->setAttachments(tmpStrList); | 910 | anEvent->setAttachments(tmpStrList); |
911 | 911 | ||
912 | // resources | 912 | // resources |
913 | if ((vo = isAPropertyOf(vevent, VCResourcesProp)) != 0) { | 913 | if ((vo = isAPropertyOf(vevent, VCResourcesProp)) != 0) { |
914 | QString resources = (s = fakeCString(vObjectUStringZValue(vo))); | 914 | QString resources = (s = fakeCString(vObjectUStringZValue(vo))); |
915 | deleteStr(s); | 915 | deleteStr(s); |
916 | tmpStrList.clear(); | 916 | tmpStrList.clear(); |
917 | index1 = 0; | 917 | index1 = 0; |
918 | index2 = 0; | 918 | index2 = 0; |
919 | QString resource; | 919 | QString resource; |
920 | while ((index2 = resources.find(';', index1)) != -1) { | 920 | while ((index2 = resources.find(';', index1)) != -1) { |
921 | resource = resources.mid(index1, (index2 - index1)); | 921 | resource = resources.mid(index1, (index2 - index1)); |
922 | tmpStrList.append(resource); | 922 | tmpStrList.append(resource); |
923 | index1 = index2; | 923 | index1 = index2; |
924 | } | 924 | } |
925 | anEvent->setResources(tmpStrList); | 925 | anEvent->setResources(tmpStrList); |
926 | } | 926 | } |
927 | #endif | 927 | #endif |
928 | 928 | ||
929 | case ICAL_RELATEDTO_PROPERTY: // releated event (parent) | 929 | case ICAL_RELATEDTO_PROPERTY: // releated event (parent) |
930 | event->setRelatedToUid(QString::fromUtf8(icalproperty_get_relatedto(p))); | 930 | event->setRelatedToUid(QString::fromUtf8(icalproperty_get_relatedto(p))); |
931 | mEventsRelate.append(event); | 931 | mEventsRelate.append(event); |
932 | break; | 932 | break; |
933 | 933 | ||
934 | case ICAL_TRANSP_PROPERTY: // Transparency | 934 | case ICAL_TRANSP_PROPERTY: // Transparency |
935 | if(icalproperty_get_transp(p) == ICAL_TRANSP_TRANSPARENT ) | 935 | if(icalproperty_get_transp(p) == ICAL_TRANSP_TRANSPARENT ) |
936 | event->setTransparency( Event::Transparent ); | 936 | event->setTransparency( Event::Transparent ); |
937 | else | 937 | else |
938 | event->setTransparency( Event::Opaque ); | 938 | event->setTransparency( Event::Opaque ); |
939 | break; | 939 | break; |
940 | 940 | ||
941 | default: | 941 | default: |
942 | // kdDebug(5800) << "ICALFormat::readEvent(): Unknown property: " << kind | 942 | // kdDebug(5800) << "ICALFormat::readEvent(): Unknown property: " << kind |
943 | // << endl; | 943 | // << endl; |
944 | break; | 944 | break; |
945 | } | 945 | } |
946 | 946 | ||
947 | p = icalcomponent_get_next_property(vevent,ICAL_ANY_PROPERTY); | 947 | p = icalcomponent_get_next_property(vevent,ICAL_ANY_PROPERTY); |
948 | } | 948 | } |
949 | 949 | ||
950 | QString msade = event->nonKDECustomProperty("X-MICROSOFT-CDO-ALLDAYEVENT"); | 950 | QString msade = event->nonKDECustomProperty("X-MICROSOFT-CDO-ALLDAYEVENT"); |
951 | if (!msade.isNull()) { | 951 | if (!msade.isNull()) { |
952 | bool floats = (msade == QString::fromLatin1("TRUE")); | 952 | bool floats = (msade == QString::fromLatin1("TRUE")); |
953 | kdDebug(5800) << "ICALFormat::readEvent(): all day event: " << floats << endl; | 953 | kdDebug(5800) << "ICALFormat::readEvent(): all day event: " << floats << endl; |
954 | event->setFloats(floats); | 954 | event->setFloats(floats); |
955 | if (floats) { | 955 | if (floats) { |
956 | QDateTime endDate = event->dtEnd(); | 956 | QDateTime endDate = event->dtEnd(); |
957 | event->setDtEnd(endDate.addDays(-1)); | 957 | event->setDtEnd(endDate.addDays(-1)); |
958 | } | 958 | } |
959 | } | 959 | } |
960 | 960 | ||
961 | // some stupid vCal exporters ignore the standard and use Description | 961 | // some stupid vCal exporters ignore the standard and use Description |
962 | // instead of Summary for the default field. Correct for this. | 962 | // instead of Summary for the default field. Correct for this. |
963 | if (event->summary().isEmpty() && | 963 | if (event->summary().isEmpty() && |
964 | !(event->description().isEmpty())) { | 964 | !(event->description().isEmpty())) { |
965 | QString tmpStr = event->description().simplifyWhiteSpace(); | 965 | QString tmpStr = event->description().simplifyWhiteSpace(); |
966 | event->setDescription(""); | 966 | event->setDescription(""); |
967 | event->setSummary(tmpStr); | 967 | event->setSummary(tmpStr); |
968 | } | 968 | } |
969 | 969 | ||
970 | return event; | 970 | return event; |
971 | } | 971 | } |
972 | 972 | ||
973 | FreeBusy *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy) | 973 | FreeBusy *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy) |
974 | { | 974 | { |
975 | FreeBusy *freebusy = new FreeBusy; | 975 | FreeBusy *freebusy = new FreeBusy; |
976 | 976 | ||
977 | readIncidenceBase(vfreebusy,freebusy); | 977 | readIncidenceBase(vfreebusy,freebusy); |
978 | 978 | ||
979 | icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY); | 979 | icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY); |
980 | 980 | ||
981 | icaltimetype icaltime; | 981 | icaltimetype icaltime; |
982 | icalperiodtype icalperiod; | 982 | icalperiodtype icalperiod; |
983 | QDateTime period_start, period_end; | 983 | QDateTime period_start, period_end; |
984 | 984 | ||
985 | while (p) { | 985 | while (p) { |
986 | icalproperty_kind kind = icalproperty_isa(p); | 986 | icalproperty_kind kind = icalproperty_isa(p); |
987 | switch (kind) { | 987 | switch (kind) { |
988 | 988 | ||
989 | case ICAL_DTSTART_PROPERTY: // start date and time | 989 | case ICAL_DTSTART_PROPERTY: // start date and time |
990 | icaltime = icalproperty_get_dtstart(p); | 990 | icaltime = icalproperty_get_dtstart(p); |
991 | freebusy->setDtStart(readICalDateTime(icaltime)); | 991 | freebusy->setDtStart(readICalDateTime(icaltime)); |
992 | break; | 992 | break; |
993 | 993 | ||
994 | case ICAL_DTEND_PROPERTY: // start End Date and Time | 994 | case ICAL_DTEND_PROPERTY: // start End Date and Time |
995 | icaltime = icalproperty_get_dtend(p); | 995 | icaltime = icalproperty_get_dtend(p); |
996 | freebusy->setDtEnd(readICalDateTime(icaltime)); | 996 | freebusy->setDtEnd(readICalDateTime(icaltime)); |
997 | break; | 997 | break; |
998 | 998 | ||
999 | case ICAL_FREEBUSY_PROPERTY: //Any FreeBusy Times | 999 | case ICAL_FREEBUSY_PROPERTY: //Any FreeBusy Times |
1000 | icalperiod = icalproperty_get_freebusy(p); | 1000 | icalperiod = icalproperty_get_freebusy(p); |
1001 | period_start = readICalDateTime(icalperiod.start); | 1001 | period_start = readICalDateTime(icalperiod.start); |
1002 | period_end = readICalDateTime(icalperiod.end); | 1002 | period_end = readICalDateTime(icalperiod.end); |
1003 | freebusy->addPeriod(period_start, period_end); | 1003 | freebusy->addPeriod(period_start, period_end); |
1004 | break; | 1004 | break; |
1005 | 1005 | ||
1006 | default: | 1006 | default: |
1007 | kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind | 1007 | kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind |
1008 | << endl; | 1008 | << endl; |
1009 | break; | 1009 | break; |
1010 | } | 1010 | } |
1011 | p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY); | 1011 | p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY); |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | return freebusy; | 1014 | return freebusy; |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | Journal *ICalFormatImpl::readJournal(icalcomponent *vjournal) | 1017 | Journal *ICalFormatImpl::readJournal(icalcomponent *vjournal) |
1018 | { | 1018 | { |
1019 | Journal *journal = new Journal; | 1019 | Journal *journal = new Journal; |
1020 | 1020 | ||
1021 | readIncidence(vjournal,journal); | 1021 | readIncidence(vjournal,journal); |
1022 | 1022 | ||
1023 | if ( !journal->dtStart().isValid() && journal->created().isValid() ) { | 1023 | if ( !journal->dtStart().isValid() && journal->created().isValid() ) { |
1024 | journal->setDtStart( journal->created() ); | 1024 | journal->setDtStart( journal->created() ); |
1025 | } | 1025 | } |
1026 | return journal; | 1026 | return journal; |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee) | 1029 | Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee) |
1030 | { | 1030 | { |
1031 | icalparameter *p = 0; | 1031 | icalparameter *p = 0; |
1032 | 1032 | ||
1033 | QString email = QString::fromUtf8(icalproperty_get_attendee(attendee)); | 1033 | QString email = QString::fromUtf8(icalproperty_get_attendee(attendee)); |
1034 | 1034 | ||
1035 | QString name; | 1035 | QString name; |
1036 | QString uid = QString::null; | 1036 | QString uid = QString::null; |
1037 | p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER); | 1037 | p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER); |
1038 | if (p) { | 1038 | if (p) { |
1039 | name = QString::fromUtf8(icalparameter_get_cn(p)); | 1039 | name = QString::fromUtf8(icalparameter_get_cn(p)); |
1040 | } else { | 1040 | } else { |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | bool rsvp=false; | 1043 | bool rsvp=false; |
1044 | p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER); | 1044 | p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER); |
1045 | if (p) { | 1045 | if (p) { |
1046 | icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p); | 1046 | icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p); |
1047 | if (rsvpParameter == ICAL_RSVP_TRUE) rsvp = true; | 1047 | if (rsvpParameter == ICAL_RSVP_TRUE) rsvp = true; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | Attendee::PartStat status = Attendee::NeedsAction; | 1050 | Attendee::PartStat status = Attendee::NeedsAction; |
1051 | p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER); | 1051 | p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER); |
1052 | if (p) { | 1052 | if (p) { |
1053 | icalparameter_partstat partStatParameter = icalparameter_get_partstat(p); | 1053 | icalparameter_partstat partStatParameter = icalparameter_get_partstat(p); |
1054 | switch(partStatParameter) { | 1054 | switch(partStatParameter) { |
1055 | default: | 1055 | default: |
1056 | case ICAL_PARTSTAT_NEEDSACTION: | 1056 | case ICAL_PARTSTAT_NEEDSACTION: |
1057 | status = Attendee::NeedsAction; | 1057 | status = Attendee::NeedsAction; |
1058 | break; | 1058 | break; |
1059 | case ICAL_PARTSTAT_ACCEPTED: | 1059 | case ICAL_PARTSTAT_ACCEPTED: |
1060 | status = Attendee::Accepted; | 1060 | status = Attendee::Accepted; |
1061 | break; | 1061 | break; |
1062 | case ICAL_PARTSTAT_DECLINED: | 1062 | case ICAL_PARTSTAT_DECLINED: |
1063 | status = Attendee::Declined; | 1063 | status = Attendee::Declined; |
1064 | break; | 1064 | break; |
1065 | case ICAL_PARTSTAT_TENTATIVE: | 1065 | case ICAL_PARTSTAT_TENTATIVE: |
1066 | status = Attendee::Tentative; | 1066 | status = Attendee::Tentative; |
1067 | break; | 1067 | break; |
1068 | case ICAL_PARTSTAT_DELEGATED: | 1068 | case ICAL_PARTSTAT_DELEGATED: |
1069 | status = Attendee::Delegated; | 1069 | status = Attendee::Delegated; |
1070 | break; | 1070 | break; |
1071 | case ICAL_PARTSTAT_COMPLETED: | 1071 | case ICAL_PARTSTAT_COMPLETED: |
1072 | status = Attendee::Completed; | 1072 | status = Attendee::Completed; |
1073 | break; | 1073 | break; |
1074 | case ICAL_PARTSTAT_INPROCESS: | 1074 | case ICAL_PARTSTAT_INPROCESS: |
1075 | status = Attendee::InProcess; | 1075 | status = Attendee::InProcess; |
1076 | break; | 1076 | break; |
1077 | } | 1077 | } |
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | Attendee::Role role = Attendee::ReqParticipant; | 1080 | Attendee::Role role = Attendee::ReqParticipant; |
1081 | p = icalproperty_get_first_parameter(attendee,ICAL_ROLE_PARAMETER); | 1081 | p = icalproperty_get_first_parameter(attendee,ICAL_ROLE_PARAMETER); |
1082 | if (p) { | 1082 | if (p) { |
1083 | icalparameter_role roleParameter = icalparameter_get_role(p); | 1083 | icalparameter_role roleParameter = icalparameter_get_role(p); |
1084 | switch(roleParameter) { | 1084 | switch(roleParameter) { |
1085 | case ICAL_ROLE_CHAIR: | 1085 | case ICAL_ROLE_CHAIR: |
1086 | role = Attendee::Chair; | 1086 | role = Attendee::Chair; |
1087 | break; | 1087 | break; |
1088 | default: | 1088 | default: |
1089 | case ICAL_ROLE_REQPARTICIPANT: | 1089 | case ICAL_ROLE_REQPARTICIPANT: |
1090 | role = Attendee::ReqParticipant; | 1090 | role = Attendee::ReqParticipant; |
1091 | break; | 1091 | break; |
1092 | case ICAL_ROLE_OPTPARTICIPANT: | 1092 | case ICAL_ROLE_OPTPARTICIPANT: |
1093 | role = Attendee::OptParticipant; | 1093 | role = Attendee::OptParticipant; |
1094 | break; | 1094 | break; |
1095 | case ICAL_ROLE_NONPARTICIPANT: | 1095 | case ICAL_ROLE_NONPARTICIPANT: |
1096 | role = Attendee::NonParticipant; | 1096 | role = Attendee::NonParticipant; |
1097 | break; | 1097 | break; |
1098 | } | 1098 | } |
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER); | 1101 | p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER); |
1102 | uid = icalparameter_get_xvalue(p); | 1102 | uid = icalparameter_get_xvalue(p); |
1103 | // This should be added, but there seems to be a libical bug here. | 1103 | // This should be added, but there seems to be a libical bug here. |
1104 | /*while (p) { | 1104 | /*while (p) { |
1105 | // if (icalparameter_get_xname(p) == "X-UID") { | 1105 | // if (icalparameter_get_xname(p) == "X-UID") { |
1106 | uid = icalparameter_get_xvalue(p); | 1106 | uid = icalparameter_get_xvalue(p); |
1107 | p = icalproperty_get_next_parameter(attendee,ICAL_X_PARAMETER); | 1107 | p = icalproperty_get_next_parameter(attendee,ICAL_X_PARAMETER); |
1108 | } */ | 1108 | } */ |
1109 | 1109 | ||
1110 | return new Attendee( name, email, rsvp, status, role, uid ); | 1110 | return new Attendee( name, email, rsvp, status, role, uid ); |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | Attachment *ICalFormatImpl::readAttachment(icalproperty *attach) | 1113 | Attachment *ICalFormatImpl::readAttachment(icalproperty *attach) |
1114 | { | 1114 | { |
1115 | icalattach *a = icalproperty_get_attach(attach); | 1115 | icalattach *a = icalproperty_get_attach(attach); |
1116 | icalparameter_value v = ICAL_VALUE_NONE; | 1116 | icalparameter_value v = ICAL_VALUE_NONE; |
1117 | icalparameter_encoding e = ICAL_ENCODING_NONE; | 1117 | icalparameter_encoding e = ICAL_ENCODING_NONE; |
1118 | 1118 | ||
1119 | Attachment *attachment = 0; | 1119 | Attachment *attachment = 0; |
1120 | /* | 1120 | /* |
1121 | icalparameter *vp = icalproperty_get_first_parameter(attach, ICAL_VALUE_PARAMETER); | 1121 | icalparameter *vp = icalproperty_get_first_parameter(attach, ICAL_VALUE_PARAMETER); |
1122 | if (vp) | 1122 | if (vp) |
1123 | v = icalparameter_get_value(vp); | 1123 | v = icalparameter_get_value(vp); |
1124 | 1124 | ||
1125 | icalparameter *ep = icalproperty_get_first_parameter(attach, ICAL_ENCODING_PARAMETER); | 1125 | icalparameter *ep = icalproperty_get_first_parameter(attach, ICAL_ENCODING_PARAMETER); |
1126 | if (ep) | 1126 | if (ep) |
1127 | e = icalparameter_get_encoding(ep); | 1127 | e = icalparameter_get_encoding(ep); |
1128 | */ | 1128 | */ |
1129 | int isurl = icalattach_get_is_url (a); | 1129 | int isurl = icalattach_get_is_url (a); |
1130 | if (isurl == 0) | 1130 | if (isurl == 0) |
1131 | attachment = new Attachment((const char*)icalattach_get_data(a)); | 1131 | attachment = new Attachment((const char*)icalattach_get_data(a)); |
1132 | else { | 1132 | else { |
1133 | attachment = new Attachment(QString(icalattach_get_url(a))); | 1133 | attachment = new Attachment(QString(icalattach_get_url(a))); |
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | icalparameter *p = icalproperty_get_first_parameter(attach, ICAL_FMTTYPE_PARAMETER); | 1136 | icalparameter *p = icalproperty_get_first_parameter(attach, ICAL_FMTTYPE_PARAMETER); |
1137 | if (p) | 1137 | if (p) |
1138 | attachment->setMimeType(QString(icalparameter_get_fmttype(p))); | 1138 | attachment->setMimeType(QString(icalparameter_get_fmttype(p))); |
1139 | 1139 | ||
1140 | return attachment; | 1140 | return attachment; |
1141 | } | 1141 | } |
1142 | #include <qtextcodec.h> | 1142 | #include <qtextcodec.h> |
1143 | void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) | 1143 | void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) |
1144 | { | 1144 | { |
1145 | readIncidenceBase(parent,incidence); | 1145 | readIncidenceBase(parent,incidence); |
1146 | 1146 | ||
1147 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); | 1147 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); |
1148 | bool readrec = false; | 1148 | bool readrec = false; |
1149 | const char *text; | 1149 | const char *text; |
1150 | int intvalue; | 1150 | int intvalue; |
1151 | icaltimetype icaltime; | 1151 | icaltimetype icaltime; |
1152 | icaldurationtype icalduration; | 1152 | icaldurationtype icalduration; |
1153 | struct icalrecurrencetype rectype; | 1153 | struct icalrecurrencetype rectype; |
1154 | QStringList categories; | 1154 | QStringList categories; |
1155 | 1155 | ||
1156 | while (p) { | 1156 | while (p) { |
1157 | icalproperty_kind kind = icalproperty_isa(p); | 1157 | icalproperty_kind kind = icalproperty_isa(p); |
1158 | switch (kind) { | 1158 | switch (kind) { |
1159 | 1159 | ||
1160 | case ICAL_CREATED_PROPERTY: | 1160 | case ICAL_CREATED_PROPERTY: |
1161 | icaltime = icalproperty_get_created(p); | 1161 | icaltime = icalproperty_get_created(p); |
1162 | incidence->setCreated(readICalDateTime(icaltime)); | 1162 | incidence->setCreated(readICalDateTime(icaltime)); |
1163 | break; | 1163 | break; |
1164 | 1164 | ||
1165 | case ICAL_SEQUENCE_PROPERTY: // sequence | 1165 | case ICAL_SEQUENCE_PROPERTY: // sequence |
1166 | intvalue = icalproperty_get_sequence(p); | 1166 | intvalue = icalproperty_get_sequence(p); |
1167 | incidence->setRevision(intvalue); | 1167 | incidence->setRevision(intvalue); |
1168 | break; | 1168 | break; |
1169 | 1169 | ||
1170 | case ICAL_LASTMODIFIED_PROPERTY: // last modification date | 1170 | case ICAL_LASTMODIFIED_PROPERTY: // last modification date |
1171 | icaltime = icalproperty_get_lastmodified(p); | 1171 | icaltime = icalproperty_get_lastmodified(p); |
1172 | incidence->setLastModified(readICalDateTime(icaltime)); | 1172 | incidence->setLastModified(readICalDateTime(icaltime)); |
1173 | break; | 1173 | break; |
1174 | 1174 | ||
1175 | case ICAL_DTSTART_PROPERTY: // start date and time | 1175 | case ICAL_DTSTART_PROPERTY: // start date and time |
1176 | icaltime = icalproperty_get_dtstart(p); | 1176 | icaltime = icalproperty_get_dtstart(p); |
1177 | if (icaltime.is_date) { | 1177 | if (icaltime.is_date) { |
1178 | incidence->setDtStart(QDateTime(readICalDate(icaltime),QTime(0,0,0))); | 1178 | incidence->setDtStart(QDateTime(readICalDate(icaltime),QTime(0,0,0))); |
1179 | incidence->setFloats(true); | 1179 | incidence->setFloats(true); |
1180 | } else { | 1180 | } else { |
1181 | incidence->setDtStart(readICalDateTime(icaltime)); | 1181 | incidence->setDtStart(readICalDateTime(icaltime)); |
1182 | } | 1182 | } |
1183 | break; | 1183 | break; |
1184 | 1184 | ||
1185 | case ICAL_DURATION_PROPERTY: // start date and time | 1185 | case ICAL_DURATION_PROPERTY: // start date and time |
1186 | icalduration = icalproperty_get_duration(p); | 1186 | icalduration = icalproperty_get_duration(p); |
1187 | incidence->setDuration(readICalDuration(icalduration)); | 1187 | incidence->setDuration(readICalDuration(icalduration)); |
1188 | break; | 1188 | break; |
1189 | 1189 | ||
1190 | case ICAL_DESCRIPTION_PROPERTY: // description | 1190 | case ICAL_DESCRIPTION_PROPERTY: // description |
1191 | text = icalproperty_get_description(p); | 1191 | text = icalproperty_get_description(p); |
1192 | incidence->setDescription(QString::fromUtf8(text)); | 1192 | incidence->setDescription(QString::fromUtf8(text)); |
1193 | break; | 1193 | break; |
1194 | 1194 | ||
1195 | case ICAL_SUMMARY_PROPERTY: // summary | 1195 | case ICAL_SUMMARY_PROPERTY: // summary |
1196 | { | 1196 | { |
1197 | text = icalproperty_get_summary(p); | 1197 | text = icalproperty_get_summary(p); |
@@ -1755,403 +1755,406 @@ QDateTime ICalFormatImpl::readICalDateTime(icaltimetype t) | |||
1755 | { | 1755 | { |
1756 | QDateTime dt (QDate(t.year,t.month,t.day), | 1756 | QDateTime dt (QDate(t.year,t.month,t.day), |
1757 | QTime(t.hour,t.minute,t.second) ); | 1757 | QTime(t.hour,t.minute,t.second) ); |
1758 | 1758 | ||
1759 | if (t.is_utc) { | 1759 | if (t.is_utc) { |
1760 | int offset = KGlobal::locale()->localTimeOffset( dt ); | 1760 | int offset = KGlobal::locale()->localTimeOffset( dt ); |
1761 | dt = dt.addSecs ( offset*60); | 1761 | dt = dt.addSecs ( offset*60); |
1762 | } | 1762 | } |
1763 | 1763 | ||
1764 | return dt; | 1764 | return dt; |
1765 | } | 1765 | } |
1766 | 1766 | ||
1767 | QDate ICalFormatImpl::readICalDate(icaltimetype t) | 1767 | QDate ICalFormatImpl::readICalDate(icaltimetype t) |
1768 | { | 1768 | { |
1769 | return QDate(t.year,t.month,t.day); | 1769 | return QDate(t.year,t.month,t.day); |
1770 | } | 1770 | } |
1771 | 1771 | ||
1772 | icaldurationtype ICalFormatImpl::writeICalDuration(int seconds) | 1772 | icaldurationtype ICalFormatImpl::writeICalDuration(int seconds) |
1773 | { | 1773 | { |
1774 | icaldurationtype d; | 1774 | icaldurationtype d; |
1775 | 1775 | ||
1776 | d.is_neg = (seconds<0)?1:0; | 1776 | d.is_neg = (seconds<0)?1:0; |
1777 | if (seconds<0) seconds = -seconds; | 1777 | if (seconds<0) seconds = -seconds; |
1778 | 1778 | ||
1779 | d.weeks = seconds / gSecondsPerWeek; | 1779 | d.weeks = seconds / gSecondsPerWeek; |
1780 | seconds %= gSecondsPerWeek; | 1780 | seconds %= gSecondsPerWeek; |
1781 | d.days = seconds / gSecondsPerDay; | 1781 | d.days = seconds / gSecondsPerDay; |
1782 | seconds %= gSecondsPerDay; | 1782 | seconds %= gSecondsPerDay; |
1783 | d.hours = seconds / gSecondsPerHour; | 1783 | d.hours = seconds / gSecondsPerHour; |
1784 | seconds %= gSecondsPerHour; | 1784 | seconds %= gSecondsPerHour; |
1785 | d.minutes = seconds / gSecondsPerMinute; | 1785 | d.minutes = seconds / gSecondsPerMinute; |
1786 | seconds %= gSecondsPerMinute; | 1786 | seconds %= gSecondsPerMinute; |
1787 | d.seconds = seconds; | 1787 | d.seconds = seconds; |
1788 | return d; | 1788 | return d; |
1789 | } | 1789 | } |
1790 | 1790 | ||
1791 | int ICalFormatImpl::readICalDuration(icaldurationtype d) | 1791 | int ICalFormatImpl::readICalDuration(icaldurationtype d) |
1792 | { | 1792 | { |
1793 | int result = 0; | 1793 | int result = 0; |
1794 | 1794 | ||
1795 | result += d.weeks * gSecondsPerWeek; | 1795 | result += d.weeks * gSecondsPerWeek; |
1796 | result += d.days * gSecondsPerDay; | 1796 | result += d.days * gSecondsPerDay; |
1797 | result += d.hours * gSecondsPerHour; | 1797 | result += d.hours * gSecondsPerHour; |
1798 | result += d.minutes * gSecondsPerMinute; | 1798 | result += d.minutes * gSecondsPerMinute; |
1799 | result += d.seconds; | 1799 | result += d.seconds; |
1800 | 1800 | ||
1801 | if (d.is_neg) result *= -1; | 1801 | if (d.is_neg) result *= -1; |
1802 | 1802 | ||
1803 | return result; | 1803 | return result; |
1804 | } | 1804 | } |
1805 | 1805 | ||
1806 | icalcomponent *ICalFormatImpl::createCalendarComponent(Calendar *cal) | 1806 | icalcomponent *ICalFormatImpl::createCalendarComponent(Calendar *cal) |
1807 | { | 1807 | { |
1808 | icalcomponent *calendar; | 1808 | icalcomponent *calendar; |
1809 | 1809 | ||
1810 | // Root component | 1810 | // Root component |
1811 | calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT); | 1811 | calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT); |
1812 | 1812 | ||
1813 | icalproperty *p; | 1813 | icalproperty *p; |
1814 | 1814 | ||
1815 | // Product Identifier | 1815 | // Product Identifier |
1816 | p = icalproperty_new_prodid(CalFormat::productId().utf8()); | 1816 | p = icalproperty_new_prodid(CalFormat::productId().utf8()); |
1817 | icalcomponent_add_property(calendar,p); | 1817 | icalcomponent_add_property(calendar,p); |
1818 | 1818 | ||
1819 | // TODO: Add time zone | 1819 | // TODO: Add time zone |
1820 | 1820 | ||
1821 | // iCalendar version (2.0) | 1821 | // iCalendar version (2.0) |
1822 | p = icalproperty_new_version(const_cast<char *>(_ICAL_VERSION)); | 1822 | p = icalproperty_new_version(const_cast<char *>(_ICAL_VERSION)); |
1823 | icalcomponent_add_property(calendar,p); | 1823 | icalcomponent_add_property(calendar,p); |
1824 | 1824 | ||
1825 | // Custom properties | 1825 | // Custom properties |
1826 | if( cal != 0 ) | 1826 | if( cal != 0 ) |
1827 | writeCustomProperties(calendar, cal); | 1827 | writeCustomProperties(calendar, cal); |
1828 | 1828 | ||
1829 | return calendar; | 1829 | return calendar; |
1830 | } | 1830 | } |
1831 | 1831 | ||
1832 | 1832 | ||
1833 | 1833 | ||
1834 | // take a raw vcalendar (i.e. from a file on disk, clipboard, etc. etc. | 1834 | // take a raw vcalendar (i.e. from a file on disk, clipboard, etc. etc. |
1835 | // and break it down from its tree-like format into the dictionary format | 1835 | // and break it down from its tree-like format into the dictionary format |
1836 | // that is used internally in the ICalFormatImpl. | 1836 | // that is used internally in the ICalFormatImpl. |
1837 | bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar) | 1837 | bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar) |
1838 | { | 1838 | { |
1839 | // this function will populate the caldict dictionary and other event | 1839 | // this function will populate the caldict dictionary and other event |
1840 | // lists. It turns vevents into Events and then inserts them. | 1840 | // lists. It turns vevents into Events and then inserts them. |
1841 | 1841 | ||
1842 | if (!calendar) return false; | 1842 | if (!calendar) return false; |
1843 | 1843 | ||
1844 | // TODO: check for METHOD | 1844 | // TODO: check for METHOD |
1845 | #if 0 | 1845 | #if 0 |
1846 | if ((curVO = isAPropertyOf(vcal, ICMethodProp)) != 0) { | 1846 | if ((curVO = isAPropertyOf(vcal, ICMethodProp)) != 0) { |
1847 | char *methodType = 0; | 1847 | char *methodType = 0; |
1848 | methodType = fakeCString(vObjectUStringZValue(curVO)); | 1848 | methodType = fakeCString(vObjectUStringZValue(curVO)); |
1849 | if (mEnableDialogs) | 1849 | if (mEnableDialogs) |
1850 | KMessageBox::information(mTopWidget, | 1850 | KMessageBox::information(mTopWidget, |
1851 | i18n("This calendar is an iTIP transaction of type \"%1\".") | 1851 | i18n("This calendar is an iTIP transaction of type \"%1\".") |
1852 | .arg(methodType), | 1852 | .arg(methodType), |
1853 | i18n("%1: iTIP Transaction").arg(CalFormat::application())); | 1853 | i18n("%1: iTIP Transaction").arg(CalFormat::application())); |
1854 | delete methodType; | 1854 | delete methodType; |
1855 | } | 1855 | } |
1856 | #endif | 1856 | #endif |
1857 | 1857 | ||
1858 | icalproperty *p; | 1858 | icalproperty *p; |
1859 | 1859 | ||
1860 | p = icalcomponent_get_first_property(calendar,ICAL_PRODID_PROPERTY); | 1860 | p = icalcomponent_get_first_property(calendar,ICAL_PRODID_PROPERTY); |
1861 | if (!p) { | 1861 | if (!p) { |
1862 | // TODO: does no PRODID really matter? | 1862 | // TODO: does no PRODID really matter? |
1863 | // mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); | 1863 | // mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); |
1864 | // return false; | 1864 | // return false; |
1865 | mLoadedProductId = ""; | 1865 | mLoadedProductId = ""; |
1866 | mCalendarVersion = 0; | 1866 | mCalendarVersion = 0; |
1867 | } else { | 1867 | } else { |
1868 | mLoadedProductId = QString::fromUtf8(icalproperty_get_prodid(p)); | 1868 | mLoadedProductId = QString::fromUtf8(icalproperty_get_prodid(p)); |
1869 | mCalendarVersion = CalFormat::calendarVersion(mLoadedProductId); | 1869 | mCalendarVersion = CalFormat::calendarVersion(mLoadedProductId); |
1870 | 1870 | ||
1871 | delete mCompat; | 1871 | delete mCompat; |
1872 | mCompat = CompatFactory::createCompat( mLoadedProductId ); | 1872 | mCompat = CompatFactory::createCompat( mLoadedProductId ); |
1873 | } | 1873 | } |
1874 | 1874 | ||
1875 | // TODO: check for unknown PRODID | 1875 | // TODO: check for unknown PRODID |
1876 | #if 0 | 1876 | #if 0 |
1877 | if (!mCalendarVersion | 1877 | if (!mCalendarVersion |
1878 | && CalFormat::productId() != mLoadedProductId) { | 1878 | && CalFormat::productId() != mLoadedProductId) { |
1879 | // warn the user that we might have trouble reading non-known calendar. | 1879 | // warn the user that we might have trouble reading non-known calendar. |
1880 | if (mEnableDialogs) | 1880 | if (mEnableDialogs) |
1881 | KMessageBox::information(mTopWidget, | 1881 | KMessageBox::information(mTopWidget, |
1882 | i18n("This vCalendar file was not created by KOrganizer " | 1882 | i18n("This vCalendar file was not created by KOrganizer " |
1883 | "or any other product we support. Loading anyway..."), | 1883 | "or any other product we support. Loading anyway..."), |
1884 | i18n("%1: Unknown vCalendar Vendor").arg(CalFormat::application())); | 1884 | i18n("%1: Unknown vCalendar Vendor").arg(CalFormat::application())); |
1885 | } | 1885 | } |
1886 | #endif | 1886 | #endif |
1887 | 1887 | ||
1888 | p = icalcomponent_get_first_property(calendar,ICAL_VERSION_PROPERTY); | 1888 | p = icalcomponent_get_first_property(calendar,ICAL_VERSION_PROPERTY); |
1889 | if (!p) { | 1889 | if (!p) { |
1890 | mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); | 1890 | mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); |
1891 | return false; | 1891 | return false; |
1892 | } else { | 1892 | } else { |
1893 | const char *version = icalproperty_get_version(p); | 1893 | const char *version = icalproperty_get_version(p); |
1894 | 1894 | ||
1895 | if (strcmp(version,"1.0") == 0) { | 1895 | if (strcmp(version,"1.0") == 0) { |
1896 | mParent->setException(new ErrorFormat(ErrorFormat::CalVersion1, | 1896 | mParent->setException(new ErrorFormat(ErrorFormat::CalVersion1, |
1897 | i18n("Expected iCalendar format"))); | 1897 | i18n("Expected iCalendar format"))); |
1898 | return false; | 1898 | return false; |
1899 | } else if (strcmp(version,"2.0") != 0) { | 1899 | } else if (strcmp(version,"2.0") != 0) { |
1900 | mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); | 1900 | mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); |
1901 | return false; | 1901 | return false; |
1902 | } | 1902 | } |
1903 | } | 1903 | } |
1904 | 1904 | ||
1905 | 1905 | ||
1906 | // TODO: check for calendar format version | 1906 | // TODO: check for calendar format version |
1907 | #if 0 | 1907 | #if 0 |
1908 | // warn the user we might have trouble reading this unknown version. | 1908 | // warn the user we might have trouble reading this unknown version. |
1909 | if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != 0) { | 1909 | if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != 0) { |
1910 | char *s = fakeCString(vObjectUStringZValue(curVO)); | 1910 | char *s = fakeCString(vObjectUStringZValue(curVO)); |
1911 | if (strcmp(_VCAL_VERSION, s) != 0) | 1911 | if (strcmp(_VCAL_VERSION, s) != 0) |
1912 | if (mEnableDialogs) | 1912 | if (mEnableDialogs) |
1913 | KMessageBox::sorry(mTopWidget, | 1913 | KMessageBox::sorry(mTopWidget, |
1914 | i18n("This vCalendar file has version %1.\n" | 1914 | i18n("This vCalendar file has version %1.\n" |
1915 | "We only support %2.") | 1915 | "We only support %2.") |
1916 | .arg(s).arg(_VCAL_VERSION), | 1916 | .arg(s).arg(_VCAL_VERSION), |
1917 | i18n("%1: Unknown vCalendar Version").arg(CalFormat::application())); | 1917 | i18n("%1: Unknown vCalendar Version").arg(CalFormat::application())); |
1918 | deleteStr(s); | 1918 | deleteStr(s); |
1919 | } | 1919 | } |
1920 | #endif | 1920 | #endif |
1921 | 1921 | ||
1922 | // custom properties | 1922 | // custom properties |
1923 | readCustomProperties(calendar, cal); | 1923 | readCustomProperties(calendar, cal); |
1924 | 1924 | ||
1925 | // TODO: set time zone | 1925 | // TODO: set time zone |
1926 | #if 0 | 1926 | #if 0 |
1927 | // set the time zone | 1927 | // set the time zone |
1928 | if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) { | 1928 | if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) { |
1929 | char *s = fakeCString(vObjectUStringZValue(curVO)); | 1929 | char *s = fakeCString(vObjectUStringZValue(curVO)); |
1930 | cal->setTimeZone(s); | 1930 | cal->setTimeZone(s); |
1931 | deleteStr(s); | 1931 | deleteStr(s); |
1932 | } | 1932 | } |
1933 | #endif | 1933 | #endif |
1934 | 1934 | ||
1935 | // Store all events with a relatedTo property in a list for post-processing | 1935 | // Store all events with a relatedTo property in a list for post-processing |
1936 | mEventsRelate.clear(); | 1936 | mEventsRelate.clear(); |
1937 | mTodosRelate.clear(); | 1937 | mTodosRelate.clear(); |
1938 | // TODO: make sure that only actually added ecvens go to this lists. | 1938 | // TODO: make sure that only actually added ecvens go to this lists. |
1939 | 1939 | ||
1940 | icalcomponent *c; | 1940 | icalcomponent *c; |
1941 | 1941 | ||
1942 | // Iterate through all todos | 1942 | // Iterate through all todos |
1943 | c = icalcomponent_get_first_component(calendar,ICAL_VTODO_COMPONENT); | 1943 | c = icalcomponent_get_first_component(calendar,ICAL_VTODO_COMPONENT); |
1944 | while (c) { | 1944 | while (c) { |
1945 | // kdDebug(5800) << "----Todo found" << endl; | 1945 | // kdDebug(5800) << "----Todo found" << endl; |
1946 | Todo *todo = readTodo(c); | 1946 | Todo *todo = readTodo(c); |
1947 | if (!cal->todo(todo->uid())) cal->addTodo(todo); | 1947 | if (!cal->todo(todo->uid())) |
1948 | cal->addTodo(todo); | ||
1948 | c = icalcomponent_get_next_component(calendar,ICAL_VTODO_COMPONENT); | 1949 | c = icalcomponent_get_next_component(calendar,ICAL_VTODO_COMPONENT); |
1949 | } | 1950 | } |
1950 | 1951 | ||
1951 | // Iterate through all events | 1952 | // Iterate through all events |
1952 | c = icalcomponent_get_first_component(calendar,ICAL_VEVENT_COMPONENT); | 1953 | c = icalcomponent_get_first_component(calendar,ICAL_VEVENT_COMPONENT); |
1953 | while (c) { | 1954 | while (c) { |
1954 | // kdDebug(5800) << "----Event found" << endl; | 1955 | // kdDebug(5800) << "----Event found" << endl; |
1955 | Event *event = readEvent(c); | 1956 | Event *event = readEvent(c); |
1956 | if (!cal->event(event->uid())) cal->addEvent(event); | 1957 | if (!cal->event(event->uid())) |
1958 | cal->addEvent(event); | ||
1957 | c = icalcomponent_get_next_component(calendar,ICAL_VEVENT_COMPONENT); | 1959 | c = icalcomponent_get_next_component(calendar,ICAL_VEVENT_COMPONENT); |
1958 | } | 1960 | } |
1959 | 1961 | ||
1960 | // Iterate through all journals | 1962 | // Iterate through all journals |
1961 | c = icalcomponent_get_first_component(calendar,ICAL_VJOURNAL_COMPONENT); | 1963 | c = icalcomponent_get_first_component(calendar,ICAL_VJOURNAL_COMPONENT); |
1962 | while (c) { | 1964 | while (c) { |
1963 | // kdDebug(5800) << "----Journal found" << endl; | 1965 | // kdDebug(5800) << "----Journal found" << endl; |
1964 | Journal *journal = readJournal(c); | 1966 | Journal *journal = readJournal(c); |
1965 | if (!cal->journal(journal->uid())) cal->addJournal(journal); | 1967 | if (!cal->journal(journal->uid())) |
1968 | cal->addJournal(journal); | ||
1966 | c = icalcomponent_get_next_component(calendar,ICAL_VJOURNAL_COMPONENT); | 1969 | c = icalcomponent_get_next_component(calendar,ICAL_VJOURNAL_COMPONENT); |
1967 | } | 1970 | } |
1968 | 1971 | ||
1969 | #if 0 | 1972 | #if 0 |
1970 | initPropIterator(&i, vcal); | 1973 | initPropIterator(&i, vcal); |
1971 | 1974 | ||
1972 | // go through all the vobjects in the vcal | 1975 | // go through all the vobjects in the vcal |
1973 | while (moreIteration(&i)) { | 1976 | while (moreIteration(&i)) { |
1974 | curVO = nextVObject(&i); | 1977 | curVO = nextVObject(&i); |
1975 | 1978 | ||
1976 | /************************************************************************/ | 1979 | /************************************************************************/ |
1977 | 1980 | ||
1978 | // now, check to see that the object is an event or todo. | 1981 | // now, check to see that the object is an event or todo. |
1979 | if (strcmp(vObjectName(curVO), VCEventProp) == 0) { | 1982 | if (strcmp(vObjectName(curVO), VCEventProp) == 0) { |
1980 | 1983 | ||
1981 | if ((curVOProp = isAPropertyOf(curVO, KPilotStatusProp)) != 0) { | 1984 | if ((curVOProp = isAPropertyOf(curVO, KPilotStatusProp)) != 0) { |
1982 | char *s; | 1985 | char *s; |
1983 | s = fakeCString(vObjectUStringZValue(curVOProp)); | 1986 | s = fakeCString(vObjectUStringZValue(curVOProp)); |
1984 | // check to see if event was deleted by the kpilot conduit | 1987 | // check to see if event was deleted by the kpilot conduit |
1985 | if (atoi(s) == Event::SYNCDEL) { | 1988 | if (atoi(s) == Event::SYNCDEL) { |
1986 | deleteStr(s); | 1989 | deleteStr(s); |
1987 | goto SKIP; | 1990 | goto SKIP; |
1988 | } | 1991 | } |
1989 | deleteStr(s); | 1992 | deleteStr(s); |
1990 | } | 1993 | } |
1991 | 1994 | ||
1992 | // this code checks to see if we are trying to read in an event | 1995 | // this code checks to see if we are trying to read in an event |
1993 | // that we already find to be in the calendar. If we find this | 1996 | // that we already find to be in the calendar. If we find this |
1994 | // to be the case, we skip the event. | 1997 | // to be the case, we skip the event. |
1995 | if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) { | 1998 | if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) { |
1996 | char *s = fakeCString(vObjectUStringZValue(curVOProp)); | 1999 | char *s = fakeCString(vObjectUStringZValue(curVOProp)); |
1997 | QString tmpStr(s); | 2000 | QString tmpStr(s); |
1998 | deleteStr(s); | 2001 | deleteStr(s); |
1999 | 2002 | ||
2000 | if (cal->event(tmpStr)) { | 2003 | if (cal->event(tmpStr)) { |
2001 | goto SKIP; | 2004 | goto SKIP; |
2002 | } | 2005 | } |
2003 | if (cal->todo(tmpStr)) { | 2006 | if (cal->todo(tmpStr)) { |
2004 | goto SKIP; | 2007 | goto SKIP; |
2005 | } | 2008 | } |
2006 | } | 2009 | } |
2007 | 2010 | ||
2008 | if ((!(curVOProp = isAPropertyOf(curVO, VCDTstartProp))) && | 2011 | if ((!(curVOProp = isAPropertyOf(curVO, VCDTstartProp))) && |
2009 | (!(curVOProp = isAPropertyOf(curVO, VCDTendProp)))) { | 2012 | (!(curVOProp = isAPropertyOf(curVO, VCDTendProp)))) { |
2010 | kdDebug(5800) << "found a VEvent with no DTSTART and no DTEND! Skipping..." << endl; | 2013 | kdDebug(5800) << "found a VEvent with no DTSTART and no DTEND! Skipping..." << endl; |
2011 | goto SKIP; | 2014 | goto SKIP; |
2012 | } | 2015 | } |
2013 | 2016 | ||
2014 | anEvent = VEventToEvent(curVO); | 2017 | anEvent = VEventToEvent(curVO); |
2015 | // we now use addEvent instead of insertEvent so that the | 2018 | // we now use addEvent instead of insertEvent so that the |
2016 | // signal/slot get connected. | 2019 | // signal/slot get connected. |
2017 | if (anEvent) | 2020 | if (anEvent) |
2018 | cal->addEvent(anEvent); | 2021 | cal->addEvent(anEvent); |
2019 | else { | 2022 | else { |
2020 | // some sort of error must have occurred while in translation. | 2023 | // some sort of error must have occurred while in translation. |
2021 | goto SKIP; | 2024 | goto SKIP; |
2022 | } | 2025 | } |
2023 | } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { | 2026 | } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { |
2024 | anEvent = VTodoToEvent(curVO); | 2027 | anEvent = VTodoToEvent(curVO); |
2025 | cal->addTodo(anEvent); | 2028 | cal->addTodo(anEvent); |
2026 | } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || | 2029 | } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || |
2027 | (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || | 2030 | (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || |
2028 | (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { | 2031 | (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { |
2029 | // do nothing, we know these properties and we want to skip them. | 2032 | // do nothing, we know these properties and we want to skip them. |
2030 | // we have either already processed them or are ignoring them. | 2033 | // we have either already processed them or are ignoring them. |
2031 | ; | 2034 | ; |
2032 | } else { | 2035 | } else { |
2033 | ; | 2036 | ; |
2034 | } | 2037 | } |
2035 | SKIP: | 2038 | SKIP: |
2036 | ; | 2039 | ; |
2037 | } // while | 2040 | } // while |
2038 | #endif | 2041 | #endif |
2039 | 2042 | ||
2040 | // Post-Process list of events with relations, put Event objects in relation | 2043 | // Post-Process list of events with relations, put Event objects in relation |
2041 | Event *ev; | 2044 | Event *ev; |
2042 | for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { | 2045 | for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { |
2043 | Incidence * inc = cal->event(ev->relatedToUid()); | 2046 | Incidence * inc = cal->event(ev->relatedToUid()); |
2044 | if ( inc ) | 2047 | if ( inc ) |
2045 | ev->setRelatedTo( inc ); | 2048 | ev->setRelatedTo( inc ); |
2046 | } | 2049 | } |
2047 | Todo *todo; | 2050 | Todo *todo; |
2048 | for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { | 2051 | for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { |
2049 | Incidence * inc = cal->todo(todo->relatedToUid()); | 2052 | Incidence * inc = cal->todo(todo->relatedToUid()); |
2050 | if ( inc ) | 2053 | if ( inc ) |
2051 | todo->setRelatedTo( inc ); | 2054 | todo->setRelatedTo( inc ); |
2052 | } | 2055 | } |
2053 | 2056 | ||
2054 | return true; | 2057 | return true; |
2055 | } | 2058 | } |
2056 | 2059 | ||
2057 | QString ICalFormatImpl::extractErrorProperty(icalcomponent *c) | 2060 | QString ICalFormatImpl::extractErrorProperty(icalcomponent *c) |
2058 | { | 2061 | { |
2059 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " | 2062 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " |
2060 | // << icalcomponent_as_ical_string(c) << endl; | 2063 | // << icalcomponent_as_ical_string(c) << endl; |
2061 | 2064 | ||
2062 | QString errorMessage; | 2065 | QString errorMessage; |
2063 | 2066 | ||
2064 | icalproperty *error; | 2067 | icalproperty *error; |
2065 | error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY); | 2068 | error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY); |
2066 | while(error) { | 2069 | while(error) { |
2067 | errorMessage += icalproperty_get_xlicerror(error); | 2070 | errorMessage += icalproperty_get_xlicerror(error); |
2068 | errorMessage += "\n"; | 2071 | errorMessage += "\n"; |
2069 | error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY); | 2072 | error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY); |
2070 | } | 2073 | } |
2071 | 2074 | ||
2072 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " << errorMessage << endl; | 2075 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " << errorMessage << endl; |
2073 | 2076 | ||
2074 | return errorMessage; | 2077 | return errorMessage; |
2075 | } | 2078 | } |
2076 | 2079 | ||
2077 | void ICalFormatImpl::dumpIcalRecurrence(icalrecurrencetype r) | 2080 | void ICalFormatImpl::dumpIcalRecurrence(icalrecurrencetype r) |
2078 | { | 2081 | { |
2079 | int i; | 2082 | int i; |
2080 | 2083 | ||
2081 | 2084 | ||
2082 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2085 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2083 | int index = 0; | 2086 | int index = 0; |
2084 | QString out = " By Day: "; | 2087 | QString out = " By Day: "; |
2085 | while((i = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2088 | while((i = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2086 | out.append(QString::number(i) + " "); | 2089 | out.append(QString::number(i) + " "); |
2087 | } | 2090 | } |
2088 | } | 2091 | } |
2089 | if (r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2092 | if (r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2090 | int index = 0; | 2093 | int index = 0; |
2091 | QString out = " By Month Day: "; | 2094 | QString out = " By Month Day: "; |
2092 | while((i = r.by_month_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2095 | while((i = r.by_month_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2093 | out.append(QString::number(i) + " "); | 2096 | out.append(QString::number(i) + " "); |
2094 | } | 2097 | } |
2095 | } | 2098 | } |
2096 | if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2099 | if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2097 | int index = 0; | 2100 | int index = 0; |
2098 | QString out = " By Year Day: "; | 2101 | QString out = " By Year Day: "; |
2099 | while((i = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2102 | while((i = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2100 | out.append(QString::number(i) + " "); | 2103 | out.append(QString::number(i) + " "); |
2101 | } | 2104 | } |
2102 | } | 2105 | } |
2103 | if (r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2106 | if (r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2104 | int index = 0; | 2107 | int index = 0; |
2105 | QString out = " By Month: "; | 2108 | QString out = " By Month: "; |
2106 | while((i = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2109 | while((i = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2107 | out.append(QString::number(i) + " "); | 2110 | out.append(QString::number(i) + " "); |
2108 | } | 2111 | } |
2109 | } | 2112 | } |
2110 | if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2113 | if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2111 | int index = 0; | 2114 | int index = 0; |
2112 | QString out = " By Set Pos: "; | 2115 | QString out = " By Set Pos: "; |
2113 | while((i = r.by_set_pos[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2116 | while((i = r.by_set_pos[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2114 | out.append(QString::number(i) + " "); | 2117 | out.append(QString::number(i) + " "); |
2115 | } | 2118 | } |
2116 | } | 2119 | } |
2117 | } | 2120 | } |
2118 | 2121 | ||
2119 | icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence, | 2122 | icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence, |
2120 | Scheduler::Method method) | 2123 | Scheduler::Method method) |
2121 | { | 2124 | { |
2122 | icalcomponent *message = createCalendarComponent(); | 2125 | icalcomponent *message = createCalendarComponent(); |
2123 | 2126 | ||
2124 | icalproperty_method icalmethod = ICAL_METHOD_NONE; | 2127 | icalproperty_method icalmethod = ICAL_METHOD_NONE; |
2125 | 2128 | ||
2126 | switch (method) { | 2129 | switch (method) { |
2127 | case Scheduler::Publish: | 2130 | case Scheduler::Publish: |
2128 | icalmethod = ICAL_METHOD_PUBLISH; | 2131 | icalmethod = ICAL_METHOD_PUBLISH; |
2129 | break; | 2132 | break; |
2130 | case Scheduler::Request: | 2133 | case Scheduler::Request: |
2131 | icalmethod = ICAL_METHOD_REQUEST; | 2134 | icalmethod = ICAL_METHOD_REQUEST; |
2132 | break; | 2135 | break; |
2133 | case Scheduler::Refresh: | 2136 | case Scheduler::Refresh: |
2134 | icalmethod = ICAL_METHOD_REFRESH; | 2137 | icalmethod = ICAL_METHOD_REFRESH; |
2135 | break; | 2138 | break; |
2136 | case Scheduler::Cancel: | 2139 | case Scheduler::Cancel: |
2137 | icalmethod = ICAL_METHOD_CANCEL; | 2140 | icalmethod = ICAL_METHOD_CANCEL; |
2138 | break; | 2141 | break; |
2139 | case Scheduler::Add: | 2142 | case Scheduler::Add: |
2140 | icalmethod = ICAL_METHOD_ADD; | 2143 | icalmethod = ICAL_METHOD_ADD; |
2141 | break; | 2144 | break; |
2142 | case Scheduler::Reply: | 2145 | case Scheduler::Reply: |
2143 | icalmethod = ICAL_METHOD_REPLY; | 2146 | icalmethod = ICAL_METHOD_REPLY; |
2144 | break; | 2147 | break; |
2145 | case Scheduler::Counter: | 2148 | case Scheduler::Counter: |
2146 | icalmethod = ICAL_METHOD_COUNTER; | 2149 | icalmethod = ICAL_METHOD_COUNTER; |
2147 | break; | 2150 | break; |
2148 | case Scheduler::Declinecounter: | 2151 | case Scheduler::Declinecounter: |
2149 | icalmethod = ICAL_METHOD_DECLINECOUNTER; | 2152 | icalmethod = ICAL_METHOD_DECLINECOUNTER; |
2150 | break; | 2153 | break; |
2151 | default: | 2154 | default: |
2152 | 2155 | ||
2153 | return message; | 2156 | return message; |
2154 | } | 2157 | } |
2155 | 2158 | ||
2156 | icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); | 2159 | icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); |
2157 | 2160 | ||
diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp index 859161f..c4e4474 100644 --- a/libkcal/journal.cpp +++ b/libkcal/journal.cpp | |||
@@ -1,49 +1,51 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "journal.h" | 21 | #include "journal.h" |
22 | 22 | ||
23 | using namespace KCal; | 23 | using namespace KCal; |
24 | 24 | ||
25 | Journal::Journal() | 25 | Journal::Journal() |
26 | { | 26 | { |
27 | qDebug("New JJJ "); | ||
27 | } | 28 | } |
28 | 29 | ||
29 | Journal::~Journal() | 30 | Journal::~Journal() |
30 | { | 31 | { |
32 | qDebug("delete JJJ "); | ||
31 | } | 33 | } |
32 | 34 | ||
33 | Incidence *Journal::clone() | 35 | Incidence *Journal::clone() |
34 | { | 36 | { |
35 | return new Journal(*this); | 37 | return new Journal(*this); |
36 | } | 38 | } |
37 | 39 | ||
38 | 40 | ||
39 | bool KCal::operator==( const Journal& j1, const Journal& j2 ) | 41 | bool KCal::operator==( const Journal& j1, const Journal& j2 ) |
40 | { | 42 | { |
41 | return operator==( (const Incidence&)j1, (const Incidence&)j2 ); | 43 | return operator==( (const Incidence&)j1, (const Incidence&)j2 ); |
42 | } | 44 | } |
43 | 45 | ||
44 | 46 | ||
45 | QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const | 47 | QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const |
46 | { | 48 | { |
47 | *ok = false; | 49 | *ok = false; |
48 | return QDateTime (); | 50 | return QDateTime (); |
49 | } | 51 | } |