-rw-r--r-- | libkdepim/kdateedit.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp index 3d9e690..bf38479 100644 --- a/libkdepim/kdateedit.cpp +++ b/libkdepim/kdateedit.cpp @@ -65,12 +65,15 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) mDateButton = 0; mDatePicker = 0; } else { QPixmap pixmap = SmallIcon("smallcal"); mDateButton = new QPushButton(this); mDateButton->setPixmap(pixmap); + QPixmap pixmap2 = SmallIcon("today_small"); + QPushButton* nowButton = new QPushButton(this); + nowButton->setPixmap(pixmap2); mDateFrame = new QVBox(0,0,WType_Popup); // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); mDateFrame->setLineWidth(3); mDateFrame->hide(); @@ -79,12 +82,13 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate))); connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate))); connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate))); connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate))); connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide())); connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker())); + connect(nowButton,SIGNAL(clicked()),SLOT(goToNow())); mDateButton->setFocusPolicy( QWidget::NoFocus ); mDateButton->setAutoDefault( false ); //mDateFrame->resize( 400, 300 ); } connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed())); @@ -129,12 +133,17 @@ void KDateEdit::clear() { bool b = mDateEdit->signalsBlocked(); mDateEdit->blockSignals(true); mDateEdit->setText(""); mDateEdit->blockSignals(b); } +void KDateEdit::goToNow() +{ + setDate(QDate::currentDate() ); + emit setTimeTo( QTime::currentTime() ); +} void KDateEdit::setDate(QDate newDate) { if (!newDate.isValid() && !mHandleInvalid) return; if ( readDate() == newDate ) return; |