author | zautrix <zautrix> | 2005-02-09 13:22:06 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-09 13:22:06 (UTC) |
commit | c3dd5bfd446b893a8b39ddec425a6cf8deff2261 (patch) (side-by-side diff) | |
tree | d0dd74c17fd6101da1d6c403c85924c58bc1ac9b /libkdepim | |
parent | 940cdd0fd1349e7f8e53adff0595c1d946322ef1 (diff) | |
download | kdepimpi-c3dd5bfd446b893a8b39ddec425a6cf8deff2261.zip kdepimpi-c3dd5bfd446b893a8b39ddec425a6cf8deff2261.tar.gz kdepimpi-c3dd5bfd446b893a8b39ddec425a6cf8deff2261.tar.bz2 |
fixes
-rw-r--r-- | libkdepim/kdateedit.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp index c4c0081..2c78ea3 100644 --- a/libkdepim/kdateedit.cpp +++ b/libkdepim/kdateedit.cpp @@ -381,100 +381,101 @@ void KDateEdit::setSelect( int from, int to ) void KDateEdit::toggleDatePicker() { if( mDateFrame->isVisible() ) { mDateFrame->hide(); } else { QPoint tmpPoint = mapToGlobal(mDateButton->geometry().bottomRight()); QSize datepickersize = mDatePicker->sizeHint(); if ( tmpPoint.x() < 7+datepickersize.width() ) tmpPoint.setX( 7+datepickersize.width() ); int h = QApplication::desktop()->height(); if ( tmpPoint.y() + datepickersize.height() > h ) tmpPoint.setY( h - datepickersize.height() ); mDateFrame->setGeometry(tmpPoint.x()-datepickersize.width()-7, tmpPoint.y(), datepickersize.width()+2*mDateFrame->lineWidth(), datepickersize.height()+2*mDateFrame->lineWidth()); QDate date = readDate(); if(date.isValid()) { mDatePicker->setDate(date); } else { mDatePicker->setDate(QDate::currentDate()); } mDateFrame->show(); } } void KDateEdit::lineEnterPressed() { QDate date = readDate(); if(date.isValid()) { // Update the edit. This is needed if the user has entered a // word rather than the actual date. setDate(date); emit(dateChanged(date)); emit returnPressed(); } else { if ( withoutDp ) { KNotifyClient::beep(); } else { if ( !mDateEdit->text().isEmpty() ) { mTextChanged = false; QString text = i18n( "You entered an invalid date!\n Will use current date instead." ); - if ( KMessageBox::warningContinueCancel( 0, text ) == KMessageBox::Continue ) { - setDate( QDate::currentDate() ); - emit dateChanged( QDate::currentDate() ); - } + if ( isVisible() ) + if ( KMessageBox::warningContinueCancel( 0, text ) == KMessageBox::Continue ) { + setDate( QDate::currentDate() ); + emit dateChanged( QDate::currentDate() ); + } } } } } bool KDateEdit::inputIsValid() { return readDate().isValid(); } QDate KDateEdit::readDate() const { QString text = mDateEdit->text(); QDate date; if (mKeywordMap.contains(text.lower())) { date = QDate::currentDate().addDays(mKeywordMap[text.lower()]); } else { date = KGlobal::locale()->readDate(text); } return date; } bool KDateEdit::eventFilter(QObject *, QEvent *e) { // We only process the focus out event if the text has changed // since we got focus if ((e->type() == QEvent::FocusOut) && mTextChanged) { lineEnterPressed(); mTextChanged = false; } // switch dateFormShort by double klick with mouse else if (e->type() == QEvent::MouseButtonDblClick) { toggleDateFormat(); } else if (e->type() == QEvent::FocusIn) { maxDay = readDate().day(); } return false; } |