summaryrefslogtreecommitdiffabout
path: root/kaddressbook/addresseeeditorwidget.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/addresseeeditorwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index bd32859..5334a0e 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -614,119 +614,119 @@ void AddresseeEditorWidget::setupTab2()
if ( QApplication::desktop()->width() == 640 ) {
QHBox * nbox = new QHBox ( tab2 );
label = new QLabel( i18n( "Nick name:" )+" ", nbox );
mNicknameEdit = new KLineEdit( nbox );
connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mNicknameEdit );
label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox );
mSpouseEdit = new KLineEdit( nbox );
connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mSpouseEdit );
layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
++iii;
} else {
label = new QLabel( i18n( "Nick name:" ), tab2 );
layout->addWidget( label, iii, 1 );
mNicknameEdit = new KLineEdit( tab2 );
connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mNicknameEdit );
layout->addWidget( mNicknameEdit, iii, 2 );
++iii;
label = new QLabel( i18n( "Spouse's name:" ), tab2 );
layout->addWidget( label, iii, 1 );
mSpouseEdit = new KLineEdit( tab2 );
connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mSpouseEdit );
layout->addWidget( mSpouseEdit, iii, 2 );
++iii;
}
label = new QLabel( i18n( "Children's names:" ), tab2 );
layout->addWidget( label, iii, 1 );
mChildEdit = new KLineEdit( tab2 );
connect( mChildEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mChildEdit );
layout->addWidget( mChildEdit, iii, 2 );
++iii;
if ( QApplication::desktop()->width() == 640 ) {
QHBox * nbox = new QHBox ( tab2 );
label = new QLabel( i18n( "Birthday:" )+" ", nbox );
mBirthdayPicker = new KDateEdit( nbox );
- mBirthdayPicker->toggleDateFormat();
+ //mBirthdayPicker->toggleDateFormat();
mBirthdayPicker->setHandleInvalid( true );
connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
label->setBuddy( mBirthdayPicker );
label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox );
mAnniversaryPicker = new KDateEdit( nbox );
mAnniversaryPicker->setHandleInvalid( true );
connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
label->setBuddy( mAnniversaryPicker );
layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
++iii;
} else {
label = new QLabel( i18n( "Birthday:" ), tab2 );
layout->addWidget( label, iii, 1 );
mBirthdayPicker = new KDateEdit( tab2 );
- mBirthdayPicker->toggleDateFormat();
+ //mBirthdayPicker->toggleDateFormat();
mBirthdayPicker->setHandleInvalid( true );
connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
label->setBuddy( mBirthdayPicker );
layout->addWidget( mBirthdayPicker, iii, 2 );
++iii;
label = new QLabel( i18n( "Anniversary:" ), tab2 );
layout->addWidget( label, iii, 1 );
mAnniversaryPicker = new KDateEdit( tab2 );
mAnniversaryPicker->setHandleInvalid( true );
connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
label->setBuddy( mAnniversaryPicker );
layout->addWidget( mAnniversaryPicker, iii, 2 );
++iii;
}
label = new QLabel( i18n( "Gender:" ), tab2 );
layout->addWidget( label, iii, 1 );
mGenderBox = new QComboBox ( tab2 );
mGenderBox->insertItem ( i18n( "ALIEN (gender undefined)" ));
mGenderBox->insertItem ( i18n( "female" ));
mGenderBox->insertItem ( i18n( "male" ));
connect( mGenderBox, SIGNAL( activated ( const QString & ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mGenderBox );
layout->addWidget( mGenderBox, iii, 2 );
++iii;
// Build the layout and add to the tab widget
layout->activate(); // required
mTabWidget->addTab( tab2, i18n( "&Details" ) );
}
void AddresseeEditorWidget::setupTab2_1()
{
// This is the Details tab
QWidget *tab2_2 = new QWidget( mTabWidget );
QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 );
layout->setMargin( KDialogBase::marginHintSmall() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
QLabel *label;
@@ -1034,98 +1034,96 @@ void AddresseeEditorWidget::load()
mGeoWidget->setGeo( mAddressee.geo() );
mImageWidget->setPhoto( mAddressee.photo() );
mImageWidget->setLogo( mAddressee.logo() );
mKeyWidget->setKeys( mAddressee.keys() );
mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
#ifndef KAB_EMBEDDED
mSoundWidget->setSound( mAddressee.sound() );
#else //KAB_EMBEDDED
//US qDebug("AddresseeEditorWidget::load has to be changed 2");
#endif //KAB_EMBEDDED
// Load customs
mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) );
mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) );
mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) );
mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
if ( gen == "female" )
mGenderBox->setCurrentItem ( 1 );
else if ( gen == "male" )
mGenderBox->setCurrentItem ( 2 );
else
mGenderBox->setCurrentItem ( 0 );
blockSignals( block );
mBlockSignals = false;
mDirty = false;
}
void AddresseeEditorWidget::save()
{
if ( !dirty() ) {
return;
}
mAddressee.setRevision( QDateTime::currentDateTime() );
mAddressee.setRole( mRoleEdit->text() );
mAddressee.setOrganization( mOrgEdit->text() );
mAddressee.setUrl( KURL( mURLEdit->text() ) );
mAddressee.setNote( mNoteEdit->text() );
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() );
mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
mAddressee.setGeo( mGeoWidget->geo() );
mAddressee.setPhoto( mImageWidget->photo() );
mAddressee.setLogo( mImageWidget->logo() );
mAddressee.setKeys( mKeyWidget->keys() );
#ifndef KAB_EMBEDDED
mAddressee.setSound( mSoundWidget->sound() );
#else //KAB_EMBEDDED
//US qDebug("AddresseeEditorWidget::save sound not supported");
#endif //KAB_EMBEDDED
mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
// save custom fields
mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
if ( mAnniversaryPicker->inputIsValid() ) {
QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
}
else {
mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
mAnniversaryPicker->clear();
}
int gen = mGenderBox->currentItem ();
if ( gen == 1 )
mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female");
else if ( gen == 2 )
mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
else
mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" );
// Save the email addresses
QStringList emails = mAddressee.emails();