-rw-r--r-- | libkdepim/addresseeview.cpp | 10 | ||||
-rw-r--r-- | libkdepim/kdateedit.cpp | 17 | ||||
-rw-r--r-- | libkdepim/kdateedit.h | 3 |
3 files changed, 24 insertions, 6 deletions
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp index d710541..5c69010 100644 --- a/libkdepim/addresseeview.cpp +++ b/libkdepim/addresseeview.cpp @@ -60,17 +60,17 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name ) //US QStyleSheet *sheet = styleSheet(); //US QStyleSheetItem *link = sheet->item( "a" ); //US link->setColor( KGlobalSettings::linkColor() ); } void AddresseeView::setSource(const QString& n) { - qDebug("********AddresseeView::setSource %s", n.latin1()); + //qDebug("********AddresseeView::setSource %s", n.latin1()); if ( n.left( 6 ) == "mailto" ) ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); else if ( n.left( 7 ) == "phoneto" ) ExternalAppHandler::instance()->callByPhone( n.mid(8) ); else if ( n.left( 5 ) == "faxto" ) ExternalAppHandler::instance()->callByFax( n.mid(6) ); else if ( n.left( 5 ) == "smsto" ) @@ -119,17 +119,23 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( type ) .arg( *emailIt ); ++emailIt; } } - + if ( mAddressee.birthday().date().isValid() ) { + dynamicPart += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\">%2</td></tr>" ) + .arg( i18n ("Birthday") ) + .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); + } KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); KABC::PhoneNumber::List::ConstIterator phoneIt; QString extension; int phonetype; QString sms; for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { phonetype = (*phoneIt).type(); if (ksmsAvail && diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp index 5fb948a..c4c0081 100644 --- a/libkdepim/kdateedit.cpp +++ b/libkdepim/kdateedit.cpp @@ -119,17 +119,23 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) mHandleInvalid = false; QWidget::setTabOrder( mDateEdit, mDateButton ); } KDateEdit::~KDateEdit() { delete mDateFrame; } - +void KDateEdit::clear() +{ + bool b = mDateEdit->signalsBlocked(); + mDateEdit->blockSignals(true); + mDateEdit->setText(""); + mDateEdit->blockSignals(b); +} void KDateEdit::setDate(QDate newDate) { if (!newDate.isValid() && !mHandleInvalid) return; if ( readDate() == newDate ) return; QString dateString = ""; if(newDate.isValid()) @@ -458,26 +464,31 @@ bool KDateEdit::eventFilter(QObject *, QEvent *e) if ((e->type() == QEvent::FocusOut) && mTextChanged) { lineEnterPressed(); mTextChanged = false; } // switch dateFormShort by double klick with mouse else if (e->type() == QEvent::MouseButtonDblClick) { - dateFormShort = dateFormShort?false:true; - mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort)); + toggleDateFormat(); } else if (e->type() == QEvent::FocusIn) { maxDay = readDate().day(); } return false; } +void KDateEdit::toggleDateFormat() +{ + dateFormShort = ! dateFormShort; + mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort)); + +} void KDateEdit::textChanged(const QString &) { if(mHandleInvalid && mDateEdit->text().stripWhiteSpace().isEmpty()) { QDate date; //invalid date emit(dateChanged(date)); } else { mTextChanged = true; diff --git a/libkdepim/kdateedit.h b/libkdepim/kdateedit.h index 742d843..cf3b90a 100644 --- a/libkdepim/kdateedit.h +++ b/libkdepim/kdateedit.h @@ -73,17 +73,18 @@ class KDateEdit : public QHBox * of today will be returned. */ void setHandleInvalid(bool handleInvalid); /** Checks for a focus out event. The display of the date is updated * to display the proper date when the focus leaves. */ virtual bool eventFilter(QObject *o, QEvent *e); - + void toggleDateFormat(); + 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(); public slots: |