-rw-r--r-- | korganizer/koagenda.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 63fdecd..9b817bc 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -1414,10 +1414,11 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i //--cx;++cw; int lGridSpacingY = mGridSpacingY*2; int selDay; - if ( !backgroundOnly ) + QDate curDate = QDate::currentDate(); + if ( !backgroundOnly ) { for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) { - if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { + if ( mSelectedDates[selDay] == curDate && KOPrefs::instance()->mHighlightCurrentDay) { int x1 = cx; int y1 = 0; if (y1 < cy) y1 = cy; @@ -1445,6 +1446,7 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i } } } + } // Highlight working hours if ( !backgroundOnly ) @@ -1473,7 +1475,7 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i (mColumns - gxStart)*mGridSpacingX-1 : (gxStart+1)*mGridSpacingX-1; if (xEnd > x2) xEnd = x2; - if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { + if ( mSelectedDates[gxStart] == curDate && KOPrefs::instance()->mHighlightCurrentDay ) { if ( KOPrefs::instance()->mUseHighlightLightColor ) p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, KOPrefs::instance()->mWorkingHoursColor.light()); @@ -1676,15 +1678,14 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) return; //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); - bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); - QDate currentDate; + QDate currentDate = QDate::currentDate(); + bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda ); QDateTime dt; if ( todo->hasCompletedDate() ) dt = todo->completed(); else dt = todo->dtDue(); if ( overdue ) { - currentDate = QDate::currentDate(); days += todo->dtDue().date().daysTo( currentDate ); } else |