author | zautrix <zautrix> | 2005-04-14 17:48:58 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-14 17:48:58 (UTC) |
commit | bbdca90c599aaea557d31552c6bc33fc15e397cd (patch) (side-by-side diff) | |
tree | e41b5eb16239664d2217e5436db61610099b60ef /libkdepim | |
parent | 5ea16ef9058a21016402dd5affc0a7f82857e606 (diff) | |
download | kdepimpi-bbdca90c599aaea557d31552c6bc33fc15e397cd.zip kdepimpi-bbdca90c599aaea557d31552c6bc33fc15e397cd.tar.gz kdepimpi-bbdca90c599aaea557d31552c6bc33fc15e397cd.tar.bz2 |
today added
-rw-r--r-- | libkdepim/kdateedit.cpp | 9 | ||||
-rw-r--r-- | libkdepim/kdateedit.h | 2 |
2 files changed, 11 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 @@ -63,30 +63,34 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) if ( withoutDP ) { mDateFrame = 0; 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(); mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate()); 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())); connect(mDateEdit,SIGNAL(textChanged(const QString &)), SLOT(textChanged(const QString &))); @@ -127,16 +131,21 @@ KDateEdit::~KDateEdit() } 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; QString dateString = ""; if(newDate.isValid()) diff --git a/libkdepim/kdateedit.h b/libkdepim/kdateedit.h index cf3b90a..2d8c452 100644 --- a/libkdepim/kdateedit.h +++ b/libkdepim/kdateedit.h @@ -82,16 +82,17 @@ class KDateEdit : public QHBox void clear(); signals: /** This signal is emitted whenever the user modifies the date. This * may not get emitted until the user presses enter in the line edit or * focus leaves the widget (ie: the user confirms their selection). */ void dateChanged(QDate); void returnPressed(); + void setTimeTo( QTime ); public slots: /** Sets the date. * * @param date The new date to display. This date must be valid or * it will not be displayed. */ void setDate(QDate date); // set Date with key_up key_down to relation of cursor Position @@ -103,16 +104,17 @@ class KDateEdit : public QHBox * @param on Enabled if true, disabled if false */ void setEnabled(bool on); protected slots: void toggleDatePicker(); void lineEnterPressed(); void textChanged(const QString &); + void goToNow(); private: /** Reads the text from the line edit. If the text is a keyword, the * word will be translated to a date. If the text is not a keyword, the * text will be interpreted as a date. */ QDate readDate() const; |