summaryrefslogtreecommitdiffabout
Unidiff
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()
1415 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); 1415 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7);
1416 bool showHoliday = false; 1416 bool showHoliday = false;
1417 if ( KOPrefs::instance()->mExcludeHolidays ) { 1417 if ( KOPrefs::instance()->mExcludeHolidays ) {
1418 QPtrList<Event> events = calendar()->events( date, true ); 1418 QPtrList<Event> events = calendar()->events( date, true );
1419 Event *event; 1419 Event *event;
1420 for( event = events.first(); event; event = events.next() ) { 1420 for( event = events.first(); event; event = events.next() ) {
1421 if ( event->categories().contains("Holiday") || 1421 if ( event->isHoliday()) {
1422 event->categories().contains(i18n("Holiday"))) {
1423 showHoliday = true; 1422 showHoliday = true;
1424 break; 1423 break;
1425 } 1424 }
1426 } 1425 }
1427 1426
1428 } 1427 }
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()
345 for(event=eventlist.first();event != 0;event=eventlist.next()) { 345 for(event=eventlist.first();event != 0;event=eventlist.next()) {
346 ushort recurType = event->recurrence()->doesRecur(); 346 ushort recurType = event->recurrence()->doesRecur();
347 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 347 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
348 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 348 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
349 numEvents--; 349 numEvents--;
350 } 350 }
351 if ( event->categories().contains( i18n("Holiday") ) || event->categories().contains( "Holiday" )) { 351 if ( event->isHoliday()) {
352 if ( !holiStr.isEmpty() ) 352 if ( !holiStr.isEmpty() )
353 holiStr += "\n"; 353 holiStr += "\n";
354 holiStr += event->summary(); 354 holiStr += event->summary();
355 if ( !event->location().isEmpty() ) 355 if ( !event->location().isEmpty() )
356 holiStr += " (" + event->location() + ")"; 356 holiStr += " (" + event->location() + ")";
357 } 357 }
358 if ( event->categories().contains( i18n("Birthday") ) || event->categories().contains( "Birthday" )) { 358 if ( event->isBirthday()) {
359 if ( !holiStr.isEmpty() ) 359 if ( !holiStr.isEmpty() )
360 holiStr += "\n"; 360 holiStr += "\n";
361 holiStr += i18n("Birthday") + ": "+event->summary(); 361 holiStr += i18n("Birthday") + ": "+event->summary();
362 if ( !event->location().isEmpty() ) 362 if ( !event->location().isEmpty() )
363 holiStr += " (" + event->location() + ")"; 363 holiStr += " (" + event->location() + ")";
364 bDays.setBit(i); 364 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)
512 return; 512 return;
513 else 513 else
514 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 514 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
515 return; 515 return;
516 } 516 }
517 517
518 if ( event->categories().contains("Holiday") || 518 if ( event->isHoliday()) {
519 event->categories().contains(i18n("Holiday"))) {
520 setHoliday( true ); 519 setHoliday( true );
521 if ( mDate.dayOfWeek() == 7 ) 520 if ( mDate.dayOfWeek() == 7 )
522 mItemList->setLineWidth( 3 ); 521 mItemList->setLineWidth( 3 );
523 } 522 }
524 QString text; 523 QString text;
525 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 524 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
475 if ( reply ) { 475 if ( reply ) {
476 noc = ev->getNextOccurence( cdt, &ok ); 476 noc = ev->getNextOccurence( cdt, &ok );
477 if (! ok && ev->type() == "Event") 477 if (! ok && ev->type() == "Event")
478 return false; 478 return false;
479 } 479 }
480 bool bDay = false; 480 bool bDay = false;
481 if ( ev->categories().contains( i18n("Birthday") ) || ev->categories().contains( i18n("Anniversary") ) ) 481 if ( ev->isBirthday() || ev->isAnniversary() )
482 bDay = true; 482 bDay = true;
483 tempText += "<tr><td><b>"; 483 tempText += "<tr><td><b>";
484 if (ev->type()=="Event") { 484 if (ev->type()=="Event") {
485 if (reply) { 485 if (reply) {
486 if (!ev->doesFloat()) 486 if (!ev->doesFloat())
487 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; 487 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
@@ -533,16 +533,16 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
533 533
534 } 534 }
535 535
536 } else { 536 } else {
537 if ( bDay ) { 537 if ( bDay ) {
538 538
539 if ( ev->categories().contains( i18n("Birthday") )) 539 if ( ev->isBirthday())
540 tempText += "<font color=\"#F00000\">" + i18n("Birthday") +":</font>"; 540 tempText += "<font color=\"#00B000\">" + i18n("Birthday") +":</font>";
541 else 541 else
542 tempText += "<font color=\"#F00000\">" + i18n("Anniversary")+":</font>"; 542 tempText += "<font color=\"#00B0000\">" + i18n("Anniversary")+":</font>";
543 } else { 543 } else {
544 tempText += i18n("Allday:"); 544 tempText += i18n("Allday:");
545 } 545 }
546 546
547 } 547 }
548 } 548 }
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() :
37 mCancelled = false; 37 mCancelled = false;
38 recreate(); 38 recreate();
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{
47// TODO: reenable attributes currently commented out. 51// TODO: reenable attributes currently commented out.
48 mRevision = i.mRevision; 52 mRevision = i.mRevision;
@@ -72,12 +76,15 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
72 ++it; 76 ++it;
73 } 77 }
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{
82 89
83 Incidence *ev; 90 Incidence *ev;
@@ -86,12 +93,28 @@ Incidence::~Incidence()
86 if (ev->relatedTo() == this) ev->setRelatedTo(0); 93 if (ev->relatedTo() == this) ev->setRelatedTo(0);
87 } 94 }
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}
96 119
97void Incidence::setHasRecurrenceID( bool b ) 120void Incidence::setHasRecurrenceID( bool b )
@@ -299,17 +322,24 @@ void Incidence::setSummary(const QString &summary)
299} 322}
300 323
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
314void Incidence::setCategories(const QString &catStr) 344void Incidence::setCategories(const QString &catStr)
315{ 345{
@@ -321,13 +351,13 @@ void Incidence::setCategories(const QString &catStr)
321 mCategories = QStringList::split(",",catStr); 351 mCategories = QStringList::split(",",catStr);
322 352
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
332{ 362{
333 return mCategories; 363 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
267 bool hasRecurrenceID() const; 267 bool hasRecurrenceID() const;
268 void setHasRecurrenceID( bool b ); 268 void setHasRecurrenceID( bool b );
269 269
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
275protected: 278protected:
276 QPtrList<Alarm> mAlarms; 279 QPtrList<Alarm> mAlarms;
277 QPtrList<Incidence> mRelations; 280 QPtrList<Incidence> mRelations;
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
284 // base components of jounal, event and todo 289 // base components of jounal, event and todo
285 QDateTime mCreated; 290 QDateTime mCreated;
286 QString mDescription; 291 QString mDescription;