-rw-r--r-- | libkcal/calendar.cpp | 6 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 6 | ||||
-rw-r--r-- | libkcal/calfilter.cpp | 6 | ||||
-rw-r--r-- | libkcal/event.h | 1 | ||||
-rw-r--r-- | libkcal/freebusy.h | 1 | ||||
-rw-r--r-- | libkcal/icalformat.cpp | 4 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 6 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 6 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 2 | ||||
-rw-r--r-- | libkcal/journal.h | 1 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 4 | ||||
-rw-r--r-- | libkcal/todo.cpp | 5 | ||||
-rw-r--r-- | libkcal/todo.h | 1 |
13 files changed, 26 insertions, 23 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index ed39ddb..7e8e2c5 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -292,133 +292,133 @@ void Calendar::resetTempSyncStat() | |||
292 | QPtrList<Incidence> Calendar::rawIncidences() | 292 | QPtrList<Incidence> Calendar::rawIncidences() |
293 | { | 293 | { |
294 | QPtrList<Incidence> incidences; | 294 | QPtrList<Incidence> incidences; |
295 | 295 | ||
296 | Incidence *i; | 296 | Incidence *i; |
297 | 297 | ||
298 | QPtrList<Event> e = rawEvents(); | 298 | QPtrList<Event> e = rawEvents(); |
299 | for( i = e.first(); i; i = e.next() ) incidences.append( i ); | 299 | for( i = e.first(); i; i = e.next() ) incidences.append( i ); |
300 | 300 | ||
301 | QPtrList<Todo> t = rawTodos(); | 301 | QPtrList<Todo> t = rawTodos(); |
302 | for( i = t.first(); i; i = t.next() ) incidences.append( i ); | 302 | for( i = t.first(); i; i = t.next() ) incidences.append( i ); |
303 | 303 | ||
304 | QPtrList<Journal> j = journals(); | 304 | QPtrList<Journal> j = journals(); |
305 | for( i = j.first(); i; i = j.next() ) incidences.append( i ); | 305 | for( i = j.first(); i; i = j.next() ) incidences.append( i ); |
306 | 306 | ||
307 | return incidences; | 307 | return incidences; |
308 | } | 308 | } |
309 | 309 | ||
310 | QPtrList<Event> Calendar::events( const QDate &date, bool sorted ) | 310 | QPtrList<Event> Calendar::events( const QDate &date, bool sorted ) |
311 | { | 311 | { |
312 | QPtrList<Event> el = rawEventsForDate(date,sorted); | 312 | QPtrList<Event> el = rawEventsForDate(date,sorted); |
313 | mFilter->apply(&el); | 313 | mFilter->apply(&el); |
314 | return el; | 314 | return el; |
315 | } | 315 | } |
316 | 316 | ||
317 | QPtrList<Event> Calendar::events( const QDateTime &qdt ) | 317 | QPtrList<Event> Calendar::events( const QDateTime &qdt ) |
318 | { | 318 | { |
319 | QPtrList<Event> el = rawEventsForDate(qdt); | 319 | QPtrList<Event> el = rawEventsForDate(qdt); |
320 | mFilter->apply(&el); | 320 | mFilter->apply(&el); |
321 | return el; | 321 | return el; |
322 | } | 322 | } |
323 | 323 | ||
324 | QPtrList<Event> Calendar::events( const QDate &start, const QDate &end, | 324 | QPtrList<Event> Calendar::events( const QDate &start, const QDate &end, |
325 | bool inclusive) | 325 | bool inclusive) |
326 | { | 326 | { |
327 | QPtrList<Event> el = rawEvents(start,end,inclusive); | 327 | QPtrList<Event> el = rawEvents(start,end,inclusive); |
328 | mFilter->apply(&el); | 328 | mFilter->apply(&el); |
329 | return el; | 329 | return el; |
330 | } | 330 | } |
331 | 331 | ||
332 | QPtrList<Event> Calendar::events() | 332 | QPtrList<Event> Calendar::events() |
333 | { | 333 | { |
334 | QPtrList<Event> el = rawEvents(); | 334 | QPtrList<Event> el = rawEvents(); |
335 | mFilter->apply(&el); | 335 | mFilter->apply(&el); |
336 | return el; | 336 | return el; |
337 | } | 337 | } |
338 | void Calendar::addIncidenceBranch(Incidence *i) | 338 | void Calendar::addIncidenceBranch(Incidence *i) |
339 | { | 339 | { |
340 | addIncidence( i ); | 340 | addIncidence( i ); |
341 | Incidence * inc; | 341 | Incidence * inc; |
342 | QPtrList<Incidence> Relations = i->relations(); | 342 | QPtrList<Incidence> Relations = i->relations(); |
343 | for (inc=Relations.first();inc;inc=Relations.next()) { | 343 | for (inc=Relations.first();inc;inc=Relations.next()) { |
344 | addIncidenceBranch( inc ); | 344 | addIncidenceBranch( inc ); |
345 | } | 345 | } |
346 | } | 346 | } |
347 | 347 | ||
348 | bool Calendar::addIncidence(Incidence *i) | 348 | bool Calendar::addIncidence(Incidence *i) |
349 | { | 349 | { |
350 | Incidence::AddVisitor<Calendar> v(this); | 350 | Incidence::AddVisitor<Calendar> v(this); |
351 | 351 | ||
352 | return i->accept(v); | 352 | return i->accept(v); |
353 | } | 353 | } |
354 | void Calendar::deleteIncidence(Incidence *in) | 354 | void Calendar::deleteIncidence(Incidence *in) |
355 | { | 355 | { |
356 | if ( in->type() == "Event" ) | 356 | if ( in->typeID() == eventID ) |
357 | deleteEvent( (Event*) in ); | 357 | deleteEvent( (Event*) in ); |
358 | else if ( in->type() =="Todo" ) | 358 | else if ( in->typeID() == todoID ) |
359 | deleteTodo( (Todo*) in); | 359 | deleteTodo( (Todo*) in); |
360 | else if ( in->type() =="Journal" ) | 360 | else if ( in->typeID() == journalID ) |
361 | deleteJournal( (Journal*) in ); | 361 | deleteJournal( (Journal*) in ); |
362 | } | 362 | } |
363 | 363 | ||
364 | Incidence* Calendar::incidence( const QString& uid ) | 364 | Incidence* Calendar::incidence( const QString& uid ) |
365 | { | 365 | { |
366 | Incidence* i; | 366 | Incidence* i; |
367 | 367 | ||
368 | if( (i = todo( uid )) != 0 ) | 368 | if( (i = todo( uid )) != 0 ) |
369 | return i; | 369 | return i; |
370 | if( (i = event( uid )) != 0 ) | 370 | if( (i = event( uid )) != 0 ) |
371 | return i; | 371 | return i; |
372 | if( (i = journal( uid )) != 0 ) | 372 | if( (i = journal( uid )) != 0 ) |
373 | return i; | 373 | return i; |
374 | 374 | ||
375 | return 0; | 375 | return 0; |
376 | } | 376 | } |
377 | 377 | ||
378 | QPtrList<Todo> Calendar::todos() | 378 | QPtrList<Todo> Calendar::todos() |
379 | { | 379 | { |
380 | QPtrList<Todo> tl = rawTodos(); | 380 | QPtrList<Todo> tl = rawTodos(); |
381 | mFilter->apply( &tl ); | 381 | mFilter->apply( &tl ); |
382 | return tl; | 382 | return tl; |
383 | } | 383 | } |
384 | 384 | ||
385 | // When this is called, the todo have already been added to the calendar. | 385 | // When this is called, the todo have already been added to the calendar. |
386 | // This method is only about linking related todos | 386 | // This method is only about linking related todos |
387 | void Calendar::setupRelations( Incidence *incidence ) | 387 | void Calendar::setupRelations( Incidence *incidence ) |
388 | { | 388 | { |
389 | QString uid = incidence->uid(); | 389 | QString uid = incidence->uid(); |
390 | //qDebug("Calendar::setupRelations "); | 390 | //qDebug("Calendar::setupRelations "); |
391 | // First, go over the list of orphans and see if this is their parent | 391 | // First, go over the list of orphans and see if this is their parent |
392 | while( Incidence* i = mOrphans[ uid ] ) { | 392 | while( Incidence* i = mOrphans[ uid ] ) { |
393 | mOrphans.remove( uid ); | 393 | mOrphans.remove( uid ); |
394 | i->setRelatedTo( incidence ); | 394 | i->setRelatedTo( incidence ); |
395 | incidence->addRelation( i ); | 395 | incidence->addRelation( i ); |
396 | mOrphanUids.remove( i->uid() ); | 396 | mOrphanUids.remove( i->uid() ); |
397 | } | 397 | } |
398 | 398 | ||
399 | // Now see about this incidences parent | 399 | // Now see about this incidences parent |
400 | if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { | 400 | if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { |
401 | // This incidence has a uid it is related to, but is not registered to it yet | 401 | // This incidence has a uid it is related to, but is not registered to it yet |
402 | // Try to find it | 402 | // Try to find it |
403 | Incidence* parent = this->incidence( incidence->relatedToUid() ); | 403 | Incidence* parent = this->incidence( incidence->relatedToUid() ); |
404 | if( parent ) { | 404 | if( parent ) { |
405 | // Found it | 405 | // Found it |
406 | incidence->setRelatedTo( parent ); | 406 | incidence->setRelatedTo( parent ); |
407 | parent->addRelation( incidence ); | 407 | parent->addRelation( incidence ); |
408 | } else { | 408 | } else { |
409 | // Not found, put this in the mOrphans list | 409 | // Not found, put this in the mOrphans list |
410 | mOrphans.insert( incidence->relatedToUid(), incidence ); | 410 | mOrphans.insert( incidence->relatedToUid(), incidence ); |
411 | mOrphanUids.insert( incidence->uid(), incidence ); | 411 | mOrphanUids.insert( incidence->uid(), incidence ); |
412 | } | 412 | } |
413 | } | 413 | } |
414 | } | 414 | } |
415 | 415 | ||
416 | // If a task with subtasks is deleted, move it's subtasks to the orphans list | 416 | // If a task with subtasks is deleted, move it's subtasks to the orphans list |
417 | void Calendar::removeRelations( Incidence *incidence ) | 417 | void Calendar::removeRelations( Incidence *incidence ) |
418 | { | 418 | { |
419 | // qDebug("Calendar::removeRelations "); | 419 | // qDebug("Calendar::removeRelations "); |
420 | QString uid = incidence->uid(); | 420 | QString uid = incidence->uid(); |
421 | 421 | ||
422 | QPtrList<Incidence> relations = incidence->relations(); | 422 | QPtrList<Incidence> relations = incidence->relations(); |
423 | for( Incidence* i = relations.first(); i; i = relations.next() ) | 423 | for( Incidence* i = relations.first(); i; i = relations.next() ) |
424 | if( !mOrphanUids.find( i->uid() ) ) { | 424 | if( !mOrphanUids.find( i->uid() ) ) { |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index bc76c0b..fe74052 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -397,160 +397,156 @@ QPtrList<Todo> CalendarLocal::todos( const QDate &date ) | |||
397 | filter()->apply( &todos ); | 397 | filter()->apply( &todos ); |
398 | return todos; | 398 | return todos; |
399 | } | 399 | } |
400 | void CalendarLocal::reInitAlarmSettings() | 400 | void CalendarLocal::reInitAlarmSettings() |
401 | { | 401 | { |
402 | if ( !mNextAlarmIncidence ) { | 402 | if ( !mNextAlarmIncidence ) { |
403 | nextAlarm( 1000 ); | 403 | nextAlarm( 1000 ); |
404 | } | 404 | } |
405 | deRegisterAlarm(); | 405 | deRegisterAlarm(); |
406 | mNextAlarmIncidence = 0; | 406 | mNextAlarmIncidence = 0; |
407 | checkAlarmForIncidence( 0, false ); | 407 | checkAlarmForIncidence( 0, false ); |
408 | 408 | ||
409 | } | 409 | } |
410 | 410 | ||
411 | 411 | ||
412 | 412 | ||
413 | QDateTime CalendarLocal::nextAlarm( int daysTo ) | 413 | QDateTime CalendarLocal::nextAlarm( int daysTo ) |
414 | { | 414 | { |
415 | QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); | 415 | QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); |
416 | QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); | 416 | QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); |
417 | QDateTime next; | 417 | QDateTime next; |
418 | Event *e; | 418 | Event *e; |
419 | bool ok; | 419 | bool ok; |
420 | bool found = false; | 420 | bool found = false; |
421 | int offset; | 421 | int offset; |
422 | mNextAlarmIncidence = 0; | 422 | mNextAlarmIncidence = 0; |
423 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 423 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
424 | next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; | 424 | next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
425 | if ( ok ) { | 425 | if ( ok ) { |
426 | if ( next < nextA ) { | 426 | if ( next < nextA ) { |
427 | nextA = next; | 427 | nextA = next; |
428 | found = true; | 428 | found = true; |
429 | mNextSummary = e->summary(); | 429 | mNextSummary = e->summary(); |
430 | mNextAlarmEventDateTime = next.addSecs(offset ) ; | 430 | mNextAlarmEventDateTime = next.addSecs(offset ) ; |
431 | mNextAlarmIncidence = (Incidence *) e; | 431 | mNextAlarmIncidence = (Incidence *) e; |
432 | } | 432 | } |
433 | } | 433 | } |
434 | } | 434 | } |
435 | Todo *t; | 435 | Todo *t; |
436 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { | 436 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { |
437 | next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; | 437 | next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
438 | if ( ok ) { | 438 | if ( ok ) { |
439 | if ( next < nextA ) { | 439 | if ( next < nextA ) { |
440 | nextA = next; | 440 | nextA = next; |
441 | found = true; | 441 | found = true; |
442 | mNextSummary = t->summary(); | 442 | mNextSummary = t->summary(); |
443 | mNextAlarmEventDateTime = next.addSecs(offset ); | 443 | mNextAlarmEventDateTime = next.addSecs(offset ); |
444 | mNextAlarmIncidence = (Incidence *) t; | 444 | mNextAlarmIncidence = (Incidence *) t; |
445 | } | 445 | } |
446 | } | 446 | } |
447 | } | 447 | } |
448 | if ( mNextAlarmIncidence ) { | 448 | if ( mNextAlarmIncidence ) { |
449 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); | 449 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); |
450 | mNextAlarmDateTime = nextA; | 450 | mNextAlarmDateTime = nextA; |
451 | } | 451 | } |
452 | return nextA; | 452 | return nextA; |
453 | } | 453 | } |
454 | Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) | 454 | Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) |
455 | { | 455 | { |
456 | return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); | 456 | return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); |
457 | } | 457 | } |
458 | 458 | ||
459 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) | 459 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) |
460 | { | 460 | { |
461 | kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - " | 461 | |
462 | << to.toString() << ")\n"; | ||
463 | |||
464 | Alarm::List alarms; | 462 | Alarm::List alarms; |
465 | 463 | ||
466 | Event *e; | 464 | Event *e; |
467 | 465 | ||
468 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 466 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
469 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); | 467 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); |
470 | else appendAlarms( alarms, e, from, to ); | 468 | else appendAlarms( alarms, e, from, to ); |
471 | } | 469 | } |
472 | 470 | ||
473 | Todo *t; | 471 | Todo *t; |
474 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { | 472 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { |
475 | appendAlarms( alarms, t, from, to ); | 473 | appendAlarms( alarms, t, from, to ); |
476 | } | 474 | } |
477 | 475 | ||
478 | return alarms; | 476 | return alarms; |
479 | } | 477 | } |
480 | 478 | ||
481 | void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, | 479 | void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, |
482 | const QDateTime &from, const QDateTime &to ) | 480 | const QDateTime &from, const QDateTime &to ) |
483 | { | 481 | { |
484 | QPtrList<Alarm> alarmList = incidence->alarms(); | 482 | QPtrList<Alarm> alarmList = incidence->alarms(); |
485 | Alarm *alarm; | 483 | Alarm *alarm; |
486 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { | 484 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { |
487 | // kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() | 485 | // kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() |
488 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; | 486 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; |
489 | if ( alarm->enabled() ) { | 487 | if ( alarm->enabled() ) { |
490 | if ( alarm->time() >= from && alarm->time() <= to ) { | 488 | if ( alarm->time() >= from && alarm->time() <= to ) { |
491 | kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary() | ||
492 | << "': " << alarm->time().toString() << endl; | ||
493 | alarms.append( alarm ); | 489 | alarms.append( alarm ); |
494 | } | 490 | } |
495 | } | 491 | } |
496 | } | 492 | } |
497 | } | 493 | } |
498 | 494 | ||
499 | void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, | 495 | void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, |
500 | Incidence *incidence, | 496 | Incidence *incidence, |
501 | const QDateTime &from, | 497 | const QDateTime &from, |
502 | const QDateTime &to ) | 498 | const QDateTime &to ) |
503 | { | 499 | { |
504 | 500 | ||
505 | QPtrList<Alarm> alarmList = incidence->alarms(); | 501 | QPtrList<Alarm> alarmList = incidence->alarms(); |
506 | Alarm *alarm; | 502 | Alarm *alarm; |
507 | QDateTime qdt; | 503 | QDateTime qdt; |
508 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { | 504 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { |
509 | if (incidence->recursOn(from.date())) { | 505 | if (incidence->recursOn(from.date())) { |
510 | qdt.setTime(alarm->time().time()); | 506 | qdt.setTime(alarm->time().time()); |
511 | qdt.setDate(from.date()); | 507 | qdt.setDate(from.date()); |
512 | } | 508 | } |
513 | else qdt = alarm->time(); | 509 | else qdt = alarm->time(); |
514 | // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1()); | 510 | // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1()); |
515 | if ( alarm->enabled() ) { | 511 | if ( alarm->enabled() ) { |
516 | if ( qdt >= from && qdt <= to ) { | 512 | if ( qdt >= from && qdt <= to ) { |
517 | alarms.append( alarm ); | 513 | alarms.append( alarm ); |
518 | } | 514 | } |
519 | } | 515 | } |
520 | } | 516 | } |
521 | } | 517 | } |
522 | 518 | ||
523 | 519 | ||
524 | /****************************** PROTECTED METHODS ****************************/ | 520 | /****************************** PROTECTED METHODS ****************************/ |
525 | 521 | ||
526 | // after changes are made to an event, this should be called. | 522 | // after changes are made to an event, this should be called. |
527 | void CalendarLocal::update( IncidenceBase *incidence ) | 523 | void CalendarLocal::update( IncidenceBase *incidence ) |
528 | { | 524 | { |
529 | incidence->setSyncStatus( Event::SYNCMOD ); | 525 | incidence->setSyncStatus( Event::SYNCMOD ); |
530 | incidence->setLastModified( QDateTime::currentDateTime() ); | 526 | incidence->setLastModified( QDateTime::currentDateTime() ); |
531 | // we should probably update the revision number here, | 527 | // we should probably update the revision number here, |
532 | // or internally in the Event itself when certain things change. | 528 | // or internally in the Event itself when certain things change. |
533 | // need to verify with ical documentation. | 529 | // need to verify with ical documentation. |
534 | 530 | ||
535 | setModified( true ); | 531 | setModified( true ); |
536 | } | 532 | } |
537 | 533 | ||
538 | void CalendarLocal::insertEvent( Event *event ) | 534 | void CalendarLocal::insertEvent( Event *event ) |
539 | { | 535 | { |
540 | if ( mEventList.findRef( event ) < 0 ) mEventList.append( event ); | 536 | if ( mEventList.findRef( event ) < 0 ) mEventList.append( event ); |
541 | } | 537 | } |
542 | 538 | ||
543 | 539 | ||
544 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted ) | 540 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted ) |
545 | { | 541 | { |
546 | QPtrList<Event> eventList; | 542 | QPtrList<Event> eventList; |
547 | 543 | ||
548 | Event *event; | 544 | Event *event; |
549 | for( event = mEventList.first(); event; event = mEventList.next() ) { | 545 | for( event = mEventList.first(); event; event = mEventList.next() ) { |
550 | if ( event->doesRecur() ) { | 546 | if ( event->doesRecur() ) { |
551 | if ( event->isMultiDay() ) { | 547 | if ( event->isMultiDay() ) { |
552 | int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); | 548 | int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); |
553 | int i; | 549 | int i; |
554 | for ( i = 0; i <= extraDays; i++ ) { | 550 | for ( i = 0; i <= extraDays; i++ ) { |
555 | if ( event->recursOn( qd.addDays( -i ) ) ) { | 551 | if ( event->recursOn( qd.addDays( -i ) ) ) { |
556 | eventList.append( event ); | 552 | eventList.append( event ); |
diff --git a/libkcal/calfilter.cpp b/libkcal/calfilter.cpp index c425dfc..20078a7 100644 --- a/libkcal/calfilter.cpp +++ b/libkcal/calfilter.cpp | |||
@@ -17,133 +17,133 @@ | |||
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 <kdebug.h> | 21 | #include <kdebug.h> |
22 | 22 | ||
23 | #include "calfilter.h" | 23 | #include "calfilter.h" |
24 | 24 | ||
25 | using namespace KCal; | 25 | using namespace KCal; |
26 | 26 | ||
27 | CalFilter::CalFilter() | 27 | CalFilter::CalFilter() |
28 | { | 28 | { |
29 | mEnabled = true; | 29 | mEnabled = true; |
30 | mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; | 30 | mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; |
31 | } | 31 | } |
32 | 32 | ||
33 | CalFilter::CalFilter(const QString &name) | 33 | CalFilter::CalFilter(const QString &name) |
34 | { | 34 | { |
35 | mName = name; | 35 | mName = name; |
36 | mEnabled = true; | 36 | mEnabled = true; |
37 | mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; | 37 | mCriteria = ShowPublic | ShowPrivate| ShowConfidential ; |
38 | } | 38 | } |
39 | 39 | ||
40 | CalFilter::~CalFilter() | 40 | CalFilter::~CalFilter() |
41 | { | 41 | { |
42 | } | 42 | } |
43 | 43 | ||
44 | void CalFilter::apply(QPtrList<Event> *eventlist) | 44 | void CalFilter::apply(QPtrList<Event> *eventlist) |
45 | { | 45 | { |
46 | if (!mEnabled) return; | 46 | if (!mEnabled) return; |
47 | 47 | ||
48 | // kdDebug(5800) << "CalFilter::apply()" << endl; | 48 | // kdDebug(5800) << "CalFilter::apply()" << endl; |
49 | 49 | ||
50 | Event *event = eventlist->first(); | 50 | Event *event = eventlist->first(); |
51 | while(event) { | 51 | while(event) { |
52 | if (!filterEvent(event)) { | 52 | if (!filterEvent(event)) { |
53 | eventlist->remove(); | 53 | eventlist->remove(); |
54 | event = eventlist->current(); | 54 | event = eventlist->current(); |
55 | } else { | 55 | } else { |
56 | event = eventlist->next(); | 56 | event = eventlist->next(); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | // kdDebug(5800) << "CalFilter::apply() done" << endl; | 60 | // kdDebug(5800) << "CalFilter::apply() done" << endl; |
61 | } | 61 | } |
62 | 62 | ||
63 | // TODO: avoid duplicating apply() code | 63 | // TODO: avoid duplicating apply() code |
64 | void CalFilter::apply(QPtrList<Todo> *eventlist) | 64 | void CalFilter::apply(QPtrList<Todo> *eventlist) |
65 | { | 65 | { |
66 | if (!mEnabled) return; | 66 | if (!mEnabled) return; |
67 | Todo *event = eventlist->first(); | 67 | Todo *event = eventlist->first(); |
68 | while(event) { | 68 | while(event) { |
69 | if (!filterTodo(event)) { | 69 | if (!filterTodo(event)) { |
70 | eventlist->remove(); | 70 | eventlist->remove(); |
71 | event = eventlist->current(); | 71 | event = eventlist->current(); |
72 | } else { | 72 | } else { |
73 | event = eventlist->next(); | 73 | event = eventlist->next(); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | // kdDebug(5800) << "CalFilter::apply() done" << endl; | 77 | // kdDebug(5800) << "CalFilter::apply() done" << endl; |
78 | } | 78 | } |
79 | bool CalFilter::filterCalendarItem(Incidence *in) | 79 | bool CalFilter::filterCalendarItem(Incidence *in) |
80 | { | 80 | { |
81 | if ( in->type() == "Event" ) | 81 | if ( in->typeID() == eventID ) |
82 | return filterEvent( (Event*) in ); | 82 | return filterEvent( (Event*) in ); |
83 | else if ( in->type() =="Todo" ) | 83 | else if ( in->typeID() == todoID ) |
84 | return filterTodo( (Todo*) in); | 84 | return filterTodo( (Todo*) in); |
85 | else if ( in->type() =="Journal" ) | 85 | else if ( in->typeID () == journalID ) |
86 | return filterJournal( (Journal*) in ); | 86 | return filterJournal( (Journal*) in ); |
87 | return false; | 87 | return false; |
88 | } | 88 | } |
89 | bool CalFilter::filterEvent(Event *event) | 89 | bool CalFilter::filterEvent(Event *event) |
90 | { | 90 | { |
91 | if (mCriteria & HideEvents) | 91 | if (mCriteria & HideEvents) |
92 | return false; | 92 | return false; |
93 | if (mCriteria & HideRecurring) { | 93 | if (mCriteria & HideRecurring) { |
94 | if (event->recurrence()->doesRecur()) return false; | 94 | if (event->recurrence()->doesRecur()) return false; |
95 | } | 95 | } |
96 | 96 | ||
97 | return filterIncidence(event); | 97 | return filterIncidence(event); |
98 | } | 98 | } |
99 | bool CalFilter::filterJournal(Journal *j) | 99 | bool CalFilter::filterJournal(Journal *j) |
100 | { | 100 | { |
101 | if (mCriteria & HideJournals) | 101 | if (mCriteria & HideJournals) |
102 | return false; | 102 | return false; |
103 | return true; | 103 | return true; |
104 | } | 104 | } |
105 | bool CalFilter::filterTodo(Todo *todo) | 105 | bool CalFilter::filterTodo(Todo *todo) |
106 | { | 106 | { |
107 | if (mCriteria & HideTodos) | 107 | if (mCriteria & HideTodos) |
108 | return false; | 108 | return false; |
109 | if (mCriteria & HideCompleted) { | 109 | if (mCriteria & HideCompleted) { |
110 | if (todo->isCompleted()) return false; | 110 | if (todo->isCompleted()) return false; |
111 | } | 111 | } |
112 | 112 | ||
113 | return filterIncidence(todo); | 113 | return filterIncidence(todo); |
114 | } | 114 | } |
115 | bool CalFilter::showCategories() | 115 | bool CalFilter::showCategories() |
116 | { | 116 | { |
117 | return mCriteria & ShowCategories; | 117 | return mCriteria & ShowCategories; |
118 | } | 118 | } |
119 | int CalFilter::getSecrecy() | 119 | int CalFilter::getSecrecy() |
120 | { | 120 | { |
121 | if ( (mCriteria & ShowPublic )) | 121 | if ( (mCriteria & ShowPublic )) |
122 | return Incidence::SecrecyPublic; | 122 | return Incidence::SecrecyPublic; |
123 | if ( (mCriteria & ShowPrivate )) | 123 | if ( (mCriteria & ShowPrivate )) |
124 | return Incidence::SecrecyPrivate; | 124 | return Incidence::SecrecyPrivate; |
125 | if ( (mCriteria & ShowConfidential )) | 125 | if ( (mCriteria & ShowConfidential )) |
126 | return Incidence::SecrecyConfidential; | 126 | return Incidence::SecrecyConfidential; |
127 | return Incidence::SecrecyPublic; | 127 | return Incidence::SecrecyPublic; |
128 | } | 128 | } |
129 | bool CalFilter::filterIncidence(Incidence *incidence) | 129 | bool CalFilter::filterIncidence(Incidence *incidence) |
130 | { | 130 | { |
131 | if ( mCriteria > 7 ) { | 131 | if ( mCriteria > 7 ) { |
132 | switch (incidence->secrecy()) { | 132 | switch (incidence->secrecy()) { |
133 | case Incidence::SecrecyPublic: | 133 | case Incidence::SecrecyPublic: |
134 | if (! (mCriteria & ShowPublic )) | 134 | if (! (mCriteria & ShowPublic )) |
135 | return false; | 135 | return false; |
136 | break; | 136 | break; |
137 | case Incidence::SecrecyPrivate: | 137 | case Incidence::SecrecyPrivate: |
138 | if (! (mCriteria & ShowPrivate )) | 138 | if (! (mCriteria & ShowPrivate )) |
139 | return false; | 139 | return false; |
140 | break; | 140 | break; |
141 | case Incidence::SecrecyConfidential: | 141 | case Incidence::SecrecyConfidential: |
142 | if (! (mCriteria & ShowConfidential )) | 142 | if (! (mCriteria & ShowConfidential )) |
143 | return false; | 143 | return false; |
144 | break; | 144 | break; |
145 | default: | 145 | default: |
146 | return false; | 146 | return false; |
147 | break; | 147 | break; |
148 | } | 148 | } |
149 | } | 149 | } |
diff --git a/libkcal/event.h b/libkcal/event.h index 8729956..287d403 100644 --- a/libkcal/event.h +++ b/libkcal/event.h | |||
@@ -1,90 +1,91 @@ | |||
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 | #ifndef EVENT_H | 21 | #ifndef EVENT_H |
22 | #define EVENT_H | 22 | #define EVENT_H |
23 | // | 23 | // |
24 | // Event component, representing a VEVENT object | 24 | // Event component, representing a VEVENT object |
25 | // | 25 | // |
26 | 26 | ||
27 | #include "incidence.h" | 27 | #include "incidence.h" |
28 | namespace KCal { | 28 | namespace KCal { |
29 | 29 | ||
30 | /** | 30 | /** |
31 | This class provides an Event in the sense of RFC2445. | 31 | This class provides an Event in the sense of RFC2445. |
32 | */ | 32 | */ |
33 | class Event : public Incidence | 33 | class Event : public Incidence |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | enum Transparency { Opaque, Transparent }; | 36 | enum Transparency { Opaque, Transparent }; |
37 | typedef ListBase<Event> List; | 37 | typedef ListBase<Event> List; |
38 | Event(); | 38 | Event(); |
39 | Event(const Event &); | 39 | Event(const Event &); |
40 | ~Event(); | 40 | ~Event(); |
41 | 41 | ||
42 | QCString type() const { return "Event"; } | 42 | QCString type() const { return "Event"; } |
43 | IncTypeID typeID() const { return eventID; } | ||
43 | 44 | ||
44 | Incidence *clone(); | 45 | Incidence *clone(); |
45 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; | 46 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; |
46 | 47 | ||
47 | /** for setting an event's ending date/time with a QDateTime. */ | 48 | /** for setting an event's ending date/time with a QDateTime. */ |
48 | void setDtEnd(const QDateTime &dtEnd); | 49 | void setDtEnd(const QDateTime &dtEnd); |
49 | /** Return the event's ending date/time as a QDateTime. */ | 50 | /** Return the event's ending date/time as a QDateTime. */ |
50 | virtual QDateTime dtEnd() const; | 51 | virtual QDateTime dtEnd() const; |
51 | /** returns an event's end time as a string formatted according to the | 52 | /** returns an event's end time as a string formatted according to the |
52 | users locale settings */ | 53 | users locale settings */ |
53 | QString dtEndTimeStr() const; | 54 | QString dtEndTimeStr() const; |
54 | /** returns an event's end date as a string formatted according to the | 55 | /** returns an event's end date as a string formatted according to the |
55 | users locale settings */ | 56 | users locale settings */ |
56 | QString dtEndDateStr(bool shortfmt=true) const; | 57 | QString dtEndDateStr(bool shortfmt=true) const; |
57 | /** returns an event's end date and time as a string formatted according | 58 | /** returns an event's end date and time as a string formatted according |
58 | to the users locale settings */ | 59 | to the users locale settings */ |
59 | QString dtEndStr(bool shortfmt=true) const; | 60 | QString dtEndStr(bool shortfmt=true) const; |
60 | void setHasEndDate(bool); | 61 | void setHasEndDate(bool); |
61 | /** Return whether the event has an end date/time. */ | 62 | /** Return whether the event has an end date/time. */ |
62 | bool hasEndDate() const; | 63 | bool hasEndDate() const; |
63 | 64 | ||
64 | /** Return true if the event spans multiple days, otherwise return false. */ | 65 | /** Return true if the event spans multiple days, otherwise return false. */ |
65 | bool isMultiDay() const; | 66 | bool isMultiDay() const; |
66 | 67 | ||
67 | /** set the event's time transparency level. */ | 68 | /** set the event's time transparency level. */ |
68 | void setTransparency(Transparency transparency); | 69 | void setTransparency(Transparency transparency); |
69 | /** get the event's time transparency level. */ | 70 | /** get the event's time transparency level. */ |
70 | Transparency transparency() const; | 71 | Transparency transparency() const; |
71 | 72 | ||
72 | void setDuration(int seconds); | 73 | void setDuration(int seconds); |
73 | 74 | ||
74 | bool contains ( Event*); | 75 | bool contains ( Event*); |
75 | 76 | ||
76 | private: | 77 | private: |
77 | bool accept(Visitor &v) { return v.visit(this); } | 78 | bool accept(Visitor &v) { return v.visit(this); } |
78 | 79 | ||
79 | QDateTime mDtEnd; | 80 | QDateTime mDtEnd; |
80 | bool mHasEndDate; | 81 | bool mHasEndDate; |
81 | Transparency mTransparency; | 82 | Transparency mTransparency; |
82 | }; | 83 | }; |
83 | 84 | ||
84 | bool operator==( const Event&, const Event& ); | 85 | bool operator==( const Event&, const Event& ); |
85 | 86 | ||
86 | 87 | ||
87 | } | 88 | } |
88 | 89 | ||
89 | 90 | ||
90 | #endif | 91 | #endif |
diff --git a/libkcal/freebusy.h b/libkcal/freebusy.h index 054feda..d741c72 100644 --- a/libkcal/freebusy.h +++ b/libkcal/freebusy.h | |||
@@ -1,72 +1,73 @@ | |||
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 | #ifndef KCAL_FREEBUSY_H | 20 | #ifndef KCAL_FREEBUSY_H |
21 | #define KCAL_FREEBUSY_H | 21 | #define KCAL_FREEBUSY_H |
22 | // | 22 | // |
23 | // FreeBusy - information about free/busy times | 23 | // FreeBusy - information about free/busy times |
24 | // | 24 | // |
25 | 25 | ||
26 | #include <qdatetime.h> | 26 | #include <qdatetime.h> |
27 | #include <qvaluelist.h> | 27 | #include <qvaluelist.h> |
28 | #include <qptrlist.h> | 28 | #include <qptrlist.h> |
29 | 29 | ||
30 | #include "period.h" | 30 | #include "period.h" |
31 | #include "calendar.h" | 31 | #include "calendar.h" |
32 | 32 | ||
33 | #include "incidencebase.h" | 33 | #include "incidencebase.h" |
34 | 34 | ||
35 | namespace KCal { | 35 | namespace KCal { |
36 | 36 | ||
37 | /** | 37 | /** |
38 | This class provides information about free/busy time of a calendar user. | 38 | This class provides information about free/busy time of a calendar user. |
39 | */ | 39 | */ |
40 | class FreeBusy : public IncidenceBase | 40 | class FreeBusy : public IncidenceBase |
41 | { | 41 | { |
42 | public: | 42 | public: |
43 | FreeBusy(); | 43 | FreeBusy(); |
44 | FreeBusy(const QDateTime &start, const QDateTime &end); | 44 | FreeBusy(const QDateTime &start, const QDateTime &end); |
45 | FreeBusy(Calendar *calendar, const QDateTime &start, const QDateTime &end); | 45 | FreeBusy(Calendar *calendar, const QDateTime &start, const QDateTime &end); |
46 | FreeBusy(QValueList<Period> busyPeriods); | 46 | FreeBusy(QValueList<Period> busyPeriods); |
47 | 47 | ||
48 | ~FreeBusy(); | 48 | ~FreeBusy(); |
49 | 49 | ||
50 | QCString type() const { return "FreeBusy"; } | 50 | QCString type() const { return "FreeBusy"; } |
51 | IncTypeID typeID() const { return freebusyID; } | ||
51 | 52 | ||
52 | virtual QDateTime dtEnd() const; | 53 | virtual QDateTime dtEnd() const; |
53 | bool setDtEnd( const QDateTime &end ); | 54 | bool setDtEnd( const QDateTime &end ); |
54 | 55 | ||
55 | QValueList<Period> busyPeriods() const; | 56 | QValueList<Period> busyPeriods() const; |
56 | 57 | ||
57 | void addPeriod(const QDateTime &start, const QDateTime &end); | 58 | void addPeriod(const QDateTime &start, const QDateTime &end); |
58 | void sortList(); | 59 | void sortList(); |
59 | 60 | ||
60 | private: | 61 | private: |
61 | 62 | ||
62 | //This is used for creating a freebusy object for the current user | 63 | //This is used for creating a freebusy object for the current user |
63 | bool addLocalPeriod(const QDateTime &start, const QDateTime &end); | 64 | bool addLocalPeriod(const QDateTime &start, const QDateTime &end); |
64 | 65 | ||
65 | QDateTime mDtEnd; | 66 | QDateTime mDtEnd; |
66 | QValueList<Period> mBusyPeriods; | 67 | QValueList<Period> mBusyPeriods; |
67 | Calendar *mCalendar; | 68 | Calendar *mCalendar; |
68 | }; | 69 | }; |
69 | 70 | ||
70 | } | 71 | } |
71 | 72 | ||
72 | #endif | 73 | #endif |
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp index 3a2aac6..d9fe40b 100644 --- a/libkcal/icalformat.cpp +++ b/libkcal/icalformat.cpp | |||
@@ -323,134 +323,134 @@ ScheduleMessage *ICalFormat::parseScheduleMessage( Calendar *cal, | |||
323 | } | 323 | } |
324 | } | 324 | } |
325 | 325 | ||
326 | if (!incidence) { | 326 | if (!incidence) { |
327 | c = icalcomponent_get_first_component(message,ICAL_VFREEBUSY_COMPONENT); | 327 | c = icalcomponent_get_first_component(message,ICAL_VFREEBUSY_COMPONENT); |
328 | if (c) { | 328 | if (c) { |
329 | incidence = mImpl->readFreeBusy(c); | 329 | incidence = mImpl->readFreeBusy(c); |
330 | } | 330 | } |
331 | } | 331 | } |
332 | 332 | ||
333 | if (!incidence) { | 333 | if (!incidence) { |
334 | kdDebug() << "ICalFormat:parseScheduleMessage: object is not a freebusy, event or todo" << endl; | 334 | kdDebug() << "ICalFormat:parseScheduleMessage: object is not a freebusy, event or todo" << endl; |
335 | return 0; | 335 | return 0; |
336 | } | 336 | } |
337 | 337 | ||
338 | kdDebug(5800) << "ICalFormat::parseScheduleMessage() getting method..." << endl; | 338 | kdDebug(5800) << "ICalFormat::parseScheduleMessage() getting method..." << endl; |
339 | 339 | ||
340 | icalproperty_method icalmethod = icalproperty_get_method(m); | 340 | icalproperty_method icalmethod = icalproperty_get_method(m); |
341 | Scheduler::Method method; | 341 | Scheduler::Method method; |
342 | 342 | ||
343 | switch (icalmethod) { | 343 | switch (icalmethod) { |
344 | case ICAL_METHOD_PUBLISH: | 344 | case ICAL_METHOD_PUBLISH: |
345 | method = Scheduler::Publish; | 345 | method = Scheduler::Publish; |
346 | break; | 346 | break; |
347 | case ICAL_METHOD_REQUEST: | 347 | case ICAL_METHOD_REQUEST: |
348 | method = Scheduler::Request; | 348 | method = Scheduler::Request; |
349 | break; | 349 | break; |
350 | case ICAL_METHOD_REFRESH: | 350 | case ICAL_METHOD_REFRESH: |
351 | method = Scheduler::Refresh; | 351 | method = Scheduler::Refresh; |
352 | break; | 352 | break; |
353 | case ICAL_METHOD_CANCEL: | 353 | case ICAL_METHOD_CANCEL: |
354 | method = Scheduler::Cancel; | 354 | method = Scheduler::Cancel; |
355 | break; | 355 | break; |
356 | case ICAL_METHOD_ADD: | 356 | case ICAL_METHOD_ADD: |
357 | method = Scheduler::Add; | 357 | method = Scheduler::Add; |
358 | break; | 358 | break; |
359 | case ICAL_METHOD_REPLY: | 359 | case ICAL_METHOD_REPLY: |
360 | method = Scheduler::Reply; | 360 | method = Scheduler::Reply; |
361 | break; | 361 | break; |
362 | case ICAL_METHOD_COUNTER: | 362 | case ICAL_METHOD_COUNTER: |
363 | method = Scheduler::Counter; | 363 | method = Scheduler::Counter; |
364 | break; | 364 | break; |
365 | case ICAL_METHOD_DECLINECOUNTER: | 365 | case ICAL_METHOD_DECLINECOUNTER: |
366 | method = Scheduler::Declinecounter; | 366 | method = Scheduler::Declinecounter; |
367 | break; | 367 | break; |
368 | default: | 368 | default: |
369 | method = Scheduler::NoMethod; | 369 | method = Scheduler::NoMethod; |
370 | kdDebug(5800) << "ICalFormat::parseScheduleMessage(): Unknow method" << endl; | 370 | kdDebug(5800) << "ICalFormat::parseScheduleMessage(): Unknow method" << endl; |
371 | break; | 371 | break; |
372 | } | 372 | } |
373 | 373 | ||
374 | 374 | ||
375 | if (!icalrestriction_check(message)) { | 375 | if (!icalrestriction_check(message)) { |
376 | setException(new ErrorFormat(ErrorFormat::Restriction, | 376 | setException(new ErrorFormat(ErrorFormat::Restriction, |
377 | Scheduler::translatedMethodName(method) + ": " + | 377 | Scheduler::translatedMethodName(method) + ": " + |
378 | mImpl->extractErrorProperty(c))); | 378 | mImpl->extractErrorProperty(c))); |
379 | return 0; | 379 | return 0; |
380 | } | 380 | } |
381 | 381 | ||
382 | icalcomponent *calendarComponent = mImpl->createCalendarComponent(cal); | 382 | icalcomponent *calendarComponent = mImpl->createCalendarComponent(cal); |
383 | 383 | ||
384 | Incidence *existingIncidence = cal->event(incidence->uid()); | 384 | Incidence *existingIncidence = cal->event(incidence->uid()); |
385 | if (existingIncidence) { | 385 | if (existingIncidence) { |
386 | // TODO: check, if cast is required, or if it can be done by virtual funcs. | 386 | // TODO: check, if cast is required, or if it can be done by virtual funcs. |
387 | if (existingIncidence->type() == "Todo") { | 387 | if (existingIncidence->typeID() == todoID ) { |
388 | Todo *todo = static_cast<Todo *>(existingIncidence); | 388 | Todo *todo = static_cast<Todo *>(existingIncidence); |
389 | icalcomponent_add_component(calendarComponent, | 389 | icalcomponent_add_component(calendarComponent, |
390 | mImpl->writeTodo(todo)); | 390 | mImpl->writeTodo(todo)); |
391 | } | 391 | } |
392 | if (existingIncidence->type() == "Event") { | 392 | if (existingIncidence->typeID() == eventID ) { |
393 | Event *event = static_cast<Event *>(existingIncidence); | 393 | Event *event = static_cast<Event *>(existingIncidence); |
394 | icalcomponent_add_component(calendarComponent, | 394 | icalcomponent_add_component(calendarComponent, |
395 | mImpl->writeEvent(event)); | 395 | mImpl->writeEvent(event)); |
396 | } | 396 | } |
397 | } else { | 397 | } else { |
398 | calendarComponent = 0; | 398 | calendarComponent = 0; |
399 | } | 399 | } |
400 | qDebug("icalclassify commented out "); | 400 | qDebug("icalclassify commented out "); |
401 | ScheduleMessage::Status status; | 401 | ScheduleMessage::Status status; |
402 | #if 0 | 402 | #if 0 |
403 | 403 | ||
404 | icalclass result = icalclassify(message,calendarComponent,(char *)""); | 404 | icalclass result = icalclassify(message,calendarComponent,(char *)""); |
405 | 405 | ||
406 | 406 | ||
407 | 407 | ||
408 | switch (result) { | 408 | switch (result) { |
409 | case ICAL_PUBLISH_NEW_CLASS: | 409 | case ICAL_PUBLISH_NEW_CLASS: |
410 | status = ScheduleMessage::PublishNew; | 410 | status = ScheduleMessage::PublishNew; |
411 | break; | 411 | break; |
412 | case ICAL_OBSOLETE_CLASS: | 412 | case ICAL_OBSOLETE_CLASS: |
413 | status = ScheduleMessage::Obsolete; | 413 | status = ScheduleMessage::Obsolete; |
414 | break; | 414 | break; |
415 | case ICAL_REQUEST_NEW_CLASS: | 415 | case ICAL_REQUEST_NEW_CLASS: |
416 | status = ScheduleMessage::RequestNew; | 416 | status = ScheduleMessage::RequestNew; |
417 | break; | 417 | break; |
418 | case ICAL_REQUEST_UPDATE_CLASS: | 418 | case ICAL_REQUEST_UPDATE_CLASS: |
419 | status = ScheduleMessage::RequestUpdate; | 419 | status = ScheduleMessage::RequestUpdate; |
420 | break; | 420 | break; |
421 | case ICAL_UNKNOWN_CLASS: | 421 | case ICAL_UNKNOWN_CLASS: |
422 | default: | 422 | default: |
423 | status = ScheduleMessage::Unknown; | 423 | status = ScheduleMessage::Unknown; |
424 | break; | 424 | break; |
425 | } | 425 | } |
426 | #endif | 426 | #endif |
427 | status = ScheduleMessage::RequestUpdate; | 427 | status = ScheduleMessage::RequestUpdate; |
428 | return new ScheduleMessage(incidence,method,status); | 428 | return new ScheduleMessage(incidence,method,status); |
429 | } | 429 | } |
430 | 430 | ||
431 | void ICalFormat::setTimeZone( const QString &id, bool utc ) | 431 | void ICalFormat::setTimeZone( const QString &id, bool utc ) |
432 | { | 432 | { |
433 | 433 | ||
434 | 434 | ||
435 | mTimeZoneId = id; | 435 | mTimeZoneId = id; |
436 | mUtc = utc; | 436 | mUtc = utc; |
437 | 437 | ||
438 | tzOffsetMin = KGlobal::locale()->timezoneOffset(mTimeZoneId); | 438 | tzOffsetMin = KGlobal::locale()->timezoneOffset(mTimeZoneId); |
439 | 439 | ||
440 | //qDebug("ICalFormat::setTimeZoneOffset %s %d ",mTimeZoneId.latin1(), tzOffsetMin); | 440 | //qDebug("ICalFormat::setTimeZoneOffset %s %d ",mTimeZoneId.latin1(), tzOffsetMin); |
441 | } | 441 | } |
442 | 442 | ||
443 | QString ICalFormat::timeZoneId() const | 443 | QString ICalFormat::timeZoneId() const |
444 | { | 444 | { |
445 | return mTimeZoneId; | 445 | return mTimeZoneId; |
446 | } | 446 | } |
447 | 447 | ||
448 | bool ICalFormat::utc() const | 448 | bool ICalFormat::utc() const |
449 | { | 449 | { |
450 | return mUtc; | 450 | return mUtc; |
451 | } | 451 | } |
452 | int ICalFormat::timeOffset() | 452 | int ICalFormat::timeOffset() |
453 | { | 453 | { |
454 | return tzOffsetMin; | 454 | return tzOffsetMin; |
455 | } | 455 | } |
456 | const char *ICalFormat::tzString() | 456 | const char *ICalFormat::tzString() |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 2405682..3e28714 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -2094,79 +2094,79 @@ void ICalFormatImpl::dumpIcalRecurrence(icalrecurrencetype r) | |||
2094 | } | 2094 | } |
2095 | if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2095 | if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2096 | int index = 0; | 2096 | int index = 0; |
2097 | QString out = " By Year Day: "; | 2097 | QString out = " By Year Day: "; |
2098 | while((i = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2098 | while((i = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2099 | out.append(QString::number(i) + " "); | 2099 | out.append(QString::number(i) + " "); |
2100 | } | 2100 | } |
2101 | } | 2101 | } |
2102 | if (r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2102 | if (r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2103 | int index = 0; | 2103 | int index = 0; |
2104 | QString out = " By Month: "; | 2104 | QString out = " By Month: "; |
2105 | while((i = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2105 | while((i = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2106 | out.append(QString::number(i) + " "); | 2106 | out.append(QString::number(i) + " "); |
2107 | } | 2107 | } |
2108 | } | 2108 | } |
2109 | if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2109 | if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2110 | int index = 0; | 2110 | int index = 0; |
2111 | QString out = " By Set Pos: "; | 2111 | QString out = " By Set Pos: "; |
2112 | while((i = r.by_set_pos[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2112 | while((i = r.by_set_pos[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2113 | out.append(QString::number(i) + " "); | 2113 | out.append(QString::number(i) + " "); |
2114 | } | 2114 | } |
2115 | } | 2115 | } |
2116 | } | 2116 | } |
2117 | 2117 | ||
2118 | icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence, | 2118 | icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence, |
2119 | Scheduler::Method method) | 2119 | Scheduler::Method method) |
2120 | { | 2120 | { |
2121 | icalcomponent *message = createCalendarComponent(); | 2121 | icalcomponent *message = createCalendarComponent(); |
2122 | 2122 | ||
2123 | icalproperty_method icalmethod = ICAL_METHOD_NONE; | 2123 | icalproperty_method icalmethod = ICAL_METHOD_NONE; |
2124 | 2124 | ||
2125 | switch (method) { | 2125 | switch (method) { |
2126 | case Scheduler::Publish: | 2126 | case Scheduler::Publish: |
2127 | icalmethod = ICAL_METHOD_PUBLISH; | 2127 | icalmethod = ICAL_METHOD_PUBLISH; |
2128 | break; | 2128 | break; |
2129 | case Scheduler::Request: | 2129 | case Scheduler::Request: |
2130 | icalmethod = ICAL_METHOD_REQUEST; | 2130 | icalmethod = ICAL_METHOD_REQUEST; |
2131 | break; | 2131 | break; |
2132 | case Scheduler::Refresh: | 2132 | case Scheduler::Refresh: |
2133 | icalmethod = ICAL_METHOD_REFRESH; | 2133 | icalmethod = ICAL_METHOD_REFRESH; |
2134 | break; | 2134 | break; |
2135 | case Scheduler::Cancel: | 2135 | case Scheduler::Cancel: |
2136 | icalmethod = ICAL_METHOD_CANCEL; | 2136 | icalmethod = ICAL_METHOD_CANCEL; |
2137 | break; | 2137 | break; |
2138 | case Scheduler::Add: | 2138 | case Scheduler::Add: |
2139 | icalmethod = ICAL_METHOD_ADD; | 2139 | icalmethod = ICAL_METHOD_ADD; |
2140 | break; | 2140 | break; |
2141 | case Scheduler::Reply: | 2141 | case Scheduler::Reply: |
2142 | icalmethod = ICAL_METHOD_REPLY; | 2142 | icalmethod = ICAL_METHOD_REPLY; |
2143 | break; | 2143 | break; |
2144 | case Scheduler::Counter: | 2144 | case Scheduler::Counter: |
2145 | icalmethod = ICAL_METHOD_COUNTER; | 2145 | icalmethod = ICAL_METHOD_COUNTER; |
2146 | break; | 2146 | break; |
2147 | case Scheduler::Declinecounter: | 2147 | case Scheduler::Declinecounter: |
2148 | icalmethod = ICAL_METHOD_DECLINECOUNTER; | 2148 | icalmethod = ICAL_METHOD_DECLINECOUNTER; |
2149 | break; | 2149 | break; |
2150 | default: | 2150 | default: |
2151 | 2151 | ||
2152 | return message; | 2152 | return message; |
2153 | } | 2153 | } |
2154 | 2154 | ||
2155 | icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); | 2155 | icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); |
2156 | 2156 | ||
2157 | // TODO: check, if dynamic cast is required | 2157 | // TODO: check, if dynamic cast is required |
2158 | if(incidence->type() == "Todo") { | 2158 | if(incidence->typeID() == todoID ) { |
2159 | Todo *todo = static_cast<Todo *>(incidence); | 2159 | Todo *todo = static_cast<Todo *>(incidence); |
2160 | icalcomponent_add_component(message,writeTodo(todo)); | 2160 | icalcomponent_add_component(message,writeTodo(todo)); |
2161 | } | 2161 | } |
2162 | if(incidence->type() == "Event") { | 2162 | if(incidence->typeID() == eventID ) { |
2163 | Event *event = static_cast<Event *>(incidence); | 2163 | Event *event = static_cast<Event *>(incidence); |
2164 | icalcomponent_add_component(message,writeEvent(event)); | 2164 | icalcomponent_add_component(message,writeEvent(event)); |
2165 | } | 2165 | } |
2166 | if(incidence->type() == "FreeBusy") { | 2166 | if(incidence->typeID() == freebusyID) { |
2167 | FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); | 2167 | FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); |
2168 | icalcomponent_add_component(message,writeFreeBusy(freebusy, method)); | 2168 | icalcomponent_add_component(message,writeFreeBusy(freebusy, method)); |
2169 | } | 2169 | } |
2170 | 2170 | ||
2171 | return message; | 2171 | return message; |
2172 | } | 2172 | } |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 762103f..f446197 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -175,129 +175,129 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | |||
175 | return false; | 175 | return false; |
176 | } | 176 | } |
177 | } | 177 | } |
178 | #if 0 | 178 | #if 0 |
179 | QPtrListIterator<Alarm> a1( i1.alarms() ); | 179 | QPtrListIterator<Alarm> a1( i1.alarms() ); |
180 | QPtrListIterator<Alarm> a2( i2.alarms() ); | 180 | QPtrListIterator<Alarm> a2( i2.alarms() ); |
181 | for( ; a1.current() && a2.current(); ++a1, ++a2 ) { | 181 | for( ; a1.current() && a2.current(); ++a1, ++a2 ) { |
182 | if( *a1.current() == *a2.current() ) { | 182 | if( *a1.current() == *a2.current() ) { |
183 | continue; | 183 | continue; |
184 | } | 184 | } |
185 | else { | 185 | else { |
186 | return false; | 186 | return false; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | #endif | 189 | #endif |
190 | 190 | ||
191 | if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { | 191 | if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { |
192 | if ( i1.hasRecurrenceID() ) { | 192 | if ( i1.hasRecurrenceID() ) { |
193 | if ( i1.recurrenceID() != i2.recurrenceID() ) | 193 | if ( i1.recurrenceID() != i2.recurrenceID() ) |
194 | return false; | 194 | return false; |
195 | } | 195 | } |
196 | 196 | ||
197 | } else { | 197 | } else { |
198 | return false; | 198 | return false; |
199 | } | 199 | } |
200 | 200 | ||
201 | if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) | 201 | if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) |
202 | return false; | 202 | return false; |
203 | if ( i1.hasStartDate() == i2.hasStartDate() ) { | 203 | if ( i1.hasStartDate() == i2.hasStartDate() ) { |
204 | if ( i1.hasStartDate() ) { | 204 | if ( i1.hasStartDate() ) { |
205 | if ( i1.dtStart() != i2.dtStart() ) | 205 | if ( i1.dtStart() != i2.dtStart() ) |
206 | return false; | 206 | return false; |
207 | } | 207 | } |
208 | } else { | 208 | } else { |
209 | return false; | 209 | return false; |
210 | } | 210 | } |
211 | if (!( *i1.recurrence() == *i2.recurrence()) ) { | 211 | if (!( *i1.recurrence() == *i2.recurrence()) ) { |
212 | qDebug("recurrence is NOT equal "); | 212 | qDebug("recurrence is NOT equal "); |
213 | return false; | 213 | return false; |
214 | } | 214 | } |
215 | return | 215 | return |
216 | // i1.created() == i2.created() && | 216 | // i1.created() == i2.created() && |
217 | stringCompare( i1.description(), i2.description() ) && | 217 | stringCompare( i1.description(), i2.description() ) && |
218 | stringCompare( i1.summary(), i2.summary() ) && | 218 | stringCompare( i1.summary(), i2.summary() ) && |
219 | i1.categories() == i2.categories() && | 219 | i1.categories() == i2.categories() && |
220 | // no need to compare mRelatedTo | 220 | // no need to compare mRelatedTo |
221 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && | 221 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && |
222 | // i1.relations() == i2.relations() && | 222 | // i1.relations() == i2.relations() && |
223 | i1.exDates() == i2.exDates() && | 223 | i1.exDates() == i2.exDates() && |
224 | i1.attachments() == i2.attachments() && | 224 | i1.attachments() == i2.attachments() && |
225 | i1.resources() == i2.resources() && | 225 | i1.resources() == i2.resources() && |
226 | i1.secrecy() == i2.secrecy() && | 226 | i1.secrecy() == i2.secrecy() && |
227 | i1.priority() == i2.priority() && | 227 | i1.priority() == i2.priority() && |
228 | i1.cancelled() == i2.cancelled() && | 228 | i1.cancelled() == i2.cancelled() && |
229 | stringCompare( i1.location(), i2.location() ); | 229 | stringCompare( i1.location(), i2.location() ); |
230 | } | 230 | } |
231 | 231 | ||
232 | Incidence* Incidence::recreateCloneException( QDate d ) | 232 | Incidence* Incidence::recreateCloneException( QDate d ) |
233 | { | 233 | { |
234 | Incidence* newInc = clone(); | 234 | Incidence* newInc = clone(); |
235 | newInc->recreate(); | 235 | newInc->recreate(); |
236 | if ( doesRecur() ) { | 236 | if ( doesRecur() ) { |
237 | addExDate( d ); | 237 | addExDate( d ); |
238 | newInc->recurrence()->unsetRecurs(); | 238 | newInc->recurrence()->unsetRecurs(); |
239 | if ( type() == "Event") { | 239 | if ( typeID() == eventID ) { |
240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
241 | QTime tim = dtStart().time(); | 241 | QTime tim = dtStart().time(); |
242 | newInc->setDtStart( QDateTime(d, tim) ); | 242 | newInc->setDtStart( QDateTime(d, tim) ); |
243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
244 | } else { | 244 | } else { |
245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); | 245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); |
246 | QTime tim = ((Todo*)this)->dtDue().time(); | 246 | QTime tim = ((Todo*)this)->dtDue().time(); |
247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); | 247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); |
248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); | 248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); |
249 | ((Todo*)this)->setRecurDates(); | 249 | ((Todo*)this)->setRecurDates(); |
250 | } | 250 | } |
251 | newInc->setExDates( DateList () ); | 251 | newInc->setExDates( DateList () ); |
252 | } | 252 | } |
253 | return newInc; | 253 | return newInc; |
254 | } | 254 | } |
255 | 255 | ||
256 | void Incidence::recreate() | 256 | void Incidence::recreate() |
257 | { | 257 | { |
258 | setCreated(QDateTime::currentDateTime()); | 258 | setCreated(QDateTime::currentDateTime()); |
259 | 259 | ||
260 | setUid(CalFormat::createUniqueId()); | 260 | setUid(CalFormat::createUniqueId()); |
261 | 261 | ||
262 | setRevision(0); | 262 | setRevision(0); |
263 | setIDStr( ":" ); | 263 | setIDStr( ":" ); |
264 | setLastModified(QDateTime::currentDateTime()); | 264 | setLastModified(QDateTime::currentDateTime()); |
265 | } | 265 | } |
266 | void Incidence::cloneRelations( Incidence * newInc ) | 266 | void Incidence::cloneRelations( Incidence * newInc ) |
267 | { | 267 | { |
268 | // newInc is already a clone of this incidence | 268 | // newInc is already a clone of this incidence |
269 | Incidence * inc; | 269 | Incidence * inc; |
270 | Incidence * cloneInc; | 270 | Incidence * cloneInc; |
271 | QPtrList<Incidence> Relations = relations(); | 271 | QPtrList<Incidence> Relations = relations(); |
272 | for (inc=Relations.first();inc;inc=Relations.next()) { | 272 | for (inc=Relations.first();inc;inc=Relations.next()) { |
273 | cloneInc = inc->clone(); | 273 | cloneInc = inc->clone(); |
274 | cloneInc->recreate(); | 274 | cloneInc->recreate(); |
275 | cloneInc->setRelatedTo( newInc ); | 275 | cloneInc->setRelatedTo( newInc ); |
276 | inc->cloneRelations( cloneInc ); | 276 | inc->cloneRelations( cloneInc ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | void Incidence::setReadOnly( bool readOnly ) | 279 | void Incidence::setReadOnly( bool readOnly ) |
280 | { | 280 | { |
281 | IncidenceBase::setReadOnly( readOnly ); | 281 | IncidenceBase::setReadOnly( readOnly ); |
282 | recurrence()->setRecurReadOnly( readOnly); | 282 | recurrence()->setRecurReadOnly( readOnly); |
283 | } | 283 | } |
284 | 284 | ||
285 | void Incidence::setCreated(QDateTime created) | 285 | void Incidence::setCreated(QDateTime created) |
286 | { | 286 | { |
287 | if (mReadOnly) return; | 287 | if (mReadOnly) return; |
288 | mCreated = getEvenTime(created); | 288 | mCreated = getEvenTime(created); |
289 | } | 289 | } |
290 | 290 | ||
291 | QDateTime Incidence::created() const | 291 | QDateTime Incidence::created() const |
292 | { | 292 | { |
293 | return mCreated; | 293 | return mCreated; |
294 | } | 294 | } |
295 | 295 | ||
296 | void Incidence::setRevision(int rev) | 296 | void Incidence::setRevision(int rev) |
297 | { | 297 | { |
298 | if (mReadOnly) return; | 298 | if (mReadOnly) return; |
299 | mRevision = rev; | 299 | mRevision = rev; |
300 | 300 | ||
301 | updated(); | 301 | updated(); |
302 | } | 302 | } |
303 | 303 | ||
@@ -663,82 +663,82 @@ bool Incidence::isAlarmEnabled() const | |||
663 | return false; | 663 | return false; |
664 | } | 664 | } |
665 | 665 | ||
666 | Recurrence *Incidence::recurrence() const | 666 | Recurrence *Incidence::recurrence() const |
667 | { | 667 | { |
668 | return mRecurrence; | 668 | return mRecurrence; |
669 | } | 669 | } |
670 | void Incidence::setRecurrence( Recurrence * r) | 670 | void Incidence::setRecurrence( Recurrence * r) |
671 | { | 671 | { |
672 | delete mRecurrence; | 672 | delete mRecurrence; |
673 | mRecurrence = r; | 673 | mRecurrence = r; |
674 | } | 674 | } |
675 | 675 | ||
676 | void Incidence::setLocation(const QString &location) | 676 | void Incidence::setLocation(const QString &location) |
677 | { | 677 | { |
678 | if (mReadOnly) return; | 678 | if (mReadOnly) return; |
679 | mLocation = location; | 679 | mLocation = location; |
680 | updated(); | 680 | updated(); |
681 | } | 681 | } |
682 | 682 | ||
683 | QString Incidence::location() const | 683 | QString Incidence::location() const |
684 | { | 684 | { |
685 | return mLocation; | 685 | return mLocation; |
686 | } | 686 | } |
687 | 687 | ||
688 | ushort Incidence::doesRecur() const | 688 | ushort Incidence::doesRecur() const |
689 | { | 689 | { |
690 | if ( mRecurrence ) return mRecurrence->doesRecur(); | 690 | if ( mRecurrence ) return mRecurrence->doesRecur(); |
691 | else return Recurrence::rNone; | 691 | else return Recurrence::rNone; |
692 | } | 692 | } |
693 | 693 | ||
694 | QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const | 694 | QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const |
695 | { | 695 | { |
696 | QDateTime incidenceStart = dt; | 696 | QDateTime incidenceStart = dt; |
697 | *ok = false; | 697 | *ok = false; |
698 | if ( doesRecur() ) { | 698 | if ( doesRecur() ) { |
699 | bool last; | 699 | bool last; |
700 | recurrence()->getPreviousDateTime( incidenceStart , &last ); | 700 | recurrence()->getPreviousDateTime( incidenceStart , &last ); |
701 | int count = 0; | 701 | int count = 0; |
702 | if ( !last ) { | 702 | if ( !last ) { |
703 | while ( !last ) { | 703 | while ( !last ) { |
704 | ++count; | 704 | ++count; |
705 | incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); | 705 | incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); |
706 | if ( recursOn( incidenceStart.date() ) ) { | 706 | if ( recursOn( incidenceStart.date() ) ) { |
707 | last = true; // exit while llop | 707 | last = true; // exit while llop |
708 | } else { | 708 | } else { |
709 | if ( last ) { // no alarm on last recurrence | 709 | if ( last ) { // no alarm on last recurrence |
710 | return QDateTime (); | 710 | return QDateTime (); |
711 | } | 711 | } |
712 | int year = incidenceStart.date().year(); | 712 | int year = incidenceStart.date().year(); |
713 | // workaround for bug in recurrence | 713 | // workaround for bug in recurrence |
714 | if ( count == 100 || year < 1000 || year > 5000 ) { | 714 | if ( count == 100 || year < 1000 || year > 5000 ) { |
715 | return QDateTime (); | 715 | return QDateTime (); |
716 | } | 716 | } |
717 | incidenceStart = incidenceStart.addSecs( 1 ); | 717 | incidenceStart = incidenceStart.addSecs( 1 ); |
718 | } | 718 | } |
719 | } | 719 | } |
720 | } else { | 720 | } else { |
721 | return QDateTime (); | 721 | return QDateTime (); |
722 | } | 722 | } |
723 | } else { | 723 | } else { |
724 | if ( hasStartDate () ) { | 724 | if ( hasStartDate () ) { |
725 | incidenceStart = dtStart(); | 725 | incidenceStart = dtStart(); |
726 | } | 726 | } |
727 | if ( type() =="Todo" ) { | 727 | if ( typeID() == todoID ) { |
728 | if ( ((Todo*)this)->hasDueDate() ) | 728 | if ( ((Todo*)this)->hasDueDate() ) |
729 | incidenceStart = ((Todo*)this)->dtDue(); | 729 | incidenceStart = ((Todo*)this)->dtDue(); |
730 | } | 730 | } |
731 | } | 731 | } |
732 | if ( incidenceStart > dt ) | 732 | if ( incidenceStart > dt ) |
733 | *ok = true; | 733 | *ok = true; |
734 | return incidenceStart; | 734 | return incidenceStart; |
735 | } | 735 | } |
736 | QDateTime Incidence::dtStart() const | 736 | QDateTime Incidence::dtStart() const |
737 | { | 737 | { |
738 | if ( doesRecur() ) { | 738 | if ( doesRecur() ) { |
739 | if ( type() == "Todo" ) { | 739 | if ( typeID() == todoID ) { |
740 | ((Todo*)this)->checkSetCompletedFalse(); | 740 | ((Todo*)this)->checkSetCompletedFalse(); |
741 | } | 741 | } |
742 | } | 742 | } |
743 | return mDtStart; | 743 | return mDtStart; |
744 | } | 744 | } |
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 8624786..05209e0 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h | |||
@@ -1,117 +1,119 @@ | |||
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 | #ifndef KCAL_INCIDENCEBASE_H | 20 | #ifndef KCAL_INCIDENCEBASE_H |
21 | #define KCAL_INCIDENCEBASE_H | 21 | #define KCAL_INCIDENCEBASE_H |
22 | // | 22 | // |
23 | // Incidence - base class of calendaring components | 23 | // Incidence - base class of calendaring components |
24 | // | 24 | // |
25 | 25 | ||
26 | #include <qdatetime.h> | 26 | #include <qdatetime.h> |
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | #include <qvaluelist.h> | 28 | #include <qvaluelist.h> |
29 | #include <qptrlist.h> | 29 | #include <qptrlist.h> |
30 | 30 | ||
31 | #include "customproperties.h" | 31 | #include "customproperties.h" |
32 | #include "attendee.h" | 32 | #include "attendee.h" |
33 | 33 | ||
34 | namespace KCal { | 34 | namespace KCal { |
35 | 35 | ||
36 | typedef QValueList<QDate> DateList; | 36 | typedef QValueList<QDate> DateList; |
37 | enum IncTypeID { eventID,todoID,journalID,freebusyID }; | ||
37 | 38 | ||
38 | /** | 39 | /** |
39 | This class provides the base class common to all calendar components. | 40 | This class provides the base class common to all calendar components. |
40 | */ | 41 | */ |
41 | class IncidenceBase : public CustomProperties | 42 | class IncidenceBase : public CustomProperties |
42 | { | 43 | { |
43 | public: | 44 | public: |
44 | class Observer { | 45 | class Observer { |
45 | public: | 46 | public: |
46 | virtual void incidenceUpdated( IncidenceBase * ) = 0; | 47 | virtual void incidenceUpdated( IncidenceBase * ) = 0; |
47 | }; | 48 | }; |
48 | 49 | ||
49 | IncidenceBase(); | 50 | IncidenceBase(); |
50 | IncidenceBase(const IncidenceBase &); | 51 | IncidenceBase(const IncidenceBase &); |
51 | virtual ~IncidenceBase(); | 52 | virtual ~IncidenceBase(); |
52 | 53 | ||
53 | virtual QCString type() const = 0; | 54 | virtual QCString type() const = 0; |
55 | virtual IncTypeID typeID() const = 0; | ||
54 | 56 | ||
55 | /** Set the unique id for the event */ | 57 | /** Set the unique id for the event */ |
56 | void setUid(const QString &); | 58 | void setUid(const QString &); |
57 | /** Return the unique id for the event */ | 59 | /** Return the unique id for the event */ |
58 | QString uid() const; | 60 | QString uid() const; |
59 | 61 | ||
60 | /** Sets the time the incidence was last modified. */ | 62 | /** Sets the time the incidence was last modified. */ |
61 | void setLastModified(const QDateTime &lm); | 63 | void setLastModified(const QDateTime &lm); |
62 | /** Return the time the incidence was last modified. */ | 64 | /** Return the time the incidence was last modified. */ |
63 | QDateTime lastModified() const; | 65 | QDateTime lastModified() const; |
64 | 66 | ||
65 | /** sets the organizer for the event */ | 67 | /** sets the organizer for the event */ |
66 | void setOrganizer(const QString &o); | 68 | void setOrganizer(const QString &o); |
67 | QString organizer() const; | 69 | QString organizer() const; |
68 | 70 | ||
69 | /** Set readonly status. */ | 71 | /** Set readonly status. */ |
70 | virtual void setReadOnly( bool ); | 72 | virtual void setReadOnly( bool ); |
71 | /** Return if the object is read-only. */ | 73 | /** Return if the object is read-only. */ |
72 | bool isReadOnly() const { return mReadOnly; } | 74 | bool isReadOnly() const { return mReadOnly; } |
73 | 75 | ||
74 | /** for setting the event's starting date/time with a QDateTime. */ | 76 | /** for setting the event's starting date/time with a QDateTime. */ |
75 | virtual void setDtStart(const QDateTime &dtStart); | 77 | virtual void setDtStart(const QDateTime &dtStart); |
76 | /** returns an event's starting date/time as a QDateTime. */ | 78 | /** returns an event's starting date/time as a QDateTime. */ |
77 | virtual QDateTime dtStart() const; | 79 | virtual QDateTime dtStart() const; |
78 | /** returns an event's starting time as a string formatted according to the | 80 | /** returns an event's starting time as a string formatted according to the |
79 | users locale settings */ | 81 | users locale settings */ |
80 | QString dtStartTimeStr() const; | 82 | QString dtStartTimeStr() const; |
81 | /** returns an event's starting date as a string formatted according to the | 83 | /** returns an event's starting date as a string formatted according to the |
82 | users locale settings */ | 84 | users locale settings */ |
83 | QString dtStartDateStr(bool shortfmt=true) const; | 85 | QString dtStartDateStr(bool shortfmt=true) const; |
84 | /** returns an event's starting date and time as a string formatted according | 86 | /** returns an event's starting date and time as a string formatted according |
85 | to the users locale settings */ | 87 | to the users locale settings */ |
86 | QString dtStartStr(bool shortfmt=true) const; | 88 | QString dtStartStr(bool shortfmt=true) const; |
87 | 89 | ||
88 | virtual void setDuration(int seconds); | 90 | virtual void setDuration(int seconds); |
89 | int duration() const; | 91 | int duration() const; |
90 | void setHasDuration(bool); | 92 | void setHasDuration(bool); |
91 | bool hasDuration() const; | 93 | bool hasDuration() const; |
92 | 94 | ||
93 | /** Return true or false depending on whether the incidence "floats," | 95 | /** Return true or false depending on whether the incidence "floats," |
94 | * i.e. has a date but no time attached to it. */ | 96 | * i.e. has a date but no time attached to it. */ |
95 | bool doesFloat() const; | 97 | bool doesFloat() const; |
96 | /** Set whether the incidence floats, i.e. has a date but no time attached to it. */ | 98 | /** Set whether the incidence floats, i.e. has a date but no time attached to it. */ |
97 | void setFloats(bool f); | 99 | void setFloats(bool f); |
98 | 100 | ||
99 | /** | 101 | /** |
100 | Add Attendee to this incidence. IncidenceBase takes ownership of the | 102 | Add Attendee to this incidence. IncidenceBase takes ownership of the |
101 | Attendee object. | 103 | Attendee object. |
102 | */ | 104 | */ |
103 | bool addAttendee(Attendee *a, bool doupdate=true ); | 105 | bool addAttendee(Attendee *a, bool doupdate=true ); |
104 | // void removeAttendee(Attendee *a); | 106 | // void removeAttendee(Attendee *a); |
105 | // void removeAttendee(const char *n); | 107 | // void removeAttendee(const char *n); |
106 | /** Remove all Attendees. */ | 108 | /** Remove all Attendees. */ |
107 | void clearAttendees(); | 109 | void clearAttendees(); |
108 | /** Return list of attendees. */ | 110 | /** Return list of attendees. */ |
109 | QPtrList<Attendee> attendees() const { return mAttendees; }; | 111 | QPtrList<Attendee> attendees() const { return mAttendees; }; |
110 | /** Return number of attendees. */ | 112 | /** Return number of attendees. */ |
111 | int attendeeCount() const { return mAttendees.count(); }; | 113 | int attendeeCount() const { return mAttendees.count(); }; |
112 | /** Return the Attendee with this email */ | 114 | /** Return the Attendee with this email */ |
113 | Attendee* attendeeByMail(const QString &); | 115 | Attendee* attendeeByMail(const QString &); |
114 | /** Return first Attendee with one of this emails */ | 116 | /** Return first Attendee with one of this emails */ |
115 | Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); | 117 | Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); |
116 | 118 | ||
117 | /** pilot syncronization states */ | 119 | /** pilot syncronization states */ |
diff --git a/libkcal/journal.h b/libkcal/journal.h index 2c1d7ea..1cd0a22 100644 --- a/libkcal/journal.h +++ b/libkcal/journal.h | |||
@@ -1,50 +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 | #ifndef JOURNAL_H | 20 | #ifndef JOURNAL_H |
21 | #define JOURNAL_H | 21 | #define JOURNAL_H |
22 | // | 22 | // |
23 | // Journal component, representing a VJOURNAL object | 23 | // Journal component, representing a VJOURNAL object |
24 | // | 24 | // |
25 | 25 | ||
26 | #include "incidence.h" | 26 | #include "incidence.h" |
27 | 27 | ||
28 | namespace KCal { | 28 | namespace KCal { |
29 | 29 | ||
30 | /** | 30 | /** |
31 | This class provides a Journal in the sense of RFC2445. | 31 | This class provides a Journal in the sense of RFC2445. |
32 | */ | 32 | */ |
33 | class Journal : public Incidence | 33 | class Journal : public Incidence |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | Journal(); | 36 | Journal(); |
37 | ~Journal(); | 37 | ~Journal(); |
38 | 38 | ||
39 | QCString type() const { return "Journal"; } | 39 | QCString type() const { return "Journal"; } |
40 | IncTypeID typeID() const { return journalID; } | ||
40 | 41 | ||
41 | Incidence *clone(); | 42 | Incidence *clone(); |
42 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; | 43 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; |
43 | private: | 44 | private: |
44 | bool accept(Visitor &v) { return v.visit(this); } | 45 | bool accept(Visitor &v) { return v.visit(this); } |
45 | }; | 46 | }; |
46 | 47 | ||
47 | bool operator==( const Journal&, const Journal& ); | 48 | bool operator==( const Journal&, const Journal& ); |
48 | } | 49 | } |
49 | 50 | ||
50 | #endif | 51 | #endif |
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 7d61b7f..d1ace4f 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -1,90 +1,90 @@ | |||
1 | #include "kincidenceformatter.h" | 1 | #include "kincidenceformatter.h" |
2 | #include <kstaticdeleter.h> | 2 | #include <kstaticdeleter.h> |
3 | #include <kglobal.h> | 3 | #include <kglobal.h> |
4 | #include <klocale.h> | 4 | #include <klocale.h> |
5 | #ifdef DEKTOP_VERSION | 5 | #ifdef DEKTOP_VERSION |
6 | #include <kabc/stdaddressbook.h> | 6 | #include <kabc/stdaddressbook.h> |
7 | #define size count | 7 | #define size count |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; | 10 | KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; |
11 | static KStaticDeleter<KIncidenceFormatter> insd; | 11 | static KStaticDeleter<KIncidenceFormatter> insd; |
12 | 12 | ||
13 | QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified ) | 13 | QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified ) |
14 | { | 14 | { |
15 | // #ifndef QT_NO_INPUTDIALOG | 15 | // #ifndef QT_NO_INPUTDIALOG |
16 | // return QInputDialog::getItem( caption, label, items, current, editable ); | 16 | // return QInputDialog::getItem( caption, label, items, current, editable ); |
17 | // #else | 17 | // #else |
18 | // return QString::null; | 18 | // return QString::null; |
19 | // #endif | 19 | // #endif |
20 | mDetails = details; | 20 | mDetails = details; |
21 | mCreated = created ; | 21 | mCreated = created ; |
22 | mModified = modified; | 22 | mModified = modified; |
23 | mText = ""; | 23 | mText = ""; |
24 | if ( inc->type() == "Event" ) | 24 | if ( inc->typeID() == eventID ) |
25 | setEvent((Event *) inc ); | 25 | setEvent((Event *) inc ); |
26 | else if ( inc->type() == "Todo" ) | 26 | else if ( inc->typeID() == todoID ) |
27 | setTodo((Todo *) inc ); | 27 | setTodo((Todo *) inc ); |
28 | return mText; | 28 | return mText; |
29 | } | 29 | } |
30 | 30 | ||
31 | KIncidenceFormatter* KIncidenceFormatter::instance() | 31 | KIncidenceFormatter* KIncidenceFormatter::instance() |
32 | { | 32 | { |
33 | if (!mInstance) { | 33 | if (!mInstance) { |
34 | mInstance = insd.setObject(new KIncidenceFormatter()); | 34 | mInstance = insd.setObject(new KIncidenceFormatter()); |
35 | } | 35 | } |
36 | return mInstance; | 36 | return mInstance; |
37 | } | 37 | } |
38 | KIncidenceFormatter::~KIncidenceFormatter() | 38 | KIncidenceFormatter::~KIncidenceFormatter() |
39 | { | 39 | { |
40 | if (mInstance == this) | 40 | if (mInstance == this) |
41 | mInstance = insd.setObject(0); | 41 | mInstance = insd.setObject(0); |
42 | //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); | 42 | //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); |
43 | } | 43 | } |
44 | KIncidenceFormatter::KIncidenceFormatter() | 44 | KIncidenceFormatter::KIncidenceFormatter() |
45 | { | 45 | { |
46 | mColorMode = 0; | 46 | mColorMode = 0; |
47 | } | 47 | } |
48 | void KIncidenceFormatter::setEvent(Event *event) | 48 | void KIncidenceFormatter::setEvent(Event *event) |
49 | { | 49 | { |
50 | int mode = 0; | 50 | int mode = 0; |
51 | mCurrentIncidence = event; | 51 | mCurrentIncidence = event; |
52 | bool shortDate = true; | 52 | bool shortDate = true; |
53 | if ( mode == 0 ) { | 53 | if ( mode == 0 ) { |
54 | addTag("h3",deTag(event->summary())); | 54 | addTag("h3",deTag(event->summary())); |
55 | } | 55 | } |
56 | else { | 56 | else { |
57 | if ( mColorMode == 1 ) { | 57 | if ( mColorMode == 1 ) { |
58 | mText +="<font color=\"#00A000\">"; | 58 | mText +="<font color=\"#00A000\">"; |
59 | } | 59 | } |
60 | if ( mColorMode == 2 ) { | 60 | if ( mColorMode == 2 ) { |
61 | mText +="<font color=\"#C00000\">"; | 61 | mText +="<font color=\"#C00000\">"; |
62 | } | 62 | } |
63 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 63 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
64 | if ( mode == 1 ) { | 64 | if ( mode == 1 ) { |
65 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 65 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
66 | } else { | 66 | } else { |
67 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 67 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
68 | } | 68 | } |
69 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 69 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
70 | if ( mColorMode ) | 70 | if ( mColorMode ) |
71 | mText += "</font>"; | 71 | mText += "</font>"; |
72 | } | 72 | } |
73 | if (event->cancelled ()) { | 73 | if (event->cancelled ()) { |
74 | mText +="<font color=\"#B00000\">"; | 74 | mText +="<font color=\"#B00000\">"; |
75 | addTag("i",i18n("This event has been cancelled!")); | 75 | addTag("i",i18n("This event has been cancelled!")); |
76 | mText.append("<br>"); | 76 | mText.append("<br>"); |
77 | mText += "</font>"; | 77 | mText += "</font>"; |
78 | } | 78 | } |
79 | if (event->doesFloat()) { | 79 | if (event->doesFloat()) { |
80 | if (event->isMultiDay()) { | 80 | if (event->isMultiDay()) { |
81 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 81 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
82 | .arg(event->dtStartDateStr(shortDate)) | 82 | .arg(event->dtStartDateStr(shortDate)) |
83 | .arg(event->dtEndDateStr(shortDate))); | 83 | .arg(event->dtEndDateStr(shortDate))); |
84 | } else { | 84 | } else { |
85 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 85 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
86 | } | 86 | } |
87 | } else { | 87 | } else { |
88 | if (event->isMultiDay()) { | 88 | if (event->isMultiDay()) { |
89 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 89 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
90 | .arg(event->dtStartStr( shortDate))); | 90 | .arg(event->dtStartStr( shortDate))); |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 38ba2c7..c97a61e 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -69,129 +69,129 @@ void Todo::setRunningFalse( QString s ) | |||
69 | mRunSaveTimer->stop(); | 69 | mRunSaveTimer->stop(); |
70 | saveRunningInfoToFile( s ); | 70 | saveRunningInfoToFile( s ); |
71 | } | 71 | } |
72 | void Todo::setRunning( bool run ) | 72 | void Todo::setRunning( bool run ) |
73 | { | 73 | { |
74 | if ( run == mRunning ) | 74 | if ( run == mRunning ) |
75 | return; | 75 | return; |
76 | //qDebug("Todo::setRunning %d ", run); | 76 | //qDebug("Todo::setRunning %d ", run); |
77 | if ( !mRunSaveTimer ) { | 77 | if ( !mRunSaveTimer ) { |
78 | mRunSaveTimer = new QTimer ( this ); | 78 | mRunSaveTimer = new QTimer ( this ); |
79 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); | 79 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); |
80 | } | 80 | } |
81 | mRunning = run; | 81 | mRunning = run; |
82 | if ( mRunning ) { | 82 | if ( mRunning ) { |
83 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min | 83 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min |
84 | mRunStart = QDateTime::currentDateTime(); | 84 | mRunStart = QDateTime::currentDateTime(); |
85 | } else { | 85 | } else { |
86 | mRunSaveTimer->stop(); | 86 | mRunSaveTimer->stop(); |
87 | saveRunningInfoToFile(); | 87 | saveRunningInfoToFile(); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | void Todo::saveRunningInfoToFile( QString comment ) | 91 | void Todo::saveRunningInfoToFile( QString comment ) |
92 | { | 92 | { |
93 | //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); | 93 | //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); |
94 | if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { | 94 | if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { |
95 | qDebug("Running time < 30 seconds. Skipped. "); | 95 | qDebug("Running time < 30 seconds. Skipped. "); |
96 | return; | 96 | return; |
97 | } | 97 | } |
98 | QString dir = KGlobalSettings::timeTrackerDir(); | 98 | QString dir = KGlobalSettings::timeTrackerDir(); |
99 | //qDebug("%s ", dir.latin1()); | 99 | //qDebug("%s ", dir.latin1()); |
100 | QString file = "%1%2%3-%4%5%6-"; | 100 | QString file = "%1%2%3-%4%5%6-"; |
101 | file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); | 101 | file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); |
102 | file.replace ( QRegExp (" "), "0" ); | 102 | file.replace ( QRegExp (" "), "0" ); |
103 | file += uid(); | 103 | file += uid(); |
104 | //qDebug("File %s ",file.latin1() ); | 104 | //qDebug("File %s ",file.latin1() ); |
105 | CalendarLocal cal; | 105 | CalendarLocal cal; |
106 | cal.setLocalTime(); | 106 | cal.setLocalTime(); |
107 | Todo * to = (Todo*) clone(); | 107 | Todo * to = (Todo*) clone(); |
108 | to->setFloats( false ); | 108 | to->setFloats( false ); |
109 | to->setDtStart( mRunStart ); | 109 | to->setDtStart( mRunStart ); |
110 | to->setHasStartDate( true ); | 110 | to->setHasStartDate( true ); |
111 | to->setDtDue( QDateTime::currentDateTime() ); | 111 | to->setDtDue( QDateTime::currentDateTime() ); |
112 | to->setHasDueDate( true ); | 112 | to->setHasDueDate( true ); |
113 | to->setUid( file ); | 113 | to->setUid( file ); |
114 | if ( !comment.isEmpty() ) { | 114 | if ( !comment.isEmpty() ) { |
115 | QString des = to->description(); | 115 | QString des = to->description(); |
116 | if ( des.isEmpty () ) | 116 | if ( des.isEmpty () ) |
117 | to->setDescription( "TT-Note: " + comment ); | 117 | to->setDescription( "TT-Note: " + comment ); |
118 | else | 118 | else |
119 | to->setDescription( "TT-Note: " + comment +"\n" + des ); | 119 | to->setDescription( "TT-Note: " + comment +"\n" + des ); |
120 | } | 120 | } |
121 | cal.addIncidence( to ); | 121 | cal.addIncidence( to ); |
122 | ICalFormat format; | 122 | ICalFormat format; |
123 | file = dir +"/" +file +".ics"; | 123 | file = dir +"/" +file +".ics"; |
124 | format.save( &cal, file ); | 124 | format.save( &cal, file ); |
125 | saveParents(); | 125 | saveParents(); |
126 | 126 | ||
127 | } | 127 | } |
128 | void Todo::saveParents() | 128 | void Todo::saveParents() |
129 | { | 129 | { |
130 | if (!relatedTo() ) | 130 | if (!relatedTo() ) |
131 | return; | 131 | return; |
132 | Incidence * inc = relatedTo(); | 132 | Incidence * inc = relatedTo(); |
133 | if ( inc->type() != "Todo" ) | 133 | if ( inc->typeID() != todoID ) |
134 | return; | 134 | return; |
135 | Todo* to = (Todo*)inc; | 135 | Todo* to = (Todo*)inc; |
136 | bool saveTodo = false; | 136 | bool saveTodo = false; |
137 | QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; | 137 | QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; |
138 | QFileInfo fi ( file ); | 138 | QFileInfo fi ( file ); |
139 | if ( fi.exists() ) { | 139 | if ( fi.exists() ) { |
140 | if ( fi.lastModified () < to->lastModified ()) | 140 | if ( fi.lastModified () < to->lastModified ()) |
141 | saveTodo = true; | 141 | saveTodo = true; |
142 | } else { | 142 | } else { |
143 | saveTodo = true; | 143 | saveTodo = true; |
144 | } | 144 | } |
145 | if ( saveTodo ) { | 145 | if ( saveTodo ) { |
146 | CalendarLocal cal; | 146 | CalendarLocal cal; |
147 | cal.setLocalTime(); | 147 | cal.setLocalTime(); |
148 | Todo * par = (Todo *) to->clone(); | 148 | Todo * par = (Todo *) to->clone(); |
149 | cal.addIncidence( par ); | 149 | cal.addIncidence( par ); |
150 | ICalFormat format; | 150 | ICalFormat format; |
151 | format.save( &cal, file ); | 151 | format.save( &cal, file ); |
152 | } | 152 | } |
153 | to->saveParents(); | 153 | to->saveParents(); |
154 | } | 154 | } |
155 | 155 | ||
156 | int Todo::runTime() | 156 | int Todo::runTime() |
157 | { | 157 | { |
158 | if ( !mRunning ) | 158 | if ( !mRunning ) |
159 | return 0; | 159 | return 0; |
160 | return mRunStart.secsTo( QDateTime::currentDateTime() ); | 160 | return mRunStart.secsTo( QDateTime::currentDateTime() ); |
161 | } | 161 | } |
162 | bool Todo::hasRunningSub() | 162 | bool Todo::hasRunningSub() |
163 | { | 163 | { |
164 | if ( mRunning ) | 164 | if ( mRunning ) |
165 | return true; | 165 | return true; |
166 | Incidence *aTodo; | 166 | Incidence *aTodo; |
167 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { | 167 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { |
168 | if ( ((Todo*)aTodo)->hasRunningSub() ) | 168 | if ( ((Todo*)aTodo)->hasRunningSub() ) |
169 | return true; | 169 | return true; |
170 | } | 170 | } |
171 | return false; | 171 | return false; |
172 | } | 172 | } |
173 | Incidence *Todo::clone() | 173 | Incidence *Todo::clone() |
174 | { | 174 | { |
175 | return new Todo(*this); | 175 | return new Todo(*this); |
176 | } | 176 | } |
177 | 177 | ||
178 | bool Todo::contains ( Todo* from ) | 178 | bool Todo::contains ( Todo* from ) |
179 | { | 179 | { |
180 | 180 | ||
181 | if ( !from->summary().isEmpty() ) | 181 | if ( !from->summary().isEmpty() ) |
182 | if ( !summary().startsWith( from->summary() )) | 182 | if ( !summary().startsWith( from->summary() )) |
183 | return false; | 183 | return false; |
184 | if ( from->hasStartDate() ) { | 184 | if ( from->hasStartDate() ) { |
185 | if ( !hasStartDate() ) | 185 | if ( !hasStartDate() ) |
186 | return false; | 186 | return false; |
187 | if ( from->dtStart() != dtStart()) | 187 | if ( from->dtStart() != dtStart()) |
188 | return false; | 188 | return false; |
189 | } | 189 | } |
190 | if ( from->hasDueDate() ){ | 190 | if ( from->hasDueDate() ){ |
191 | if ( !hasDueDate() ) | 191 | if ( !hasDueDate() ) |
192 | return false; | 192 | return false; |
193 | if ( from->dtDue() != dtDue()) | 193 | if ( from->dtDue() != dtDue()) |
194 | return false; | 194 | return false; |
195 | } | 195 | } |
196 | if ( !from->location().isEmpty() ) | 196 | if ( !from->location().isEmpty() ) |
197 | if ( !location().startsWith( from->location() ) ) | 197 | if ( !location().startsWith( from->location() ) ) |
@@ -503,78 +503,79 @@ bool Todo::setRecurDates() | |||
503 | recurrence()->unsetRecurs(); | 503 | recurrence()->unsetRecurs(); |
504 | } | 504 | } |
505 | return true; | 505 | return true; |
506 | } | 506 | } |
507 | void Todo::setPercentComplete(int v) | 507 | void Todo::setPercentComplete(int v) |
508 | { | 508 | { |
509 | if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { | 509 | if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { |
510 | if ( !setRecurDates() ) | 510 | if ( !setRecurDates() ) |
511 | v = 0; | 511 | v = 0; |
512 | } | 512 | } |
513 | mPercentComplete = v; | 513 | mPercentComplete = v; |
514 | if ( v != 100 ) | 514 | if ( v != 100 ) |
515 | mHasCompletedDate = false; | 515 | mHasCompletedDate = false; |
516 | updated(); | 516 | updated(); |
517 | } | 517 | } |
518 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const | 518 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const |
519 | { | 519 | { |
520 | if ( isCompleted() || ! hasDueDate() || cancelled() ) { | 520 | if ( isCompleted() || ! hasDueDate() || cancelled() ) { |
521 | *ok = false; | 521 | *ok = false; |
522 | return QDateTime (); | 522 | return QDateTime (); |
523 | } | 523 | } |
524 | QDateTime incidenceStart; | 524 | QDateTime incidenceStart; |
525 | incidenceStart = dtDue(); | 525 | incidenceStart = dtDue(); |
526 | bool enabled = false; | 526 | bool enabled = false; |
527 | Alarm* alarm; | 527 | Alarm* alarm; |
528 | int off = 0; | 528 | int off = 0; |
529 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; | 529 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; |
530 | // if ( QDateTime::currentDateTime() > incidenceStart ){ | 530 | // if ( QDateTime::currentDateTime() > incidenceStart ){ |
531 | // *ok = false; | 531 | // *ok = false; |
532 | // return incidenceStart; | 532 | // return incidenceStart; |
533 | // } | 533 | // } |
534 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { | 534 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { |
535 | if (alarm->enabled()) { | 535 | if (alarm->enabled()) { |
536 | if ( alarm->hasTime () ) { | 536 | if ( alarm->hasTime () ) { |
537 | if ( alarm->time() < alarmStart ) { | 537 | if ( alarm->time() < alarmStart ) { |
538 | alarmStart = alarm->time(); | 538 | alarmStart = alarm->time(); |
539 | enabled = true; | 539 | enabled = true; |
540 | off = alarmStart.secsTo( incidenceStart ); | 540 | off = alarmStart.secsTo( incidenceStart ); |
541 | } | 541 | } |
542 | 542 | ||
543 | } else { | 543 | } else { |
544 | int secs = alarm->startOffset().asSeconds(); | 544 | int secs = alarm->startOffset().asSeconds(); |
545 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { | 545 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { |
546 | alarmStart = incidenceStart.addSecs( secs ); | 546 | alarmStart = incidenceStart.addSecs( secs ); |
547 | enabled = true; | 547 | enabled = true; |
548 | off = -secs; | 548 | off = -secs; |
549 | } | 549 | } |
550 | } | 550 | } |
551 | } | 551 | } |
552 | } | 552 | } |
553 | if ( enabled ) { | 553 | if ( enabled ) { |
554 | if ( alarmStart > start_dt ) { | 554 | if ( alarmStart > start_dt ) { |
555 | *ok = true; | 555 | *ok = true; |
556 | * offset = off; | 556 | * offset = off; |
557 | return alarmStart; | 557 | return alarmStart; |
558 | } | 558 | } |
559 | } | 559 | } |
560 | *ok = false; | 560 | *ok = false; |
561 | return QDateTime (); | 561 | return QDateTime (); |
562 | 562 | ||
563 | } | 563 | } |
564 | 564 | ||
565 | void Todo::checkSetCompletedFalse() | 565 | void Todo::checkSetCompletedFalse() |
566 | { | 566 | { |
567 | if ( !hasRecurrenceID() ) { | 567 | if ( !mHasRecurrenceID ) { |
568 | qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); | 568 | qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); |
569 | return; | ||
569 | } | 570 | } |
570 | // qDebug("Todo::checkSetCompletedFalse()"); | 571 | // qDebug("Todo::checkSetCompletedFalse()"); |
571 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 572 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
572 | if ( mPercentComplete == 100 ) { | 573 | if ( mPercentComplete == 100 ) { |
573 | QDateTime dt = QDateTime::currentDateTime(); | 574 | QDateTime dt = QDateTime::currentDateTime(); |
574 | if ( dt > mDtStart && dt > mRecurrenceID ) { | 575 | if ( dt > mDtStart && dt > mRecurrenceID ) { |
575 | qDebug("start: %s --due: %s --recID: %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 576 | qDebug("start: %s --due: %s --recID: %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
576 | setCompleted( false ); | 577 | setCompleted( false ); |
577 | qDebug("Todo::checkSetCompletedFalse "); | 578 | qDebug("Todo::checkSetCompletedFalse "); |
578 | } | 579 | } |
579 | } | 580 | } |
580 | } | 581 | } |
diff --git a/libkcal/todo.h b/libkcal/todo.h index ab8fdf1..501c2ba 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h | |||
@@ -1,107 +1,108 @@ | |||
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 | #ifndef TODO_H | 20 | #ifndef TODO_H |
21 | #define TODO_H | 21 | #define TODO_H |
22 | // | 22 | // |
23 | // Todo component, representing a VTODO object | 23 | // Todo component, representing a VTODO object |
24 | // | 24 | // |
25 | 25 | ||
26 | #include "incidence.h" | 26 | #include "incidence.h" |
27 | 27 | ||
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | 29 | ||
30 | namespace KCal { | 30 | namespace KCal { |
31 | 31 | ||
32 | /** | 32 | /** |
33 | This class provides a Todo in the sense of RFC2445. | 33 | This class provides a Todo in the sense of RFC2445. |
34 | */ | 34 | */ |
35 | class Todo : public QObject,public Incidence | 35 | class Todo : public QObject,public Incidence |
36 | { | 36 | { |
37 | Q_OBJECT | 37 | Q_OBJECT |
38 | public: | 38 | public: |
39 | Todo(); | 39 | Todo(); |
40 | Todo(const Todo &); | 40 | Todo(const Todo &); |
41 | ~Todo(); | 41 | ~Todo(); |
42 | typedef ListBase<Todo> List; | 42 | typedef ListBase<Todo> List; |
43 | QCString type() const { return "Todo"; } | 43 | QCString type() const { return "Todo"; } |
44 | IncTypeID typeID() const { return todoID; } | ||
44 | 45 | ||
45 | /** Return an exact copy of this todo. */ | 46 | /** Return an exact copy of this todo. */ |
46 | Incidence *clone(); | 47 | Incidence *clone(); |
47 | QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const; | 48 | QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const; |
48 | 49 | ||
49 | /** for setting the todo's due date/time with a QDateTime. */ | 50 | /** for setting the todo's due date/time with a QDateTime. */ |
50 | void setDtDue(const QDateTime &dtDue); | 51 | void setDtDue(const QDateTime &dtDue); |
51 | /** returns an event's Due date/time as a QDateTime. */ | 52 | /** returns an event's Due date/time as a QDateTime. */ |
52 | QDateTime dtDue() const; | 53 | QDateTime dtDue() const; |
53 | /** returns an event's due time as a string formatted according to the | 54 | /** returns an event's due time as a string formatted according to the |
54 | users locale settings */ | 55 | users locale settings */ |
55 | QString dtDueTimeStr() const; | 56 | QString dtDueTimeStr() const; |
56 | /** returns an event's due date as a string formatted according to the | 57 | /** returns an event's due date as a string formatted according to the |
57 | users locale settings */ | 58 | users locale settings */ |
58 | QString dtDueDateStr(bool shortfmt=true) const; | 59 | QString dtDueDateStr(bool shortfmt=true) const; |
59 | /** returns an event's due date and time as a string formatted according | 60 | /** returns an event's due date and time as a string formatted according |
60 | to the users locale settings */ | 61 | to the users locale settings */ |
61 | QString dtDueStr(bool shortfmt=true) const; | 62 | QString dtDueStr(bool shortfmt=true) const; |
62 | 63 | ||
63 | /** returns TRUE or FALSE depending on whether the todo has a due date */ | 64 | /** returns TRUE or FALSE depending on whether the todo has a due date */ |
64 | bool hasDueDate() const; | 65 | bool hasDueDate() const; |
65 | /** sets the event's hasDueDate value. */ | 66 | /** sets the event's hasDueDate value. */ |
66 | void setHasDueDate(bool f); | 67 | void setHasDueDate(bool f); |
67 | 68 | ||
68 | /* | 69 | /* |
69 | Looks for a subtodo (including itself ) which is not complete and is | 70 | Looks for a subtodo (including itself ) which is not complete and is |
70 | - overdue, or | 71 | - overdue, or |
71 | - due today. | 72 | - due today. |
72 | It returns 0 for nothing found, | 73 | It returns 0 for nothing found, |
73 | 1 for found a todo which is due today and no overdue found | 74 | 1 for found a todo which is due today and no overdue found |
74 | 2 for found a overdue todo | 75 | 2 for found a overdue todo |
75 | */ | 76 | */ |
76 | int hasDueSubTodo( bool checkSubtodos = true ); | 77 | int hasDueSubTodo( bool checkSubtodos = true ); |
77 | /* same as above, but a specific date can be specified*/ | 78 | /* same as above, but a specific date can be specified*/ |
78 | int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ); | 79 | int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ); |
79 | 80 | ||
80 | 81 | ||
81 | /** sets the event's status to the string specified. The string | 82 | /** sets the event's status to the string specified. The string |
82 | * must be a recognized value for the status field, i.e. a string | 83 | * must be a recognized value for the status field, i.e. a string |
83 | * equivalent of the possible status enumerations previously described. */ | 84 | * equivalent of the possible status enumerations previously described. */ |
84 | // void setStatus(const QString &statStr); | 85 | // void setStatus(const QString &statStr); |
85 | /** sets the event's status to the value specified. See the enumeration | 86 | /** sets the event's status to the value specified. See the enumeration |
86 | * above for possible values. */ | 87 | * above for possible values. */ |
87 | // void setStatus(int); | 88 | // void setStatus(int); |
88 | /** return the event's status. */ | 89 | /** return the event's status. */ |
89 | // int status() const; | 90 | // int status() const; |
90 | /** return the event's status in string format. */ | 91 | /** return the event's status in string format. */ |
91 | // QString statusStr() const; | 92 | // QString statusStr() const; |
92 | 93 | ||
93 | /** return, if this todo is completed */ | 94 | /** return, if this todo is completed */ |
94 | bool isCompleted() const; | 95 | bool isCompleted() const; |
95 | /** set completed state of this todo */ | 96 | /** set completed state of this todo */ |
96 | void setCompleted(bool); | 97 | void setCompleted(bool); |
97 | 98 | ||
98 | /** | 99 | /** |
99 | Return how many percent of the task are completed. Returns a value | 100 | Return how many percent of the task are completed. Returns a value |
100 | between 0 and 100. | 101 | between 0 and 100. |
101 | */ | 102 | */ |
102 | int percentComplete() const; | 103 | int percentComplete() const; |
103 | /** | 104 | /** |
104 | Set how many percent of the task are completed. Valid values are in the | 105 | Set how many percent of the task are completed. Valid values are in the |
105 | range from 0 to 100. | 106 | range from 0 to 100. |
106 | */ | 107 | */ |
107 | void setPercentComplete(int); | 108 | void setPercentComplete(int); |