summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-10-11 09:11:35 (UTC)
committer zautrix <zautrix>2004-10-11 09:11:35 (UTC)
commit5ec2ee22f69f6b3d78b505a4a44b6b0deff29645 (patch) (unidiff)
treee5c7b6f21b9541a870f296d69a4ab7f82db82b13 /kaddressbook
parentea40295e233db219dc2431960e18fb4398ddb75c (diff)
downloadkdepimpi-5ec2ee22f69f6b3d78b505a4a44b6b0deff29645.zip
kdepimpi-5ec2ee22f69f6b3d78b505a4a44b6b0deff29645.tar.gz
kdepimpi-5ec2ee22f69f6b3d78b505a4a44b6b0deff29645.tar.bz2
added support for gender/children
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp214
-rw-r--r--kaddressbook/addresseeeditorwidget.h2
2 files changed, 130 insertions, 86 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 609
610 label = new QLabel( i18n( "Nick name:" ), tab2 ); 610
611//US layout->addWidget( label, 4, 1 ); 611 int iii = 6;
612 layout->addWidget( label, 6, 1 ); 612
613 mNicknameEdit = new KLineEdit( tab2 ); 613 if ( QApplication::desktop()->width() == 640 ) {
614 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 614 QHBox * nbox = new QHBox ( tab2 );
615 SLOT( textChanged( const QString& ) ) ); 615 label = new QLabel( i18n( "Nick name:" )+" ", nbox );
616 label->setBuddy( mNicknameEdit ); 616 layout->addWidget( label, iii, 1 );
617//US layout->addWidget( mNicknameEdit, 4, 2 ); 617 mNicknameEdit = new KLineEdit( nbox );
618 layout->addWidget( mNicknameEdit, 6, 2 ); 618 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
619 619 SLOT( textChanged( const QString& ) ) );
620 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 620 label->setBuddy( mNicknameEdit );
621//US layout->addWidget( label, 5, 1 ); 621
622 layout->addWidget( label, 7, 1 ); 622 label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox );
623 mSpouseEdit = new KLineEdit( tab2 ); 623 layout->addWidget( label, iii, 1 );
624 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 624 mSpouseEdit = new KLineEdit( nbox );
625 SLOT( textChanged( const QString& ) ) ); 625 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
626 label->setBuddy( mSpouseEdit ); 626 SLOT( textChanged( const QString& ) ) );
627//US layout->addWidget( mSpouseEdit, 5, 2 ); 627 label->setBuddy( mSpouseEdit );
628 layout->addWidget( mSpouseEdit, 7, 2 ); 628 layout->addWidget( mSpouseEdit, iii, 2 );
629 629 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
630 label = new QLabel( i18n( "Birthday:" ), tab2 ); 630 ++iii;
631//US layout->addWidget( label, 4, 3 ); 631
632 layout->addWidget( label, 8, 1 ); 632 } else {
633 mBirthdayPicker = new KDateEdit( tab2 ); 633 label = new QLabel( i18n( "Nick name:" ), tab2 );
634 mBirthdayPicker->toggleDateFormat(); 634 layout->addWidget( label, iii, 1 );
635 mBirthdayPicker->setHandleInvalid( true ); 635 mNicknameEdit = new KLineEdit( tab2 );
636 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 636 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
637 SLOT( dateChanged( QDate ) ) ); 637 SLOT( textChanged( const QString& ) ) );
638 638 label->setBuddy( mNicknameEdit );
639 layout->addWidget( mNicknameEdit, iii, 2 );
640 ++iii;
641
642 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
643 layout->addWidget( label, iii, 1 );
644 mSpouseEdit = new KLineEdit( tab2 );
645 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
646 SLOT( textChanged( const QString& ) ) );
647 label->setBuddy( mSpouseEdit );
648 layout->addWidget( mSpouseEdit, iii, 2 );
649 ++iii;
650 }
639 651
640#ifndef KAB_EMBEDDED 652 label = new QLabel( i18n( "Children's names:" ), tab2 );
641 //US invalid dates are handdled by the KDateEdit widget itself 653 layout->addWidget( label, iii, 1 );
642 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ), 654 mChildEdit = new KLineEdit( tab2 );
643 SLOT( invalidDate() ) ); 655 connect( mChildEdit, SIGNAL( textChanged( const QString& ) ),
644 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ), 656 SLOT( textChanged( const QString& ) ) );
645 SLOT( emitModified() ) ); 657 label->setBuddy( mChildEdit );
646#endif //KAB_EMBEDDED 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 );
665 mBirthdayPicker->toggleDateFormat();
666 mBirthdayPicker->setHandleInvalid( true );
667 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
668 SLOT( dateChanged( QDate ) ) );
647 669
648 label->setBuddy( mBirthdayPicker ); 670 label->setBuddy( mBirthdayPicker );
649//US layout->addWidget( mBirthdayPicker, 4, 4 ); 671
650 layout->addWidget( mBirthdayPicker, 8, 2 ); 672 label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox );
651 673 layout->addWidget( label, iii, 1 );
652 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 674 mAnniversaryPicker = new KDateEdit( nbox );
653//US layout->addWidget( label, 5, 3 ); 675 mAnniversaryPicker->setHandleInvalid( true );
654 layout->addWidget( label, 9, 1 ); 676 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
655 mAnniversaryPicker = new KDateEdit( tab2 ); 677 SLOT( dateChanged( QDate ) ) );
656 mAnniversaryPicker->setHandleInvalid( true );
657 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
658 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 678
667 label->setBuddy( mAnniversaryPicker ); 679 label->setBuddy( mAnniversaryPicker );
668//US layout->addWidget( mAnniversaryPicker, 5, 4 ); 680 layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
669 layout->addWidget( mAnniversaryPicker, 9, 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 ) ) );
692
693 label->setBuddy( mBirthdayPicker );
694 layout->addWidget( mBirthdayPicker, iii, 2 );
695 ++iii;
696
697 label = new QLabel( i18n( "Anniversary:" ), tab2 );
698 layout->addWidget( label, iii, 1 );
699 mAnniversaryPicker = new KDateEdit( tab2 );
700 mAnniversaryPicker->setHandleInvalid( true );
701 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
702 SLOT( dateChanged( QDate ) ) );
703
704 label->setBuddy( mAnniversaryPicker );
705 layout->addWidget( mAnniversaryPicker, iii, 2 );
706 ++iii;
670 707
671/*US 708 }
672 bar = new KSeparator( KSeparator::HLine, tab2 ); 709
673 layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); 710 label = new QLabel( i18n( "Gender:" ), tab2 );
674 711 layout->addWidget( label, iii, 1 );
675 ////////////////////////////////////// 712 mGenderBox = new QComboBox ( tab2 );
676 // Notes 713 mGenderBox->insertItem ( i18n( "ALIEN (gender undefined)" ));
677 label = new QLabel( i18n( "Note:" ), tab2 ); 714 mGenderBox->insertItem ( i18n( "female" ));
678 label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); 715 mGenderBox->insertItem ( i18n( "male" ));
679 layout->addWidget( label, 7, 0 ); 716 connect( mGenderBox, SIGNAL( activated ( const QString & ) ),
680#ifndef KAB_EMBEDDED 717 SLOT( textChanged( const QString& ) ) );
681 mNoteEdit = new QTextEdit( tab2 ); 718 label->setBuddy( mGenderBox );
682 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); 719 layout->addWidget( mGenderBox, iii, 2 );
683 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 720 ++iii;
684#else //KAB_EMBEDDED
685 mNoteEdit = new QMultiLineEdit( tab2 );
686//US mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
687//US mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
688qDebug("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,7 +1111,14 @@ void AddresseeEditorWidget::save()
1076 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); 1111 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
1077 mAnniversaryPicker->clear(); 1112 mAnniversaryPicker->clear();
1078 } 1113 }
1079 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" );
1121
1080 // Save the email addresses 1122 // Save the email addresses
1081 QStringList emails = mAddressee.emails(); 1123 QStringList emails = mAddressee.emails();
1082 QStringList::Iterator iter; 1124 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
@@ -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