author | zautrix <zautrix> | 2005-03-21 17:39:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-21 17:39:46 (UTC) |
commit | 3c5d7b484e6ab263ab4091f22815770ea8da6c9c (patch) (side-by-side diff) | |
tree | 97f86965d7ae565fc054918978756c3953476e82 | |
parent | 070055b60f76ffd6907e44a4ffc2d752578f3211 (diff) | |
download | kdepimpi-3c5d7b484e6ab263ab4091f22815770ea8da6c9c.zip kdepimpi-3c5d7b484e6ab263ab4091f22815770ea8da6c9c.tar.gz kdepimpi-3c5d7b484e6ab263ab4091f22815770ea8da6c9c.tar.bz2 |
fix
-rw-r--r-- | korganizer/koagendaview.cpp | 3 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 4 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 3 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 8 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 32 | ||||
-rw-r--r-- | libkcal/incidence.h | 5 |
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 @@ -1397,50 +1397,49 @@ void KOAgendaView::writeSettings(KConfig *config) config->setGroup("Views"); //#ifndef KORG_NOSPLITTER QValueList<int> list = mSplitterAgenda->sizes(); config->writeEntry("Separator AgendaView",list); //qDebug("write %d %d ", list[0],list[1] ); //#endif } void KOAgendaView::setHolidayMasks() { mHolidayMask.resize(mSelectedDates.count()); uint i; for(i=0;i<mSelectedDates.count();++i) { QDate date = mSelectedDates[i]; bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); 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; } } } #ifndef KORG_NOPLUGINS bool showHoliday = KOPrefs::instance()->mExcludeHolidays && !KOCore::self()->holiday(date).isEmpty(); #endif bool showDay = showSaturday || showSunday || showHoliday; if (showDay) { mHolidayMask.at(i) = true; } else { mHolidayMask.at(i) = false; } } mAgenda->setHolidayMask(&mHolidayMask); mAllDayAgenda->setHolidayMask(&mHolidayMask); } diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index d7a4112..36cd990 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -327,56 +327,56 @@ void KODayMatrix::repaintViewTimed() mRepaintTimer->stop(); repaint(false); } void KODayMatrix::updateViewTimed() { mUpdateTimer->stop(); if ( !mCalendar ) { qDebug("NOT CAL "); return; } //qDebug("KODayMatrix::updateViewTimed "); for(int i = 0; i < NUMDAYS; i++) { // if events are set for the day then remember to draw it bold QPtrList<Event> eventlist = mCalendar->events(days[i]); Event *event; int numEvents = eventlist.count(); QString holiStr = ""; bDays.clearBit(i); 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); } } events[i] = numEvents; //if it is a holy day then draw it red. Sundays are consider holidays, too if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || !holiStr.isEmpty()) { mHolidays[i] = holiStr; } else { mHolidays[i] = QString::null; } } if ( ! mPendingUpdateBeforeRepaint ) repaint(false); } void KODayMatrix::updateView(QDate actdate) { if ( ! actdate.isValid() ) { diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 004ff50..76982b4 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -494,50 +494,49 @@ void MonthViewCell::startUpdateCell() QToolTip::remove(this); #endif mToolTip.clear(); //qApp->processEvents(); if ( !mHolidayString.isEmpty() ) { MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); item->setPalette( mHolidayPalette ); mItemList->insertItem( item ); mToolTip.append ( mHolidayString ); } } void MonthViewCell::insertEvent(Event *event) { QString mToolTipText; mItemList->setFocusPolicy(WheelFocus); if ( !(event->doesRecur() == Recurrence::rNone) ) { if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 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 if (event->isMultiDay()) { QString prefix = "<->";multiday = 2; QString time; if ( event->doesRecur() ) { if ( event->recursOn( mDate) ) { prefix ="->" ;multiday = 1; } else { int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); if ( event->recursOn( mDate.addDays( -days)) ) { prefix ="<-" ;multiday = 3; } } } else { if (mDate == event->dtStart().date()) { prefix ="->" ;multiday = 1; } else if (mDate == event->dtEnd().date()) { diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 18dc656..66ff75d 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp @@ -457,49 +457,49 @@ void KOWhatsNextView::changeEventDisplay(Event *, int action) break; default: updateView(); kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; } } bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) { if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) return false; QDateTime cdt = QDateTime::currentDateTime(); QDateTime noc; QString tempText; if ( appendTable && !notRed ) { tempText = "<table>"; } bool ok = true; 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) +": "; else tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; } else { if (!ev->doesFloat()) { Event *event = static_cast<Event *>(ev); QDateTime st,end; if ( event->recurrence()->doesRecur() ) { QDate recDate= mEventDate; int days = event->dtStart().date().daysTo (event->dtEnd().date() ); while ( ! event->recursOn( recDate ) ) { recDate = recDate.addDays( -1 ); } st = QDateTime ( recDate, event->dtStart().time() ); end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); } else { @@ -515,52 +515,52 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a else dateText = event->dtStartTimeStr() + "-"; if ( end.date() > mEventDate ) dateText += "++:++"; else dateText += event->dtEndTimeStr(); if ( notRed ) tempText += dateText; else { if ( end < cdt ) { if ( !KOPrefs::instance()->mWNViewShowsPast ) return false; tempText += "<font color=\"#F00000\">" + dateText + "</font>"; } else if ( st < cdt ) tempText += "<font color=\"#008000\">" + dateText + "</font>"; else tempText += dateText; } } 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:"); } } } } else { mTodos.append( ev ); tempText += i18n("ToDo:"); if (reply) { tempText += " "; if ( noc != cdt ) { tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; } } else { if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; QString dfs = KGlobal::locale()->dateFormatShort(); KGlobal::locale()->setDateFormatShort("%d.%b"); tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; KGlobal::locale()->setDateFormatShort(dfs); } else { if (!ev->doesFloat() ) if( ( (Todo*)ev)->dtDue() < cdt ) { diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 708ee6b..9a36939 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -19,97 +19,120 @@ */ #include <kglobal.h> #include <klocale.h> #include <kdebug.h> #include "calformat.h" #include "incidence.h" #include "todo.h" using namespace KCal; Incidence::Incidence() : IncidenceBase(), mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) { 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; mSummary = i.mSummary; mCategories = i.mCategories; // Incidence *mRelatedTo; Incidence *mRelatedTo; mRelatedTo = 0; mRelatedToUid = i.mRelatedToUid; // QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; mExDates = i.mExDates; mAttachments = i.mAttachments; mResources = i.mResources; mSecrecy = i.mSecrecy; mPriority = i.mPriority; mLocation = i.mLocation; mCancelled = i.mCancelled; mHasStartDate = i.mHasStartDate; QPtrListIterator<Alarm> it( i.mAlarms ); const Alarm *a; while( (a = it.current()) ) { Alarm *b = new Alarm( *a ); b->setParent( this ); 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; } void Incidence::setRecurrenceID(QDateTime d) { mRecurrenceID = d; mHasRecurrenceID = true; updated(); } QDateTime Incidence::recurrenceID () const { return mRecurrenceID; } bool Incidence::cancelled() const { return mCancelled; @@ -281,71 +304,78 @@ void Incidence::setDtStart(const QDateTime &dtStart) void Incidence::setDescription(const QString &description) { if (mReadOnly) return; mDescription = description; updated(); } QString Incidence::description() const { return mDescription; } void Incidence::setSummary(const QString &summary) { if (mReadOnly) return; 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(); 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; } QString Incidence::categoriesStr() { return mCategories.join(","); } void Incidence::setRelatedToUid(const QString &relatedToUid) { if (mReadOnly) return; mRelatedToUid = relatedToUid; } QString Incidence::relatedToUid() const { return mRelatedToUid; } diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 0ae9656..f8da342 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -249,56 +249,61 @@ class Incidence : public IncidenceBase void setRecurrence(Recurrence * r); /** Forward to Recurrence::doesRecur(). */ ushort doesRecur() const; /** set the event's/todo's location. Do _not_ use it with journal */ void setLocation(const QString &location); /** return the event's/todo's location. Do _not_ use it with journal */ QString location() const; /** returns TRUE or FALSE depending on whether the todo has a start date */ bool hasStartDate() const; /** sets the event's hasStartDate value. */ void setHasStartDate(bool f); QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; bool cancelled() const; void setCancelled( bool b ); 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; QString mSummary; QStringList mCategories; Incidence *mRelatedTo; QString mRelatedToUid; DateList mExDates; QPtrList<Attachment> mAttachments; QStringList mResources; bool mHasStartDate; // if todo has associated start date int mSecrecy; int mPriority; // 1 = highest, 2 = less, etc. //QPtrList<Alarm> mAlarms; Recurrence *mRecurrence; QString mLocation; }; |