summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.cpp
Side-by-side diff
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
@@ -35,16 +35,20 @@ Incidence::Incidence() :
{
mRecurrence = new Recurrence(this);
mCancelled = false;
recreate();
mHasStartDate = true;
mAlarms.setAutoDelete(true);
mAttachments.setAutoDelete(true);
mHasRecurrenceID = false;
+ mHoliday = false;
+ mBirthday = false;
+ mAnniversary = false;
+
}
Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
{
// TODO: reenable attributes currently commented out.
mRevision = i.mRevision;
mCreated = i.mCreated;
mDescription = i.mDescription;
@@ -70,30 +74,49 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
mAlarms.append( b );
++it;
}
mAlarms.setAutoDelete(true);
mHasRecurrenceID = i.mHasRecurrenceID;
mRecurrenceID = i.mRecurrenceID;
mRecurrence = new Recurrence( *(i.mRecurrence), this );
+ mHoliday = i.mHoliday ;
+ mBirthday = i.mBirthday;
+ mAnniversary = i.mAnniversary;
}
Incidence::~Incidence()
{
Incidence *ev;
QPtrList<Incidence> Relations = relations();
for (ev=Relations.first();ev;ev=Relations.next()) {
if (ev->relatedTo() == this) ev->setRelatedTo(0);
}
if (relatedTo()) relatedTo()->removeRelation(this);
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;
}
void Incidence::setHasRecurrenceID( bool b )
{
mHasRecurrenceID = b;
@@ -297,21 +320,28 @@ void Incidence::setSummary(const QString &summary)
mSummary = summary;
updated();
}
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();
}
// TODO: remove setCategories(QString) function
void Incidence::setCategories(const QString &catStr)
{
if (mReadOnly) return;
mCategories.clear();
@@ -319,17 +349,17 @@ void Incidence::setCategories(const QString &catStr)
if (catStr.isEmpty()) return;
mCategories = QStringList::split(",",catStr);
QStringList::Iterator it;
for(it = mCategories.begin();it != mCategories.end(); ++it) {
*it = (*it).stripWhiteSpace();
}
-
+ checkCategories();
updated();
}
QStringList Incidence::categories() const
{
return mCategories;
}