-rw-r--r-- | libkcal/incidence.cpp | 32 | ||||
-rw-r--r-- | libkcal/incidence.h | 5 |
2 files changed, 36 insertions, 1 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 708ee6b..9a36939 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -40,6 +40,10 @@ Incidence::Incidence() : mAlarms.setAutoDelete(true); mAttachments.setAutoDelete(true); mHasRecurrenceID = false; + mHoliday = false; + mBirthday = false; + mAnniversary = false; + } Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) @@ -75,6 +79,9 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) mHasRecurrenceID = i.mHasRecurrenceID; mRecurrenceID = i.mRecurrenceID; mRecurrence = new Recurrence( *(i.mRecurrence), this ); + mHoliday = i.mHoliday ; + mBirthday = i.mBirthday; + mAnniversary = i.mAnniversary; } Incidence::~Incidence() @@ -89,6 +96,22 @@ Incidence::~Incidence() delete mRecurrence; } + +bool Incidence::isHoliday() const +{ + return mHoliday; +} +bool Incidence::isBirthday() const +{ + + return mBirthday ; +} +bool Incidence::isAnniversary() const +{ + return mAnniversary ; + +} + bool Incidence::hasRecurrenceID() const { return mHasRecurrenceID; @@ -302,11 +325,18 @@ QString Incidence::summary() const { return mSummary; } +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")); +} void Incidence::setCategories(const QStringList &categories) { if (mReadOnly) return; mCategories = categories; + checkCategories(); updated(); } @@ -324,7 +354,7 @@ void Incidence::setCategories(const QString &catStr) for(it = mCategories.begin();it != mCategories.end(); ++it) { *it = (*it).stripWhiteSpace(); } - + checkCategories(); updated(); } diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 0ae9656..f8da342 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -270,6 +270,9 @@ class Incidence : public IncidenceBase void setRecurrenceID(QDateTime); QDateTime recurrenceID () const; QDateTime dtStart() const; + bool isHoliday() const; + bool isBirthday() const; + bool isAnniversary() const; protected: @@ -278,6 +281,8 @@ protected: QDateTime mRecurrenceID; bool mHasRecurrenceID; private: + void checkCategories(); + bool mHoliday, mBirthday, mAnniversary; int mRevision; bool mCancelled; |