author | zautrix <zautrix> | 2004-10-11 09:11:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-11 09:11:35 (UTC) |
commit | 5ec2ee22f69f6b3d78b505a4a44b6b0deff29645 (patch) (unidiff) | |
tree | e5c7b6f21b9541a870f296d69a4ab7f82db82b13 | |
parent | ea40295e233db219dc2431960e18fb4398ddb75c (diff) | |
download | kdepimpi-5ec2ee22f69f6b3d78b505a4a44b6b0deff29645.zip kdepimpi-5ec2ee22f69f6b3d78b505a4a44b6b0deff29645.tar.gz kdepimpi-5ec2ee22f69f6b3d78b505a4a44b6b0deff29645.tar.bz2 |
added support for gender/children
-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 158 | ||||
-rw-r--r-- | kaddressbook/addresseeeditorwidget.h | 2 |
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 | |||
@@ -600,97 +600,124 @@ void AddresseeEditorWidget::setupTab2() | |||
600 | ///////////////////////////////////////////////// | 600 | ///////////////////////////////////////////////// |
601 | // Personal info | 601 | // Personal info |
602 | 602 | ||
603 | label = new QLabel( tab2 ); | 603 | //label = new QLabel( tab2 ); |
604 | //US loadIcon call is ambiguous. Add one more parameter | 604 | //US loadIcon call is ambiguous. Add one more parameter |
605 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); | 605 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); |
606 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); | 606 | //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); |
607 | //US layout->addMultiCellWidget( label, 4, 5, 0, 0 ); | 607 | //US layout->addMultiCellWidget( label, 4, 5, 0, 0 ); |
608 | layout->addMultiCellWidget( label, 6, 7, 0, 0 ); | 608 | //layout->addMultiCellWidget( label, 6, 7, 0, 0 ); |
609 | |||
610 | |||
611 | int iii = 6; | ||
609 | 612 | ||
613 | if ( QApplication::desktop()->width() == 640 ) { | ||
614 | QHBox * nbox = new QHBox ( tab2 ); | ||
615 | label = new QLabel( i18n( "Nick name:" )+" ", nbox ); | ||
616 | layout->addWidget( label, iii, 1 ); | ||
617 | mNicknameEdit = new KLineEdit( nbox ); | ||
618 | connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), | ||
619 | SLOT( textChanged( const QString& ) ) ); | ||
620 | label->setBuddy( mNicknameEdit ); | ||
621 | |||
622 | label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox ); | ||
623 | layout->addWidget( label, iii, 1 ); | ||
624 | mSpouseEdit = new KLineEdit( nbox ); | ||
625 | connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), | ||
626 | SLOT( textChanged( const QString& ) ) ); | ||
627 | label->setBuddy( mSpouseEdit ); | ||
628 | layout->addWidget( mSpouseEdit, iii, 2 ); | ||
629 | layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); | ||
630 | ++iii; | ||
631 | |||
632 | } else { | ||
610 | label = new QLabel( i18n( "Nick name:" ), tab2 ); | 633 | label = new QLabel( i18n( "Nick name:" ), tab2 ); |
611 | //US layout->addWidget( label, 4, 1 ); | 634 | layout->addWidget( label, iii, 1 ); |
612 | layout->addWidget( label, 6, 1 ); | ||
613 | mNicknameEdit = new KLineEdit( tab2 ); | 635 | mNicknameEdit = new KLineEdit( tab2 ); |
614 | connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), | 636 | connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), |
615 | SLOT( textChanged( const QString& ) ) ); | 637 | SLOT( textChanged( const QString& ) ) ); |
616 | label->setBuddy( mNicknameEdit ); | 638 | label->setBuddy( mNicknameEdit ); |
617 | //US layout->addWidget( mNicknameEdit, 4, 2 ); | 639 | layout->addWidget( mNicknameEdit, iii, 2 ); |
618 | layout->addWidget( mNicknameEdit, 6, 2 ); | 640 | ++iii; |
619 | 641 | ||
620 | label = new QLabel( i18n( "Spouse's name:" ), tab2 ); | 642 | label = new QLabel( i18n( "Spouse's name:" ), tab2 ); |
621 | //US layout->addWidget( label, 5, 1 ); | 643 | layout->addWidget( label, iii, 1 ); |
622 | layout->addWidget( label, 7, 1 ); | ||
623 | mSpouseEdit = new KLineEdit( tab2 ); | 644 | mSpouseEdit = new KLineEdit( tab2 ); |
624 | connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), | 645 | connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), |
625 | SLOT( textChanged( const QString& ) ) ); | 646 | SLOT( textChanged( const QString& ) ) ); |
626 | label->setBuddy( mSpouseEdit ); | 647 | label->setBuddy( mSpouseEdit ); |
627 | //US layout->addWidget( mSpouseEdit, 5, 2 ); | 648 | layout->addWidget( mSpouseEdit, iii, 2 ); |
628 | layout->addWidget( mSpouseEdit, 7, 2 ); | 649 | ++iii; |
650 | } | ||
629 | 651 | ||
630 | label = new QLabel( i18n( "Birthday:" ), tab2 ); | 652 | label = new QLabel( i18n( "Children's names:" ), tab2 ); |
631 | //US layout->addWidget( label, 4, 3 ); | 653 | layout->addWidget( label, iii, 1 ); |
632 | layout->addWidget( label, 8, 1 ); | 654 | mChildEdit = new KLineEdit( tab2 ); |
633 | mBirthdayPicker = new KDateEdit( tab2 ); | 655 | connect( mChildEdit, SIGNAL( textChanged( const QString& ) ), |
656 | SLOT( textChanged( const QString& ) ) ); | ||
657 | label->setBuddy( mChildEdit ); | ||
658 | layout->addWidget( mChildEdit, iii, 2 ); | ||
659 | ++iii; | ||
660 | if ( QApplication::desktop()->width() == 640 ) { | ||
661 | QHBox * nbox = new QHBox ( tab2 ); | ||
662 | label = new QLabel( i18n( "Birthday:" )+" ", nbox ); | ||
663 | layout->addWidget( label, iii, 1 ); | ||
664 | mBirthdayPicker = new KDateEdit( nbox ); | ||
634 | mBirthdayPicker->toggleDateFormat(); | 665 | mBirthdayPicker->toggleDateFormat(); |
635 | mBirthdayPicker->setHandleInvalid( true ); | 666 | mBirthdayPicker->setHandleInvalid( true ); |
636 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), | 667 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), |
637 | SLOT( dateChanged( QDate ) ) ); | 668 | SLOT( dateChanged( QDate ) ) ); |
638 | 669 | ||
670 | label->setBuddy( mBirthdayPicker ); | ||
639 | 671 | ||
640 | #ifndef KAB_EMBEDDED | 672 | label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox ); |
641 | //US invalid dates are handdled by the KDateEdit widget itself | 673 | layout->addWidget( label, iii, 1 ); |
642 | connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ), | 674 | mAnniversaryPicker = new KDateEdit( nbox ); |
643 | SLOT( invalidDate() ) ); | 675 | mAnniversaryPicker->setHandleInvalid( true ); |
644 | connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ), | 676 | connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), |
645 | SLOT( emitModified() ) ); | 677 | SLOT( dateChanged( QDate ) ) ); |
646 | #endif //KAB_EMBEDDED | 678 | |
679 | label->setBuddy( mAnniversaryPicker ); | ||
680 | layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); | ||
681 | ++iii; | ||
682 | |||
683 | } else { | ||
684 | |||
685 | label = new QLabel( i18n( "Birthday:" ), tab2 ); | ||
686 | layout->addWidget( label, iii, 1 ); | ||
687 | mBirthdayPicker = new KDateEdit( tab2 ); | ||
688 | mBirthdayPicker->toggleDateFormat(); | ||
689 | mBirthdayPicker->setHandleInvalid( true ); | ||
690 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), | ||
691 | SLOT( dateChanged( QDate ) ) ); | ||
647 | 692 | ||
648 | label->setBuddy( mBirthdayPicker ); | 693 | label->setBuddy( mBirthdayPicker ); |
649 | //US layout->addWidget( mBirthdayPicker, 4, 4 ); | 694 | layout->addWidget( mBirthdayPicker, iii, 2 ); |
650 | layout->addWidget( mBirthdayPicker, 8, 2 ); | 695 | ++iii; |
651 | 696 | ||
652 | label = new QLabel( i18n( "Anniversary:" ), tab2 ); | 697 | label = new QLabel( i18n( "Anniversary:" ), tab2 ); |
653 | //US layout->addWidget( label, 5, 3 ); | 698 | layout->addWidget( label, iii, 1 ); |
654 | layout->addWidget( label, 9, 1 ); | ||
655 | mAnniversaryPicker = new KDateEdit( tab2 ); | 699 | mAnniversaryPicker = new KDateEdit( tab2 ); |
656 | mAnniversaryPicker->setHandleInvalid( true ); | 700 | mAnniversaryPicker->setHandleInvalid( true ); |
657 | connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), | 701 | connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), |
658 | SLOT( dateChanged( QDate ) ) ); | 702 | SLOT( dateChanged( QDate ) ) ); |
659 | #ifndef KAB_EMBEDDED | ||
660 | //US invalid dates are handled by the KDateEdit widget itself | ||
661 | connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ), | ||
662 | SLOT( invalidDate() ) ); | ||
663 | connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ), | ||
664 | SLOT( emitModified() ) ); | ||
665 | #endif //KAB_EMBEDDED | ||
666 | 703 | ||
667 | label->setBuddy( mAnniversaryPicker ); | 704 | label->setBuddy( mAnniversaryPicker ); |
668 | //US layout->addWidget( mAnniversaryPicker, 5, 4 ); | 705 | layout->addWidget( mAnniversaryPicker, iii, 2 ); |
669 | layout->addWidget( mAnniversaryPicker, 9, 2 ); | 706 | ++iii; |
670 | 707 | ||
671 | /*US | 708 | } |
672 | bar = new KSeparator( KSeparator::HLine, tab2 ); | ||
673 | layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); | ||
674 | 709 | ||
675 | ////////////////////////////////////// | 710 | label = new QLabel( i18n( "Gender:" ), tab2 ); |
676 | // Notes | 711 | layout->addWidget( label, iii, 1 ); |
677 | label = new QLabel( i18n( "Note:" ), tab2 ); | 712 | mGenderBox = new QComboBox ( tab2 ); |
678 | label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); | 713 | mGenderBox->insertItem ( i18n( "ALIEN (gender undefined)" )); |
679 | layout->addWidget( label, 7, 0 ); | 714 | mGenderBox->insertItem ( i18n( "female" )); |
680 | #ifndef KAB_EMBEDDED | 715 | mGenderBox->insertItem ( i18n( "male" )); |
681 | mNoteEdit = new QTextEdit( tab2 ); | 716 | connect( mGenderBox, SIGNAL( activated ( const QString & ) ), |
682 | mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); | 717 | SLOT( textChanged( const QString& ) ) ); |
683 | mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); | 718 | label->setBuddy( mGenderBox ); |
684 | #else //KAB_EMBEDDED | 719 | layout->addWidget( mGenderBox, iii, 2 ); |
685 | mNoteEdit = new QMultiLineEdit( tab2 ); | 720 | ++iii; |
686 | //US mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); | ||
687 | //US mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); | ||
688 | qDebug("AddresseeEditorWidget::setupTab2 has to be changed"); | ||
689 | #endif //KAB_EMBEDDED | ||
690 | connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) ); | ||
691 | label->setBuddy( mNoteEdit ); | ||
692 | layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 ); | ||
693 | */ | ||
694 | // Build the layout and add to the tab widget | 721 | // Build the layout and add to the tab widget |
695 | layout->activate(); // required | 722 | layout->activate(); // required |
696 | 723 | ||
@@ -1013,12 +1040,19 @@ void AddresseeEditorWidget::load() | |||
1013 | // Load customs | 1040 | // Load customs |
1014 | mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); | 1041 | mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); |
1015 | mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); | 1042 | mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); |
1043 | mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) ); | ||
1016 | mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); | 1044 | mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); |
1017 | mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); | 1045 | mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); |
1018 | mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); | 1046 | mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); |
1019 | mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); | 1047 | mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); |
1020 | mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); | 1048 | mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); |
1021 | 1049 | QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); | |
1050 | if ( gen == "female" ) | ||
1051 | mGenderBox->setCurrentItem ( 1 ); | ||
1052 | else if ( gen == "male" ) | ||
1053 | mGenderBox->setCurrentItem ( 2 ); | ||
1054 | else | ||
1055 | mGenderBox->setCurrentItem ( 0 ); | ||
1022 | blockSignals( block ); | 1056 | blockSignals( block ); |
1023 | mBlockSignals = false; | 1057 | mBlockSignals = false; |
1024 | 1058 | ||
@@ -1063,6 +1097,7 @@ void AddresseeEditorWidget::save() | |||
1063 | // save custom fields | 1097 | // save custom fields |
1064 | mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); | 1098 | mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); |
1065 | mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); | 1099 | mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); |
1100 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); | ||
1066 | mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); | 1101 | mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); |
1067 | mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); | 1102 | mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); |
1068 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); | 1103 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); |
@@ -1076,6 +1111,13 @@ void AddresseeEditorWidget::save() | |||
1076 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); | 1111 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); |
1077 | mAnniversaryPicker->clear(); | 1112 | mAnniversaryPicker->clear(); |
1078 | } | 1113 | } |
1114 | int gen = mGenderBox->currentItem (); | ||
1115 | if ( gen == 1 ) | ||
1116 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); | ||
1117 | else if ( gen == 2 ) | ||
1118 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); | ||
1119 | else | ||
1120 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); | ||
1079 | 1121 | ||
1080 | // Save the email addresses | 1122 | // Save the email addresses |
1081 | QStringList emails = mAddressee.emails(); | 1123 | QStringList emails = mAddressee.emails(); |
diff --git a/kaddressbook/addresseeeditorwidget.h b/kaddressbook/addresseeeditorwidget.h index b9d9e25..995f30e 100644 --- a/kaddressbook/addresseeeditorwidget.h +++ b/kaddressbook/addresseeeditorwidget.h | |||
@@ -160,6 +160,8 @@ class AddresseeEditorWidget : public ExtensionWidget | |||
160 | KLineEdit *mAssistantEdit; | 160 | KLineEdit *mAssistantEdit; |
161 | KLineEdit *mNicknameEdit; | 161 | KLineEdit *mNicknameEdit; |
162 | KLineEdit *mSpouseEdit; | 162 | KLineEdit *mSpouseEdit; |
163 | KLineEdit *mChildEdit; | ||
164 | QComboBox *mGenderBox; | ||
163 | KDateEdit *mBirthdayPicker; | 165 | KDateEdit *mBirthdayPicker; |
164 | KDateEdit *mAnniversaryPicker; | 166 | KDateEdit *mAnniversaryPicker; |
165 | #ifndef KAB_EMBEDDED | 167 | #ifndef KAB_EMBEDDED |