summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagenda.cpp13
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
@@ -1409,20 +1409,21 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i
}
else
p = paint ;
// qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch);
//--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;
int x2 = cx+cw-1;
int y2 = contentsHeight();
if (y2 > cy+ch-1) y2=cy+ch-1;
if (x2 >= x1 && y2 >= y1) {
int gxStart = selDay;
@@ -1440,16 +1441,17 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i
KOPrefs::instance()->mAgendaBgColor.light());
else
p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
KOPrefs::instance()->mAgendaBgColor.dark());
}
}
}
+ }
// Highlight working hours
if ( !backgroundOnly )
if (mWorkingHoursEnable) {
int x1 = cx;
int y1 = mWorkingHoursYTop;
if (y1 < cy) y1 = cy;
int x2 = cx+cw-1;
@@ -1468,17 +1470,17 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i
int xStart = KOGlobals::self()->reverseLayout() ?
(mColumns - 1 - gxStart)*mGridSpacingX :
gxStart*mGridSpacingX;
if (xStart < x1) xStart = x1;
int xEnd = KOGlobals::self()->reverseLayout() ?
(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());
else
p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
KOPrefs::instance()->mWorkingHoursColor.dark());
} else {
p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
@@ -1671,25 +1673,24 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
}
if ( remove ) {
//qDebug("remove****************************************** ");
return;
}
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
currentDate = dt.date();
if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) {
if ( ! mAllDayMode ) return;
// aldayagenda