Diffstat (limited to 'core/pim/addressbook/contacteditor.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index e496387..72c8bd3 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -69,25 +69,25 @@ ContactEditor::ContactEditor( const Opie::OPimContact &entry, | |||
69 | init(); | 69 | init(); |
70 | setEntry( entry ); | 70 | setEntry( entry ); |
71 | // cmbDefaultEmail = 0; | 71 | // cmbDefaultEmail = 0; |
72 | // defaultEmailChooserPosition = -1; | 72 | // defaultEmailChooserPosition = -1; |
73 | 73 | ||
74 | initializing = false; | 74 | initializing = false; |
75 | } | 75 | } |
76 | 76 | ||
77 | ContactEditor::~ContactEditor() { | 77 | ContactEditor::~ContactEditor() { |
78 | } | 78 | } |
79 | 79 | ||
80 | void ContactEditor::init() { | 80 | void ContactEditor::init() { |
81 | Opie::Core::owarn << "init() START" << oendl; | 81 | owarn << "init() START" << oendl; |
82 | 82 | ||
83 | uint i = 0; | 83 | uint i = 0; |
84 | 84 | ||
85 | QStringList trlChooserNames; | 85 | QStringList trlChooserNames; |
86 | 86 | ||
87 | for (i = 0; i <= 6; i++) { | 87 | for (i = 0; i <= 6; i++) { |
88 | slHomeAddress.append( "" ); | 88 | slHomeAddress.append( "" ); |
89 | slBusinessAddress.append( "" ); | 89 | slBusinessAddress.append( "" ); |
90 | } | 90 | } |
91 | 91 | ||
92 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); | 92 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); |
93 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); | 93 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); |
@@ -678,84 +678,84 @@ void ContactEditor::init() { | |||
678 | this, SLOT(slotCmbChooser2Change(int)) ); | 678 | this, SLOT(slotCmbChooser2Change(int)) ); |
679 | connect( cmbChooserField3, SIGNAL(activated(int)), | 679 | connect( cmbChooserField3, SIGNAL(activated(int)), |
680 | this, SLOT(slotCmbChooser3Change(int)) ); | 680 | this, SLOT(slotCmbChooser3Change(int)) ); |
681 | connect( cmbChooserField4, SIGNAL(activated(int)), | 681 | connect( cmbChooserField4, SIGNAL(activated(int)), |
682 | this, SLOT(slotCmbChooser4Change(int)) ); | 682 | this, SLOT(slotCmbChooser4Change(int)) ); |
683 | connect( cmbAddress, SIGNAL(activated(int)), | 683 | connect( cmbAddress, SIGNAL(activated(int)), |
684 | this, SLOT(slotAddressTypeChange(int)) ); | 684 | this, SLOT(slotAddressTypeChange(int)) ); |
685 | 685 | ||
686 | new QPEDialogListener(this); | 686 | new QPEDialogListener(this); |
687 | 687 | ||
688 | setPersonalView ( m_personalView ); | 688 | setPersonalView ( m_personalView ); |
689 | 689 | ||
690 | Opie::Core::owarn << "init() END" << oendl; | 690 | owarn << "init() END" << oendl; |
691 | } | 691 | } |
692 | 692 | ||
693 | void ContactEditor::defaultEmailChanged(int i){ | 693 | void ContactEditor::defaultEmailChanged(int i){ |
694 | Opie::Core::odebug << "defaultEmailChanged" << oendl; | 694 | odebug << "defaultEmailChanged" << oendl; |
695 | 695 | ||
696 | // was sollte das ? (se) | 696 | // was sollte das ? (se) |
697 | // int index = cmbChooserField1->currentItem(); | 697 | // int index = cmbChooserField1->currentItem(); |
698 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 698 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
699 | 699 | ||
700 | defaultEmail = cmbDefaultEmail->text(i); | 700 | defaultEmail = cmbDefaultEmail->text(i); |
701 | Opie::Core::odebug << "Changed to: " << defaultEmail << oendl; | 701 | odebug << "Changed to: " << defaultEmail << oendl; |
702 | 702 | ||
703 | } | 703 | } |
704 | 704 | ||
705 | void ContactEditor::populateDefaultEmailCmb(){ | 705 | void ContactEditor::populateDefaultEmailCmb(){ |
706 | 706 | ||
707 | // if the default-email combo was not selected and therfore not created | 707 | // if the default-email combo was not selected and therfore not created |
708 | // we get a lot of trouble.. Therfore create an invisible one.. | 708 | // we get a lot of trouble.. Therfore create an invisible one.. |
709 | if ( !cmbDefaultEmail ){ | 709 | if ( !cmbDefaultEmail ){ |
710 | cmbDefaultEmail = new QComboBox(this); | 710 | cmbDefaultEmail = new QComboBox(this); |
711 | cmbDefaultEmail -> hide(); | 711 | cmbDefaultEmail -> hide(); |
712 | } | 712 | } |
713 | cmbDefaultEmail->clear(); | 713 | cmbDefaultEmail->clear(); |
714 | cmbDefaultEmail->insertStringList( emails ); | 714 | cmbDefaultEmail->insertStringList( emails ); |
715 | // cmbDefaultEmail->show(); | 715 | // cmbDefaultEmail->show(); |
716 | 716 | ||
717 | // Select default email in combo.. | 717 | // Select default email in combo.. |
718 | bool found = false; | 718 | bool found = false; |
719 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 719 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
720 | Opie::Core::odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i ) | 720 | odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i ) |
721 | << "< defaultEmail >" << defaultEmail << "<" << oendl; | 721 | << "< defaultEmail >" << defaultEmail << "<" << oendl; |
722 | 722 | ||
723 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 723 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
724 | cmbDefaultEmail->setCurrentItem( i ); | 724 | cmbDefaultEmail->setCurrentItem( i ); |
725 | Opie::Core::odebug << "set" << oendl; | 725 | odebug << "set" << oendl; |
726 | found = true; | 726 | found = true; |
727 | } | 727 | } |
728 | } | 728 | } |
729 | 729 | ||
730 | // If the current default email is not found in the list, we choose the | 730 | // If the current default email is not found in the list, we choose the |
731 | // first one.. | 731 | // first one.. |
732 | if ( !found ) | 732 | if ( !found ) |
733 | defaultEmail = cmbDefaultEmail->text(0); | 733 | defaultEmail = cmbDefaultEmail->text(0); |
734 | } | 734 | } |
735 | 735 | ||
736 | // Called when any combobox was changed. | 736 | // Called when any combobox was changed. |
737 | // "true" returned if the change was chandled by this function, else it should | 737 | // "true" returned if the change was chandled by this function, else it should |
738 | // be handled by something else.. | 738 | // be handled by something else.. |
739 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { | 739 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { |
740 | QString type = slChooserNames[index]; | 740 | QString type = slChooserNames[index]; |
741 | Opie::Core::owarn << "ContactEditor::cmbChooserChange -> Type: " << type | 741 | owarn << "ContactEditor::cmbChooserChange -> Type: " << type |
742 | << ", WidgetPos: " << widgetPos << oendl; | 742 | << ", WidgetPos: " << widgetPos << oendl; |
743 | 743 | ||
744 | if ( !initializing ) | 744 | if ( !initializing ) |
745 | contactfields.setFieldOrder( widgetPos-1, index ); | 745 | contactfields.setFieldOrder( widgetPos-1, index ); |
746 | 746 | ||
747 | // Create and connect combobox for selecting the default email | 747 | // Create and connect combobox for selecting the default email |
748 | if ( type == "Default Email"){ | 748 | if ( type == "Default Email"){ |
749 | Opie::Core::owarn << "Choosing default-email (defaultEmailChooserPosition= " | 749 | owarn << "Choosing default-email (defaultEmailChooserPosition= " |
750 | << defaultEmailChooserPosition << ") " << oendl; | 750 | << defaultEmailChooserPosition << ") " << oendl; |
751 | 751 | ||
752 | // More than one default-email chooser is not allowed ! | 752 | // More than one default-email chooser is not allowed ! |
753 | if ( ( defaultEmailChooserPosition != -1 ) && | 753 | if ( ( defaultEmailChooserPosition != -1 ) && |
754 | defaultEmailChooserPosition != widgetPos && !initializing){ | 754 | defaultEmailChooserPosition != widgetPos && !initializing){ |
755 | chooserError( widgetPos ); | 755 | chooserError( widgetPos ); |
756 | return true; | 756 | return true; |
757 | } | 757 | } |
758 | 758 | ||
759 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 759 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
760 | if ( cmbo ){ | 760 | if ( cmbo ){ |
761 | inputStack->raiseWidget( TextField ); | 761 | inputStack->raiseWidget( TextField ); |
@@ -771,50 +771,50 @@ bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int w | |||
771 | defaultEmailChooserPosition = widgetPos; | 771 | defaultEmailChooserPosition = widgetPos; |
772 | cmbDefaultEmail = cmbo; | 772 | cmbDefaultEmail = cmbo; |
773 | 773 | ||
774 | connect( cmbo,SIGNAL( activated(int) ), | 774 | connect( cmbo,SIGNAL( activated(int) ), |
775 | SLOT( defaultEmailChanged(int) ) ); | 775 | SLOT( defaultEmailChanged(int) ) ); |
776 | 776 | ||
777 | // Set current default email | 777 | // Set current default email |
778 | populateDefaultEmailCmb(); | 778 | populateDefaultEmailCmb(); |
779 | 779 | ||
780 | 780 | ||
781 | } else { | 781 | } else { |
782 | // Something else was selected: Hide combo.. | 782 | // Something else was selected: Hide combo.. |
783 | Opie::Core::owarn << " Hiding default-email combo" << oendl; | 783 | owarn << " Hiding default-email combo" << oendl; |
784 | if ( defaultEmailChooserPosition == widgetPos ){ | 784 | if ( defaultEmailChooserPosition == widgetPos ){ |
785 | defaultEmailChooserPosition = -1; | 785 | defaultEmailChooserPosition = -1; |
786 | } | 786 | } |
787 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 787 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
788 | if ( cmbo ){ | 788 | if ( cmbo ){ |
789 | inputStack->raiseWidget( TextField ); | 789 | inputStack->raiseWidget( TextField ); |
790 | inputStack -> removeWidget( cmbo ); | 790 | inputStack -> removeWidget( cmbo ); |
791 | cmbDefaultEmail = 0l; | 791 | cmbDefaultEmail = 0l; |
792 | delete cmbo; | 792 | delete cmbo; |
793 | } | 793 | } |
794 | 794 | ||
795 | // Caller should initialize the responsible textfield, therefore | 795 | // Caller should initialize the responsible textfield, therefore |
796 | // "false" is returned | 796 | // "false" is returned |
797 | return false; | 797 | return false; |
798 | } | 798 | } |
799 | 799 | ||
800 | // Everything is worked off .. | 800 | // Everything is worked off .. |
801 | return true; | 801 | return true; |
802 | 802 | ||
803 | } | 803 | } |
804 | 804 | ||
805 | // Currently accessed when we select default-email more than once ! | 805 | // Currently accessed when we select default-email more than once ! |
806 | void ContactEditor::chooserError( int index ) | 806 | void ContactEditor::chooserError( int index ) |
807 | { | 807 | { |
808 | Opie::Core::owarn << "ContactEditor::chooserError( " << index << " )" << oendl; | 808 | owarn << "ContactEditor::chooserError( " << index << " )" << oendl; |
809 | QMessageBox::warning( this, "Chooser Error", | 809 | QMessageBox::warning( this, "Chooser Error", |
810 | "Multiple selection of this\n" | 810 | "Multiple selection of this\n" |
811 | "Item is not allowed !\n\n" | 811 | "Item is not allowed !\n\n" |
812 | "First deselect the previous one !", | 812 | "First deselect the previous one !", |
813 | "&OK", 0, 0, | 813 | "&OK", 0, 0, |
814 | 0, 0 ); | 814 | 0, 0 ); |
815 | 815 | ||
816 | // Reset the selected Chooser. Unfortunately the chooser | 816 | // Reset the selected Chooser. Unfortunately the chooser |
817 | // generates no signal, therfore we have to | 817 | // generates no signal, therfore we have to |
818 | // call the cmbChooserChange function manually.. | 818 | // call the cmbChooserChange function manually.. |
819 | switch( index ){ | 819 | switch( index ){ |
820 | case 1: | 820 | case 1: |
@@ -832,65 +832,65 @@ void ContactEditor::chooserError( int index ) | |||
832 | case 4: | 832 | case 4: |
833 | cmbChooserField4 -> setCurrentItem( 0 ); | 833 | cmbChooserField4 -> setCurrentItem( 0 ); |
834 | slotCmbChooser4Change( 0 ); | 834 | slotCmbChooser4Change( 0 ); |
835 | break; | 835 | break; |
836 | } | 836 | } |
837 | } | 837 | } |
838 | 838 | ||
839 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 839 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
840 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 840 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
841 | QLineEdit* , int widgetPos ) { | 841 | QLineEdit* , int widgetPos ) { |
842 | 842 | ||
843 | QString type = slChooserNames[index]; // :SX | 843 | QString type = slChooserNames[index]; // :SX |
844 | Opie::Core::odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>" | 844 | odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>" |
845 | << textChanged << "< index=" << index << ", widgetPos=" << widgetPos | 845 | << textChanged << "< index=" << index << ", widgetPos=" << widgetPos |
846 | << " )" << oendl; | 846 | << " )" << oendl; |
847 | 847 | ||
848 | if ( type == "Default Email"){ | 848 | if ( type == "Default Email"){ |
849 | Opie::Core::owarn << "??? Wozu??: " << textChanged << oendl; | 849 | owarn << "??? Wozu??: " << textChanged << oendl; |
850 | defaultEmail = textChanged; | 850 | defaultEmail = textChanged; |
851 | 851 | ||
852 | populateDefaultEmailCmb(); | 852 | populateDefaultEmailCmb(); |
853 | 853 | ||
854 | }else if (type == "Emails"){ | 854 | }else if (type == "Emails"){ |
855 | Opie::Core::odebug << "emails" << oendl; | 855 | odebug << "emails" << oendl; |
856 | 856 | ||
857 | QString de; | 857 | QString de; |
858 | emails = QStringList::split (",", textChanged ); | 858 | emails = QStringList::split (",", textChanged ); |
859 | 859 | ||
860 | populateDefaultEmailCmb(); | 860 | populateDefaultEmailCmb(); |
861 | } | 861 | } |
862 | 862 | ||
863 | slChooserValues[index] = textChanged; | 863 | slChooserValues[index] = textChanged; |
864 | 864 | ||
865 | } | 865 | } |
866 | 866 | ||
867 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 867 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
868 | Opie::Core::owarn << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl; | 868 | owarn << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl; |
869 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 869 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
870 | } | 870 | } |
871 | 871 | ||
872 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 872 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
873 | Opie::Core::owarn << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl; | 873 | owarn << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl; |
874 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 874 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
875 | 875 | ||
876 | } | 876 | } |
877 | 877 | ||
878 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 878 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
879 | Opie::Core::owarn << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl; | 879 | owarn << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl; |
880 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 880 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
881 | } | 881 | } |
882 | 882 | ||
883 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 883 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
884 | Opie::Core::owarn << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl; | 884 | owarn << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl; |
885 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 885 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
886 | } | 886 | } |
887 | 887 | ||
888 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 888 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
889 | 889 | ||
890 | if ( cmbAddress->currentItem() == 0 ) { | 890 | if ( cmbAddress->currentItem() == 0 ) { |
891 | slBusinessAddress[0] = textChanged; | 891 | slBusinessAddress[0] = textChanged; |
892 | } else { | 892 | } else { |
893 | slHomeAddress[0] = textChanged; | 893 | slHomeAddress[0] = textChanged; |
894 | } | 894 | } |
895 | } | 895 | } |
896 | 896 | ||
@@ -942,58 +942,58 @@ void ContactEditor::slotZipChange( const QString &textChanged ) { | |||
942 | 942 | ||
943 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 943 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
944 | 944 | ||
945 | if ( cmbAddress->currentItem() == 0 ) { | 945 | if ( cmbAddress->currentItem() == 0 ) { |
946 | slBusinessAddress[6] = textChanged; | 946 | slBusinessAddress[6] = textChanged; |
947 | } else { | 947 | } else { |
948 | slHomeAddress[6] = textChanged; | 948 | slHomeAddress[6] = textChanged; |
949 | } | 949 | } |
950 | } | 950 | } |
951 | 951 | ||
952 | 952 | ||
953 | void ContactEditor::slotCmbChooser1Change( int index ) { | 953 | void ContactEditor::slotCmbChooser1Change( int index ) { |
954 | Opie::Core::owarn << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl; | 954 | owarn << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl; |
955 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ | 955 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
956 | 956 | ||
957 | txtChooserField1->setText( slChooserValues[index] ); | 957 | txtChooserField1->setText( slChooserValues[index] ); |
958 | txtChooserField1->setFocus(); | 958 | txtChooserField1->setFocus(); |
959 | 959 | ||
960 | } | 960 | } |
961 | 961 | ||
962 | } | 962 | } |
963 | 963 | ||
964 | void ContactEditor::slotCmbChooser2Change( int index ) { | 964 | void ContactEditor::slotCmbChooser2Change( int index ) { |
965 | Opie::Core::owarn << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl; | 965 | owarn << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl; |
966 | 966 | ||
967 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ | 967 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
968 | 968 | ||
969 | txtChooserField2->setText( slChooserValues[index] ); | 969 | txtChooserField2->setText( slChooserValues[index] ); |
970 | txtChooserField2->setFocus(); | 970 | txtChooserField2->setFocus(); |
971 | 971 | ||
972 | } | 972 | } |
973 | } | 973 | } |
974 | 974 | ||
975 | void ContactEditor::slotCmbChooser3Change( int index ) { | 975 | void ContactEditor::slotCmbChooser3Change( int index ) { |
976 | Opie::Core::owarn << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl; | 976 | owarn << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl; |
977 | 977 | ||
978 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ | 978 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
979 | 979 | ||
980 | txtChooserField3->setText( slChooserValues[index] ); | 980 | txtChooserField3->setText( slChooserValues[index] ); |
981 | txtChooserField3->setFocus(); | 981 | txtChooserField3->setFocus(); |
982 | 982 | ||
983 | } | 983 | } |
984 | } | 984 | } |
985 | 985 | ||
986 | void ContactEditor::slotCmbChooser4Change( int index ) { | 986 | void ContactEditor::slotCmbChooser4Change( int index ) { |
987 | Opie::Core::owarn << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl; | 987 | owarn << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl; |
988 | 988 | ||
989 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ | 989 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
990 | 990 | ||
991 | txtChooserField4->setText( slChooserValues[index] ); | 991 | txtChooserField4->setText( slChooserValues[index] ); |
992 | txtChooserField4->setFocus(); | 992 | txtChooserField4->setFocus(); |
993 | 993 | ||
994 | } | 994 | } |
995 | } | 995 | } |
996 | 996 | ||
997 | void ContactEditor::slotAddressTypeChange( int index ) { | 997 | void ContactEditor::slotAddressTypeChange( int index ) { |
998 | 998 | ||
999 | 999 | ||
@@ -1020,49 +1020,49 @@ void ContactEditor::slotAddressTypeChange( int index ) { | |||
1020 | txtCity->setText( slHomeAddress[3] ); | 1020 | txtCity->setText( slHomeAddress[3] ); |
1021 | txtState->setText( slHomeAddress[4] ); | 1021 | txtState->setText( slHomeAddress[4] ); |
1022 | txtZip->setText( slHomeAddress[5] ); | 1022 | txtZip->setText( slHomeAddress[5] ); |
1023 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1023 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1024 | txtTmp->setText( slHomeAddress[6] ); | 1024 | txtTmp->setText( slHomeAddress[6] ); |
1025 | 1025 | ||
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1030 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1031 | 1031 | ||
1032 | Opie::Core::owarn << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl; | 1032 | owarn << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl; |
1033 | 1033 | ||
1034 | int index = cmbFileAs->currentItem(); | 1034 | int index = cmbFileAs->currentItem(); |
1035 | 1035 | ||
1036 | cmbFileAs->clear(); | 1036 | cmbFileAs->clear(); |
1037 | 1037 | ||
1038 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); | 1038 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1039 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); | 1039 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1040 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | 1040 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); |
1041 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); | 1041 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); |
1042 | if ( ! txtSuffix->text().isEmpty() ) | 1042 | if ( ! txtSuffix->text().isEmpty() ) |
1043 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); | 1043 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); |
1044 | 1044 | ||
1045 | cmbFileAs->setCurrentItem( index ); | 1045 | cmbFileAs->setCurrentItem( index ); |
1046 | 1046 | ||
1047 | 1047 | ||
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | void ContactEditor::slotSuffixChange( const QString& ) { | 1050 | void ContactEditor::slotSuffixChange( const QString& ) { |
1051 | // Just want to update the FileAs combo if the suffix was changed.. | 1051 | // Just want to update the FileAs combo if the suffix was changed.. |
1052 | slotFullNameChange( txtFullName->text() ); | 1052 | slotFullNameChange( txtFullName->text() ); |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ | 1055 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ |
1056 | Opie::Core::owarn << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl; | 1056 | owarn << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl; |
1057 | // Special handling for storing Companies: | 1057 | // Special handling for storing Companies: |
1058 | // If no Fullname is given, we store the Company-Name as lastname | 1058 | // If no Fullname is given, we store the Company-Name as lastname |
1059 | // to handle it like a person.. | 1059 | // to handle it like a person.. |
1060 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) | 1060 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) |
1061 | txtFullName->setText( textChanged ); | 1061 | txtFullName->setText( textChanged ); |
1062 | 1062 | ||
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | void ContactEditor::accept() { | 1065 | void ContactEditor::accept() { |
1066 | 1066 | ||
1067 | if ( isEmpty() ) { | 1067 | if ( isEmpty() ) { |
1068 | cleanupFields(); | 1068 | cleanupFields(); |
@@ -1126,38 +1126,38 @@ bool ContactEditor::isEmpty() { | |||
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1128 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1129 | 1129 | ||
1130 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1130 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1131 | QString strFirstName; | 1131 | QString strFirstName; |
1132 | QString strMiddleName; | 1132 | QString strMiddleName; |
1133 | QString strLastName; | 1133 | QString strLastName; |
1134 | QString strTitle; | 1134 | QString strTitle; |
1135 | int commapos; | 1135 | int commapos; |
1136 | bool haveLastName = false; | 1136 | bool haveLastName = false; |
1137 | 1137 | ||
1138 | Opie::Core::owarn << "Fullname: " << simplifiedName << oendl; | 1138 | owarn << "Fullname: " << simplifiedName << oendl; |
1139 | 1139 | ||
1140 | commapos = simplifiedName.find( ',', 0, TRUE); | 1140 | commapos = simplifiedName.find( ',', 0, TRUE); |
1141 | if ( commapos >= 0 ) { | 1141 | if ( commapos >= 0 ) { |
1142 | Opie::Core::owarn << " Commapos: " << commapos << oendl; | 1142 | owarn << " Commapos: " << commapos << oendl; |
1143 | 1143 | ||
1144 | // A comma (",") separates the lastname from one or | 1144 | // A comma (",") separates the lastname from one or |
1145 | // many first names. Thus, remove the lastname from the | 1145 | // many first names. Thus, remove the lastname from the |
1146 | // String and parse the firstnames. | 1146 | // String and parse the firstnames. |
1147 | 1147 | ||
1148 | strLastName = simplifiedName.left( commapos ); | 1148 | strLastName = simplifiedName.left( commapos ); |
1149 | simplifiedName= simplifiedName.mid( commapos + 1 ); | 1149 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1150 | haveLastName = true; | 1150 | haveLastName = true; |
1151 | Opie::Core::owarn << "Fullname without ',': " << simplifiedName << oendl; | 1151 | owarn << "Fullname without ',': " << simplifiedName << oendl; |
1152 | 1152 | ||
1153 | // If we have any lastname, we should now split all first names. | 1153 | // If we have any lastname, we should now split all first names. |
1154 | // The first one will be the used as first, the rest as "middle names" | 1154 | // The first one will be the used as first, the rest as "middle names" |
1155 | 1155 | ||
1156 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); | 1156 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1157 | QStringList::Iterator it = allFirstNames.begin(); | 1157 | QStringList::Iterator it = allFirstNames.begin(); |
1158 | strFirstName = *it++; | 1158 | strFirstName = *it++; |
1159 | QStringList allSecondNames; | 1159 | QStringList allSecondNames; |
1160 | for ( ; it != allFirstNames.end(); ++it ) | 1160 | for ( ; it != allFirstNames.end(); ++it ) |
1161 | allSecondNames.append( *it ); | 1161 | allSecondNames.append( *it ); |
1162 | 1162 | ||
1163 | strMiddleName = allSecondNames.join(" "); | 1163 | strMiddleName = allSecondNames.join(" "); |
@@ -1173,28 +1173,28 @@ QString ContactEditor::parseName( const QString fullName, int type ) { | |||
1173 | QStringList allSecondNames; | 1173 | QStringList allSecondNames; |
1174 | for ( ; it != --allNames.end(); ++it ) | 1174 | for ( ; it != --allNames.end(); ++it ) |
1175 | allSecondNames.append( *it ); | 1175 | allSecondNames.append( *it ); |
1176 | 1176 | ||
1177 | strMiddleName = allSecondNames.join(" "); | 1177 | strMiddleName = allSecondNames.join(" "); |
1178 | strLastName = *(--allNames.end()); | 1178 | strLastName = *(--allNames.end()); |
1179 | 1179 | ||
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | if ( strFirstName == strLastName ) | 1182 | if ( strFirstName == strLastName ) |
1183 | strFirstName = ""; | 1183 | strFirstName = ""; |
1184 | 1184 | ||
1185 | Opie::Core::owarn << "strFirstName: " << strFirstName << oendl; | 1185 | owarn << "strFirstName: " << strFirstName << oendl; |
1186 | Opie::Core::owarn << "strMiddletName: " << strMiddleName << oendl; | 1186 | owarn << "strMiddletName: " << strMiddleName << oendl; |
1187 | Opie::Core::owarn << "strLastName: " << strLastName << oendl; | 1187 | owarn << "strLastName: " << strLastName << oendl; |
1188 | Opie::Core::owarn << "strTitle: " << strTitle << oendl; | 1188 | owarn << "strTitle: " << strTitle << oendl; |
1189 | 1189 | ||
1190 | switch (type) { | 1190 | switch (type) { |
1191 | case NAME_FL: | 1191 | case NAME_FL: |
1192 | return strFirstName + " " + strLastName; | 1192 | return strFirstName + " " + strLastName; |
1193 | 1193 | ||
1194 | case NAME_LF: | 1194 | case NAME_LF: |
1195 | return strLastName + ", " + strFirstName; | 1195 | return strLastName + ", " + strFirstName; |
1196 | 1196 | ||
1197 | case NAME_LFM: | 1197 | case NAME_LFM: |
1198 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1198 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1199 | 1199 | ||
1200 | case NAME_FML: | 1200 | case NAME_FML: |
@@ -1259,25 +1259,25 @@ void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | |||
1259 | 1259 | ||
1260 | initializing = true; | 1260 | initializing = true; |
1261 | 1261 | ||
1262 | // Cleanup and activate the general Page .. | 1262 | // Cleanup and activate the general Page .. |
1263 | cleanupFields(); | 1263 | cleanupFields(); |
1264 | tabMain->setCurrentPage( 0 ); | 1264 | tabMain->setCurrentPage( 0 ); |
1265 | 1265 | ||
1266 | ent = entry; | 1266 | ent = entry; |
1267 | 1267 | ||
1268 | emails = QStringList(ent.emailList()); | 1268 | emails = QStringList(ent.emailList()); |
1269 | defaultEmail = ent.defaultEmail(); | 1269 | defaultEmail = ent.defaultEmail(); |
1270 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1270 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1271 | Opie::Core::odebug << "default email=" << defaultEmail << oendl; | 1271 | odebug << "default email=" << defaultEmail << oendl; |
1272 | 1272 | ||
1273 | txtFirstName->setText( ent.firstName() ); | 1273 | txtFirstName->setText( ent.firstName() ); |
1274 | txtMiddleName->setText( ent.middleName() ); | 1274 | txtMiddleName->setText( ent.middleName() ); |
1275 | txtLastName->setText( ent.lastName() ); | 1275 | txtLastName->setText( ent.lastName() ); |
1276 | txtSuffix->setText( ent.suffix() ); | 1276 | txtSuffix->setText( ent.suffix() ); |
1277 | 1277 | ||
1278 | // QString *tmpString = new QString; | 1278 | // QString *tmpString = new QString; |
1279 | // *tmpString = ent.firstName() + " " + ent.middleName() + | 1279 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1280 | // + " " + ent.lastName() + " " + ent.suffix(); | 1280 | // + " " + ent.lastName() + " " + ent.suffix(); |
1281 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1281 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1282 | 1282 | ||
1283 | if ( !ent.isEmpty() ){ | 1283 | if ( !ent.isEmpty() ){ |
@@ -1319,49 +1319,49 @@ void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | |||
1319 | slBusinessAddress[5] = ent.businessZip(); | 1319 | slBusinessAddress[5] = ent.businessZip(); |
1320 | //} | 1320 | //} |
1321 | 1321 | ||
1322 | //if (hasCountry) { | 1322 | //if (hasCountry) { |
1323 | slHomeAddress[6] = ent.homeCountry(); | 1323 | slHomeAddress[6] = ent.homeCountry(); |
1324 | slBusinessAddress[6] = ent.businessCountry(); | 1324 | slBusinessAddress[6] = ent.businessCountry(); |
1325 | //} | 1325 | //} |
1326 | 1326 | ||
1327 | QStringList::ConstIterator it; | 1327 | QStringList::ConstIterator it; |
1328 | QListIterator<QLineEdit> itLE( listValue ); | 1328 | QListIterator<QLineEdit> itLE( listValue ); |
1329 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1329 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1330 | 1330 | ||
1331 | Opie::Core::owarn << " Filling dynamic Field: " << (*it) << oendl; | 1331 | owarn << " Filling dynamic Field: " << (*it) << oendl; |
1332 | 1332 | ||
1333 | if ( *it == "Department" ) | 1333 | if ( *it == "Department" ) |
1334 | (*itLE)->setText( ent.department() ); | 1334 | (*itLE)->setText( ent.department() ); |
1335 | 1335 | ||
1336 | if ( *it == "Company" ) | 1336 | if ( *it == "Company" ) |
1337 | (*itLE)->setText( ent.company() ); | 1337 | (*itLE)->setText( ent.company() ); |
1338 | 1338 | ||
1339 | if ( *it == "Office" ) | 1339 | if ( *it == "Office" ) |
1340 | (*itLE)->setText( ent.office() ); | 1340 | (*itLE)->setText( ent.office() ); |
1341 | 1341 | ||
1342 | if ( *it == "Profession" ) | 1342 | if ( *it == "Profession" ) |
1343 | (*itLE)->setText( ent.profession() ); | 1343 | (*itLE)->setText( ent.profession() ); |
1344 | 1344 | ||
1345 | if ( *it == "Assistant" ) | 1345 | if ( *it == "Assistant" ) |
1346 | (*itLE)->setText( ent.assistant() ); | 1346 | (*itLE)->setText( ent.assistant() ); |
1347 | 1347 | ||
1348 | if ( *it == "Manager" ) | 1348 | if ( *it == "Manager" ) |
1349 | (*itLE)->setText( ent.manager() ); | 1349 | (*itLE)->setText( ent.manager() ); |
1350 | 1350 | ||
1351 | if ( *it == "Spouse" ) | 1351 | if ( *it == "Spouse" ) |
1352 | (*itLE)->setText( ent.spouse() ); | 1352 | (*itLE)->setText( ent.spouse() ); |
1353 | 1353 | ||
1354 | if ( *it == "Nickname" ){ | 1354 | if ( *it == "Nickname" ){ |
1355 | Opie::Core::owarn << "**** Nichname: " << ent.nickname() << oendl; | 1355 | owarn << "**** Nichname: " << ent.nickname() << oendl; |
1356 | (*itLE)->setText( ent.nickname() ); | 1356 | (*itLE)->setText( ent.nickname() ); |
1357 | } | 1357 | } |
1358 | 1358 | ||
1359 | if ( *it == "Children" ) | 1359 | if ( *it == "Children" ) |
1360 | (*itLE)->setText( ent.children() ); | 1360 | (*itLE)->setText( ent.children() ); |
1361 | 1361 | ||
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | QStringList::Iterator itV; | 1364 | QStringList::Iterator itV; |
1365 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1365 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1366 | 1366 | ||
1367 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1367 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
@@ -1576,26 +1576,26 @@ void ContactEditor::saveEntry() { | |||
1576 | 1576 | ||
1577 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1577 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1578 | ent.setBusinessFax( *itV ); | 1578 | ent.setBusinessFax( *itV ); |
1579 | 1579 | ||
1580 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1580 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1581 | ent.setBusinessMobile( *itV ); | 1581 | ent.setBusinessMobile( *itV ); |
1582 | 1582 | ||
1583 | if ( *it == "Emails" ){ | 1583 | if ( *it == "Emails" ){ |
1584 | QString allemail; | 1584 | QString allemail; |
1585 | QString defaultmail; | 1585 | QString defaultmail; |
1586 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1586 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1587 | if ( defaultEmail.isEmpty() ){ | 1587 | if ( defaultEmail.isEmpty() ){ |
1588 | Opie::Core::owarn << "Default email was not set by user!" << oendl; | 1588 | owarn << "Default email was not set by user!" << oendl; |
1589 | Opie::Core::owarn << "Using first email in list: " << defaultmail << oendl; | 1589 | owarn << "Using first email in list: " << defaultmail << oendl; |
1590 | ent.setDefaultEmail( defaultmail ); | 1590 | ent.setDefaultEmail( defaultmail ); |
1591 | } | 1591 | } |
1592 | ent.setEmails( allemail ); | 1592 | ent.setEmails( allemail ); |
1593 | } | 1593 | } |
1594 | 1594 | ||
1595 | if ( *it == "Default Email") | 1595 | if ( *it == "Default Email") |
1596 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1596 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1597 | 1597 | ||
1598 | if ( *it == "Home Phone" ) | 1598 | if ( *it == "Home Phone" ) |
1599 | ent.setHomePhone( *itV ); | 1599 | ent.setHomePhone( *itV ); |
1600 | 1600 | ||
1601 | if ( *it == "Home Fax" ) | 1601 | if ( *it == "Home Fax" ) |
@@ -1729,23 +1729,23 @@ void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | |||
1729 | 1729 | ||
1730 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | 1730 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) |
1731 | { | 1731 | { |
1732 | QDate date; | 1732 | QDate date; |
1733 | date.setYMD( year, month, day ); | 1733 | date.setYMD( year, month, day ); |
1734 | QString dateString = TimeString::numberDateString( date ); | 1734 | QString dateString = TimeString::numberDateString( date ); |
1735 | birthdayButton->setText( dateString ); | 1735 | birthdayButton->setText( dateString ); |
1736 | ent.setBirthday ( date ); | 1736 | ent.setBirthday ( date ); |
1737 | } | 1737 | } |
1738 | 1738 | ||
1739 | void ContactEditor::slotRemoveBirthday() | 1739 | void ContactEditor::slotRemoveBirthday() |
1740 | { | 1740 | { |
1741 | Opie::Core::owarn << "void ContactEditor::slotRemoveBirthday()" << oendl; | 1741 | owarn << "void ContactEditor::slotRemoveBirthday()" << oendl; |
1742 | ent.setBirthday( QDate() ); | 1742 | ent.setBirthday( QDate() ); |
1743 | updateDatePicker(); | 1743 | updateDatePicker(); |
1744 | } | 1744 | } |
1745 | 1745 | ||
1746 | void ContactEditor::slotRemoveAnniversary() | 1746 | void ContactEditor::slotRemoveAnniversary() |
1747 | { | 1747 | { |
1748 | Opie::Core::owarn << "void ContactEditor::slotRemoveAnniversary()" << oendl; | 1748 | owarn << "void ContactEditor::slotRemoveAnniversary()" << oendl; |
1749 | ent.setAnniversary( QDate() ); | 1749 | ent.setAnniversary( QDate() ); |
1750 | updateDatePicker(); | 1750 | updateDatePicker(); |
1751 | } | 1751 | } |