Bug 71913 - gray out days of previous / next month in monthly printout
Summary: gray out days of previous / next month in monthly printout
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: 3.1.1
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Cornelius Schumacher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-05 15:23 UTC by Andreas Bergen
Modified: 2004-01-16 15:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Bergen 2004-01-05 15:23:43 UTC
Version:           3.1.1 (using KDE 3.1.2)
Installed from:    SuSE
Compiler:          gcc version 3.3 20030226 (prerelease) (SuSE Linux)
OS:          Linux (i686) release 2.4.20-4GB-athlon

In order to improve the readability of the monthly printout I think it would be great if the days of the previous and the next month would be grayed out / had a gray background.

Thanks for this great program!
Comment 1 Reinhold Kainhofer 2004-01-16 15:40:37 UTC
Subject: osnabrueck_branch: kdepim/korganizer

CVS commit by kainhofe: 

When printing out the month view, use a gray background for the days of the previous/next months. Only the current month has a white background.

CCMAIL: 71913-done@bugs.kde.org


  M +15 -0     calprintbase.cpp   1.14.2.1


--- kdepim/korganizer/calprintbase.cpp  #1.14:1.14.2.1
@@ -634,4 +634,5 @@ void CalPrintBase::drawDayBox(QPainter &
   }
 
+  p.eraseRect( x, y, width, height );
   p.drawRect( x, y, width, height );
   // p.fillRect( x+1, y+1, width-2,height, QBrush(Dense7Pattern) );
@@ -777,4 +778,7 @@ void CalPrintBase::drawMonth(QPainter &p
   int xoffset = 0;
   QDate monthDate(QDate(qd.year(), qd.month(), 1));
+  QDate monthFirst(monthDate);
+  QDate monthLast(monthDate.addMonths(1).addDays(-1));
+  
 
   int weekdayCol = weekdayColumn( monthDate.dayOfWeek() );
@@ -803,8 +807,19 @@ void CalPrintBase::drawMonth(QPainter &p
   int cellWidth = (width-xoffset) / 7;
 
+  QColor back = p.backgroundColor();
+  bool darkbg = false;
   for (int row = 0; row < rows; row++) {
     for (int col = 0; col < 7; col++) {
+      // show days from previous/next month with a grayed background
+      if ( (monthDate < monthFirst) || (monthDate > monthLast) ) {
+        p.setBackgroundColor( back.dark( 120 ) );
+        darkbg = true;
+      }
       drawDayBox(p, monthDate, x+xoffset+col*cellWidth, y+yoffset+row*cellHeight,
                  cellWidth, cellHeight);
+      if ( darkbg ) {
+        p.setBackgroundColor( back );
+        darkbg = false;
+      }
       monthDate = monthDate.addDays(1);
     }