author | tux_mike <tux_mike> | 2002-04-18 20:07:11 (UTC) |
---|---|---|
committer | tux_mike <tux_mike> | 2002-04-18 20:07:11 (UTC) |
commit | 56c20411484700350362b5041e3c9db030084caf (patch) (unidiff) | |
tree | 4779dffaf8a4b54312f63a103c01b5042f9c876c | |
parent | 706686e0ee82390b85bd4e3ba2813251cae5ea0d (diff) | |
download | opie-56c20411484700350362b5041e3c9db030084caf.zip opie-56c20411484700350362b5041e3c9db030084caf.tar.gz opie-56c20411484700350362b5041e3c9db030084caf.tar.bz2 |
Fixed a bug with Suffixes due to a missing 2
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index cbcd11f..adea1a1 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -920,259 +920,259 @@ void ContactEditor::accept() { | |||
920 | QDialog::accept(); | 920 | QDialog::accept(); |
921 | } | 921 | } |
922 | 922 | ||
923 | } | 923 | } |
924 | 924 | ||
925 | void ContactEditor::slotNote() { | 925 | void ContactEditor::slotNote() { |
926 | 926 | ||
927 | dlgNote->showMaximized(); | 927 | dlgNote->showMaximized(); |
928 | if ( !dlgNote->exec() ) { | 928 | if ( !dlgNote->exec() ) { |
929 | txtNote->setText( ent.notes() ); | 929 | txtNote->setText( ent.notes() ); |
930 | } | 930 | } |
931 | } | 931 | } |
932 | 932 | ||
933 | void ContactEditor::slotName() { | 933 | void ContactEditor::slotName() { |
934 | 934 | ||
935 | if (useFullName = TRUE) { | 935 | if (useFullName = TRUE) { |
936 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 936 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
937 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 937 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
938 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 938 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
939 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 939 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
940 | } | 940 | } |
941 | 941 | ||
942 | dlgName->showMaximized(); | 942 | dlgName->showMaximized(); |
943 | if ( dlgName->exec() ) { | 943 | if ( dlgName->exec() ) { |
944 | txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() ); | 944 | txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() ); |
945 | slotFullNameChange( txtFullName->text() ); | 945 | slotFullNameChange( txtFullName->text() ); |
946 | useFullName = FALSE; | 946 | useFullName = FALSE; |
947 | } | 947 | } |
948 | 948 | ||
949 | } | 949 | } |
950 | 950 | ||
951 | void ContactEditor::setNameFocus() { | 951 | void ContactEditor::setNameFocus() { |
952 | 952 | ||
953 | txtFullName->setFocus(); | 953 | txtFullName->setFocus(); |
954 | 954 | ||
955 | } | 955 | } |
956 | 956 | ||
957 | bool ContactEditor::isEmpty() { | 957 | bool ContactEditor::isEmpty() { |
958 | // Test and see if the record should be saved. | 958 | // Test and see if the record should be saved. |
959 | // More strict than the original qtopia, needs name or fileas to save | 959 | // More strict than the original qtopia, needs name or fileas to save |
960 | 960 | ||
961 | QString t = txtFullName->text(); | 961 | QString t = txtFullName->text(); |
962 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 962 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
963 | return false; | 963 | return false; |
964 | 964 | ||
965 | t = cmbFileAs->currentText(); | 965 | t = cmbFileAs->currentText(); |
966 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 966 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
967 | return false; | 967 | return false; |
968 | 968 | ||
969 | return true; | 969 | return true; |
970 | 970 | ||
971 | } | 971 | } |
972 | 972 | ||
973 | QString ContactEditor::parseName( const QString fullName, int type ) { | 973 | QString ContactEditor::parseName( const QString fullName, int type ) { |
974 | 974 | ||
975 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 975 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
976 | QString strFirstName; | 976 | QString strFirstName; |
977 | QString strMiddleName; | 977 | QString strMiddleName; |
978 | QString strLastName; | 978 | QString strLastName; |
979 | QString strSuffix; | 979 | QString strSuffix; |
980 | QString strTitle; | 980 | QString strTitle; |
981 | int commapos; | 981 | int commapos; |
982 | int spCount; | 982 | int spCount; |
983 | int spPos; | 983 | int spPos; |
984 | int spPos2; | 984 | int spPos2; |
985 | 985 | ||
986 | 986 | ||
987 | commapos = simplifiedName.find( ',', 0, TRUE); | 987 | commapos = simplifiedName.find( ',', 0, TRUE); |
988 | spCount = simplifiedName.contains( ' ', TRUE ); | 988 | spCount = simplifiedName.contains( ' ', TRUE ); |
989 | 989 | ||
990 | if ( commapos == -1 ) { | 990 | if ( commapos == -1 ) { |
991 | 991 | ||
992 | switch (spCount) { | 992 | switch (spCount) { |
993 | case 0: | 993 | case 0: |
994 | return simplifiedName; | 994 | return simplifiedName; |
995 | 995 | ||
996 | case 1: | 996 | case 1: |
997 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 997 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
998 | strFirstName = simplifiedName.left( spPos ); | 998 | strFirstName = simplifiedName.left( spPos ); |
999 | strLastName = simplifiedName.mid( spPos + 1 ); | 999 | strLastName = simplifiedName.mid( spPos + 1 ); |
1000 | break; | 1000 | break; |
1001 | 1001 | ||
1002 | case 2: | 1002 | case 2: |
1003 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1003 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1004 | strFirstName = simplifiedName.left( spPos ); | 1004 | strFirstName = simplifiedName.left( spPos ); |
1005 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1005 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1006 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1006 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1007 | strLastName = simplifiedName.mid( spPos2 + 1 ); | 1007 | strLastName = simplifiedName.mid( spPos2 + 1 ); |
1008 | break; | 1008 | break; |
1009 | 1009 | ||
1010 | case 3: | 1010 | case 3: |
1011 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1011 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1012 | strFirstName = simplifiedName.left( spPos ); | 1012 | strFirstName = simplifiedName.left( spPos ); |
1013 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1013 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1014 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1014 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1015 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1015 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1016 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 1016 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1017 | strSuffix = simplifiedName.mid( spPos + 1 ); | 1017 | strSuffix = simplifiedName.mid( spPos + 1 ); |
1018 | break; | 1018 | break; |
1019 | 1019 | ||
1020 | case 4: | 1020 | case 4: |
1021 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1021 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1022 | strTitle = simplifiedName.left( spPos ); | 1022 | strTitle = simplifiedName.left( spPos ); |
1023 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1023 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1024 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1024 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1025 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1025 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1026 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 1026 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1027 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1027 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1028 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1028 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1029 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1029 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1030 | break; | 1030 | break; |
1031 | 1031 | ||
1032 | default: | 1032 | default: |
1033 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1033 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1034 | strTitle = simplifiedName.left( spPos ); | 1034 | strTitle = simplifiedName.left( spPos ); |
1035 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1035 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1036 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1036 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1037 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1037 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1038 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 1038 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1039 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1039 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1040 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1040 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1041 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1041 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1042 | break; | 1042 | break; |
1043 | } | 1043 | } |
1044 | } else { | 1044 | } else { |
1045 | simplifiedName.replace( commapos, 1, " " ); | 1045 | simplifiedName.replace( commapos, 1, " " ); |
1046 | simplifiedName = simplifiedName.simplifyWhiteSpace(); | 1046 | simplifiedName = simplifiedName.simplifyWhiteSpace(); |
1047 | 1047 | ||
1048 | switch (spCount) { | 1048 | switch (spCount) { |
1049 | case 0: | 1049 | case 0: |
1050 | return simplifiedName; | 1050 | return simplifiedName; |
1051 | 1051 | ||
1052 | case 1: | 1052 | case 1: |
1053 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1053 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1054 | strLastName = simplifiedName.left( spPos ); | 1054 | strLastName = simplifiedName.left( spPos ); |
1055 | strFirstName = simplifiedName.mid( spPos + 1 ); | 1055 | strFirstName = simplifiedName.mid( spPos + 1 ); |
1056 | break; | 1056 | break; |
1057 | 1057 | ||
1058 | case 2: | 1058 | case 2: |
1059 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1059 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1060 | strLastName = simplifiedName.left( spPos ); | 1060 | strLastName = simplifiedName.left( spPos ); |
1061 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1061 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1062 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1062 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1063 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); | 1063 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); |
1064 | break; | 1064 | break; |
1065 | 1065 | ||
1066 | case 3: | 1066 | case 3: |
1067 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1067 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1068 | strLastName = simplifiedName.left( spPos ); | 1068 | strLastName = simplifiedName.left( spPos ); |
1069 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1069 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1070 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1070 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1071 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1071 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1072 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 1072 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1073 | strSuffix = simplifiedName.mid( spPos + 1 ); | 1073 | strSuffix = simplifiedName.mid( spPos + 1 ); |
1074 | break; | 1074 | break; |
1075 | 1075 | ||
1076 | case 4: | 1076 | case 4: |
1077 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1077 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1078 | strLastName = simplifiedName.left( spPos ); | 1078 | strLastName = simplifiedName.left( spPos ); |
1079 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1079 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1080 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1080 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1081 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1081 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1082 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 1082 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1083 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1083 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1084 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1084 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1085 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1085 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1086 | break; | 1086 | break; |
1087 | 1087 | ||
1088 | default: | 1088 | default: |
1089 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1089 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1090 | strLastName = simplifiedName.left( spPos ); | 1090 | strLastName = simplifiedName.left( spPos ); |
1091 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1091 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1092 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1092 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1093 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1093 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1094 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 1094 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); |
1095 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1095 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1096 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1096 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1097 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1097 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1098 | break; | 1098 | break; |
1099 | } | 1099 | } |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | switch (type) { | 1102 | switch (type) { |
1103 | case NAME_FL: | 1103 | case NAME_FL: |
1104 | return strFirstName + " " + strLastName; | 1104 | return strFirstName + " " + strLastName; |
1105 | 1105 | ||
1106 | case NAME_LF: | 1106 | case NAME_LF: |
1107 | return strLastName + ", " + strFirstName; | 1107 | return strLastName + ", " + strFirstName; |
1108 | 1108 | ||
1109 | case NAME_LFM: | 1109 | case NAME_LFM: |
1110 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1110 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1111 | 1111 | ||
1112 | case NAME_FMLS: | 1112 | case NAME_FMLS: |
1113 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; | 1113 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; |
1114 | 1114 | ||
1115 | case NAME_F: | 1115 | case NAME_F: |
1116 | return strFirstName; | 1116 | return strFirstName; |
1117 | 1117 | ||
1118 | case NAME_M: | 1118 | case NAME_M: |
1119 | return strMiddleName; | 1119 | return strMiddleName; |
1120 | 1120 | ||
1121 | case NAME_L: | 1121 | case NAME_L: |
1122 | return strLastName; | 1122 | return strLastName; |
1123 | 1123 | ||
1124 | case NAME_S: | 1124 | case NAME_S: |
1125 | return strSuffix; | 1125 | return strSuffix; |
1126 | 1126 | ||
1127 | } | 1127 | } |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | void ContactEditor::cleanupFields() { | 1130 | void ContactEditor::cleanupFields() { |
1131 | 1131 | ||
1132 | QStringList::Iterator it = slChooserValues->begin(); | 1132 | QStringList::Iterator it = slChooserValues->begin(); |
1133 | for ( int i = 0; it != slChooserValues->end(); i++, ++it ) { | 1133 | for ( int i = 0; it != slChooserValues->end(); i++, ++it ) { |
1134 | (*it) = ""; | 1134 | (*it) = ""; |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | for ( int i = 0; i < 7; i++ ) { | 1137 | for ( int i = 0; i < 7; i++ ) { |
1138 | (*slHomeAddress)[i] = ""; | 1138 | (*slHomeAddress)[i] = ""; |
1139 | (*slBusinessAddress)[i] = ""; | 1139 | (*slBusinessAddress)[i] = ""; |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | QStringList::ConstIterator cit; | 1142 | QStringList::ConstIterator cit; |
1143 | QListIterator<QLineEdit> itLE( listValue ); | 1143 | QListIterator<QLineEdit> itLE( listValue ); |
1144 | for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) { | 1144 | for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) { |
1145 | (*itLE)->setText( "" ); | 1145 | (*itLE)->setText( "" ); |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | txtFirstName->setText(""); | 1148 | txtFirstName->setText(""); |
1149 | txtMiddleName->setText(""); | 1149 | txtMiddleName->setText(""); |
1150 | txtLastName->setText(""); | 1150 | txtLastName->setText(""); |
1151 | txtSuffix->setText(""); | 1151 | txtSuffix->setText(""); |
1152 | txtNote->setText(""); | 1152 | txtNote->setText(""); |
1153 | txtFullName->setText(""); | 1153 | txtFullName->setText(""); |
1154 | txtJobTitle->setText(""); | 1154 | txtJobTitle->setText(""); |
1155 | txtOrganization->setText(""); | 1155 | txtOrganization->setText(""); |
1156 | txtChooserField1->setText(""); | 1156 | txtChooserField1->setText(""); |
1157 | txtChooserField2->setText(""); | 1157 | txtChooserField2->setText(""); |
1158 | txtChooserField3->setText(""); | 1158 | txtChooserField3->setText(""); |
1159 | txtAddress->setText(""); | 1159 | txtAddress->setText(""); |
1160 | //txtAddress2->setText(""); | 1160 | //txtAddress2->setText(""); |
1161 | txtCity->setText(""); | 1161 | txtCity->setText(""); |
1162 | //txtPOBox->setText(""); | 1162 | //txtPOBox->setText(""); |
1163 | txtState->setText(""); | 1163 | txtState->setText(""); |
1164 | txtZip->setText(""); | 1164 | txtZip->setText(""); |
1165 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1165 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1166 | txtTmp->setText(""); | 1166 | txtTmp->setText(""); |
1167 | txtTmp = cmbFileAs->lineEdit(); | 1167 | txtTmp = cmbFileAs->lineEdit(); |
1168 | txtTmp->setText(""); | 1168 | txtTmp->setText(""); |
1169 | 1169 | ||
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | void ContactEditor::setEntry( const Contact &entry ) { | 1172 | void ContactEditor::setEntry( const Contact &entry ) { |
1173 | 1173 | ||
1174 | cleanupFields(); | 1174 | cleanupFields(); |
1175 | 1175 | ||
1176 | 1176 | ||
1177 | ent = entry; | 1177 | ent = entry; |
1178 | 1178 | ||
@@ -1286,192 +1286,193 @@ void ContactEditor::setEntry( const Contact &entry ) { | |||
1286 | 1286 | ||
1287 | if ( *it == "Business Mobile" || *it == "work Mobile" ) | 1287 | if ( *it == "Business Mobile" || *it == "work Mobile" ) |
1288 | *itV = ent.businessMobile(); | 1288 | *itV = ent.businessMobile(); |
1289 | /* | 1289 | /* |
1290 | if ( *it == "Company Phone" ) | 1290 | if ( *it == "Company Phone" ) |
1291 | *itV = ent.companyPhone(); | 1291 | *itV = ent.companyPhone(); |
1292 | */ | 1292 | */ |
1293 | if ( *it == "Default Email" ) | 1293 | if ( *it == "Default Email" ) |
1294 | *itV = ent.defaultEmail(); | 1294 | *itV = ent.defaultEmail(); |
1295 | 1295 | ||
1296 | if ( *it == "Emails" ) | 1296 | if ( *it == "Emails" ) |
1297 | *itV = ent.emails(); | 1297 | *itV = ent.emails(); |
1298 | 1298 | ||
1299 | if ( *it == "Home Phone" ) | 1299 | if ( *it == "Home Phone" ) |
1300 | *itV = ent.homePhone(); | 1300 | *itV = ent.homePhone(); |
1301 | /* | 1301 | /* |
1302 | if ( *it == "Home 2 Phone" ) | 1302 | if ( *it == "Home 2 Phone" ) |
1303 | *itV = ent.home2Phone(); | 1303 | *itV = ent.home2Phone(); |
1304 | */ | 1304 | */ |
1305 | if ( *it == "Home Fax" ) | 1305 | if ( *it == "Home Fax" ) |
1306 | *itV = ent.homeFax(); | 1306 | *itV = ent.homeFax(); |
1307 | 1307 | ||
1308 | if ( *it == "Home Mobile" ) | 1308 | if ( *it == "Home Mobile" ) |
1309 | *itV = ent.homeMobile(); | 1309 | *itV = ent.homeMobile(); |
1310 | /* | 1310 | /* |
1311 | if ( *it == "Car Phone" ) | 1311 | if ( *it == "Car Phone" ) |
1312 | *itV = ent.carPhone(); | 1312 | *itV = ent.carPhone(); |
1313 | 1313 | ||
1314 | if ( *it == "ISDN Phone" ) | 1314 | if ( *it == "ISDN Phone" ) |
1315 | *itV = ent.ISDNPhone(); | 1315 | *itV = ent.ISDNPhone(); |
1316 | 1316 | ||
1317 | if ( *it == "Other Phone" ) | 1317 | if ( *it == "Other Phone" ) |
1318 | *itV = ent.otherPhone(); | 1318 | *itV = ent.otherPhone(); |
1319 | */ | 1319 | */ |
1320 | if ( *it == "Business Pager" || *it == "Work Pager" ) | 1320 | if ( *it == "Business Pager" || *it == "Work Pager" ) |
1321 | *itV = ent.businessPager(); | 1321 | *itV = ent.businessPager(); |
1322 | /* | 1322 | /* |
1323 | if ( *it == "Home Pager") | 1323 | if ( *it == "Home Pager") |
1324 | *itV = ent.homePager(); | 1324 | *itV = ent.homePager(); |
1325 | 1325 | ||
1326 | if ( *it == "AIM IM" ) | 1326 | if ( *it == "AIM IM" ) |
1327 | *itV = ent.AIMIM(); | 1327 | *itV = ent.AIMIM(); |
1328 | 1328 | ||
1329 | if ( *it == "ICQ IM" ) | 1329 | if ( *it == "ICQ IM" ) |
1330 | *itV = ent.ICQIM(); | 1330 | *itV = ent.ICQIM(); |
1331 | 1331 | ||
1332 | if ( *it == "Jabber IM" ) | 1332 | if ( *it == "Jabber IM" ) |
1333 | *itV = ent.jabberIM(); | 1333 | *itV = ent.jabberIM(); |
1334 | 1334 | ||
1335 | if ( *it == "MSN IM" ) | 1335 | if ( *it == "MSN IM" ) |
1336 | *itV = ent.MSNIM(); | 1336 | *itV = ent.MSNIM(); |
1337 | 1337 | ||
1338 | if ( *it == "Yahoo IM" ) | 1338 | if ( *it == "Yahoo IM" ) |
1339 | *itV = ent.yahooIM(); | 1339 | *itV = ent.yahooIM(); |
1340 | */ | 1340 | */ |
1341 | if ( *it == "Home Web Page" ) | 1341 | if ( *it == "Home Web Page" ) |
1342 | *itV = ent.homeWebpage(); | 1342 | *itV = ent.homeWebpage(); |
1343 | if ( *it == "Business Web Page" || *it == "Work Web Page" ) | 1343 | if ( *it == "Business Web Page" || *it == "Work Web Page" ) |
1344 | *itV = ent.businessWebpage(); | 1344 | *itV = ent.businessWebpage(); |
1345 | 1345 | ||
1346 | 1346 | ||
1347 | } | 1347 | } |
1348 | 1348 | ||
1349 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1349 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1350 | 1350 | ||
1351 | QString gender = ent.gender(); | 1351 | QString gender = ent.gender(); |
1352 | cmbGender->setCurrentItem( gender.toInt() ); | 1352 | cmbGender->setCurrentItem( gender.toInt() ); |
1353 | 1353 | ||
1354 | txtNote->setText( ent.notes() ); | 1354 | txtNote->setText( ent.notes() ); |
1355 | 1355 | ||
1356 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1356 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1357 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1357 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1358 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1358 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1359 | 1359 | ||
1360 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1360 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1361 | 1361 | ||
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | void ContactEditor::saveEntry() { | 1364 | void ContactEditor::saveEntry() { |
1365 | 1365 | ||
1366 | if ( useFullName == TRUE ) { | 1366 | if ( useFullName == TRUE ) { |
1367 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1367 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1368 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1368 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1369 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1369 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1370 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1370 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1371 | 1371 | ||
1372 | useFullName = FALSE; | 1372 | useFullName = FALSE; |
1373 | } | 1373 | } |
1374 | 1374 | ||
1375 | /*if ( ent.firstName() != txtFirstName->text() || | 1375 | /*if ( ent.firstName() != txtFirstName->text() || |
1376 | ent.lastName != txtLastName->text() || | 1376 | ent.lastName != txtLastName->text() || |
1377 | ent.middleName != txtMiddleName->text() ) { | 1377 | ent.middleName != txtMiddleName->text() ) { |
1378 | */ | 1378 | */ |
1379 | ent.setFirstName( txtFirstName->text() ); | 1379 | ent.setFirstName( txtFirstName->text() ); |
1380 | ent.setLastName( txtLastName->text() ); | 1380 | ent.setLastName( txtLastName->text() ); |
1381 | ent.setMiddleName( txtMiddleName->text() ); | 1381 | ent.setMiddleName( txtMiddleName->text() ); |
1382 | ent.setSuffix( txtSuffix->text() ); | ||
1382 | 1383 | ||
1383 | //} | 1384 | //} |
1384 | 1385 | ||
1385 | ent.setFileAs( cmbFileAs->currentText() ); | 1386 | ent.setFileAs( cmbFileAs->currentText() ); |
1386 | 1387 | ||
1387 | ent.setCategories( cmbCat->currentCategories() ); | 1388 | ent.setCategories( cmbCat->currentCategories() ); |
1388 | 1389 | ||
1389 | if (hasTitle) | 1390 | if (hasTitle) |
1390 | ent.setJobTitle( txtJobTitle->text() ); | 1391 | ent.setJobTitle( txtJobTitle->text() ); |
1391 | 1392 | ||
1392 | if (hasCompany) | 1393 | if (hasCompany) |
1393 | ent.setCompany( txtOrganization->text() ); | 1394 | ent.setCompany( txtOrganization->text() ); |
1394 | 1395 | ||
1395 | if (hasNotes) | 1396 | if (hasNotes) |
1396 | ent.setNotes( txtNote->text() ); | 1397 | ent.setNotes( txtNote->text() ); |
1397 | 1398 | ||
1398 | if (hasStreet) { | 1399 | if (hasStreet) { |
1399 | ent.setHomeStreet( (*slHomeAddress)[0] ); | 1400 | ent.setHomeStreet( (*slHomeAddress)[0] ); |
1400 | ent.setBusinessStreet( (*slBusinessAddress)[0] ); | 1401 | ent.setBusinessStreet( (*slBusinessAddress)[0] ); |
1401 | } | 1402 | } |
1402 | /* | 1403 | /* |
1403 | if (hasStreet2) { | 1404 | if (hasStreet2) { |
1404 | ent.setHomeStreet2( (*slHomeAddress)[1] ); | 1405 | ent.setHomeStreet2( (*slHomeAddress)[1] ); |
1405 | ent.setBusinessStreet2( (*slBusinessAddress)[1] ); | 1406 | ent.setBusinessStreet2( (*slBusinessAddress)[1] ); |
1406 | } | 1407 | } |
1407 | 1408 | ||
1408 | if (hasPOBox) { | 1409 | if (hasPOBox) { |
1409 | ent.setHomePOBox( (*slHomeAddress)[2] ); | 1410 | ent.setHomePOBox( (*slHomeAddress)[2] ); |
1410 | ent.setBusinessPOBox( (*slBusinessAddress)[2] ); | 1411 | ent.setBusinessPOBox( (*slBusinessAddress)[2] ); |
1411 | } | 1412 | } |
1412 | */ | 1413 | */ |
1413 | if (hasCity) { | 1414 | if (hasCity) { |
1414 | ent.setHomeCity( (*slHomeAddress)[3] ); | 1415 | ent.setHomeCity( (*slHomeAddress)[3] ); |
1415 | ent.setBusinessCity( (*slBusinessAddress)[3] ); | 1416 | ent.setBusinessCity( (*slBusinessAddress)[3] ); |
1416 | } | 1417 | } |
1417 | 1418 | ||
1418 | if (hasState) { | 1419 | if (hasState) { |
1419 | ent.setHomeState( (*slHomeAddress)[4] ); | 1420 | ent.setHomeState( (*slHomeAddress)[4] ); |
1420 | ent.setBusinessState( (*slBusinessAddress)[4] ); | 1421 | ent.setBusinessState( (*slBusinessAddress)[4] ); |
1421 | } | 1422 | } |
1422 | 1423 | ||
1423 | if (hasZip) { | 1424 | if (hasZip) { |
1424 | ent.setHomeZip( (*slHomeAddress)[5] ); | 1425 | ent.setHomeZip( (*slHomeAddress)[5] ); |
1425 | ent.setBusinessZip( (*slBusinessAddress)[5] ); | 1426 | ent.setBusinessZip( (*slBusinessAddress)[5] ); |
1426 | } | 1427 | } |
1427 | 1428 | ||
1428 | if (hasCountry) { | 1429 | if (hasCountry) { |
1429 | ent.setHomeCountry( (*slHomeAddress)[6] ); | 1430 | ent.setHomeCountry( (*slHomeAddress)[6] ); |
1430 | ent.setBusinessCountry( (*slBusinessAddress)[6] ); | 1431 | ent.setBusinessCountry( (*slBusinessAddress)[6] ); |
1431 | } | 1432 | } |
1432 | 1433 | ||
1433 | QStringList::ConstIterator it; | 1434 | QStringList::ConstIterator it; |
1434 | QListIterator<QLineEdit> itLE( listValue ); | 1435 | QListIterator<QLineEdit> itLE( listValue ); |
1435 | for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { | 1436 | for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { |
1436 | if ( *it == "Department" ) | 1437 | if ( *it == "Department" ) |
1437 | ent.setDepartment( (*itLE)->text() ); | 1438 | ent.setDepartment( (*itLE)->text() ); |
1438 | 1439 | ||
1439 | if ( *it == "Company" ) | 1440 | if ( *it == "Company" ) |
1440 | ent.setCompany( (*itLE)->text() ); | 1441 | ent.setCompany( (*itLE)->text() ); |
1441 | 1442 | ||
1442 | if ( *it == "Office" ) | 1443 | if ( *it == "Office" ) |
1443 | ent.setOffice( (*itLE)->text() ); | 1444 | ent.setOffice( (*itLE)->text() ); |
1444 | 1445 | ||
1445 | if ( *it == "Profession" ) | 1446 | if ( *it == "Profession" ) |
1446 | ent.setProfession( (*itLE)->text() ); | 1447 | ent.setProfession( (*itLE)->text() ); |
1447 | 1448 | ||
1448 | if ( *it == "Assistant" ) | 1449 | if ( *it == "Assistant" ) |
1449 | ent.setAssistant( (*itLE)->text() ); | 1450 | ent.setAssistant( (*itLE)->text() ); |
1450 | 1451 | ||
1451 | if ( *it == "Manager" ) | 1452 | if ( *it == "Manager" ) |
1452 | ent.setManager( (*itLE)->text() ); | 1453 | ent.setManager( (*itLE)->text() ); |
1453 | 1454 | ||
1454 | if ( *it == "Spouse" ) | 1455 | if ( *it == "Spouse" ) |
1455 | ent.setSpouse( (*itLE)->text() ); | 1456 | ent.setSpouse( (*itLE)->text() ); |
1456 | 1457 | ||
1457 | if ( *it == "Birthday" ) | 1458 | if ( *it == "Birthday" ) |
1458 | ent.setBirthday( (*itLE)->text() ); | 1459 | ent.setBirthday( (*itLE)->text() ); |
1459 | 1460 | ||
1460 | if ( *it == "Anniversary" ) | 1461 | if ( *it == "Anniversary" ) |
1461 | ent.setAnniversary( (*itLE)->text() ); | 1462 | ent.setAnniversary( (*itLE)->text() ); |
1462 | 1463 | ||
1463 | if ( *it == "Nickname" ) | 1464 | if ( *it == "Nickname" ) |
1464 | ent.setNickname( (*itLE)->text() ); | 1465 | ent.setNickname( (*itLE)->text() ); |
1465 | 1466 | ||
1466 | if ( *it == "Children" ) | 1467 | if ( *it == "Children" ) |
1467 | ent.setChildren( (*itLE)->text() ); | 1468 | ent.setChildren( (*itLE)->text() ); |
1468 | 1469 | ||
1469 | } | 1470 | } |
1470 | 1471 | ||
1471 | QStringList::ConstIterator itV; | 1472 | QStringList::ConstIterator itV; |
1472 | for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { | 1473 | for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { |
1473 | 1474 | ||
1474 | if ( *it == "Business Phone" || *it == "Work Phone" ) | 1475 | if ( *it == "Business Phone" || *it == "Work Phone" ) |
1475 | ent.setBusinessPhone( *itV ); | 1476 | ent.setBusinessPhone( *itV ); |
1476 | /* | 1477 | /* |
1477 | if ( *it == "Business 2 Phone" ) | 1478 | if ( *it == "Business 2 Phone" ) |