summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.cpp
Unidiff
Diffstat (limited to 'libkcal/incidence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp32
1 files changed, 31 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
@@ -39,8 +39,12 @@ Incidence::Incidence() :
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
45Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) 49Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
46{ 50{
@@ -74,8 +78,11 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
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
80Incidence::~Incidence() 87Incidence::~Incidence()
81{ 88{
@@ -88,8 +95,24 @@ Incidence::~Incidence()
88 if (relatedTo()) relatedTo()->removeRelation(this); 95 if (relatedTo()) relatedTo()->removeRelation(this);
89 delete mRecurrence; 96 delete mRecurrence;
90 97
91} 98}
99
100bool Incidence::isHoliday() const
101{
102 return mHoliday;
103}
104bool Incidence::isBirthday() const
105{
106
107 return mBirthday ;
108}
109bool Incidence::isAnniversary() const
110{
111 return mAnniversary ;
112
113}
114
92bool Incidence::hasRecurrenceID() const 115bool Incidence::hasRecurrenceID() const
93{ 116{
94 return mHasRecurrenceID; 117 return mHasRecurrenceID;
95} 118}
@@ -301,13 +324,20 @@ void Incidence::setSummary(const QString &summary)
301QString Incidence::summary() const 324QString Incidence::summary() const
302{ 325{
303 return mSummary; 326 return mSummary;
304} 327}
328void 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
306void Incidence::setCategories(const QStringList &categories) 335void 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
@@ -323,9 +353,9 @@ void Incidence::setCategories(const QString &catStr)
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
331QStringList Incidence::categories() const 361QStringList Incidence::categories() const