-rw-r--r-- | korganizer/koagendaview.cpp | 19 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 2 |
2 files changed, 17 insertions, 4 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 749204b..c5acafd 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -1281,71 +1281,84 @@ void KOAgendaView::readSettings(KConfig *config) sizes[0] = 20; } mSplitterAgenda->setSizes(sizes); // qDebug("read %d %d ",sizes[0],sizes[1] ); } //#endif // updateConfig(); } void KOAgendaView::writeSettings(KConfig *config) { // kdDebug() << "KOAgendaView::writeSettings()" << endl; 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"))) { + showHoliday = true; + break; + } + } + + } + #ifndef KORG_NOPLUGINS bool showHoliday = KOPrefs::instance()->mExcludeHolidays && !KOCore::self()->holiday(date).isEmpty(); - bool showDay = showSaturday || showSunday || showHoliday; -#else - bool showDay = showSaturday || showSunday; #endif + bool showDay = showSaturday || showSunday || showHoliday; + if (showDay) { mHolidayMask.at(i) = true; } else { mHolidayMask.at(i) = false; } } mAgenda->setHolidayMask(&mHolidayMask); mAllDayAgenda->setHolidayMask(&mHolidayMask); } void KOAgendaView::setContentsPos(int y) { mAgenda->setContentsPos(0,y); } void KOAgendaView::setExpandedButton( bool expanded ) { if ( expanded ) { mExpandButton->setPixmap( mExpandedPixmap ); } else { mExpandButton->setPixmap( mNotExpandedPixmap ); } } void KOAgendaView::clearSelection() { mAgenda->deselectItem(); mAllDayAgenda->deselectItem(); } void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart, diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 688d9e1..7d1e82f 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -356,65 +356,65 @@ QPalette MonthViewCell::getPalette () } return mNonPrimaryPalette; } bool MonthViewCell::isPrimary() const { return mPrimary; } void MonthViewCell::setHoliday( bool holiday ) { mHoliday = holiday; //setMyPalette(); } void MonthViewCell::setHoliday( const QString &holiday ) { mHolidayString = holiday; if ( !holiday.isEmpty() ) { setHoliday( true ); } } void MonthViewCell::keyPressEvent ( QKeyEvent * e ) { e->ignore(); } void MonthViewCell::updateCell() { setPrimary( mDate.month()%2 ); - setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() ); + setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); if ( mDate == QDate::currentDate() ) { mItemList->setLineWidth( 3 ); } else { mItemList->setLineWidth( 1 ); } mItemList->clear(); //qApp->processEvents(); if ( !mHolidayString.isEmpty() ) { MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); item->setPalette( mHolidayPalette ); mItemList->insertItem( item ); } //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); Event *event; for( event = events.first(); event; event = events.next() ) { if ( event->categories().contains("Holiday") || event->categories().contains(i18n("Holiday"))) { setHoliday( true ); if ( mDate.dayOfWeek() == 7 ) mItemList->setLineWidth( 3 ); } QString text; if (event->isMultiDay()) { QString prefix = "<->"; if ( event->doesRecur() ) { if ( event->recursOn( mDate) ) prefix ="->" ; else { int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); if ( event->recursOn( mDate.addDays( -days)) ) prefix ="<-" ; |