author | zautrix <zautrix> | 2004-09-13 21:35:12 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-13 21:35:12 (UTC) |
commit | bd6b4acb39498ffea3beea7d9b5f7620b60c14db (patch) (side-by-side diff) | |
tree | e2d7425b7bb49fbcb7acb5ced497ac1fed06dfaf /kaddressbook/addresseeeditorwidget.cpp | |
parent | 06eabf6e82c0390699d11fd12580d91261829431 (diff) | |
download | kdepimpi-bd6b4acb39498ffea3beea7d9b5f7620b60c14db.zip kdepimpi-bd6b4acb39498ffea3beea7d9b5f7620b60c14db.tar.gz kdepimpi-bd6b4acb39498ffea3beea7d9b5f7620b60c14db.tar.bz2 |
Many bugfixes
Diffstat (limited to 'kaddressbook/addresseeeditorwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 3cfc1f2..826c69b 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp @@ -89,3 +89,2 @@ AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension, - kdDebug(5720) << "AddresseeEditorWidget()" << endl; mFormattedNameType = NameEditDialog::CustomName; @@ -634,2 +633,3 @@ void AddresseeEditorWidget::setupTab2() mBirthdayPicker = new KDateEdit( tab2 ); + mBirthdayPicker->toggleDateFormat(); mBirthdayPicker->setHandleInvalid( true ); @@ -949,3 +949,2 @@ void AddresseeEditorWidget::load() { - kdDebug(5720) << "AddresseeEditorWidget::load()" << endl; @@ -1030,3 +1029,5 @@ void AddresseeEditorWidget::save() { - if ( !mDirty ) return; + if ( !dirty() ) { + return; + } @@ -1036,7 +1037,13 @@ void AddresseeEditorWidget::save() mAddressee.setNote( mNoteEdit->text() ); - if ( mBirthdayPicker->inputIsValid() ) - mAddressee.setBirthday( QDateTime( mBirthdayPicker->date() ) ); - else + if ( mBirthdayPicker->inputIsValid() ) { + QDate da = mBirthdayPicker->date(); + if ( da > QDate::currentDate() ) + da.setYMD(da.year()-100, da.month(), da.day() ); + mAddressee.setBirthday( QDateTime( da ) ); + qDebug("bday %s ",da.toString().latin1()); + } + else { mAddressee.setBirthday( QDateTime() ); - + mBirthdayPicker->clear(); + } mAddressee.setNickName( mNicknameEdit->text() ); @@ -1064,5 +1071,2 @@ void AddresseeEditorWidget::save() if ( mAnniversaryPicker->inputIsValid() ) { - -//US mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", -//US mAnniversaryPicker->date().toString( Qt::ISODate ) ); QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); @@ -1070,4 +1074,6 @@ void AddresseeEditorWidget::save() } - else + else { mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); + mAnniversaryPicker->clear(); + } @@ -1116,2 +1122,22 @@ bool AddresseeEditorWidget::dirty() { + + if ( ! mDirty ) { + if ( mBirthdayPicker->inputIsValid() ) { + QDate da = mBirthdayPicker->date(); + if ( !(da == mAddressee.birthday().date())) + mDirty = true; + } + else { + mBirthdayPicker->clear(); + } + if ( mAnniversaryPicker->inputIsValid() ) { + QDate da = mAnniversaryPicker->date(); + if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), + "%Y-%m-%d")) + mDirty = true; + } + else { + mAnniversaryPicker->clear(); + } + } return mDirty; @@ -1125,5 +1151,5 @@ void AddresseeEditorWidget::nameTextChanged( const QString &text ) if ( !mAddressee.formattedName().isEmpty() ) { - QString fn = mAddressee.formattedName(); - mAddressee.setNameFromString( text ); - mAddressee.setFormattedName( fn ); + QString fn = mAddressee.formattedName(); + mAddressee.setNameFromString( text ); + mAddressee.setFormattedName( fn ); } else { @@ -1171,3 +1197,3 @@ void AddresseeEditorWidget::nameButtonClicked() - if ( dialog.exec() ) { + if ( KApplication::execDialog( &dialog) ) { if ( dialog.changed() ) { |