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
@@ -507,283 +507,310 @@ qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
507 507
508 // Categories 508 // Categories
509 button = new QPushButton( i18n( "Categories" ), categoryBox ); 509 button = new QPushButton( i18n( "Categories" ), categoryBox );
510 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 510 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
511 511
512 mCategoryEdit = new KLineEdit( categoryBox ); 512 mCategoryEdit = new KLineEdit( categoryBox );
513 mCategoryEdit->setReadOnly( true ); 513 mCategoryEdit->setReadOnly( true );
514 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 514 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
515 SLOT( textChanged( const QString& ) ) ); 515 SLOT( textChanged( const QString& ) ) );
516 516
517 mSecrecyWidget = new SecrecyWidget( categoryBox ); 517 mSecrecyWidget = new SecrecyWidget( categoryBox );
518 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 518 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
519 519
520 layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 520 layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
521*/ 521*/
522 // Build the layout and add to the tab widget 522 // Build the layout and add to the tab widget
523 layout->activate(); // required 523 layout->activate(); // required
524 524
525 mTabWidget->addTab( tab1_1, i18n( "&Address" ) ); 525 mTabWidget->addTab( tab1_1, i18n( "&Address" ) );
526} 526}
527 527
528 528
529 529
530void AddresseeEditorWidget::setupTab2() 530void AddresseeEditorWidget::setupTab2()
531{ 531{
532 // This is the Details tab 532 // This is the Details tab
533 QWidget *tab2 = new QWidget( mTabWidget ); 533 QWidget *tab2 = new QWidget( mTabWidget );
534 534
535 QGridLayout *layout = new QGridLayout( tab2, 8, 3 ); 535 QGridLayout *layout = new QGridLayout( tab2, 8, 3 );
536 layout->setMargin( KDialogBase::marginHintSmall() ); 536 layout->setMargin( KDialogBase::marginHintSmall() );
537 layout->setSpacing( KDialogBase::spacingHintSmall() ); 537 layout->setSpacing( KDialogBase::spacingHintSmall() );
538 538
539 QLabel *label; 539 QLabel *label;
540 KSeparator* bar; 540 KSeparator* bar;
541 541
542 /////////////////////// 542 ///////////////////////
543 // Office info 543 // Office info
544 544
545 // Department 545 // Department
546 label = new QLabel( tab2 ); 546 label = new QLabel( tab2 );
547//US loadIcon call is ambiguous. Add one more parameter 547//US loadIcon call is ambiguous. Add one more parameter
548//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 548//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
549 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 549 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
550 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 550 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
551 551
552 label = new QLabel( i18n( "Department:" ), tab2 ); 552 label = new QLabel( i18n( "Department:" ), tab2 );
553 layout->addWidget( label, 0, 1 ); 553 layout->addWidget( label, 0, 1 );
554 mDepartmentEdit = new KLineEdit( tab2 ); 554 mDepartmentEdit = new KLineEdit( tab2 );
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 );
742 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 769 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
743 SLOT( textChanged( const QString& ) ) ); 770 SLOT( textChanged( const QString& ) ) );
744 label->setBuddy( mProfessionEdit ); 771 label->setBuddy( mProfessionEdit );
745 layout->addWidget( mProfessionEdit, 2, 2 ); 772 layout->addWidget( mProfessionEdit, 2, 2 );
746 773
747 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 774 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
748 layout->addWidget( label, 0, 3 ); 775 layout->addWidget( label, 0, 3 );
749 mManagerEdit = new KLineEdit( tab2 ); 776 mManagerEdit = new KLineEdit( tab2 );
750 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 777 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
751 SLOT( textChanged( const QString& ) ) ); 778 SLOT( textChanged( const QString& ) ) );
752 label->setBuddy( mManagerEdit ); 779 label->setBuddy( mManagerEdit );
753 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 780 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
754 781
755 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 782 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
756 layout->addWidget( label, 1, 3 ); 783 layout->addWidget( label, 1, 3 );
757 mAssistantEdit = new KLineEdit( tab2 ); 784 mAssistantEdit = new KLineEdit( tab2 );
758 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 785 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
759 SLOT( textChanged( const QString& ) ) ); 786 SLOT( textChanged( const QString& ) ) );
760 label->setBuddy( mAssistantEdit ); 787 label->setBuddy( mAssistantEdit );
761 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 788 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
762 789
763 bar = new KSeparator( KSeparator::HLine, tab2 ); 790 bar = new KSeparator( KSeparator::HLine, tab2 );
764 layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 791 layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
765 792
766 ///////////////////////////////////////////////// 793 /////////////////////////////////////////////////
767 // Personal info 794 // Personal info
768 795
769 label = new QLabel( tab2 ); 796 label = new QLabel( tab2 );
770//US loadIcon call is ambiguous. Add one more parameter 797//US loadIcon call is ambiguous. Add one more parameter
771//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 798//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
772 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 799 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
773 layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 800 layout->addMultiCellWidget( label, 4, 5, 0, 0 );
774 801
775 label = new QLabel( i18n( "Nick name:" ), tab2 ); 802 label = new QLabel( i18n( "Nick name:" ), tab2 );
776 layout->addWidget( label, 4, 1 ); 803 layout->addWidget( label, 4, 1 );
777 mNicknameEdit = new KLineEdit( tab2 ); 804 mNicknameEdit = new KLineEdit( tab2 );
778 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 805 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
779 SLOT( textChanged( const QString& ) ) ); 806 SLOT( textChanged( const QString& ) ) );
780 label->setBuddy( mNicknameEdit ); 807 label->setBuddy( mNicknameEdit );
781 layout->addWidget( mNicknameEdit, 4, 2 ); 808 layout->addWidget( mNicknameEdit, 4, 2 );
782 809
783 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 810 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
784 layout->addWidget( label, 5, 1 ); 811 layout->addWidget( label, 5, 1 );
785 mSpouseEdit = new KLineEdit( tab2 ); 812 mSpouseEdit = new KLineEdit( tab2 );
786 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 813 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
787 SLOT( textChanged( const QString& ) ) ); 814 SLOT( textChanged( const QString& ) ) );
788 label->setBuddy( mSpouseEdit ); 815 label->setBuddy( mSpouseEdit );
789 layout->addWidget( mSpouseEdit, 5, 2 ); 816 layout->addWidget( mSpouseEdit, 5, 2 );
@@ -920,256 +947,271 @@ void AddresseeEditorWidget::setupTab3_1()
920 // Sound 947 // Sound
921#ifndef KAB_EMBEDDED 948#ifndef KAB_EMBEDDED
922 mSoundWidget = new SoundWidget( tab3 ); 949 mSoundWidget = new SoundWidget( tab3 );
923 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 950 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
924 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 951 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
925 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 952 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
926#else //KAB_EMBEDDED 953#else //KAB_EMBEDDED
927//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 954//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
928#endif //KAB_EMBEDDED 955#endif //KAB_EMBEDDED
929 956
930 ////////////////////////////////////// 957 //////////////////////////////////////
931 // Images 958 // Images
932 mImageWidget = new ImageWidget( tab3 ); 959 mImageWidget = new ImageWidget( tab3 );
933 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 960 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
934 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 961 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
935 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop ); 962 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop );
936/*US 963/*US
937 ////////////////////////////////////// 964 //////////////////////////////////////
938 // Keys 965 // Keys
939 mKeyWidget = new KeyWidget( tab3 ); 966 mKeyWidget = new KeyWidget( tab3 );
940 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 967 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
941 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 968 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
942 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 969 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
943*/ 970*/
944 mTabWidget->addTab( tab3, i18n( "&Images" ) ); 971 mTabWidget->addTab( tab3, i18n( "&Images" ) );
945} 972}
946 973
947 974
948void AddresseeEditorWidget::load() 975void AddresseeEditorWidget::load()
949{ 976{
950 977
951 // Block signals in case anything tries to emit modified 978 // Block signals in case anything tries to emit modified
952 // CS: This doesn't seem to work. 979 // CS: This doesn't seem to work.
953 bool block = signalsBlocked(); 980 bool block = signalsBlocked();
954 blockSignals( true ); 981 blockSignals( true );
955 mBlockSignals = true; // used for internal signal blocking 982 mBlockSignals = true; // used for internal signal blocking
956 983
957 mNameEdit->setText( mAddressee.assembledName() ); 984 mNameEdit->setText( mAddressee.assembledName() );
958 985
959 if ( mAddressee.formattedName().isEmpty() ) { 986 if ( mAddressee.formattedName().isEmpty() ) {
960//US KConfig config( "kaddressbookrc" ); 987//US KConfig config( "kaddressbookrc" );
961 KConfig config( locateLocal("config", "kaddressbookrc") ); 988 KConfig config( locateLocal("config", "kaddressbookrc") );
962 config.setGroup( "General" ); 989 config.setGroup( "General" );
963 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 ); 990 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 );
964 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 991 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
965 } else { 992 } else {
966 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) ) 993 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) )
967 mFormattedNameType = NameEditDialog::SimpleName; 994 mFormattedNameType = NameEditDialog::SimpleName;
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()))
1128 mDirty = true; 1170 mDirty = true;
1129 } 1171 }
1130 else { 1172 else {
1131 mBirthdayPicker->clear(); 1173 mBirthdayPicker->clear();
1132 } 1174 }
1133 if ( mAnniversaryPicker->inputIsValid() ) { 1175 if ( mAnniversaryPicker->inputIsValid() ) {
1134 QDate da = mAnniversaryPicker->date(); 1176 QDate da = mAnniversaryPicker->date();
1135 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 1177 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1136 "%Y-%m-%d")) 1178 "%Y-%m-%d"))
1137 mDirty = true; 1179 mDirty = true;
1138 } 1180 }
1139 else { 1181 else {
1140 mAnniversaryPicker->clear(); 1182 mAnniversaryPicker->clear();
1141 } 1183 }
1142 } 1184 }
1143 return mDirty; 1185 return mDirty;
1144} 1186}
1145 1187
1146void AddresseeEditorWidget::nameTextChanged( const QString &text ) 1188void AddresseeEditorWidget::nameTextChanged( const QString &text )
1147{ 1189{
1148 // use the addressee class to parse the name for us 1190 // use the addressee class to parse the name for us
1149 mAConfig->setUid( mAddressee.uid() ); 1191 mAConfig->setUid( mAddressee.uid() );
1150 if ( mAConfig->automaticNameParsing() ) { 1192 if ( mAConfig->automaticNameParsing() ) {
1151 if ( !mAddressee.formattedName().isEmpty() ) { 1193 if ( !mAddressee.formattedName().isEmpty() ) {
1152 QString fn = mAddressee.formattedName(); 1194 QString fn = mAddressee.formattedName();
1153 mAddressee.setNameFromString( text ); 1195 mAddressee.setNameFromString( text );
1154 mAddressee.setFormattedName( fn ); 1196 mAddressee.setFormattedName( fn );
1155 } else { 1197 } else {
1156 // use extra addressee to avoid a formatted name assignment 1198 // use extra addressee to avoid a formatted name assignment
1157 Addressee addr; 1199 Addressee addr;
1158 addr.setNameFromString( text ); 1200 addr.setNameFromString( text );
1159 mAddressee.setPrefix( addr.prefix() ); 1201 mAddressee.setPrefix( addr.prefix() );
1160 mAddressee.setGivenName( addr.givenName() ); 1202 mAddressee.setGivenName( addr.givenName() );
1161 mAddressee.setAdditionalName( addr.additionalName() ); 1203 mAddressee.setAdditionalName( addr.additionalName() );
1162 mAddressee.setFamilyName( addr.familyName() ); 1204 mAddressee.setFamilyName( addr.familyName() );
1163 mAddressee.setSuffix( addr.suffix() ); 1205 mAddressee.setSuffix( addr.suffix() );
1164 } 1206 }
1165 } 1207 }
1166 1208
1167 nameBoxChanged(); 1209 nameBoxChanged();
1168 1210
1169 emitModified(); 1211 emitModified();
1170} 1212}
1171 1213
1172void AddresseeEditorWidget::nameBoxChanged() 1214void AddresseeEditorWidget::nameBoxChanged()
1173{ 1215{
1174 KABC::Addressee addr; 1216 KABC::Addressee addr;
1175 mAConfig->setUid( mAddressee.uid() ); 1217 mAConfig->setUid( mAddressee.uid() );
diff --git a/kaddressbook/addresseeeditorwidget.h b/kaddressbook/addresseeeditorwidget.h
index b9d9e25..995f30e 100644
--- a/kaddressbook/addresseeeditorwidget.h
+++ b/kaddressbook/addresseeeditorwidget.h
@@ -67,118 +67,120 @@ namespace KPIM
67namespace KABC { class AddressBook; } 67namespace KABC { class AddressBook; }
68 68
69class AddresseeEditorWidget : public ExtensionWidget 69class AddresseeEditorWidget : public ExtensionWidget
70{ 70{
71 Q_OBJECT 71 Q_OBJECT
72 72
73 public: 73 public:
74 AddresseeEditorWidget( KABCore *core, bool isExtension, 74 AddresseeEditorWidget( KABCore *core, bool isExtension,
75 QWidget *parent, const char *name = 0 ); 75 QWidget *parent, const char *name = 0 );
76 ~AddresseeEditorWidget(); 76 ~AddresseeEditorWidget();
77 77
78 void setAddressee( const KABC::Addressee& ); 78 void setAddressee( const KABC::Addressee& );
79 const KABC::Addressee &addressee(); 79 const KABC::Addressee &addressee();
80 80
81 void contactsSelectionChanged(); 81 void contactsSelectionChanged();
82 82
83 void load(); 83 void load();
84 void save(); 84 void save();
85 85
86 bool dirty(); 86 bool dirty();
87 87
88 QString title() const; 88 QString title() const;
89 QString identifier() const; 89 QString identifier() const;
90 90
91 protected slots: 91 protected slots:
92 void textChanged( const QString& ); 92 void textChanged( const QString& );
93 void pageChanged( QWidget *wdg ); 93 void pageChanged( QWidget *wdg );
94 94
95 /** 95 /**
96 Emits the modified signal and sets the dirty flag. Any slot 96 Emits the modified signal and sets the dirty flag. Any slot
97 that modifies data should use this method instead of calling emit 97 that modifies data should use this method instead of calling emit
98 modified() directly. 98 modified() directly.
99 */ 99 */
100 void emitModified(); 100 void emitModified();
101 101
102 void dateChanged( QDate ); 102 void dateChanged( QDate );
103 void invalidDate(); 103 void invalidDate();
104 void nameTextChanged( const QString& ); 104 void nameTextChanged( const QString& );
105 void nameBoxChanged(); 105 void nameBoxChanged();
106 void nameButtonClicked(); 106 void nameButtonClicked();
107 void categoryButtonClicked(); 107 void categoryButtonClicked();
108 108
109 /** 109 /**
110 Called whenever the categories change in the categories dialog. 110 Called whenever the categories change in the categories dialog.
111 */ 111 */
112 void categoriesSelected( const QStringList& ); 112 void categoriesSelected( const QStringList& );
113 113
114 /** 114 /**
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