summaryrefslogtreecommitdiff
authoreilers <eilers>2003-01-13 17:38:53 (UTC)
committer eilers <eilers>2003-01-13 17:38:53 (UTC)
commit90706ff3edbf0c30856bb9786e69a6d3a0e0867a (patch) (unidiff)
tree19839cdc38a737724a9228f421cd291cbe45baa1
parent6bae3504f8eacd604bc6d543d3eb09f996221dcc (diff)
downloadopie-90706ff3edbf0c30856bb9786e69a6d3a0e0867a.zip
opie-90706ff3edbf0c30856bb9786e69a6d3a0e0867a.tar.gz
opie-90706ff3edbf0c30856bb9786e69a6d3a0e0867a.tar.bz2
Removed nonsense which corrupted the business phone data
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 37e3a54..d14ac51 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -554,194 +554,195 @@ void ContactEditor::init() {
554 listValue.append( e ); 554 listValue.append( e );
555 gl->addWidget( e, i, 1); 555 gl->addWidget( e, i, 1);
556 } 556 }
557 // Fill labels with names.. 557 // Fill labels with names..
558 //loadFields(); 558 //loadFields();
559 559
560 560
561 tabMain->insertTab( tabViewport, tr( "Details" ) ); 561 tabMain->insertTab( tabViewport, tr( "Details" ) );
562 562
563 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 563 dlgNote = new QDialog( this, "Note Dialog", TRUE );
564 dlgNote->setCaption( tr("Enter Note") ); 564 dlgNote->setCaption( tr("Enter Note") );
565 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 565 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
566 txtNote = new QMultiLineEdit( dlgNote ); 566 txtNote = new QMultiLineEdit( dlgNote );
567 vbNote->addWidget( txtNote ); 567 vbNote->addWidget( txtNote );
568 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 568 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
569 569
570 dlgName = new QDialog( this, "Name Dialog", TRUE ); 570 dlgName = new QDialog( this, "Name Dialog", TRUE );
571 dlgName->setCaption( tr("Edit Name") ); 571 dlgName->setCaption( tr("Edit Name") );
572 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 572 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
573 573
574 l = new QLabel( tr("First Name"), dlgName ); 574 l = new QLabel( tr("First Name"), dlgName );
575 gl->addWidget( l, 0, 0 ); 575 gl->addWidget( l, 0, 0 );
576 txtFirstName = new QLineEdit( dlgName ); 576 txtFirstName = new QLineEdit( dlgName );
577 gl->addWidget( txtFirstName, 0, 1 ); 577 gl->addWidget( txtFirstName, 0, 1 );
578 578
579 l = new QLabel( tr("Middle Name"), dlgName ); 579 l = new QLabel( tr("Middle Name"), dlgName );
580 gl->addWidget( l, 1, 0 ); 580 gl->addWidget( l, 1, 0 );
581 txtMiddleName = new QLineEdit( dlgName ); 581 txtMiddleName = new QLineEdit( dlgName );
582 gl->addWidget( txtMiddleName, 1, 1 ); 582 gl->addWidget( txtMiddleName, 1, 1 );
583 583
584 l = new QLabel( tr("Last Name"), dlgName ); 584 l = new QLabel( tr("Last Name"), dlgName );
585 gl->addWidget( l, 2, 0 ); 585 gl->addWidget( l, 2, 0 );
586 txtLastName = new QLineEdit( dlgName ); 586 txtLastName = new QLineEdit( dlgName );
587 gl->addWidget( txtLastName, 2, 1 ); 587 gl->addWidget( txtLastName, 2, 1 );
588 588
589 l = new QLabel( tr("Suffix"), dlgName ); 589 l = new QLabel( tr("Suffix"), dlgName );
590 gl->addWidget( l, 3, 0 ); 590 gl->addWidget( l, 3, 0 );
591 txtSuffix = new QLineEdit( dlgName ); 591 txtSuffix = new QLineEdit( dlgName );
592 gl->addWidget( txtSuffix, 3, 1 ); 592 gl->addWidget( txtSuffix, 3, 1 );
593 space = new QSpacerItem(1,1, 593 space = new QSpacerItem(1,1,
594 QSizePolicy::Maximum, 594 QSizePolicy::Maximum,
595 QSizePolicy::MinimumExpanding ); 595 QSizePolicy::MinimumExpanding );
596 gl->addItem( space, 4, 0 ); 596 gl->addItem( space, 4, 0 );
597 597
598 cmbChooserField1->insertStringList( trlChooserNames ); 598 cmbChooserField1->insertStringList( trlChooserNames );
599 cmbChooserField2->insertStringList( trlChooserNames ); 599 cmbChooserField2->insertStringList( trlChooserNames );
600 cmbChooserField3->insertStringList( trlChooserNames ); 600 cmbChooserField3->insertStringList( trlChooserNames );
601 cmbChooserField4->insertStringList( trlChooserNames ); 601 cmbChooserField4->insertStringList( trlChooserNames );
602 602
603 cmbChooserField1->setCurrentItem( 0 ); 603 cmbChooserField1->setCurrentItem( 0 );
604 cmbChooserField2->setCurrentItem( 1 ); 604 cmbChooserField2->setCurrentItem( 1 );
605 cmbChooserField3->setCurrentItem( 2 ); 605 cmbChooserField3->setCurrentItem( 2 );
606 606
607 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 607 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
608 608
609 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 609 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
610 610
611 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 611 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
612 this, SLOT(slotChooser1Change(const QString &)) ); 612 this, SLOT(slotChooser1Change(const QString &)) );
613 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 613 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
614 this, SLOT(slotChooser2Change(const QString &)) ); 614 this, SLOT(slotChooser2Change(const QString &)) );
615 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 615 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
616 this, SLOT(slotChooser3Change(const QString &)) ); 616 this, SLOT(slotChooser3Change(const QString &)) );
617 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), 617 connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
618 this, SLOT(slotChooser4Change(const QString &)) ); 618 this, SLOT(slotChooser4Change(const QString &)) );
619 connect( txtAddress, SIGNAL(textChanged(const QString &)), 619 connect( txtAddress, SIGNAL(textChanged(const QString &)),
620 this, SLOT(slotAddressChange(const QString &)) ); 620 this, SLOT(slotAddressChange(const QString &)) );
621 connect( txtCity, SIGNAL(textChanged(const QString &)), 621 connect( txtCity, SIGNAL(textChanged(const QString &)),
622 this, SLOT(slotCityChange(const QString &)) ); 622 this, SLOT(slotCityChange(const QString &)) );
623 connect( txtState, SIGNAL(textChanged(const QString &)), 623 connect( txtState, SIGNAL(textChanged(const QString &)),
624 this, SLOT(slotStateChange(const QString &)) ); 624 this, SLOT(slotStateChange(const QString &)) );
625 connect( txtZip, SIGNAL(textChanged(const QString &)), 625 connect( txtZip, SIGNAL(textChanged(const QString &)),
626 this, SLOT(slotZipChange(const QString &)) ); 626 this, SLOT(slotZipChange(const QString &)) );
627 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 627 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
628 this, SLOT(slotCountryChange(const QString &)) ); 628 this, SLOT(slotCountryChange(const QString &)) );
629 connect( cmbCountry, SIGNAL(activated(const QString &)), 629 connect( cmbCountry, SIGNAL(activated(const QString &)),
630 this, SLOT(slotCountryChange(const QString &)) ); 630 this, SLOT(slotCountryChange(const QString &)) );
631 connect( cmbChooserField1, SIGNAL(activated(int)), 631 connect( cmbChooserField1, SIGNAL(activated(int)),
632 this, SLOT(slotCmbChooser1Change(int)) ); 632 this, SLOT(slotCmbChooser1Change(int)) );
633 connect( cmbChooserField2, SIGNAL(activated(int)), 633 connect( cmbChooserField2, SIGNAL(activated(int)),
634 this, SLOT(slotCmbChooser2Change(int)) ); 634 this, SLOT(slotCmbChooser2Change(int)) );
635 connect( cmbChooserField3, SIGNAL(activated(int)), 635 connect( cmbChooserField3, SIGNAL(activated(int)),
636 this, SLOT(slotCmbChooser3Change(int)) ); 636 this, SLOT(slotCmbChooser3Change(int)) );
637 connect( cmbChooserField4, SIGNAL(activated(int)), 637 connect( cmbChooserField4, SIGNAL(activated(int)),
638 this, SLOT(slotCmbChooser4Change(int)) ); 638 this, SLOT(slotCmbChooser4Change(int)) );
639 connect( cmbAddress, SIGNAL(activated(int)), 639 connect( cmbAddress, SIGNAL(activated(int)),
640 this, SLOT(slotAddressTypeChange(int)) ); 640 this, SLOT(slotAddressTypeChange(int)) );
641 641
642 new QPEDialogListener(this); 642 new QPEDialogListener(this);
643 643
644 setPersonalView ( m_personalView ); 644 setPersonalView ( m_personalView );
645} 645}
646 646
647void ContactEditor::defaultEmailChanged(int i){ 647void ContactEditor::defaultEmailChanged(int i){
648 qDebug("defaultEmailChanged"); 648 qDebug("defaultEmailChanged");
649 649
650 int index = cmbChooserField1->currentItem(); 650 // was sollte das ? (se)
651 slChooserValues[index] = cmbDefaultEmail->text(i); 651 // int index = cmbChooserField1->currentItem();
652 // slChooserValues[index] = cmbDefaultEmail->text(i);
652 653
653 defaultEmail = cmbDefaultEmail->text(i); 654 defaultEmail = cmbDefaultEmail->text(i);
654 qDebug ("Changed to: %s", defaultEmail.latin1()); 655 qDebug ("Changed to: %s", defaultEmail.latin1());
655 656
656} 657}
657 658
658void ContactEditor::populateDefaultEmailCmb(){ 659void ContactEditor::populateDefaultEmailCmb(){
659 660
660 // if the default-email combo was not selected and therfore not created 661 // if the default-email combo was not selected and therfore not created
661 // we get a lot of trouble.. Therfore create an invisible one.. 662 // we get a lot of trouble.. Therfore create an invisible one..
662 if ( !cmbDefaultEmail ){ 663 if ( !cmbDefaultEmail ){
663 cmbDefaultEmail = new QComboBox(this); 664 cmbDefaultEmail = new QComboBox(this);
664 cmbDefaultEmail -> hide(); 665 cmbDefaultEmail -> hide();
665 } 666 }
666 cmbDefaultEmail->clear(); 667 cmbDefaultEmail->clear();
667 cmbDefaultEmail->insertStringList( emails ); 668 cmbDefaultEmail->insertStringList( emails );
668 // cmbDefaultEmail->show(); 669 // cmbDefaultEmail->show();
669 670
670 // Select default email in combo.. 671 // Select default email in combo..
671 bool found = false; 672 bool found = false;
672 for ( int i = 0; i < cmbDefaultEmail->count(); i++){ 673 for ( int i = 0; i < cmbDefaultEmail->count(); i++){
673 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", 674 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",
674 cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); 675 cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1());
675 676
676 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ 677 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){
677 cmbDefaultEmail->setCurrentItem( i ); 678 cmbDefaultEmail->setCurrentItem( i );
678 qDebug("set"); 679 qDebug("set");
679 found = true; 680 found = true;
680 } 681 }
681 } 682 }
682 683
683 // If the current default email is not found in the list, we choose the 684 // If the current default email is not found in the list, we choose the
684 // first one.. 685 // first one..
685 if ( !found ) 686 if ( !found )
686 defaultEmail = cmbDefaultEmail->text(0); 687 defaultEmail = cmbDefaultEmail->text(0);
687} 688}
688 689
689// Called when any combobox was changed. 690// Called when any combobox was changed.
690// "true" returned if the change was chandled by this function, else it should 691// "true" returned if the change was chandled by this function, else it should
691// be handled by something else.. 692// be handled by something else..
692bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) { 693bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) {
693 QString type = slChooserNames[index]; 694 QString type = slChooserNames[index];
694 qWarning("ContactEditor::cmbChooserChange -> Type: %s", type.latin1() ); 695 qWarning("ContactEditor::cmbChooserChange -> Type: %s", type.latin1() );
695 696
696 // Create and connect combobox for selecting the default email 697 // Create and connect combobox for selecting the default email
697 if ( type == "Default Email"){ 698 if ( type == "Default Email"){
698 qWarning("Choosing default-email "); 699 qWarning("Choosing default-email ");
699 700
700 // More than one defaul-email chooser is not allowed ! 701 // More than one defaul-email chooser is not allowed !
701 if ( ( defaultEmailChooserPosition != -1 ) && 702 if ( ( defaultEmailChooserPosition != -1 ) &&
702 defaultEmailChooserPosition != widgetPos ){ 703 defaultEmailChooserPosition != widgetPos ){
703 chooserError( widgetPos ); 704 chooserError( widgetPos );
704 return true; 705 return true;
705 } 706 }
706 707
707 if ( cmbDefaultEmail ){ 708 if ( cmbDefaultEmail ){
708 delete cmbDefaultEmail; 709 delete cmbDefaultEmail;
709 cmbDefaultEmail = 0l; 710 cmbDefaultEmail = 0l;
710 } 711 }
711 cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); 712 cmbDefaultEmail = new QComboBox(inputWid->parentWidget());
712 cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); 713 cmbDefaultEmail->setGeometry(inputWid->frameGeometry());
713 714
714 connect( cmbDefaultEmail,SIGNAL( activated(int) ), 715 connect( cmbDefaultEmail,SIGNAL( activated(int) ),
715 SLOT( defaultEmailChanged(int) ) ); 716 SLOT( defaultEmailChanged(int) ) );
716 717
717 cmbDefaultEmail->clear(); 718 cmbDefaultEmail->clear();
718 cmbDefaultEmail->insertStringList( emails ); 719 cmbDefaultEmail->insertStringList( emails );
719 cmbDefaultEmail->show(); 720 cmbDefaultEmail->show();
720 721
721 defaultEmailChooserPosition = widgetPos; 722 defaultEmailChooserPosition = widgetPos;
722 723
723 // Set current default email 724 // Set current default email
724 populateDefaultEmailCmb(); 725 populateDefaultEmailCmb();
725 726
726 727
727 } else { 728 } else {
728 // Something else was selected: Hide combo.. 729 // Something else was selected: Hide combo..
729 qWarning(" Hiding default-email combo" ); 730 qWarning(" Hiding default-email combo" );
730 if ( defaultEmailChooserPosition == widgetPos ){ 731 if ( defaultEmailChooserPosition == widgetPos ){
731 defaultEmailChooserPosition = -1; 732 defaultEmailChooserPosition = -1;
732 if ( cmbDefaultEmail ) 733 if ( cmbDefaultEmail )
733 cmbDefaultEmail->hide(); 734 cmbDefaultEmail->hide();
734 735
735 } 736 }
736 737
737 // Caller should initialize the responsible textfield, therefore 738 // Caller should initialize the responsible textfield, therefore
738 // "false" is returned 739 // "false" is returned
739 return false; 740 return false;
740 } 741 }
741 742
742 // Everything is worked off .. 743 // Everything is worked off ..
743 return true; 744 return true;
744 745
745} 746}
746 747
747// Currently accessed when we select default-email more than once ! 748// Currently accessed when we select default-email more than once !
@@ -806,193 +807,192 @@ void ContactEditor::chooserChange( const QString &textChanged, int index,
806 807
807 populateDefaultEmailCmb(); 808 populateDefaultEmailCmb();
808 } 809 }
809 810
810 slChooserValues[index] = textChanged; 811 slChooserValues[index] = textChanged;
811 812
812} 813}
813 814
814void ContactEditor::slotChooser1Change( const QString &textChanged ) { 815void ContactEditor::slotChooser1Change( const QString &textChanged ) {
815 qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); 816 qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1());
816 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); 817 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1);
817} 818}
818 819
819void ContactEditor::slotChooser2Change( const QString &textChanged ) { 820void ContactEditor::slotChooser2Change( const QString &textChanged ) {
820 qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); 821 qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1());
821 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); 822 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2);
822 823
823} 824}
824 825
825void ContactEditor::slotChooser3Change( const QString &textChanged ) { 826void ContactEditor::slotChooser3Change( const QString &textChanged ) {
826 qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); 827 qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1());
827 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); 828 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3);
828} 829}
829 830
830void ContactEditor::slotChooser4Change( const QString &textChanged ) { 831void ContactEditor::slotChooser4Change( const QString &textChanged ) {
831 qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); 832 qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1());
832 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); 833 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4);
833} 834}
834 835
835void ContactEditor::slotAddressChange( const QString &textChanged ) { 836void ContactEditor::slotAddressChange( const QString &textChanged ) {
836 837
837 if ( cmbAddress->currentItem() == 0 ) { 838 if ( cmbAddress->currentItem() == 0 ) {
838 slBusinessAddress[0] = textChanged; 839 slBusinessAddress[0] = textChanged;
839 } else { 840 } else {
840 slHomeAddress[0] = textChanged; 841 slHomeAddress[0] = textChanged;
841 } 842 }
842} 843}
843 844
844void ContactEditor::slotAddress2Change( const QString &textChanged ) { 845void ContactEditor::slotAddress2Change( const QString &textChanged ) {
845 846
846 if ( cmbAddress->currentItem() == 0 ) { 847 if ( cmbAddress->currentItem() == 0 ) {
847 slBusinessAddress[1] = textChanged; 848 slBusinessAddress[1] = textChanged;
848 } else { 849 } else {
849 slHomeAddress[1] = textChanged; 850 slHomeAddress[1] = textChanged;
850 } 851 }
851} 852}
852 853
853void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 854void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
854 855
855 if ( cmbAddress->currentItem() == 0 ) { 856 if ( cmbAddress->currentItem() == 0 ) {
856 slBusinessAddress[2] = textChanged; 857 slBusinessAddress[2] = textChanged;
857 } else { 858 } else {
858 slHomeAddress[2] = textChanged; 859 slHomeAddress[2] = textChanged;
859 } 860 }
860} 861}
861 862
862void ContactEditor::slotCityChange( const QString &textChanged ) { 863void ContactEditor::slotCityChange( const QString &textChanged ) {
863 864
864 if ( cmbAddress->currentItem() == 0 ) { 865 if ( cmbAddress->currentItem() == 0 ) {
865 slBusinessAddress[3] = textChanged; 866 slBusinessAddress[3] = textChanged;
866 } else { 867 } else {
867 slHomeAddress[3] = textChanged; 868 slHomeAddress[3] = textChanged;
868 } 869 }
869} 870}
870 871
871void ContactEditor::slotStateChange( const QString &textChanged ) { 872void ContactEditor::slotStateChange( const QString &textChanged ) {
872 873
873 874
874 if ( cmbAddress->currentItem() == 0 ) { 875 if ( cmbAddress->currentItem() == 0 ) {
875 slBusinessAddress[4] = textChanged; 876 slBusinessAddress[4] = textChanged;
876 } else { 877 } else {
877 slHomeAddress[4] = textChanged; 878 slHomeAddress[4] = textChanged;
878 } 879 }
879} 880}
880 881
881void ContactEditor::slotZipChange( const QString &textChanged ) { 882void ContactEditor::slotZipChange( const QString &textChanged ) {
882 883
883 if ( cmbAddress->currentItem() == 0 ) { 884 if ( cmbAddress->currentItem() == 0 ) {
884 slBusinessAddress[5] = textChanged; 885 slBusinessAddress[5] = textChanged;
885 } else { 886 } else {
886 slHomeAddress[5] = textChanged; 887 slHomeAddress[5] = textChanged;
887 } 888 }
888} 889}
889 890
890void ContactEditor::slotCountryChange( const QString &textChanged ) { 891void ContactEditor::slotCountryChange( const QString &textChanged ) {
891 892
892 if ( cmbAddress->currentItem() == 0 ) { 893 if ( cmbAddress->currentItem() == 0 ) {
893 slBusinessAddress[6] = textChanged; 894 slBusinessAddress[6] = textChanged;
894 } else { 895 } else {
895 slHomeAddress[6] = textChanged; 896 slHomeAddress[6] = textChanged;
896 } 897 }
897} 898}
898 899
899 900
900void ContactEditor::slotCmbChooser1Change( int index ) { 901void ContactEditor::slotCmbChooser1Change( int index ) {
901 qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); 902 qWarning("ContactEditor::slotCmbChooser1Change( %d )", index);
902
903 if ( !cmbChooserChange( cmbChooserField1->currentItem(), txtChooserField1, 1) ){ 903 if ( !cmbChooserChange( cmbChooserField1->currentItem(), txtChooserField1, 1) ){
904 904
905 txtChooserField1->setText( slChooserValues[index] ); 905 txtChooserField1->setText( slChooserValues[index] );
906 txtChooserField1->setFocus(); 906 txtChooserField1->setFocus();
907 907
908 } 908 }
909 909
910} 910}
911 911
912void ContactEditor::slotCmbChooser2Change( int index ) { 912void ContactEditor::slotCmbChooser2Change( int index ) {
913 qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); 913 qWarning("ContactEditor::slotCmbChooser2Change( %d )", index);
914 914
915 if ( !cmbChooserChange( cmbChooserField2->currentItem(), txtChooserField2, 2) ){ 915 if ( !cmbChooserChange( cmbChooserField2->currentItem(), txtChooserField2, 2) ){
916 916
917 txtChooserField2->setText( slChooserValues[index] ); 917 txtChooserField2->setText( slChooserValues[index] );
918 txtChooserField2->setFocus(); 918 txtChooserField2->setFocus();
919 919
920 } 920 }
921} 921}
922 922
923void ContactEditor::slotCmbChooser3Change( int index ) { 923void ContactEditor::slotCmbChooser3Change( int index ) {
924 qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); 924 qWarning("ContactEditor::slotCmbChooser3Change( %d )", index);
925 925
926 if ( !cmbChooserChange( cmbChooserField3->currentItem(), txtChooserField3, 3) ){ 926 if ( !cmbChooserChange( cmbChooserField3->currentItem(), txtChooserField3, 3) ){
927 927
928 txtChooserField3->setText( slChooserValues[index] ); 928 txtChooserField3->setText( slChooserValues[index] );
929 txtChooserField3->setFocus(); 929 txtChooserField3->setFocus();
930 930
931 } 931 }
932} 932}
933 933
934void ContactEditor::slotCmbChooser4Change( int index ) { 934void ContactEditor::slotCmbChooser4Change( int index ) {
935 qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); 935 qWarning("ContactEditor::slotCmbChooser4Change( %d )", index);
936 936
937 if ( !cmbChooserChange( cmbChooserField4->currentItem(), txtChooserField4, 4) ){ 937 if ( !cmbChooserChange( cmbChooserField4->currentItem(), txtChooserField4, 4) ){
938 938
939 txtChooserField4->setText( slChooserValues[index] ); 939 txtChooserField4->setText( slChooserValues[index] );
940 txtChooserField4->setFocus(); 940 txtChooserField4->setFocus();
941 941
942 } 942 }
943} 943}
944 944
945void ContactEditor::slotAddressTypeChange( int index ) { 945void ContactEditor::slotAddressTypeChange( int index ) {
946 946
947 if ( index == 0 ) { 947 if ( index == 0 ) {
948 948
949 txtAddress->setText( slBusinessAddress[0] ); 949 txtAddress->setText( slBusinessAddress[0] );
950 //txtAddress2->setText( (*slBusinessAddress)[1] ); 950 //txtAddress2->setText( (*slBusinessAddress)[1] );
951 //txtPOBox->setText( (*slBusinessAddress)[2] ); 951 //txtPOBox->setText( (*slBusinessAddress)[2] );
952 txtCity->setText( slBusinessAddress[3] ); 952 txtCity->setText( slBusinessAddress[3] );
953 txtState->setText( slBusinessAddress[4] ); 953 txtState->setText( slBusinessAddress[4] );
954 txtZip->setText( slBusinessAddress[5] ); 954 txtZip->setText( slBusinessAddress[5] );
955 QLineEdit *txtTmp = cmbCountry->lineEdit(); 955 QLineEdit *txtTmp = cmbCountry->lineEdit();
956 txtTmp->setText( slBusinessAddress[6] ); 956 txtTmp->setText( slBusinessAddress[6] );
957 957
958 } else { 958 } else {
959 959
960 txtAddress->setText( slHomeAddress[0] ); 960 txtAddress->setText( slHomeAddress[0] );
961 //txtAddress2->setText( (*slHomeAddress)[1] ); 961 //txtAddress2->setText( (*slHomeAddress)[1] );
962 //txtPOBox->setText( (*slHomeAddress)[2] ); 962 //txtPOBox->setText( (*slHomeAddress)[2] );
963 txtCity->setText( slHomeAddress[3] ); 963 txtCity->setText( slHomeAddress[3] );
964 txtState->setText( slHomeAddress[4] ); 964 txtState->setText( slHomeAddress[4] );
965 txtZip->setText( slHomeAddress[5] ); 965 txtZip->setText( slHomeAddress[5] );
966 QLineEdit *txtTmp = cmbCountry->lineEdit(); 966 QLineEdit *txtTmp = cmbCountry->lineEdit();
967 txtTmp->setText( slHomeAddress[6] ); 967 txtTmp->setText( slHomeAddress[6] );
968 968
969 } 969 }
970 970
971} 971}
972 972
973void ContactEditor::slotFullNameChange( const QString &textChanged ) { 973void ContactEditor::slotFullNameChange( const QString &textChanged ) {
974 974
975 int index = cmbFileAs->currentItem(); 975 int index = cmbFileAs->currentItem();
976 976
977 cmbFileAs->clear(); 977 cmbFileAs->clear();
978 978
979 cmbFileAs->insertItem( parseName( textChanged, 0 ) ); 979 cmbFileAs->insertItem( parseName( textChanged, 0 ) );
980 cmbFileAs->insertItem( parseName( textChanged, 1 ) ); 980 cmbFileAs->insertItem( parseName( textChanged, 1 ) );
981 cmbFileAs->insertItem( parseName( textChanged, 2 ) ); 981 cmbFileAs->insertItem( parseName( textChanged, 2 ) );
982 cmbFileAs->insertItem( parseName( textChanged, 3 ) ); 982 cmbFileAs->insertItem( parseName( textChanged, 3 ) );
983 983
984 cmbFileAs->setCurrentItem( index ); 984 cmbFileAs->setCurrentItem( index );
985 985
986 useFullName = true; 986 useFullName = true;
987 987
988} 988}
989 989
990void ContactEditor::accept() { 990void ContactEditor::accept() {
991 991
992 if ( isEmpty() ) { 992 if ( isEmpty() ) {
993 cleanupFields(); 993 cleanupFields();
994 reject(); 994 reject();
995 } else { 995 } else {
996 saveEntry(); 996 saveEntry();
997 cleanupFields(); 997 cleanupFields();
998 QDialog::accept(); 998 QDialog::accept();
@@ -1390,192 +1390,193 @@ void ContactEditor::setEntry( const OContact &entry ) {
1390 if ( *it == "Company Phone" ) 1390 if ( *it == "Company Phone" )
1391 *itV = ent.companyPhone(); 1391 *itV = ent.companyPhone();
1392*/ 1392*/
1393 if ( *it == "Default Email" ) 1393 if ( *it == "Default Email" )
1394 *itV = ent.defaultEmail(); 1394 *itV = ent.defaultEmail();
1395 1395
1396 if ( *it == "Emails" ) 1396 if ( *it == "Emails" )
1397 *itV = ent.emailList().join(", "); // :SX 1397 *itV = ent.emailList().join(", "); // :SX
1398 1398
1399 if ( *it == "Home Phone" ) 1399 if ( *it == "Home Phone" )
1400 *itV = ent.homePhone(); 1400 *itV = ent.homePhone();
1401/* 1401/*
1402 if ( *it == "Home 2 Phone" ) 1402 if ( *it == "Home 2 Phone" )
1403 *itV = ent.home2Phone(); 1403 *itV = ent.home2Phone();
1404*/ 1404*/
1405 if ( *it == "Home Fax" ) 1405 if ( *it == "Home Fax" )
1406 *itV = ent.homeFax(); 1406 *itV = ent.homeFax();
1407 1407
1408 if ( *it == "Home Mobile" ) 1408 if ( *it == "Home Mobile" )
1409 *itV = ent.homeMobile(); 1409 *itV = ent.homeMobile();
1410/* 1410/*
1411 if ( *it == "Car Phone" ) 1411 if ( *it == "Car Phone" )
1412 *itV = ent.carPhone(); 1412 *itV = ent.carPhone();
1413 1413
1414 if ( *it == "ISDN Phone" ) 1414 if ( *it == "ISDN Phone" )
1415 *itV = ent.ISDNPhone(); 1415 *itV = ent.ISDNPhone();
1416 1416
1417 if ( *it == "Other Phone" ) 1417 if ( *it == "Other Phone" )
1418 *itV = ent.otherPhone(); 1418 *itV = ent.otherPhone();
1419*/ 1419*/
1420 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) 1420 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1421 *itV = ent.businessPager(); 1421 *itV = ent.businessPager();
1422/* 1422/*
1423 if ( *it == "Home Pager") 1423 if ( *it == "Home Pager")
1424 *itV = ent.homePager(); 1424 *itV = ent.homePager();
1425 1425
1426 if ( *it == "AIM IM" ) 1426 if ( *it == "AIM IM" )
1427 *itV = ent.AIMIM(); 1427 *itV = ent.AIMIM();
1428 1428
1429 if ( *it == "ICQ IM" ) 1429 if ( *it == "ICQ IM" )
1430 *itV = ent.ICQIM(); 1430 *itV = ent.ICQIM();
1431 1431
1432 if ( *it == "Jabber IM" ) 1432 if ( *it == "Jabber IM" )
1433 *itV = ent.jabberIM(); 1433 *itV = ent.jabberIM();
1434 1434
1435 if ( *it == "MSN IM" ) 1435 if ( *it == "MSN IM" )
1436 *itV = ent.MSNIM(); 1436 *itV = ent.MSNIM();
1437 1437
1438 if ( *it == "Yahoo IM" ) 1438 if ( *it == "Yahoo IM" )
1439 *itV = ent.yahooIM(); 1439 *itV = ent.yahooIM();
1440*/ 1440*/
1441 if ( *it == "Home Web Page" ) 1441 if ( *it == "Home Web Page" )
1442 *itV = ent.homeWebpage(); 1442 *itV = ent.homeWebpage();
1443 1443
1444 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) 1444 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1445 *itV = ent.businessWebpage(); 1445 *itV = ent.businessWebpage();
1446 1446
1447 1447
1448 } 1448 }
1449 1449
1450 1450
1451 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1451 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1452 1452
1453 QString gender = ent.gender(); 1453 QString gender = ent.gender();
1454 cmbGender->setCurrentItem( gender.toInt() ); 1454 cmbGender->setCurrentItem( gender.toInt() );
1455 1455
1456 txtNote->setText( ent.notes() ); 1456 txtNote->setText( ent.notes() );
1457 1457
1458 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1458 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1459 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1459 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1460 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1460 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1461 1461
1462 slotAddressTypeChange( cmbAddress->currentItem() ); 1462 slotAddressTypeChange( cmbAddress->currentItem() );
1463 1463
1464 // loadFields(); :SX 1464 // loadFields(); :SX
1465 updateDatePicker(); 1465 updateDatePicker();
1466} 1466}
1467void ContactEditor::updateDatePicker() 1467void ContactEditor::updateDatePicker()
1468{ 1468{
1469 // Set DatePicker 1469 // Set DatePicker
1470 if ( !ent.birthday().isNull() ){ 1470 if ( !ent.birthday().isNull() ){
1471 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); 1471 birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) );
1472 birthdayPicker->setDate( ent.birthday() ); 1472 birthdayPicker->setDate( ent.birthday() );
1473 } else 1473 } else
1474 birthdayButton->setText( tr ("Unknown") ); 1474 birthdayButton->setText( tr ("Unknown") );
1475 1475
1476 if ( !ent.anniversary().isNull() ){ 1476 if ( !ent.anniversary().isNull() ){
1477 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); 1477 anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) );
1478 anniversaryPicker->setDate( ent.anniversary() ); 1478 anniversaryPicker->setDate( ent.anniversary() );
1479 } else 1479 } else
1480 anniversaryButton->setText( tr ("Unknown") ); 1480 anniversaryButton->setText( tr ("Unknown") );
1481 1481
1482} 1482}
1483 1483
1484void ContactEditor::saveEntry() { 1484void ContactEditor::saveEntry() {
1485 1485
1486
1486 if ( useFullName ) { 1487 if ( useFullName ) {
1487 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1488 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1488 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1489 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1489 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1490 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1490 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1491 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1491 1492
1492 useFullName = false; 1493 useFullName = false;
1493 } 1494 }
1494 1495
1495 ent.setFirstName( txtFirstName->text() ); 1496 ent.setFirstName( txtFirstName->text() );
1496 ent.setLastName( txtLastName->text() ); 1497 ent.setLastName( txtLastName->text() );
1497 ent.setMiddleName( txtMiddleName->text() ); 1498 ent.setMiddleName( txtMiddleName->text() );
1498 ent.setSuffix( txtSuffix->text() ); 1499 ent.setSuffix( txtSuffix->text() );
1499 1500
1500 ent.setFileAs( cmbFileAs->currentText() ); 1501 ent.setFileAs( cmbFileAs->currentText() );
1501 1502
1502 ent.setCategories( cmbCat->currentCategories() ); 1503 ent.setCategories( cmbCat->currentCategories() );
1503 1504
1504 1505
1505 //if (hasTitle) 1506 //if (hasTitle)
1506 ent.setJobTitle( txtJobTitle->text() ); 1507 ent.setJobTitle( txtJobTitle->text() );
1507 1508
1508 //if (hasCompany) 1509 //if (hasCompany)
1509 ent.setCompany( txtOrganization->text() ); 1510 ent.setCompany( txtOrganization->text() );
1510 1511
1511 //if (hasNotes) 1512 //if (hasNotes)
1512 ent.setNotes( txtNote->text() ); 1513 ent.setNotes( txtNote->text() );
1513 1514
1514 //if (hasStreet) { 1515 //if (hasStreet) {
1515 ent.setHomeStreet( slHomeAddress[0] ); 1516 ent.setHomeStreet( slHomeAddress[0] );
1516 ent.setBusinessStreet( slBusinessAddress[0] ); 1517 ent.setBusinessStreet( slBusinessAddress[0] );
1517 //} 1518 //}
1518 1519
1519 //if (hasCity) { 1520 //if (hasCity) {
1520 ent.setHomeCity( slHomeAddress[3] ); 1521 ent.setHomeCity( slHomeAddress[3] );
1521 ent.setBusinessCity( slBusinessAddress[3] ); 1522 ent.setBusinessCity( slBusinessAddress[3] );
1522 //} 1523 //}
1523 1524
1524 //if (hasState) { 1525 //if (hasState) {
1525 ent.setHomeState( slHomeAddress[4] ); 1526 ent.setHomeState( slHomeAddress[4] );
1526 ent.setBusinessState( slBusinessAddress[4] ); 1527 ent.setBusinessState( slBusinessAddress[4] );
1527 //} 1528 //}
1528 1529
1529 //if (hasZip) { 1530 //if (hasZip) {
1530 ent.setHomeZip( slHomeAddress[5] ); 1531 ent.setHomeZip( slHomeAddress[5] );
1531 ent.setBusinessZip( slBusinessAddress[5] ); 1532 ent.setBusinessZip( slBusinessAddress[5] );
1532 //} 1533 //}
1533 1534
1534 //if (hasCountry) { 1535 //if (hasCountry) {
1535 ent.setHomeCountry( slHomeAddress[6] ); 1536 ent.setHomeCountry( slHomeAddress[6] );
1536 ent.setBusinessCountry( slBusinessAddress[6] ); 1537 ent.setBusinessCountry( slBusinessAddress[6] );
1537 //} 1538 //}
1538 1539
1539 QStringList::ConstIterator it; 1540 QStringList::ConstIterator it;
1540 QListIterator<QLineEdit> itLE( listValue ); 1541 QListIterator<QLineEdit> itLE( listValue );
1541 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { 1542 for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) {
1542 1543
1543 if ( *it == "Department" ) 1544 if ( *it == "Department" )
1544 ent.setDepartment( (*itLE)->text() ); 1545 ent.setDepartment( (*itLE)->text() );
1545 1546
1546 if ( *it == "Company" ) 1547 if ( *it == "Company" )
1547 ent.setCompany( (*itLE)->text() ); 1548 ent.setCompany( (*itLE)->text() );
1548 1549
1549 if ( *it == "Office" ) 1550 if ( *it == "Office" )
1550 ent.setOffice( (*itLE)->text() ); 1551 ent.setOffice( (*itLE)->text() );
1551 1552
1552 if ( *it == "Profession" ) 1553 if ( *it == "Profession" )
1553 ent.setProfession( (*itLE)->text() ); 1554 ent.setProfession( (*itLE)->text() );
1554 1555
1555 if ( *it == "Assistant" ) 1556 if ( *it == "Assistant" )
1556 ent.setAssistant( (*itLE)->text() ); 1557 ent.setAssistant( (*itLE)->text() );
1557 1558
1558 if ( *it == "Manager" ) 1559 if ( *it == "Manager" )
1559 ent.setManager( (*itLE)->text() ); 1560 ent.setManager( (*itLE)->text() );
1560 1561
1561 if ( *it == "Spouse" ) 1562 if ( *it == "Spouse" )
1562 ent.setSpouse( (*itLE)->text() ); 1563 ent.setSpouse( (*itLE)->text() );
1563 1564
1564 if ( *it == "Nickname" ) 1565 if ( *it == "Nickname" )
1565 ent.setNickname( (*itLE)->text() ); 1566 ent.setNickname( (*itLE)->text() );
1566 1567
1567 if ( *it == "Children" ) 1568 if ( *it == "Children" )
1568 ent.setChildren( (*itLE)->text() ); 1569 ent.setChildren( (*itLE)->text() );
1569 1570
1570 } 1571 }
1571 1572
1572 1573
1573 QStringList::ConstIterator itV; 1574 QStringList::ConstIterator itV;
1574 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1575 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1575 1576
1576 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) 1577 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
1577 ent.setBusinessPhone( *itV ); 1578 ent.setBusinessPhone( *itV );
1578 1579
1579 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) 1580 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
1580 ent.setBusinessFax( *itV ); 1581 ent.setBusinessFax( *itV );
1581 1582