summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp158
-rw-r--r--kaddressbook/addresseeeditorwidget.h2
2 files changed, 102 insertions, 58 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 826c69b..dbbf7fe 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -599,99 +599,126 @@ void AddresseeEditorWidget::setupTab2()
/////////////////////////////////////////////////
// Personal info
- label = new QLabel( tab2 );
+ //label = new QLabel( tab2 );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
- label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
+ //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
//US layout->addMultiCellWidget( label, 4, 5, 0, 0 );
- layout->addMultiCellWidget( label, 6, 7, 0, 0 );
+ //layout->addMultiCellWidget( label, 6, 7, 0, 0 );
+
+
+ int iii = 6;
+ if ( QApplication::desktop()->width() == 640 ) {
+ QHBox * nbox = new QHBox ( tab2 );
+ label = new QLabel( i18n( "Nick name:" )+" ", nbox );
+ layout->addWidget( label, iii, 1 );
+ 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 );
+ layout->addWidget( label, iii, 1 );
+ mSpouseEdit = new KLineEdit( nbox );
+ connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
+ SLOT( textChanged( const QString& ) ) );
+ label->setBuddy( mSpouseEdit );
+ layout->addWidget( mSpouseEdit, iii, 2 );
+ layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
+ ++iii;
+
+ } else {
label = new QLabel( i18n( "Nick name:" ), tab2 );
-//US layout->addWidget( label, 4, 1 );
- layout->addWidget( label, 6, 1 );
+ layout->addWidget( label, iii, 1 );
mNicknameEdit = new KLineEdit( tab2 );
connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mNicknameEdit );
-//US layout->addWidget( mNicknameEdit, 4, 2 );
- layout->addWidget( mNicknameEdit, 6, 2 );
+ layout->addWidget( mNicknameEdit, iii, 2 );
+ ++iii;
label = new QLabel( i18n( "Spouse's name:" ), tab2 );
-//US layout->addWidget( label, 5, 1 );
- layout->addWidget( label, 7, 1 );
+ layout->addWidget( label, iii, 1 );
mSpouseEdit = new KLineEdit( tab2 );
connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mSpouseEdit );
-//US layout->addWidget( mSpouseEdit, 5, 2 );
- layout->addWidget( mSpouseEdit, 7, 2 );
+ layout->addWidget( mSpouseEdit, iii, 2 );
+ ++iii;
+ }
- label = new QLabel( i18n( "Birthday:" ), tab2 );
-//US layout->addWidget( label, 4, 3 );
- layout->addWidget( label, 8, 1 );
- mBirthdayPicker = new KDateEdit( tab2 );
+ 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 );
+ layout->addWidget( label, iii, 1 );
+ mBirthdayPicker = new KDateEdit( nbox );
mBirthdayPicker->toggleDateFormat();
mBirthdayPicker->setHandleInvalid( true );
connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
+ label->setBuddy( mBirthdayPicker );
-#ifndef KAB_EMBEDDED
- //US invalid dates are handdled by the KDateEdit widget itself
- connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ),
- SLOT( invalidDate() ) );
- connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ),
- SLOT( emitModified() ) );
-#endif //KAB_EMBEDDED
+ label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox );
+ layout->addWidget( label, iii, 1 );
+ 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->setHandleInvalid( true );
+ connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
+ SLOT( dateChanged( QDate ) ) );
label->setBuddy( mBirthdayPicker );
-//US layout->addWidget( mBirthdayPicker, 4, 4 );
- layout->addWidget( mBirthdayPicker, 8, 2 );
+ layout->addWidget( mBirthdayPicker, iii, 2 );
+ ++iii;
label = new QLabel( i18n( "Anniversary:" ), tab2 );
-//US layout->addWidget( label, 5, 3 );
- layout->addWidget( label, 9, 1 );
+ layout->addWidget( label, iii, 1 );
mAnniversaryPicker = new KDateEdit( tab2 );
mAnniversaryPicker->setHandleInvalid( true );
connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
-#ifndef KAB_EMBEDDED
- //US invalid dates are handled by the KDateEdit widget itself
- connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ),
- SLOT( invalidDate() ) );
- connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ),
- SLOT( emitModified() ) );
-#endif //KAB_EMBEDDED
label->setBuddy( mAnniversaryPicker );
-//US layout->addWidget( mAnniversaryPicker, 5, 4 );
- layout->addWidget( mAnniversaryPicker, 9, 2 );
+ layout->addWidget( mAnniversaryPicker, iii, 2 );
+ ++iii;
-/*US
- bar = new KSeparator( KSeparator::HLine, tab2 );
- layout->addMultiCellWidget( bar, 6, 6, 0, 5 );
+ }
- //////////////////////////////////////
- // Notes
- label = new QLabel( i18n( "Note:" ), tab2 );
- label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
- layout->addWidget( label, 7, 0 );
-#ifndef KAB_EMBEDDED
- mNoteEdit = new QTextEdit( tab2 );
- mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
- mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
-#else //KAB_EMBEDDED
- mNoteEdit = new QMultiLineEdit( tab2 );
-//US mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
-//US mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
-qDebug("AddresseeEditorWidget::setupTab2 has to be changed");
-#endif //KAB_EMBEDDED
- connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) );
- label->setBuddy( mNoteEdit );
- layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 );
-*/
+ 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" ) );
@@ -1012,14 +1039,21 @@ void AddresseeEditorWidget::load()
// 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;
@@ -1062,8 +1096,9 @@ void AddresseeEditorWidget::save()
// 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() );
@@ -1075,8 +1110,15 @@ void AddresseeEditorWidget::save()
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();
QStringList::Iterator iter;
diff --git a/kaddressbook/addresseeeditorwidget.h b/kaddressbook/addresseeeditorwidget.h
index b9d9e25..995f30e 100644
--- a/kaddressbook/addresseeeditorwidget.h
+++ b/kaddressbook/addresseeeditorwidget.h
@@ -159,8 +159,10 @@ class AddresseeEditorWidget : public ExtensionWidget
KLineEdit *mManagerEdit;
KLineEdit *mAssistantEdit;
KLineEdit *mNicknameEdit;
KLineEdit *mSpouseEdit;
+ KLineEdit *mChildEdit;
+ QComboBox *mGenderBox;
KDateEdit *mBirthdayPicker;
KDateEdit *mAnniversaryPicker;
#ifndef KAB_EMBEDDED
QTextEdit *mNoteEdit;