author | zautrix <zautrix> | 2005-03-21 17:39:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-21 17:39:46 (UTC) |
commit | 3c5d7b484e6ab263ab4091f22815770ea8da6c9c (patch) (unidiff) | |
tree | 97f86965d7ae565fc054918978756c3953476e82 | |
parent | 070055b60f76ffd6907e44a4ffc2d752578f3211 (diff) | |
download | kdepimpi-3c5d7b484e6ab263ab4091f22815770ea8da6c9c.zip kdepimpi-3c5d7b484e6ab263ab4091f22815770ea8da6c9c.tar.gz kdepimpi-3c5d7b484e6ab263ab4091f22815770ea8da6c9c.tar.bz2 |
fix
-rw-r--r-- | korganizer/koagendaview.cpp | 3 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 4 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 3 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 8 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 32 | ||||
-rw-r--r-- | libkcal/incidence.h | 5 |
6 files changed, 44 insertions, 11 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index e029fdb..eb3a6cd 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1405,34 +1405,33 @@ void KOAgendaView::writeSettings(KConfig *config) | |||
1405 | } | 1405 | } |
1406 | 1406 | ||
1407 | void KOAgendaView::setHolidayMasks() | 1407 | void KOAgendaView::setHolidayMasks() |
1408 | { | 1408 | { |
1409 | mHolidayMask.resize(mSelectedDates.count()); | 1409 | mHolidayMask.resize(mSelectedDates.count()); |
1410 | 1410 | ||
1411 | uint i; | 1411 | uint i; |
1412 | for(i=0;i<mSelectedDates.count();++i) { | 1412 | for(i=0;i<mSelectedDates.count();++i) { |
1413 | QDate date = mSelectedDates[i]; | 1413 | QDate date = mSelectedDates[i]; |
1414 | bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); | 1414 | bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); |
1415 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); | 1415 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); |
1416 | bool showHoliday = false; | 1416 | bool showHoliday = false; |
1417 | if ( KOPrefs::instance()->mExcludeHolidays ) { | 1417 | if ( KOPrefs::instance()->mExcludeHolidays ) { |
1418 | QPtrList<Event> events = calendar()->events( date, true ); | 1418 | QPtrList<Event> events = calendar()->events( date, true ); |
1419 | Event *event; | 1419 | Event *event; |
1420 | for( event = events.first(); event; event = events.next() ) { | 1420 | for( event = events.first(); event; event = events.next() ) { |
1421 | if ( event->categories().contains("Holiday") || | 1421 | if ( event->isHoliday()) { |
1422 | event->categories().contains(i18n("Holiday"))) { | ||
1423 | showHoliday = true; | 1422 | showHoliday = true; |
1424 | break; | 1423 | break; |
1425 | } | 1424 | } |
1426 | } | 1425 | } |
1427 | 1426 | ||
1428 | } | 1427 | } |
1429 | 1428 | ||
1430 | #ifndef KORG_NOPLUGINS | 1429 | #ifndef KORG_NOPLUGINS |
1431 | bool showHoliday = KOPrefs::instance()->mExcludeHolidays && | 1430 | bool showHoliday = KOPrefs::instance()->mExcludeHolidays && |
1432 | !KOCore::self()->holiday(date).isEmpty(); | 1431 | !KOCore::self()->holiday(date).isEmpty(); |
1433 | #endif | 1432 | #endif |
1434 | bool showDay = showSaturday || showSunday || showHoliday; | 1433 | bool showDay = showSaturday || showSunday || showHoliday; |
1435 | 1434 | ||
1436 | if (showDay) { | 1435 | if (showDay) { |
1437 | mHolidayMask.at(i) = true; | 1436 | mHolidayMask.at(i) = true; |
1438 | } else { | 1437 | } else { |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index d7a4112..36cd990 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -335,40 +335,40 @@ void KODayMatrix::updateViewTimed() | |||
335 | return; | 335 | return; |
336 | } | 336 | } |
337 | //qDebug("KODayMatrix::updateViewTimed "); | 337 | //qDebug("KODayMatrix::updateViewTimed "); |
338 | for(int i = 0; i < NUMDAYS; i++) { | 338 | for(int i = 0; i < NUMDAYS; i++) { |
339 | // if events are set for the day then remember to draw it bold | 339 | // if events are set for the day then remember to draw it bold |
340 | QPtrList<Event> eventlist = mCalendar->events(days[i]); | 340 | QPtrList<Event> eventlist = mCalendar->events(days[i]); |
341 | Event *event; | 341 | Event *event; |
342 | int numEvents = eventlist.count(); | 342 | int numEvents = eventlist.count(); |
343 | QString holiStr = ""; | 343 | QString holiStr = ""; |
344 | bDays.clearBit(i); | 344 | bDays.clearBit(i); |
345 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 345 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
346 | ushort recurType = event->recurrence()->doesRecur(); | 346 | ushort recurType = event->recurrence()->doesRecur(); |
347 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 347 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
348 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 348 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
349 | numEvents--; | 349 | numEvents--; |
350 | } | 350 | } |
351 | if ( event->categories().contains( i18n("Holiday") ) || event->categories().contains( "Holiday" )) { | 351 | if ( event->isHoliday()) { |
352 | if ( !holiStr.isEmpty() ) | 352 | if ( !holiStr.isEmpty() ) |
353 | holiStr += "\n"; | 353 | holiStr += "\n"; |
354 | holiStr += event->summary(); | 354 | holiStr += event->summary(); |
355 | if ( !event->location().isEmpty() ) | 355 | if ( !event->location().isEmpty() ) |
356 | holiStr += " (" + event->location() + ")"; | 356 | holiStr += " (" + event->location() + ")"; |
357 | } | 357 | } |
358 | if ( event->categories().contains( i18n("Birthday") ) || event->categories().contains( "Birthday" )) { | 358 | if ( event->isBirthday()) { |
359 | if ( !holiStr.isEmpty() ) | 359 | if ( !holiStr.isEmpty() ) |
360 | holiStr += "\n"; | 360 | holiStr += "\n"; |
361 | holiStr += i18n("Birthday") + ": "+event->summary(); | 361 | holiStr += i18n("Birthday") + ": "+event->summary(); |
362 | if ( !event->location().isEmpty() ) | 362 | if ( !event->location().isEmpty() ) |
363 | holiStr += " (" + event->location() + ")"; | 363 | holiStr += " (" + event->location() + ")"; |
364 | bDays.setBit(i); | 364 | bDays.setBit(i); |
365 | } | 365 | } |
366 | } | 366 | } |
367 | events[i] = numEvents; | 367 | events[i] = numEvents; |
368 | //if it is a holy day then draw it red. Sundays are consider holidays, too | 368 | //if it is a holy day then draw it red. Sundays are consider holidays, too |
369 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 369 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
370 | !holiStr.isEmpty()) { | 370 | !holiStr.isEmpty()) { |
371 | mHolidays[i] = holiStr; | 371 | mHolidays[i] = holiStr; |
372 | } else { | 372 | } else { |
373 | mHolidays[i] = QString::null; | 373 | mHolidays[i] = QString::null; |
374 | } | 374 | } |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 004ff50..76982b4 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -502,34 +502,33 @@ void MonthViewCell::startUpdateCell() | |||
502 | mToolTip.append ( mHolidayString ); | 502 | mToolTip.append ( mHolidayString ); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | void MonthViewCell::insertEvent(Event *event) | 506 | void MonthViewCell::insertEvent(Event *event) |
507 | { | 507 | { |
508 | QString mToolTipText; | 508 | QString mToolTipText; |
509 | mItemList->setFocusPolicy(WheelFocus); | 509 | mItemList->setFocusPolicy(WheelFocus); |
510 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 510 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
511 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 511 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
512 | return; | 512 | return; |
513 | else | 513 | else |
514 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 514 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
515 | return; | 515 | return; |
516 | } | 516 | } |
517 | 517 | ||
518 | if ( event->categories().contains("Holiday") || | 518 | if ( event->isHoliday()) { |
519 | event->categories().contains(i18n("Holiday"))) { | ||
520 | setHoliday( true ); | 519 | setHoliday( true ); |
521 | if ( mDate.dayOfWeek() == 7 ) | 520 | if ( mDate.dayOfWeek() == 7 ) |
522 | mItemList->setLineWidth( 3 ); | 521 | mItemList->setLineWidth( 3 ); |
523 | } | 522 | } |
524 | QString text; | 523 | QString text; |
525 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 524 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
526 | if (event->isMultiDay()) { | 525 | if (event->isMultiDay()) { |
527 | QString prefix = "<->";multiday = 2; | 526 | QString prefix = "<->";multiday = 2; |
528 | QString time; | 527 | QString time; |
529 | if ( event->doesRecur() ) { | 528 | if ( event->doesRecur() ) { |
530 | if ( event->recursOn( mDate) ) { | 529 | if ( event->recursOn( mDate) ) { |
531 | prefix ="->" ;multiday = 1; | 530 | prefix ="->" ;multiday = 1; |
532 | } | 531 | } |
533 | else { | 532 | else { |
534 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 533 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
535 | if ( event->recursOn( mDate.addDays( -days)) ) { | 534 | if ( event->recursOn( mDate.addDays( -days)) ) { |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 18dc656..66ff75d 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -465,33 +465,33 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
465 | { | 465 | { |
466 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) | 466 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) |
467 | return false; | 467 | return false; |
468 | QDateTime cdt = QDateTime::currentDateTime(); | 468 | QDateTime cdt = QDateTime::currentDateTime(); |
469 | QDateTime noc; | 469 | QDateTime noc; |
470 | QString tempText; | 470 | QString tempText; |
471 | if ( appendTable && !notRed ) { | 471 | if ( appendTable && !notRed ) { |
472 | tempText = "<table>"; | 472 | tempText = "<table>"; |
473 | } | 473 | } |
474 | bool ok = true; | 474 | bool ok = true; |
475 | if ( reply ) { | 475 | if ( reply ) { |
476 | noc = ev->getNextOccurence( cdt, &ok ); | 476 | noc = ev->getNextOccurence( cdt, &ok ); |
477 | if (! ok && ev->type() == "Event") | 477 | if (! ok && ev->type() == "Event") |
478 | return false; | 478 | return false; |
479 | } | 479 | } |
480 | bool bDay = false; | 480 | bool bDay = false; |
481 | if ( ev->categories().contains( i18n("Birthday") ) || ev->categories().contains( i18n("Anniversary") ) ) | 481 | if ( ev->isBirthday() || ev->isAnniversary() ) |
482 | bDay = true; | 482 | bDay = true; |
483 | tempText += "<tr><td><b>"; | 483 | tempText += "<tr><td><b>"; |
484 | if (ev->type()=="Event") { | 484 | if (ev->type()=="Event") { |
485 | if (reply) { | 485 | if (reply) { |
486 | if (!ev->doesFloat()) | 486 | if (!ev->doesFloat()) |
487 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; | 487 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; |
488 | else | 488 | else |
489 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 489 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
490 | 490 | ||
491 | } else { | 491 | } else { |
492 | if (!ev->doesFloat()) { | 492 | if (!ev->doesFloat()) { |
493 | Event *event = static_cast<Event *>(ev); | 493 | Event *event = static_cast<Event *>(ev); |
494 | QDateTime st,end; | 494 | QDateTime st,end; |
495 | if ( event->recurrence()->doesRecur() ) { | 495 | if ( event->recurrence()->doesRecur() ) { |
496 | QDate recDate= mEventDate; | 496 | QDate recDate= mEventDate; |
497 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | 497 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); |
@@ -523,36 +523,36 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
523 | else { | 523 | else { |
524 | if ( end < cdt ) { | 524 | if ( end < cdt ) { |
525 | if ( !KOPrefs::instance()->mWNViewShowsPast ) | 525 | if ( !KOPrefs::instance()->mWNViewShowsPast ) |
526 | return false; | 526 | return false; |
527 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; | 527 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; |
528 | } | 528 | } |
529 | else if ( st < cdt ) | 529 | else if ( st < cdt ) |
530 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; | 530 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; |
531 | else | 531 | else |
532 | tempText += dateText; | 532 | tempText += dateText; |
533 | 533 | ||
534 | } | 534 | } |
535 | 535 | ||
536 | } else { | 536 | } else { |
537 | if ( bDay ) { | 537 | if ( bDay ) { |
538 | 538 | ||
539 | if ( ev->categories().contains( i18n("Birthday") )) | 539 | if ( ev->isBirthday()) |
540 | tempText += "<font color=\"#F00000\">" + i18n("Birthday") +":</font>"; | 540 | tempText += "<font color=\"#00B000\">" + i18n("Birthday") +":</font>"; |
541 | else | 541 | else |
542 | tempText += "<font color=\"#F00000\">" + i18n("Anniversary")+":</font>"; | 542 | tempText += "<font color=\"#00B0000\">" + i18n("Anniversary")+":</font>"; |
543 | } else { | 543 | } else { |
544 | tempText += i18n("Allday:"); | 544 | tempText += i18n("Allday:"); |
545 | } | 545 | } |
546 | 546 | ||
547 | } | 547 | } |
548 | } | 548 | } |
549 | } else { | 549 | } else { |
550 | mTodos.append( ev ); | 550 | mTodos.append( ev ); |
551 | tempText += i18n("ToDo:"); | 551 | tempText += i18n("ToDo:"); |
552 | if (reply) { | 552 | if (reply) { |
553 | tempText += " "; | 553 | tempText += " "; |
554 | if ( noc != cdt ) { | 554 | if ( noc != cdt ) { |
555 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 555 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
556 | } | 556 | } |
557 | } else { | 557 | } else { |
558 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { | 558 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 708ee6b..9a36939 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -27,32 +27,36 @@ | |||
27 | #include "incidence.h" | 27 | #include "incidence.h" |
28 | #include "todo.h" | 28 | #include "todo.h" |
29 | 29 | ||
30 | using namespace KCal; | 30 | using namespace KCal; |
31 | 31 | ||
32 | Incidence::Incidence() : | 32 | Incidence::Incidence() : |
33 | IncidenceBase(), | 33 | IncidenceBase(), |
34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) | 34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) |
35 | { | 35 | { |
36 | mRecurrence = new Recurrence(this); | 36 | mRecurrence = new Recurrence(this); |
37 | mCancelled = false; | 37 | mCancelled = false; |
38 | recreate(); | 38 | recreate(); |
39 | mHasStartDate = true; | 39 | mHasStartDate = true; |
40 | mAlarms.setAutoDelete(true); | 40 | mAlarms.setAutoDelete(true); |
41 | mAttachments.setAutoDelete(true); | 41 | mAttachments.setAutoDelete(true); |
42 | mHasRecurrenceID = false; | 42 | mHasRecurrenceID = false; |
43 | mHoliday = false; | ||
44 | mBirthday = false; | ||
45 | mAnniversary = false; | ||
46 | |||
43 | } | 47 | } |
44 | 48 | ||
45 | Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) | 49 | Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) |
46 | { | 50 | { |
47 | // TODO: reenable attributes currently commented out. | 51 | // TODO: reenable attributes currently commented out. |
48 | mRevision = i.mRevision; | 52 | mRevision = i.mRevision; |
49 | mCreated = i.mCreated; | 53 | mCreated = i.mCreated; |
50 | mDescription = i.mDescription; | 54 | mDescription = i.mDescription; |
51 | mSummary = i.mSummary; | 55 | mSummary = i.mSummary; |
52 | mCategories = i.mCategories; | 56 | mCategories = i.mCategories; |
53 | // Incidence *mRelatedTo; Incidence *mRelatedTo; | 57 | // Incidence *mRelatedTo; Incidence *mRelatedTo; |
54 | mRelatedTo = 0; | 58 | mRelatedTo = 0; |
55 | mRelatedToUid = i.mRelatedToUid; | 59 | mRelatedToUid = i.mRelatedToUid; |
56 | // QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; | 60 | // QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; |
57 | mExDates = i.mExDates; | 61 | mExDates = i.mExDates; |
58 | mAttachments = i.mAttachments; | 62 | mAttachments = i.mAttachments; |
@@ -62,46 +66,65 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) | |||
62 | mLocation = i.mLocation; | 66 | mLocation = i.mLocation; |
63 | mCancelled = i.mCancelled; | 67 | mCancelled = i.mCancelled; |
64 | mHasStartDate = i.mHasStartDate; | 68 | mHasStartDate = i.mHasStartDate; |
65 | QPtrListIterator<Alarm> it( i.mAlarms ); | 69 | QPtrListIterator<Alarm> it( i.mAlarms ); |
66 | const Alarm *a; | 70 | const Alarm *a; |
67 | while( (a = it.current()) ) { | 71 | while( (a = it.current()) ) { |
68 | Alarm *b = new Alarm( *a ); | 72 | Alarm *b = new Alarm( *a ); |
69 | b->setParent( this ); | 73 | b->setParent( this ); |
70 | mAlarms.append( b ); | 74 | mAlarms.append( b ); |
71 | 75 | ||
72 | ++it; | 76 | ++it; |
73 | } | 77 | } |
74 | mAlarms.setAutoDelete(true); | 78 | mAlarms.setAutoDelete(true); |
75 | mHasRecurrenceID = i.mHasRecurrenceID; | 79 | mHasRecurrenceID = i.mHasRecurrenceID; |
76 | mRecurrenceID = i.mRecurrenceID; | 80 | mRecurrenceID = i.mRecurrenceID; |
77 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); | 81 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); |
82 | mHoliday = i.mHoliday ; | ||
83 | mBirthday = i.mBirthday; | ||
84 | mAnniversary = i.mAnniversary; | ||
78 | } | 85 | } |
79 | 86 | ||
80 | Incidence::~Incidence() | 87 | Incidence::~Incidence() |
81 | { | 88 | { |
82 | 89 | ||
83 | Incidence *ev; | 90 | Incidence *ev; |
84 | QPtrList<Incidence> Relations = relations(); | 91 | QPtrList<Incidence> Relations = relations(); |
85 | for (ev=Relations.first();ev;ev=Relations.next()) { | 92 | for (ev=Relations.first();ev;ev=Relations.next()) { |
86 | if (ev->relatedTo() == this) ev->setRelatedTo(0); | 93 | if (ev->relatedTo() == this) ev->setRelatedTo(0); |
87 | } | 94 | } |
88 | if (relatedTo()) relatedTo()->removeRelation(this); | 95 | if (relatedTo()) relatedTo()->removeRelation(this); |
89 | delete mRecurrence; | 96 | delete mRecurrence; |
90 | 97 | ||
91 | } | 98 | } |
99 | |||
100 | bool Incidence::isHoliday() const | ||
101 | { | ||
102 | return mHoliday; | ||
103 | } | ||
104 | bool Incidence::isBirthday() const | ||
105 | { | ||
106 | |||
107 | return mBirthday ; | ||
108 | } | ||
109 | bool Incidence::isAnniversary() const | ||
110 | { | ||
111 | return mAnniversary ; | ||
112 | |||
113 | } | ||
114 | |||
92 | bool Incidence::hasRecurrenceID() const | 115 | bool Incidence::hasRecurrenceID() const |
93 | { | 116 | { |
94 | return mHasRecurrenceID; | 117 | return mHasRecurrenceID; |
95 | } | 118 | } |
96 | 119 | ||
97 | void Incidence::setHasRecurrenceID( bool b ) | 120 | void Incidence::setHasRecurrenceID( bool b ) |
98 | { | 121 | { |
99 | mHasRecurrenceID = b; | 122 | mHasRecurrenceID = b; |
100 | } | 123 | } |
101 | 124 | ||
102 | void Incidence::setRecurrenceID(QDateTime d) | 125 | void Incidence::setRecurrenceID(QDateTime d) |
103 | { | 126 | { |
104 | mRecurrenceID = d; | 127 | mRecurrenceID = d; |
105 | mHasRecurrenceID = true; | 128 | mHasRecurrenceID = true; |
106 | updated(); | 129 | updated(); |
107 | } | 130 | } |
@@ -289,55 +312,62 @@ QString Incidence::description() const | |||
289 | { | 312 | { |
290 | return mDescription; | 313 | return mDescription; |
291 | } | 314 | } |
292 | 315 | ||
293 | 316 | ||
294 | void Incidence::setSummary(const QString &summary) | 317 | void Incidence::setSummary(const QString &summary) |
295 | { | 318 | { |
296 | if (mReadOnly) return; | 319 | if (mReadOnly) return; |
297 | mSummary = summary; | 320 | mSummary = summary; |
298 | updated(); | 321 | updated(); |
299 | } | 322 | } |
300 | 323 | ||
301 | QString Incidence::summary() const | 324 | QString Incidence::summary() const |
302 | { | 325 | { |
303 | return mSummary; | 326 | return mSummary; |
304 | } | 327 | } |
328 | void Incidence::checkCategories() | ||
329 | { | ||
330 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); | ||
331 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); | ||
332 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); | ||
333 | } | ||
305 | 334 | ||
306 | void Incidence::setCategories(const QStringList &categories) | 335 | void Incidence::setCategories(const QStringList &categories) |
307 | { | 336 | { |
308 | if (mReadOnly) return; | 337 | if (mReadOnly) return; |
309 | mCategories = categories; | 338 | mCategories = categories; |
339 | checkCategories(); | ||
310 | updated(); | 340 | updated(); |
311 | } | 341 | } |
312 | 342 | ||
313 | // TODO: remove setCategories(QString) function | 343 | // TODO: remove setCategories(QString) function |
314 | void Incidence::setCategories(const QString &catStr) | 344 | void Incidence::setCategories(const QString &catStr) |
315 | { | 345 | { |
316 | if (mReadOnly) return; | 346 | if (mReadOnly) return; |
317 | mCategories.clear(); | 347 | mCategories.clear(); |
318 | 348 | ||
319 | if (catStr.isEmpty()) return; | 349 | if (catStr.isEmpty()) return; |
320 | 350 | ||
321 | mCategories = QStringList::split(",",catStr); | 351 | mCategories = QStringList::split(",",catStr); |
322 | 352 | ||
323 | QStringList::Iterator it; | 353 | QStringList::Iterator it; |
324 | for(it = mCategories.begin();it != mCategories.end(); ++it) { | 354 | for(it = mCategories.begin();it != mCategories.end(); ++it) { |
325 | *it = (*it).stripWhiteSpace(); | 355 | *it = (*it).stripWhiteSpace(); |
326 | } | 356 | } |
327 | 357 | checkCategories(); | |
328 | updated(); | 358 | updated(); |
329 | } | 359 | } |
330 | 360 | ||
331 | QStringList Incidence::categories() const | 361 | QStringList Incidence::categories() const |
332 | { | 362 | { |
333 | return mCategories; | 363 | return mCategories; |
334 | } | 364 | } |
335 | 365 | ||
336 | QString Incidence::categoriesStr() | 366 | QString Incidence::categoriesStr() |
337 | { | 367 | { |
338 | return mCategories.join(","); | 368 | return mCategories.join(","); |
339 | } | 369 | } |
340 | 370 | ||
341 | void Incidence::setRelatedToUid(const QString &relatedToUid) | 371 | void Incidence::setRelatedToUid(const QString &relatedToUid) |
342 | { | 372 | { |
343 | if (mReadOnly) return; | 373 | if (mReadOnly) return; |
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 0ae9656..f8da342 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -257,40 +257,45 @@ class Incidence : public IncidenceBase | |||
257 | /** return the event's/todo's location. Do _not_ use it with journal */ | 257 | /** return the event's/todo's location. Do _not_ use it with journal */ |
258 | QString location() const; | 258 | QString location() const; |
259 | /** returns TRUE or FALSE depending on whether the todo has a start date */ | 259 | /** returns TRUE or FALSE depending on whether the todo has a start date */ |
260 | bool hasStartDate() const; | 260 | bool hasStartDate() const; |
261 | /** sets the event's hasStartDate value. */ | 261 | /** sets the event's hasStartDate value. */ |
262 | void setHasStartDate(bool f); | 262 | void setHasStartDate(bool f); |
263 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; | 263 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; |
264 | bool cancelled() const; | 264 | bool cancelled() const; |
265 | void setCancelled( bool b ); | 265 | void setCancelled( bool b ); |
266 | 266 | ||
267 | bool hasRecurrenceID() const; | 267 | bool hasRecurrenceID() const; |
268 | void setHasRecurrenceID( bool b ); | 268 | void setHasRecurrenceID( bool b ); |
269 | 269 | ||
270 | void setRecurrenceID(QDateTime); | 270 | void setRecurrenceID(QDateTime); |
271 | QDateTime recurrenceID () const; | 271 | QDateTime recurrenceID () const; |
272 | QDateTime dtStart() const; | 272 | QDateTime dtStart() const; |
273 | bool isHoliday() const; | ||
274 | bool isBirthday() const; | ||
275 | bool isAnniversary() const; | ||
273 | 276 | ||
274 | 277 | ||
275 | protected: | 278 | protected: |
276 | QPtrList<Alarm> mAlarms; | 279 | QPtrList<Alarm> mAlarms; |
277 | QPtrList<Incidence> mRelations; | 280 | QPtrList<Incidence> mRelations; |
278 | QDateTime mRecurrenceID; | 281 | QDateTime mRecurrenceID; |
279 | bool mHasRecurrenceID; | 282 | bool mHasRecurrenceID; |
280 | private: | 283 | private: |
284 | void checkCategories(); | ||
285 | bool mHoliday, mBirthday, mAnniversary; | ||
281 | int mRevision; | 286 | int mRevision; |
282 | bool mCancelled; | 287 | bool mCancelled; |
283 | 288 | ||
284 | // base components of jounal, event and todo | 289 | // base components of jounal, event and todo |
285 | QDateTime mCreated; | 290 | QDateTime mCreated; |
286 | QString mDescription; | 291 | QString mDescription; |
287 | QString mSummary; | 292 | QString mSummary; |
288 | QStringList mCategories; | 293 | QStringList mCategories; |
289 | Incidence *mRelatedTo; | 294 | Incidence *mRelatedTo; |
290 | QString mRelatedToUid; | 295 | QString mRelatedToUid; |
291 | DateList mExDates; | 296 | DateList mExDates; |
292 | QPtrList<Attachment> mAttachments; | 297 | QPtrList<Attachment> mAttachments; |
293 | QStringList mResources; | 298 | QStringList mResources; |
294 | bool mHasStartDate; // if todo has associated start date | 299 | bool mHasStartDate; // if todo has associated start date |
295 | 300 | ||
296 | int mSecrecy; | 301 | int mSecrecy; |