summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp225
1 files changed, 113 insertions, 112 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 63fdecd..9b817bc 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1414,115 +1414,117 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i
//--cx;++cw;
- int lGridSpacingY = mGridSpacingY*2;
- int selDay;
- if ( !backgroundOnly )
- for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay)
- {
- if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && 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;
- int gxEnd = gxStart ;
- 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 ( KOPrefs::instance()->mUseHighlightLightColor )
- p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
- KOPrefs::instance()->mAgendaBgColor.light());
- else
- p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
- KOPrefs::instance()->mAgendaBgColor.dark());
+ int lGridSpacingY = mGridSpacingY*2;
+ int selDay;
+ QDate curDate = QDate::currentDate();
+ if ( !backgroundOnly ) {
+ for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay)
+ {
+ 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;
+ int gxEnd = gxStart ;
+ 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 ( KOPrefs::instance()->mUseHighlightLightColor )
+ p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
+ 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;
- // int x2 = mGridSpacingX * 5 - 1;
- // if (x2 > cx+cw-1) x2 = cx + cw - 1;
- int y2 = mWorkingHoursYBottom;
- if (y2 > cy+ch-1) y2=cy+ch-1;
-
- if (x2 >= x1 && y2 >= y1) {
- // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX );
- int gxStart = x1/mGridSpacingX;
- int gxEnd = x2/mGridSpacingX;
- while(gxStart <= gxEnd) {
- if (gxStart < int(mHolidayMask->count()) &&
- !mHolidayMask->at(gxStart)) {
- 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 ( 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,
- KOPrefs::instance()->mWorkingHoursColor);
- }
+ }
+ }
+ }
+ }
+ // Highlight working hours
+
+ if ( !backgroundOnly )
+ if (mWorkingHoursEnable) {
+ int x1 = cx;
+ int y1 = mWorkingHoursYTop;
+ if (y1 < cy) y1 = cy;
+ int x2 = cx+cw-1;
+ // int x2 = mGridSpacingX * 5 - 1;
+ // if (x2 > cx+cw-1) x2 = cx + cw - 1;
+ int y2 = mWorkingHoursYBottom;
+ if (y2 > cy+ch-1) y2=cy+ch-1;
+
+ if (x2 >= x1 && y2 >= y1) {
+ // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX );
+ int gxStart = x1/mGridSpacingX;
+ int gxEnd = x2/mGridSpacingX;
+ while(gxStart <= gxEnd) {
+ if (gxStart < int(mHolidayMask->count()) &&
+ !mHolidayMask->at(gxStart)) {
+ 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] == 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,
+ KOPrefs::instance()->mWorkingHoursColor);
+ }
+ }
+ ++gxStart;
+ }
+ }
}
- ++gxStart;
+ /*
+ int selectionX = KOGlobals::self()->reverseLayout() ?
+ (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
+ mSelectionCellX * mGridSpacingX;
+
+ // Draw selection
+ if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
+ ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
+ // TODO: paint only part within cx,cy,cw,ch
+ p->fillRect( selectionX, mSelectionYTop, mGridSpacingX,
+ mSelectionHeight, KOPrefs::instance()->mHighlightColor );
}
- }
- }
- /*
- int selectionX = KOGlobals::self()->reverseLayout() ?
- (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
- mSelectionCellX * mGridSpacingX;
-
- // Draw selection
- if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
- ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
- // TODO: paint only part within cx,cy,cw,ch
- p->fillRect( selectionX, mSelectionYTop, mGridSpacingX,
- mSelectionHeight, KOPrefs::instance()->mHighlightColor );
- }
- */
- // Draw vertical lines of grid
+ */
+ // Draw vertical lines of grid
- int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
- if ( mGridSpacingX > 0 ) {
- while (x < cx + cw) {
- p->drawLine(x,cy,x,cy+ch);
- x+=mGridSpacingX;
- }
- }
- // Draw horizontal lines of grid
- int y = ((int)(cy/lGridSpacingY))*lGridSpacingY;
- if ( lGridSpacingY > 0 ) {
- while (y < cy + ch) {
- p->setPen( SolidLine );
- p->drawLine(cx,y,cx+cw,y);
- y+=lGridSpacingY;
- p->setPen( DotLine );
- p->drawLine(cx,y,cx+cw,y);
- y+=lGridSpacingY;
- }
- p->setPen( SolidLine );
- }
- mPixPainter.end() ;
+ int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
+ if ( mGridSpacingX > 0 ) {
+ while (x < cx + cw) {
+ p->drawLine(x,cy,x,cy+ch);
+ x+=mGridSpacingX;
+ }
+ }
+ // Draw horizontal lines of grid
+ int y = ((int)(cy/lGridSpacingY))*lGridSpacingY;
+ if ( lGridSpacingY > 0 ) {
+ while (y < cy + ch) {
+ p->setPen( SolidLine );
+ p->drawLine(cx,y,cx+cw,y);
+ y+=lGridSpacingY;
+ p->setPen( DotLine );
+ p->drawLine(cx,y,cx+cw,y);
+ y+=lGridSpacingY;
+ }
+ p->setPen( SolidLine );
+ }
+ mPixPainter.end() ;
}
@@ -1678,4 +1680,4 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
//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;
@@ -1686,3 +1688,2 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
if ( overdue ) {
- currentDate = QDate::currentDate();
days += todo->dtDue().date().daysTo( currentDate );