-rw-r--r-- | libkdepim/kdateedit.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp index 5fb948a..c4c0081 100644 --- a/libkdepim/kdateedit.cpp +++ b/libkdepim/kdateedit.cpp | |||
@@ -124,7 +124,13 @@ KDateEdit::~KDateEdit() | |||
124 | { | 124 | { |
125 | delete mDateFrame; | 125 | delete mDateFrame; |
126 | } | 126 | } |
127 | 127 | void KDateEdit::clear() | |
128 | { | ||
129 | bool b = mDateEdit->signalsBlocked(); | ||
130 | mDateEdit->blockSignals(true); | ||
131 | mDateEdit->setText(""); | ||
132 | mDateEdit->blockSignals(b); | ||
133 | } | ||
128 | void KDateEdit::setDate(QDate newDate) | 134 | void KDateEdit::setDate(QDate newDate) |
129 | { | 135 | { |
130 | if (!newDate.isValid() && !mHandleInvalid) | 136 | if (!newDate.isValid() && !mHandleInvalid) |
@@ -463,8 +469,7 @@ bool KDateEdit::eventFilter(QObject *, QEvent *e) | |||
463 | // switch dateFormShort by double klick with mouse | 469 | // switch dateFormShort by double klick with mouse |
464 | else if (e->type() == QEvent::MouseButtonDblClick) | 470 | else if (e->type() == QEvent::MouseButtonDblClick) |
465 | { | 471 | { |
466 | dateFormShort = dateFormShort?false:true; | 472 | toggleDateFormat(); |
467 | mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort)); | ||
468 | } | 473 | } |
469 | else if (e->type() == QEvent::FocusIn) | 474 | else if (e->type() == QEvent::FocusIn) |
470 | { | 475 | { |
@@ -473,6 +478,12 @@ bool KDateEdit::eventFilter(QObject *, QEvent *e) | |||
473 | 478 | ||
474 | return false; | 479 | return false; |
475 | } | 480 | } |
481 | void KDateEdit::toggleDateFormat() | ||
482 | { | ||
483 | dateFormShort = ! dateFormShort; | ||
484 | mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort)); | ||
485 | |||
486 | } | ||
476 | 487 | ||
477 | void KDateEdit::textChanged(const QString &) | 488 | void KDateEdit::textChanged(const QString &) |
478 | { | 489 | { |