-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() : | |||
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 ) |
@@ -75,6 +79,9 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) | |||
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() |
@@ -89,6 +96,22 @@ Incidence::~Incidence() | |||
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; |
@@ -302,11 +325,18 @@ 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 | ||
@@ -324,7 +354,7 @@ void Incidence::setCategories(const QString &catStr) | |||
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 | ||
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 | |||
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: |
@@ -278,6 +281,8 @@ protected: | |||
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 | ||