summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (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
@@ -555,187 +555,214 @@ void AddresseeEditorWidget::setupTab2()
555 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 555 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
556 SLOT( textChanged( const QString& ) ) ); 556 SLOT( textChanged( const QString& ) ) );
557 label->setBuddy( mDepartmentEdit ); 557 label->setBuddy( mDepartmentEdit );
558 layout->addWidget( mDepartmentEdit, 0, 2 ); 558 layout->addWidget( mDepartmentEdit, 0, 2 );
559 559
560 label = new QLabel( i18n( "Office:" ), tab2 ); 560 label = new QLabel( i18n( "Office:" ), tab2 );
561 layout->addWidget( label, 1, 1 ); 561 layout->addWidget( label, 1, 1 );
562 mOfficeEdit = new KLineEdit( tab2 ); 562 mOfficeEdit = new KLineEdit( tab2 );
563 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 563 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
564 SLOT( textChanged( const QString& ) ) ); 564 SLOT( textChanged( const QString& ) ) );
565 label->setBuddy( mOfficeEdit ); 565 label->setBuddy( mOfficeEdit );
566 layout->addWidget( mOfficeEdit, 1, 2 ); 566 layout->addWidget( mOfficeEdit, 1, 2 );
567 567
568 label = new QLabel( i18n( "Profession:" ), tab2 ); 568 label = new QLabel( i18n( "Profession:" ), tab2 );
569 layout->addWidget( label, 2, 1 ); 569 layout->addWidget( label, 2, 1 );
570 mProfessionEdit = new KLineEdit( tab2 ); 570 mProfessionEdit = new KLineEdit( tab2 );
571 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 571 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
572 SLOT( textChanged( const QString& ) ) ); 572 SLOT( textChanged( const QString& ) ) );
573 label->setBuddy( mProfessionEdit ); 573 label->setBuddy( mProfessionEdit );
574 layout->addWidget( mProfessionEdit, 2, 2 ); 574 layout->addWidget( mProfessionEdit, 2, 2 );
575 575
576 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 576 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
577//US layout->addWidget( label, 0, 3 ); 577//US layout->addWidget( label, 0, 3 );
578 layout->addWidget( label, 3, 1 ); 578 layout->addWidget( label, 3, 1 );
579 mManagerEdit = new KLineEdit( tab2 ); 579 mManagerEdit = new KLineEdit( tab2 );
580 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 580 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
581 SLOT( textChanged( const QString& ) ) ); 581 SLOT( textChanged( const QString& ) ) );
582 label->setBuddy( mManagerEdit ); 582 label->setBuddy( mManagerEdit );
583//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 583//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
584 layout->addWidget( mManagerEdit, 3, 2 ); 584 layout->addWidget( mManagerEdit, 3, 2 );
585 585
586 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 586 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
587//US layout->addWidget( label, 1, 3 ); 587//US layout->addWidget( label, 1, 3 );
588 layout->addWidget( label, 4, 1 ); 588 layout->addWidget( label, 4, 1 );
589 mAssistantEdit = new KLineEdit( tab2 ); 589 mAssistantEdit = new KLineEdit( tab2 );
590 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 590 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
591 SLOT( textChanged( const QString& ) ) ); 591 SLOT( textChanged( const QString& ) ) );
592 label->setBuddy( mAssistantEdit ); 592 label->setBuddy( mAssistantEdit );
593//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 593//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
594 layout->addWidget( mAssistantEdit, 4, 2 ); 594 layout->addWidget( mAssistantEdit, 4, 2 );
595 595
596 bar = new KSeparator( KSeparator::HLine, tab2 ); 596 bar = new KSeparator( KSeparator::HLine, tab2 );
597//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 597//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
598 layout->addMultiCellWidget( bar, 5, 5, 0, 2 ); 598 layout->addMultiCellWidget( bar, 5, 5, 0, 2 );
599 599
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
697 mTabWidget->addTab( tab2, i18n( "&Details" ) ); 724 mTabWidget->addTab( tab2, i18n( "&Details" ) );
698} 725}
699 726
700void AddresseeEditorWidget::setupTab2_1() 727void AddresseeEditorWidget::setupTab2_1()
701{ 728{
702 // This is the Details tab 729 // This is the Details tab
703 QWidget *tab2_2 = new QWidget( mTabWidget ); 730 QWidget *tab2_2 = new QWidget( mTabWidget );
704 731
705 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 ); 732 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 );
706 layout->setMargin( KDialogBase::marginHintSmall() ); 733 layout->setMargin( KDialogBase::marginHintSmall() );
707 layout->setSpacing( KDialogBase::spacingHintSmall() ); 734 layout->setSpacing( KDialogBase::spacingHintSmall() );
708 735
709 QLabel *label; 736 QLabel *label;
710 KSeparator* bar; 737 KSeparator* bar;
711 738
712/*US 739/*US
713 /////////////////////// 740 ///////////////////////
714 // Office info 741 // Office info
715 742
716 // Department 743 // Department
717 label = new QLabel( tab2 ); 744 label = new QLabel( tab2 );
718//US loadIcon call is ambiguous. Add one more parameter 745//US loadIcon call is ambiguous. Add one more parameter
719//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 746//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
720 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 747 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
721 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 748 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
722 749
723 label = new QLabel( i18n( "Department:" ), tab2 ); 750 label = new QLabel( i18n( "Department:" ), tab2 );
724 layout->addWidget( label, 0, 1 ); 751 layout->addWidget( label, 0, 1 );
725 mDepartmentEdit = new KLineEdit( tab2 ); 752 mDepartmentEdit = new KLineEdit( tab2 );
726 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 753 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
727 SLOT( textChanged( const QString& ) ) ); 754 SLOT( textChanged( const QString& ) ) );
728 label->setBuddy( mDepartmentEdit ); 755 label->setBuddy( mDepartmentEdit );
729 layout->addWidget( mDepartmentEdit, 0, 2 ); 756 layout->addWidget( mDepartmentEdit, 0, 2 );
730 757
731 label = new QLabel( i18n( "Office:" ), tab2 ); 758 label = new QLabel( i18n( "Office:" ), tab2 );
732 layout->addWidget( label, 1, 1 ); 759 layout->addWidget( label, 1, 1 );
733 mOfficeEdit = new KLineEdit( tab2 ); 760 mOfficeEdit = new KLineEdit( tab2 );
734 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 761 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
735 SLOT( textChanged( const QString& ) ) ); 762 SLOT( textChanged( const QString& ) ) );
736 label->setBuddy( mOfficeEdit ); 763 label->setBuddy( mOfficeEdit );
737 layout->addWidget( mOfficeEdit, 1, 2 ); 764 layout->addWidget( mOfficeEdit, 1, 2 );
738 765
739 label = new QLabel( i18n( "Profession:" ), tab2 ); 766 label = new QLabel( i18n( "Profession:" ), tab2 );
740 layout->addWidget( label, 2, 1 ); 767 layout->addWidget( label, 2, 1 );
741 mProfessionEdit = new KLineEdit( tab2 ); 768 mProfessionEdit = new KLineEdit( tab2 );
@@ -968,160 +995,175 @@ void AddresseeEditorWidget::load()
968 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) ) 995 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) )
969 mFormattedNameType = NameEditDialog::FullName; 996 mFormattedNameType = NameEditDialog::FullName;
970 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) ) 997 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) )
971 mFormattedNameType = NameEditDialog::ReverseName; 998 mFormattedNameType = NameEditDialog::ReverseName;
972 else 999 else
973 mFormattedNameType = NameEditDialog::CustomName; 1000 mFormattedNameType = NameEditDialog::CustomName;
974 } 1001 }
975 1002
976 mFormattedNameLabel->setText( mAddressee.formattedName() ); 1003 mFormattedNameLabel->setText( mAddressee.formattedName() );
977 1004
978 mRoleEdit->setText( mAddressee.role() ); 1005 mRoleEdit->setText( mAddressee.role() );
979 mOrgEdit->setText( mAddressee.organization() ); 1006 mOrgEdit->setText( mAddressee.organization() );
980 1007
981//US mURLEdit->setURL( mAddressee.url().url() ); 1008//US mURLEdit->setURL( mAddressee.url().url() );
982 mURLEdit->setText( mAddressee.url().prettyURL() ); 1009 mURLEdit->setText( mAddressee.url().prettyURL() );
983//US?? mURLEdit->home( false ); 1010//US?? mURLEdit->home( false );
984 1011
985 // mNoteEdit->setText( mAddressee.note() ); 1012 // mNoteEdit->setText( mAddressee.note() );
986 mNoteEdit->setText( mAddressee.note() ); 1013 mNoteEdit->setText( mAddressee.note() );
987 mEmailWidget->setEmails( mAddressee.emails() ); 1014 mEmailWidget->setEmails( mAddressee.emails() );
988 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() ); 1015 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() );
989 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() ); 1016 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() );
990 mBirthdayPicker->setDate( mAddressee.birthday().date() ); 1017 mBirthdayPicker->setDate( mAddressee.birthday().date() );
991 1018
992//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom( 1019//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom(
993//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) ); 1020//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) );
994 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 1021 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
995 "%Y-%m-%d"); // = Qt::ISODate 1022 "%Y-%m-%d"); // = Qt::ISODate
996 mAnniversaryPicker->setDate( dt ); 1023 mAnniversaryPicker->setDate( dt );
997 1024
998 1025
999 mNicknameEdit->setText( mAddressee.nickName() ); 1026 mNicknameEdit->setText( mAddressee.nickName() );
1000 mCategoryEdit->setText( mAddressee.categories().join( "," ) ); 1027 mCategoryEdit->setText( mAddressee.categories().join( "," ) );
1001 1028
1002 mGeoWidget->setGeo( mAddressee.geo() ); 1029 mGeoWidget->setGeo( mAddressee.geo() );
1003 mImageWidget->setPhoto( mAddressee.photo() ); 1030 mImageWidget->setPhoto( mAddressee.photo() );
1004 mImageWidget->setLogo( mAddressee.logo() ); 1031 mImageWidget->setLogo( mAddressee.logo() );
1005 mKeyWidget->setKeys( mAddressee.keys() ); 1032 mKeyWidget->setKeys( mAddressee.keys() );
1006 mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); 1033 mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
1007#ifndef KAB_EMBEDDED 1034#ifndef KAB_EMBEDDED
1008 mSoundWidget->setSound( mAddressee.sound() ); 1035 mSoundWidget->setSound( mAddressee.sound() );
1009#else //KAB_EMBEDDED 1036#else //KAB_EMBEDDED
1010//US qDebug("AddresseeEditorWidget::load has to be changed 2"); 1037//US qDebug("AddresseeEditorWidget::load has to be changed 2");
1011#endif //KAB_EMBEDDED 1038#endif //KAB_EMBEDDED
1012 1039
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
1025 mDirty = false; 1059 mDirty = false;
1026} 1060}
1027 1061
1028void AddresseeEditorWidget::save() 1062void AddresseeEditorWidget::save()
1029{ 1063{
1030 if ( !dirty() ) { 1064 if ( !dirty() ) {
1031 return; 1065 return;
1032 } 1066 }
1033 1067
1034 mAddressee.setRole( mRoleEdit->text() ); 1068 mAddressee.setRole( mRoleEdit->text() );
1035 mAddressee.setOrganization( mOrgEdit->text() ); 1069 mAddressee.setOrganization( mOrgEdit->text() );
1036 mAddressee.setUrl( KURL( mURLEdit->text() ) ); 1070 mAddressee.setUrl( KURL( mURLEdit->text() ) );
1037 mAddressee.setNote( mNoteEdit->text() ); 1071 mAddressee.setNote( mNoteEdit->text() );
1038 if ( mBirthdayPicker->inputIsValid() ) { 1072 if ( mBirthdayPicker->inputIsValid() ) {
1039 QDate da = mBirthdayPicker->date(); 1073 QDate da = mBirthdayPicker->date();
1040 if ( da > QDate::currentDate() ) 1074 if ( da > QDate::currentDate() )
1041 da.setYMD(da.year()-100, da.month(), da.day() ); 1075 da.setYMD(da.year()-100, da.month(), da.day() );
1042 mAddressee.setBirthday( QDateTime( da ) ); 1076 mAddressee.setBirthday( QDateTime( da ) );
1043 qDebug("bday %s ",da.toString().latin1()); 1077 qDebug("bday %s ",da.toString().latin1());
1044 } 1078 }
1045 else { 1079 else {
1046 mAddressee.setBirthday( QDateTime() ); 1080 mAddressee.setBirthday( QDateTime() );
1047 mBirthdayPicker->clear(); 1081 mBirthdayPicker->clear();
1048 } 1082 }
1049 mAddressee.setNickName( mNicknameEdit->text() ); 1083 mAddressee.setNickName( mNicknameEdit->text() );
1050 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); 1084 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
1051 1085
1052 mAddressee.setGeo( mGeoWidget->geo() ); 1086 mAddressee.setGeo( mGeoWidget->geo() );
1053 mAddressee.setPhoto( mImageWidget->photo() ); 1087 mAddressee.setPhoto( mImageWidget->photo() );
1054 mAddressee.setLogo( mImageWidget->logo() ); 1088 mAddressee.setLogo( mImageWidget->logo() );
1055 mAddressee.setKeys( mKeyWidget->keys() ); 1089 mAddressee.setKeys( mKeyWidget->keys() );
1056#ifndef KAB_EMBEDDED 1090#ifndef KAB_EMBEDDED
1057 mAddressee.setSound( mSoundWidget->sound() ); 1091 mAddressee.setSound( mSoundWidget->sound() );
1058#else //KAB_EMBEDDED 1092#else //KAB_EMBEDDED
1059//US qDebug("AddresseeEditorWidget::save sound not supported"); 1093//US qDebug("AddresseeEditorWidget::save sound not supported");
1060#endif //KAB_EMBEDDED 1094#endif //KAB_EMBEDDED
1061 mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); 1095 mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
1062 1096
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() );
1069 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); 1104 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
1070 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); 1105 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
1071 if ( mAnniversaryPicker->inputIsValid() ) { 1106 if ( mAnniversaryPicker->inputIsValid() ) {
1072 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); 1107 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
1073 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 1108 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
1074 } 1109 }
1075 else { 1110 else {
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;
1083 for ( iter = emails.begin(); iter != emails.end(); ++iter ) 1125 for ( iter = emails.begin(); iter != emails.end(); ++iter )
1084 mAddressee.removeEmail( *iter ); 1126 mAddressee.removeEmail( *iter );
1085 1127
1086 emails = mEmailWidget->emails(); 1128 emails = mEmailWidget->emails();
1087 bool first = true; 1129 bool first = true;
1088 for ( iter = emails.begin(); iter != emails.end(); ++iter ) { 1130 for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
1089 mAddressee.insertEmail( *iter, first ); 1131 mAddressee.insertEmail( *iter, first );
1090 first = false; 1132 first = false;
1091 } 1133 }
1092 1134
1093 // Save the phone numbers 1135 // Save the phone numbers
1094 KABC::PhoneNumber::List phoneNumbers; 1136 KABC::PhoneNumber::List phoneNumbers;
1095 KABC::PhoneNumber::List::Iterator phoneIter; 1137 KABC::PhoneNumber::List::Iterator phoneIter;
1096 phoneNumbers = mAddressee.phoneNumbers(); 1138 phoneNumbers = mAddressee.phoneNumbers();
1097 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1139 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1098 ++phoneIter ) 1140 ++phoneIter )
1099 mAddressee.removePhoneNumber( *phoneIter ); 1141 mAddressee.removePhoneNumber( *phoneIter );
1100 1142
1101 phoneNumbers = mPhoneEditWidget->phoneNumbers(); 1143 phoneNumbers = mPhoneEditWidget->phoneNumbers();
1102 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1144 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1103 ++phoneIter ) 1145 ++phoneIter )
1104 mAddressee.insertPhoneNumber( *phoneIter ); 1146 mAddressee.insertPhoneNumber( *phoneIter );
1105 1147
1106 // Save the addresses 1148 // Save the addresses
1107 KABC::Address::List addresses; 1149 KABC::Address::List addresses;
1108 KABC::Address::List::Iterator addressIter; 1150 KABC::Address::List::Iterator addressIter;
1109 addresses = mAddressee.addresses(); 1151 addresses = mAddressee.addresses();
1110 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1152 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1111 ++addressIter ) 1153 ++addressIter )
1112 mAddressee.removeAddress( *addressIter ); 1154 mAddressee.removeAddress( *addressIter );
1113 1155
1114 addresses = mAddressEditWidget->addresses(); 1156 addresses = mAddressEditWidget->addresses();
1115 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1157 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1116 ++addressIter ) 1158 ++addressIter )
1117 mAddressee.insertAddress( *addressIter ); 1159 mAddressee.insertAddress( *addressIter );
1118 mDirty = false; 1160 mDirty = false;
1119} 1161}
1120 1162
1121bool AddresseeEditorWidget::dirty() 1163bool AddresseeEditorWidget::dirty()
1122{ 1164{
1123 1165
1124 if ( ! mDirty ) { 1166 if ( ! mDirty ) {
1125 if ( mBirthdayPicker->inputIsValid() ) { 1167 if ( mBirthdayPicker->inputIsValid() ) {
1126 QDate da = mBirthdayPicker->date(); 1168 QDate da = mBirthdayPicker->date();
1127 if ( !(da == mAddressee.birthday().date())) 1169 if ( !(da == mAddressee.birthday().date()))
diff --git a/kaddressbook/addresseeeditorwidget.h b/kaddressbook/addresseeeditorwidget.h
index b9d9e25..995f30e 100644
--- a/kaddressbook/addresseeeditorwidget.h
+++ b/kaddressbook/addresseeeditorwidget.h
@@ -115,70 +115,72 @@ class AddresseeEditorWidget : public ExtensionWidget
115 Edits which categories are available in the CategorySelectDialog. 115 Edits which categories are available in the CategorySelectDialog.
116 */ 116 */
117 void editCategories(); 117 void editCategories();
118 118
119 private: 119 private:
120 AddresseeConfig * mAConfig; 120 AddresseeConfig * mAConfig;
121 void initGUI(); 121 void initGUI();
122 void setupTab1(); 122 void setupTab1();
123 void setupTab1_1(); 123 void setupTab1_1();
124 void setupTab2(); 124 void setupTab2();
125 void setupTab2_1(); 125 void setupTab2_1();
126 void setupTab3(); 126 void setupTab3();
127 void setupTab3_1(); 127 void setupTab3_1();
128 128
129 KABC::Addressee mAddressee; 129 KABC::Addressee mAddressee;
130 int mFormattedNameType; 130 int mFormattedNameType;
131 bool mDirty; 131 bool mDirty;
132 bool mIsExtension; 132 bool mIsExtension;
133 bool mBlockSignals; 133 bool mBlockSignals;
134 134
135 // GUI 135 // GUI
136 KPIM::CategorySelectDialog *mCategoryDialog; 136 KPIM::CategorySelectDialog *mCategoryDialog;
137 KPIM::CategoryEditDialog *mCategoryEditDialog; 137 KPIM::CategoryEditDialog *mCategoryEditDialog;
138 QTabWidget *mTabWidget; 138 QTabWidget *mTabWidget;
139 139
140 // Tab1 and Tab1_1 140 // Tab1 and Tab1_1
141 KLineEdit *mNameEdit; 141 KLineEdit *mNameEdit;
142 KLineEdit *mRoleEdit; 142 KLineEdit *mRoleEdit;
143 KLineEdit *mOrgEdit; 143 KLineEdit *mOrgEdit;
144 144
145 KSqueezedTextLabel *mFormattedNameLabel; 145 KSqueezedTextLabel *mFormattedNameLabel;
146 AddressEditWidget *mAddressEditWidget; 146 AddressEditWidget *mAddressEditWidget;
147 EmailEditWidget *mEmailWidget; 147 EmailEditWidget *mEmailWidget;
148 PhoneEditWidget *mPhoneEditWidget; 148 PhoneEditWidget *mPhoneEditWidget;
149 KLineEdit *mURLEdit; 149 KLineEdit *mURLEdit;
150 KLineEdit *mIMAddressEdit; 150 KLineEdit *mIMAddressEdit;
151 KLineEdit *mCategoryEdit; 151 KLineEdit *mCategoryEdit;
152 SecrecyWidget *mSecrecyWidget; 152 SecrecyWidget *mSecrecyWidget;
153 KSqueezedTextLabel *mNameLabel; 153 KSqueezedTextLabel *mNameLabel;
154 154
155 // Tab2 and Tab2_2 155 // Tab2 and Tab2_2
156 KLineEdit *mDepartmentEdit; 156 KLineEdit *mDepartmentEdit;
157 KLineEdit *mOfficeEdit; 157 KLineEdit *mOfficeEdit;
158 KLineEdit *mProfessionEdit; 158 KLineEdit *mProfessionEdit;
159 KLineEdit *mManagerEdit; 159 KLineEdit *mManagerEdit;
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
166 QTextEdit *mNoteEdit; 168 QTextEdit *mNoteEdit;
167#else //KAB_EMBEDDED 169#else //KAB_EMBEDDED
168 QMultiLineEdit *mNoteEdit; 170 QMultiLineEdit *mNoteEdit;
169#endif //KAB_EMBEDDED 171#endif //KAB_EMBEDDED
170 172
171 QSpinBox *mTimeZoneSpin; 173 QSpinBox *mTimeZoneSpin;
172 QSpinBox *mGeoLat; 174 QSpinBox *mGeoLat;
173 QSpinBox *mGeoLon; 175 QSpinBox *mGeoLon;
174 176
175 // Tab3 177 // Tab3
176 GeoWidget *mGeoWidget; 178 GeoWidget *mGeoWidget;
177 ImageWidget *mImageWidget; 179 ImageWidget *mImageWidget;
178#ifndef KAB_EMBEDDED 180#ifndef KAB_EMBEDDED
179 SoundWidget *mSoundWidget; 181 SoundWidget *mSoundWidget;
180#endif //KAB_EMBEDDED 182#endif //KAB_EMBEDDED
181 KeyWidget *mKeyWidget; 183 KeyWidget *mKeyWidget;
182}; 184};
183 185
184#endif 186#endif