-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 @@ -1420,4 +1420,3 @@ void KOAgendaView::setHolidayMasks() for( event = events.first(); event; event = events.next() ) { - if ( event->categories().contains("Holiday") || - event->categories().contains(i18n("Holiday"))) { + if ( event->isHoliday()) { showHoliday = true; diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index d7a4112..36cd990 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -350,3 +350,3 @@ void KODayMatrix::updateViewTimed() } - if ( event->categories().contains( i18n("Holiday") ) || event->categories().contains( "Holiday" )) { + if ( event->isHoliday()) { if ( !holiStr.isEmpty() ) @@ -357,3 +357,3 @@ void KODayMatrix::updateViewTimed() } - if ( event->categories().contains( i18n("Birthday") ) || event->categories().contains( "Birthday" )) { + if ( event->isBirthday()) { if ( !holiStr.isEmpty() ) diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 004ff50..76982b4 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -517,4 +517,3 @@ void MonthViewCell::insertEvent(Event *event) - if ( event->categories().contains("Holiday") || - event->categories().contains(i18n("Holiday"))) { + if ( event->isHoliday()) { setHoliday( true ); diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 18dc656..66ff75d 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp @@ -480,3 +480,3 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a bool bDay = false; - if ( ev->categories().contains( i18n("Birthday") ) || ev->categories().contains( i18n("Anniversary") ) ) + if ( ev->isBirthday() || ev->isAnniversary() ) bDay = true; @@ -538,6 +538,6 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a - if ( ev->categories().contains( i18n("Birthday") )) - tempText += "<font color=\"#F00000\">" + i18n("Birthday") +":</font>"; + if ( ev->isBirthday()) + tempText += "<font color=\"#00B000\">" + i18n("Birthday") +":</font>"; else - tempText += "<font color=\"#F00000\">" + i18n("Anniversary")+":</font>"; + tempText += "<font color=\"#00B0000\">" + i18n("Anniversary")+":</font>"; } else { diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 708ee6b..9a36939 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -42,2 +42,6 @@ Incidence::Incidence() : mHasRecurrenceID = false; + mHoliday = false; + mBirthday = false; + mAnniversary = false; + } @@ -77,2 +81,5 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) mRecurrence = new Recurrence( *(i.mRecurrence), this ); + mHoliday = i.mHoliday ; + mBirthday = i.mBirthday; + mAnniversary = i.mAnniversary; } @@ -91,2 +98,18 @@ Incidence::~Incidence() } + +bool Incidence::isHoliday() const +{ + return mHoliday; +} +bool Incidence::isBirthday() const +{ + + return mBirthday ; +} +bool Incidence::isAnniversary() const +{ + return mAnniversary ; + +} + bool Incidence::hasRecurrenceID() const @@ -304,2 +327,8 @@ QString Incidence::summary() const } +void Incidence::checkCategories() +{ + mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); + mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); + mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); +} @@ -309,2 +338,3 @@ void Incidence::setCategories(const QStringList &categories) mCategories = categories; + checkCategories(); updated(); @@ -326,3 +356,3 @@ void Incidence::setCategories(const QString &catStr) } - + checkCategories(); updated(); diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 0ae9656..f8da342 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -272,2 +272,5 @@ class Incidence : public IncidenceBase QDateTime dtStart() const; + bool isHoliday() const; + bool isBirthday() const; + bool isAnniversary() const; @@ -280,2 +283,4 @@ protected: private: + void checkCategories(); + bool mHoliday, mBirthday, mAnniversary; int mRevision; |