summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp3
-rw-r--r--korganizer/kodaymatrix.cpp4
-rw-r--r--korganizer/komonthview.cpp3
-rw-r--r--korganizer/kowhatsnextview.cpp8
-rw-r--r--libkcal/incidence.cpp32
-rw-r--r--libkcal/incidence.h5
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
@@ -1415,14 +1415,13 @@ void KOAgendaView::setHolidayMasks()
bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7);
bool showHoliday = false;
if ( KOPrefs::instance()->mExcludeHolidays ) {
QPtrList<Event> events = calendar()->events( date, true );
Event *event;
for( event = events.first(); event; event = events.next() ) {
- if ( event->categories().contains("Holiday") ||
- event->categories().contains(i18n("Holiday"))) {
+ if ( event->isHoliday()) {
showHoliday = true;
break;
}
}
}
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index d7a4112..36cd990 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -345,20 +345,20 @@ void KODayMatrix::updateViewTimed()
for(event=eventlist.first();event != 0;event=eventlist.next()) {
ushort recurType = event->recurrence()->doesRecur();
if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
(recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
numEvents--;
}
- if ( event->categories().contains( i18n("Holiday") ) || event->categories().contains( "Holiday" )) {
+ if ( event->isHoliday()) {
if ( !holiStr.isEmpty() )
holiStr += "\n";
holiStr += event->summary();
if ( !event->location().isEmpty() )
holiStr += " (" + event->location() + ")";
}
- if ( event->categories().contains( i18n("Birthday") ) || event->categories().contains( "Birthday" )) {
+ if ( event->isBirthday()) {
if ( !holiStr.isEmpty() )
holiStr += "\n";
holiStr += i18n("Birthday") + ": "+event->summary();
if ( !event->location().isEmpty() )
holiStr += " (" + event->location() + ")";
bDays.setBit(i);
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 004ff50..76982b4 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -512,14 +512,13 @@ void MonthViewCell::insertEvent(Event *event)
return;
else
if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
return;
}
- if ( event->categories().contains("Holiday") ||
- event->categories().contains(i18n("Holiday"))) {
+ if ( event->isHoliday()) {
setHoliday( true );
if ( mDate.dayOfWeek() == 7 )
mItemList->setLineWidth( 3 );
}
QString text;
int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 18dc656..66ff75d 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -475,13 +475,13 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
if ( reply ) {
noc = ev->getNextOccurence( cdt, &ok );
if (! ok && ev->type() == "Event")
return false;
}
bool bDay = false;
- if ( ev->categories().contains( i18n("Birthday") ) || ev->categories().contains( i18n("Anniversary") ) )
+ if ( ev->isBirthday() || ev->isAnniversary() )
bDay = true;
tempText += "<tr><td><b>";
if (ev->type()=="Event") {
if (reply) {
if (!ev->doesFloat())
tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
@@ -533,16 +533,16 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
}
} else {
if ( bDay ) {
- 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 {
tempText += i18n("Allday:");
}
}
}
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 708ee6b..9a36939 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -37,12 +37,16 @@ Incidence::Incidence() :
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;
@@ -72,12 +76,15 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
++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;
@@ -86,12 +93,28 @@ Incidence::~Incidence()
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 )
@@ -299,17 +322,24 @@ void Incidence::setSummary(const QString &summary)
}
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)
{
@@ -321,13 +351,13 @@ void Incidence::setCategories(const QString &catStr)
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;
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index 0ae9656..f8da342 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -267,20 +267,25 @@ class Incidence : public IncidenceBase
bool hasRecurrenceID() const;
void setHasRecurrenceID( bool b );
void setRecurrenceID(QDateTime);
QDateTime recurrenceID () const;
QDateTime dtStart() const;
+ bool isHoliday() const;
+ bool isBirthday() const;
+ bool isAnniversary() const;
protected:
QPtrList<Alarm> mAlarms;
QPtrList<Incidence> mRelations;
QDateTime mRecurrenceID;
bool mHasRecurrenceID;
private:
+ void checkCategories();
+ bool mHoliday, mBirthday, mAnniversary;
int mRevision;
bool mCancelled;
// base components of jounal, event and todo
QDateTime mCreated;
QString mDescription;