summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-17 12:38:04 (UTC)
committer zautrix <zautrix>2004-09-17 12:38:04 (UTC)
commit053b3550aa2b987d7aeaf74cc458754d7e80a67b (patch) (side-by-side diff)
tree4190b96b6b581c18943ac7e1cdd5cbca96741eae
parentdd33ac512eb4b4b647fb3423f7cdb39ec322221b (diff)
downloadkdepimpi-053b3550aa2b987d7aeaf74cc458754d7e80a67b.zip
kdepimpi-053b3550aa2b987d7aeaf74cc458754d7e80a67b.tar.gz
kdepimpi-053b3550aa2b987d7aeaf74cc458754d7e80a67b.tar.bz2
Better datepicker
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
@@ -97,2 +97,3 @@ KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, WFlags f)
#endif
+ mMarkCurrent = false;
setDate(date_); // this initializes firstday, numdays, numDaysPrevMonth
@@ -172,5 +173,8 @@ KDateTable::paintCell(QPainter *painter, int row, int col)
{
- if(hasFocus())
- { // draw the currently selected date
+ if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos)
+ painter->setPen(green);
+ else
painter->setPen(red);
+ if(hasFocus())
+ {
painter->setBrush(darkRed);
@@ -178,3 +182,2 @@ KDateTable::paintCell(QPainter *painter, int row, int col)
} else {
- painter->setPen(darkGray);
painter->setBrush(darkGray);
@@ -183,2 +186,8 @@ KDateTable::paintCell(QPainter *painter, int row, int col)
} else {
+ if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos)
+ {
+ painter->setPen(green);
+ painter->setBrush(darkGreen);
+ pen=white;
+ } else {
painter->setBrush(QColor(220,245,255));
@@ -186,2 +195,3 @@ KDateTable::paintCell(QPainter *painter, int row, int col)
}
+ }
painter->drawRect(0, 0, w, h);
@@ -359,2 +369,3 @@ KDateTable::setDate(const QDate& date_)
QDate temp;
+ mMarkCurrent = false;
// -----
@@ -370,2 +381,3 @@ KDateTable::setDate(const QDate& date_)
}
+ mMarkCurrent = ( date.month() == QDate::currentDate().month() && date.year() == QDate::currentDate().year() );
temp.setYMD(date.year(), date.month(), 1);
diff --git a/microkde/kdatetbl.h b/microkde/kdatetbl.h
index df7b7ef..b4d3e16 100644
--- a/microkde/kdatetbl.h
+++ b/microkde/kdatetbl.h
@@ -247,2 +247,3 @@ public:
protected:
+ bool mMarkCurrent;
/**