-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | libkdepim/kdatepicker.cpp | 12 | ||||
-rw-r--r-- | libkdepim/kdatepicker.h | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 3d8edfc..62c8447 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -7,4 +7,6 @@ Fixed a problem in dependency info in the ipk files for the Zaurus. Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. +Added a "go today" button to the datepicker. + ********** VERSION 2.0.7 ************ diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp index c13734f..77793c4 100644 --- a/libkdepim/kdatepicker.cpp +++ b/libkdepim/kdatepicker.cpp @@ -48,4 +48,5 @@ KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) selectMonth(new QToolButton(this)), selectYear(new QToolButton(this)), + todayBut(new QToolButton(this)), //line(new QLineEdit(this)), val(new KDateValidator(this)) @@ -67,4 +68,5 @@ KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) monthForward->setPixmap(SmallIcon("1rightarrowB")); monthBackward->setPixmap(SmallIcon("1leftarrowB")); + todayBut->setPixmap(SmallIcon("today")); setDate(dt); // set button texts connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); @@ -76,4 +78,5 @@ KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); + connect(todayBut, SIGNAL(clicked()), SLOT(goToday())); //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate))); @@ -137,5 +140,7 @@ KDatePicker::resizeEvent(QResizeEvent*) sizes[0]=lineDate->sizeHint(); //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); - lineDate->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); + int todaywid = todayBut->sizeHint().width(); +todayBut->setGeometry(0, height()-sizes[0].height(),todaywid, sizes[0].height()); + lineDate->setGeometry(0+todaywid, height()-sizes[0].height(), width()-todaywid, sizes[0].height()); // ----- adjust the table: table->setGeometry(0, buttonHeight, width(), @@ -171,4 +176,9 @@ KDatePicker::date() const } +void KDatePicker::goToday() +{ + slotSetDate( QDate::currentDate() ); + +} void KDatePicker::slotSetDate( QDate date ) { diff --git a/libkdepim/kdatepicker.h b/libkdepim/kdatepicker.h index 6625357..3db9a89 100644 --- a/libkdepim/kdatepicker.h +++ b/libkdepim/kdatepicker.h @@ -108,4 +108,5 @@ protected: /// the resize event void resizeEvent(QResizeEvent*); + QToolButton *todayBut; /// the year forward button QToolButton *yearForward; @@ -142,4 +143,5 @@ protected slots: void lineEnterPressed(); void slotSetDate(QDate); + void goToday(); signals: /** This signal is emitted each time the selected date is changed. |