[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kdeui
From:       Hans Petter Bieker <bieker () kde ! org>
Date:       2003-08-28 18:56:50
[Download RAW message or body]

CVS commit by bieker: 

Made it work again for calendars where the week is not starting at monday.


  M +2 -18     kdatetbl.cpp   1.68


--- kdelibs/kdeui/kdatetbl.cpp  #1.67:1.68
@@ -192,11 +192,4 @@ KDateTable::paintCell(QPainter *painter,
       // First day of month
       calendar->setYMD(pCellDate, calendar->year(date), calendar->month(date), 1);
-      pCellDate = calendar->addDays(pCellDate, firstWeekDay - calendar->dayOfWeek(pCellDate));
-      // The first day of the month should never be the first day in the calendar
-      if (calendar->day(pCellDate) == 1 )
-        pCellDate = calendar->addDays(pCellDate, -7);
-
-      pCellDate = calendar->addDays(pCellDate, pos);
-      kdDebug() << "MyDate: " << pCellDate.toString() << endl;
 
       if ( firstWeekDay < 4 )
@@ -204,4 +197,5 @@ KDateTable::paintCell(QPainter *painter,
       else
           pos += firstWeekDay - 7;
+      pCellDate = calendar->addDays(pCellDate, pos-firstday);
       text = calendar->dayString(pCellDate, true);
       if(pos<firstday || (firstday+numdays<=pos))
@@ -209,13 +203,6 @@ KDateTable::paintCell(QPainter *painter,
           // ° painting a day of the previous month or
           // ° painting a day of the following month
-          if(pos<firstday)
-            { // previous month
-              //text.setNum(numDaysPrevMonth+pos-firstday+1);
-            } else { // following month
-              //text.setNum(pos-firstday-numdays+1);
-            }
           painter->setPen(gray);
         } else { // paint a day of the current month
-          //text.setNum(pos-firstday+1);
           if ( d->useCustomColors )
           {
@@ -263,8 +250,5 @@ KDateTable::paintCell(QPainter *painter,
         }
 
-      QDate cur_date = QDate::currentDate();
-      if ( (calendar->year(date)  == calendar->year(cur_date)) &&
-           (calendar->month(date) == calendar->month(cur_date)) &&
-           (firstday+calendar->day(cur_date)-1 == pos) )
+      if ( pCellDate == QDate::currentDate() )
       {
          painter->setPen(KGlobalSettings::textColor());


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic