summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--microkde/kdatetbl.cpp18
-rw-r--r--microkde/kdatetbl.h1
2 files changed, 16 insertions, 3 deletions
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp
index 0a2d1f5..146291b 100644
--- a/microkde/kdatetbl.cpp
+++ b/microkde/kdatetbl.cpp
@@ -95,6 +95,7 @@ KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, WFlags f)
95#if 0 95#if 0
96 viewport()->setEraseColor(lightGray); 96 viewport()->setEraseColor(lightGray);
97#endif 97#endif
98 mMarkCurrent = false;
98 setDate(date_); // this initializes firstday, numdays, numDaysPrevMonth 99 setDate(date_); // this initializes firstday, numdays, numDaysPrevMonth
99} 100}
100 101
@@ -170,20 +171,29 @@ KDateTable::paintCell(QPainter *painter, int row, int col)
170 pen=painter->pen(); 171 pen=painter->pen();
171 if(firstday+date.day()-1==pos) 172 if(firstday+date.day()-1==pos)
172 { 173 {
173 if(hasFocus()) 174 if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos)
174 { // draw the currently selected date 175 painter->setPen(green);
176 else
175 painter->setPen(red); 177 painter->setPen(red);
178 if(hasFocus())
179 {
176 painter->setBrush(darkRed); 180 painter->setBrush(darkRed);
177 pen=white; 181 pen=white;
178 } else { 182 } else {
179 painter->setPen(darkGray);
180 painter->setBrush(darkGray); 183 painter->setBrush(darkGray);
181 pen=white; 184 pen=white;
182 } 185 }
183 } else { 186 } else {
187 if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos)
188 {
189 painter->setPen(green);
190 painter->setBrush(darkGreen);
191 pen=white;
192 } else {
184 painter->setBrush(QColor(220,245,255)); 193 painter->setBrush(QColor(220,245,255));
185 painter->setPen(QColor(220,245,255)); 194 painter->setPen(QColor(220,245,255));
186 } 195 }
196 }
187 painter->drawRect(0, 0, w, h); 197 painter->drawRect(0, 0, w, h);
188 painter->setPen(pen); 198 painter->setPen(pen);
189 painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect); 199 painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect);
@@ -357,6 +367,7 @@ KDateTable::setDate(const QDate& date_)
357{ 367{
358 bool changed=false; 368 bool changed=false;
359 QDate temp; 369 QDate temp;
370 mMarkCurrent = false;
360 // ----- 371 // -----
361 if(!date_.isValid()) 372 if(!date_.isValid())
362 { 373 {
@@ -368,6 +379,7 @@ KDateTable::setDate(const QDate& date_)
368 date=date_; 379 date=date_;
369 changed=true; 380 changed=true;
370 } 381 }
382 mMarkCurrent = ( date.month() == QDate::currentDate().month() && date.year() == QDate::currentDate().year() );
371 temp.setYMD(date.year(), date.month(), 1); 383 temp.setYMD(date.year(), date.month(), 1);
372 firstday=temp.dayOfWeek(); 384 firstday=temp.dayOfWeek();
373 if(firstday==1) firstday=8; 385 if(firstday==1) firstday=8;
diff --git a/microkde/kdatetbl.h b/microkde/kdatetbl.h
index df7b7ef..b4d3e16 100644
--- a/microkde/kdatetbl.h
+++ b/microkde/kdatetbl.h
@@ -245,6 +245,7 @@ public:
245 245
246 246
247protected: 247protected:
248 bool mMarkCurrent;
248 /** 249 /**
249 * Paint a cell. 250 * Paint a cell.
250 */ 251 */