-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 218 |
1 files changed, 156 insertions, 62 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index fa60f98..d419142 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -96,79 +96,113 @@ void ContactEditor::init() { | |||
96 | hasNotes = FALSE; | 96 | hasNotes = FALSE; |
97 | hasStreet = FALSE; | 97 | hasStreet = FALSE; |
98 | hasStreet2 = FALSE; | 98 | hasStreet2 = FALSE; |
99 | hasPOBox = FALSE; | 99 | hasPOBox = FALSE; |
100 | hasCity = FALSE; | 100 | hasCity = FALSE; |
101 | hasState = FALSE; | 101 | hasState = FALSE; |
102 | hasZip = FALSE; | 102 | hasZip = FALSE; |
103 | hasCountry = FALSE; | 103 | hasCountry = FALSE; |
104 | 104 | ||
105 | QStringList::ConstIterator it = slOrdered.begin(); | 105 | QStringList::ConstIterator it = slOrdered.begin(); |
106 | for ( i = 0; it != slOrdered.end(); i++, ++it ) { | 106 | for ( i = 0; it != slOrdered.end(); i++, ++it ) { |
107 | 107 | ||
108 | if ( (*it).right( 3 ) == tr( "Fax" ) ) { | 108 | if ( (*it) == tr( "Business Fax" ) ) { |
109 | slChooserNames.append( *it ); | 109 | slChooserNames.append( *it ); |
110 | slChooserValues.append("" ); | 110 | slChooserValues.append("" ); |
111 | //slDynamicEntries->remove( it ); | 111 | //slDynamicEntries->remove( it ); |
112 | continue; | 112 | continue; |
113 | } | 113 | } |
114 | |||
115 | if ( (*it) == tr( "Home Fax" ) ) { | ||
116 | slChooserNames.append( *it ); | ||
117 | slChooserValues.append("" ); | ||
118 | //slDynamicEntries->remove( it ); | ||
119 | continue; | ||
120 | } | ||
121 | |||
114 | 122 | ||
115 | if ( (*it).right( 5 ) == tr( "Phone" ) ) { | 123 | if ( (*it) == tr( "Business Phone" ) ) { |
116 | slChooserNames.append( *it ); | 124 | slChooserNames.append( *it ); |
117 | slChooserValues.append( "" ); | 125 | slChooserValues.append( "" ); |
118 | //slDynamicEntries->remove( it ); | 126 | //slDynamicEntries->remove( it ); |
119 | continue; | 127 | continue; |
120 | } | 128 | } |
121 | 129 | ||
130 | if ( (*it) == tr( "Home Phone" ) ) { | ||
131 | slChooserNames.append( *it ); | ||
132 | slChooserValues.append( "" ); | ||
133 | //slDynamicEntries->remove( it ); | ||
134 | continue; | ||
135 | } | ||
136 | |||
137 | /* | ||
122 | if ( (*it).right( 2 ) == tr( "IM" ) ) { | 138 | if ( (*it).right( 2 ) == tr( "IM" ) ) { |
123 | slChooserNames.append( *it ); | 139 | slChooserNames.append( *it ); |
124 | slChooserValues.append( "" ); | 140 | slChooserValues.append( "" ); |
125 | //slDynamicEntries->remove( it ); | 141 | //slDynamicEntries->remove( it ); |
126 | continue; | 142 | continue; |
143 | } */ | ||
144 | |||
145 | if ( (*it) == tr( "Business Mobile" ) ) { | ||
146 | slChooserNames.append( *it ); | ||
147 | slChooserValues.append( "" ); | ||
148 | //slDynamicEntries->remove( it ); | ||
149 | continue; | ||
150 | } | ||
151 | |||
152 | if ( (*it) == tr( "Home Mobile" ) ) { | ||
153 | slChooserNames.append( *it ); | ||
154 | slChooserValues.append( "" ); | ||
155 | //slDynamicEntries->remove( it ); | ||
156 | continue; | ||
127 | } | 157 | } |
128 | 158 | ||
129 | if ( (*it).right( 6 ) == tr( "Mobile" ) ) { | 159 | |
160 | if ( (*it) == tr( "Business WebPage" ) ) { | ||
130 | slChooserNames.append( *it ); | 161 | slChooserNames.append( *it ); |
131 | slChooserValues.append( "" ); | 162 | slChooserValues.append( "" ); |
132 | //slDynamicEntries->remove( it ); | 163 | //slDynamicEntries->remove( it ); |
133 | continue; | 164 | continue; |
134 | } | 165 | } |
135 | 166 | ||
136 | if ( (*it).right( 4 ) == tr( "Page" ) ) { | 167 | if ( (*it) == tr( "Home Web Page" ) ) { |
137 | slChooserNames.append( *it ); | 168 | slChooserNames.append( *it ); |
138 | slChooserValues.append( "" ); | 169 | slChooserValues.append( "" ); |
139 | //slDynamicEntries->remove( it ); | 170 | //slDynamicEntries->remove( it ); |
140 | continue; | 171 | continue; |
141 | } | 172 | } |
142 | 173 | ||
143 | if ( (*it).right( 5 ) == tr( "Pager" ) ) { | 174 | if ( (*it) == tr( "Business Pager" ) ) { |
144 | slChooserNames.append( *it ); | 175 | slChooserNames.append( *it ); |
145 | slChooserValues.append( "" ); | 176 | slChooserValues.append( "" ); |
146 | //slDynamicEntries->remove( it ); | 177 | //slDynamicEntries->remove( it ); |
147 | continue; | 178 | continue; |
148 | } | 179 | } |
149 | 180 | ||
150 | if ( *it == tr( "Default Email" ) ) { | 181 | if ( *it == tr( "Default Email" ) ) { |
151 | slChooserNames.append( *it ); | 182 | slChooserNames.append( *it ); |
152 | slChooserValues.append( "" ); | 183 | slChooserValues.append( "" ); |
153 | //slDynamicEntries->remove( it ); | 184 | //slDynamicEntries->remove( it ); |
154 | continue; | 185 | continue; |
155 | } | 186 | } |
156 | 187 | ||
157 | if ( *it == tr( "Emails" ) ) { | 188 | if ( *it == tr( "Emails" ) ) { |
158 | slChooserNames.append( *it ); | 189 | slChooserNames.append( *it ); |
159 | slChooserValues.append( "" ); | 190 | slChooserValues.append( "" ); |
160 | //slDynamicEntries->remove( it ); | 191 | //slDynamicEntries->remove( it ); |
161 | continue; | 192 | continue; |
162 | } | 193 | } |
194 | |||
195 | if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" ) | ||
196 | continue; | ||
163 | 197 | ||
164 | if ( *it == tr( "Name Title" ) ) { | 198 | if ( *it == tr( "Name Title" ) ) { |
165 | //slDynamicEntries->remove( it ); | 199 | //slDynamicEntries->remove( it ); |
166 | continue; | 200 | continue; |
167 | } | 201 | } |
168 | 202 | ||
169 | if ( *it == tr( "First Name" ) ) { | 203 | if ( *it == tr( "First Name" ) ) { |
170 | //slDynamicEntries->remove( it ); | 204 | //slDynamicEntries->remove( it ); |
171 | continue; | 205 | continue; |
172 | } | 206 | } |
173 | 207 | ||
174 | if ( *it == tr( "Middle Name" ) ) { | 208 | if ( *it == tr( "Middle Name" ) ) { |
@@ -194,83 +228,114 @@ void ContactEditor::init() { | |||
194 | if ( *it == tr( "Gender" ) ) { | 228 | if ( *it == tr( "Gender" ) ) { |
195 | hasGender = TRUE; | 229 | hasGender = TRUE; |
196 | //slDynamicEntries->remove( it ); | 230 | //slDynamicEntries->remove( it ); |
197 | continue; | 231 | continue; |
198 | } | 232 | } |
199 | 233 | ||
200 | if ( *it == tr( "Job Title" ) ) { | 234 | if ( *it == tr( "Job Title" ) ) { |
201 | hasTitle = TRUE; | 235 | hasTitle = TRUE; |
202 | //slDynamicEntries->remove( it ); | 236 | //slDynamicEntries->remove( it ); |
203 | continue; | 237 | continue; |
204 | } | 238 | } |
205 | 239 | ||
206 | if ( *it == tr( "Company" ) ) { | 240 | if ( *it == tr( "Company") || *it == tr( "Organization" ) ) { |
207 | hasCompany = TRUE; | 241 | hasCompany = TRUE; |
208 | //slDynamicEntries->remove( it ); | 242 | //slDynamicEntries->remove( it ); |
209 | continue; | 243 | continue; |
210 | } | 244 | } |
211 | 245 | ||
212 | if ( *it == tr( "Notes" ) ) { | 246 | if ( *it == tr( "Notes" ) ) { |
213 | hasNotes = TRUE; | 247 | hasNotes = TRUE; |
214 | //slDynamicEntries->remove( it ); | 248 | //slDynamicEntries->remove( it ); |
215 | continue; | 249 | continue; |
216 | } | 250 | } |
217 | 251 | ||
218 | if ( *it == tr( "Groups" ) ) { | 252 | if ( *it == tr( "Groups" ) ) { |
219 | //slDynamicEntries->remove( it ); | 253 | //slDynamicEntries->remove( it ); |
220 | continue; | 254 | continue; |
221 | } | 255 | } |
222 | 256 | ||
223 | if ( (*it).right( 6 ) == tr( "Street" ) ) { | 257 | if ( (*it) == tr( "Business Street" ) ) { |
224 | hasStreet = TRUE; | 258 | hasStreet = TRUE; |
225 | //slDynamicEntries->remove( it ); | 259 | //slDynamicEntries->remove( it ); |
226 | continue; | 260 | continue; |
227 | } | 261 | } |
228 | 262 | ||
263 | if ( (*it) == tr( "Home Street" ) ) { | ||
264 | hasStreet = TRUE; | ||
265 | //slDynamicEntries->remove( it ); | ||
266 | continue; | ||
267 | } | ||
268 | /* | ||
229 | if ( (*it).right( 8 ) == tr( "Street 2" ) ) { | 269 | if ( (*it).right( 8 ) == tr( "Street 2" ) ) { |
230 | hasStreet2 = TRUE; | 270 | hasStreet2 = TRUE; |
231 | //slDynamicEntries->remove( it ); | 271 | //slDynamicEntries->remove( it ); |
232 | continue; | 272 | continue; |
233 | } | 273 | } |
234 | 274 | ||
235 | if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { | 275 | if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { |
236 | hasPOBox = TRUE; | 276 | hasPOBox = TRUE; |
237 | //slDynamicEntries->remove( it ); | 277 | //slDynamicEntries->remove( it ); |
238 | continue; | 278 | continue; |
279 | } */ | ||
280 | |||
281 | if ( (*it) == tr( "Business City" ) ) { | ||
282 | hasCity = TRUE; | ||
283 | //slDynamicEntries->remove( it ); | ||
284 | continue; | ||
285 | } | ||
286 | |||
287 | if ( (*it) == tr( "Business State" ) ) { | ||
288 | hasState = TRUE; | ||
289 | //slDynamicEntries->remove( it ); | ||
290 | continue; | ||
291 | } | ||
292 | |||
293 | if ( (*it) == tr( "Business Zip" ) ) { | ||
294 | hasZip = TRUE; | ||
295 | //slDynamicEntries->remove( it ); | ||
296 | continue; | ||
297 | } | ||
298 | |||
299 | if ( (*it) == tr( "Business Country" ) ) { | ||
300 | hasCountry = TRUE; | ||
301 | //slDynamicEntries->remove( it ); | ||
302 | continue; | ||
239 | } | 303 | } |
240 | 304 | ||
241 | if ( (*it).right( 4 ) == tr( "City" ) ) { | 305 | if ( (*it) == tr( "Home City" ) ) { |
242 | hasCity = TRUE; | 306 | hasCity = TRUE; |
243 | //slDynamicEntries->remove( it ); | 307 | //slDynamicEntries->remove( it ); |
244 | continue; | 308 | continue; |
245 | } | 309 | } |
246 | 310 | ||
247 | if ( (*it).right( 5 ) == tr( "State" ) ) { | 311 | if ( (*it) == tr( "Home State" ) ) { |
248 | hasState = TRUE; | 312 | hasState = TRUE; |
249 | //slDynamicEntries->remove( it ); | 313 | //slDynamicEntries->remove( it ); |
250 | continue; | 314 | continue; |
251 | } | 315 | } |
252 | 316 | ||
253 | if ( (*it).right( 3 ) == tr( "Zip" ) ) { | 317 | if ( (*it) == tr( "Home Zip" ) ) { |
254 | hasZip = TRUE; | 318 | hasZip = TRUE; |
255 | //slDynamicEntries->remove( it ); | 319 | //slDynamicEntries->remove( it ); |
256 | continue; | 320 | continue; |
257 | } | 321 | } |
258 | 322 | ||
259 | if ( (*it).right( 7 ) == tr( "Country" ) ) { | 323 | if ( (*it) == tr( "Home Country" ) ) { |
260 | hasCountry = TRUE; | 324 | hasCountry = TRUE; |
261 | //slDynamicEntries->remove( it ); | 325 | //slDynamicEntries->remove( it ); |
262 | continue; | 326 | continue; |
263 | } | 327 | } |
264 | 328 | ||
329 | |||
265 | slDynamicEntries.append( *it ); | 330 | slDynamicEntries.append( *it ); |
266 | } | 331 | } |
267 | } | 332 | } |
268 | 333 | ||
269 | QVBoxLayout *vb = new QVBoxLayout( this ); | 334 | QVBoxLayout *vb = new QVBoxLayout( this ); |
270 | 335 | ||
271 | tabMain = new QTabWidget( this ); | 336 | tabMain = new QTabWidget( this ); |
272 | vb->addWidget( tabMain ); | 337 | vb->addWidget( tabMain ); |
273 | 338 | ||
274 | QWidget *tabViewport = new QWidget ( tabMain ); | 339 | QWidget *tabViewport = new QWidget ( tabMain ); |
275 | 340 | ||
276 | vb = new QVBoxLayout( tabViewport ); | 341 | vb = new QVBoxLayout( tabViewport ); |
@@ -951,34 +1016,36 @@ void ContactEditor::accept() { | |||
951 | } | 1016 | } |
952 | 1017 | ||
953 | void ContactEditor::slotNote() { | 1018 | void ContactEditor::slotNote() { |
954 | 1019 | ||
955 | dlgNote->showMaximized(); | 1020 | dlgNote->showMaximized(); |
956 | if ( !dlgNote->exec() ) { | 1021 | if ( !dlgNote->exec() ) { |
957 | txtNote->setText( ent.notes() ); | 1022 | txtNote->setText( ent.notes() ); |
958 | } | 1023 | } |
959 | } | 1024 | } |
960 | 1025 | ||
961 | void ContactEditor::slotName() { | 1026 | void ContactEditor::slotName() { |
962 | 1027 | ||
963 | if (useFullName = TRUE) { | 1028 | QString tmpName; |
1029 | if (useFullName == TRUE) { | ||
964 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1030 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
965 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1031 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
966 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1032 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
967 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1033 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
968 | } | 1034 | } |
969 | |||
970 | dlgName->showMaximized(); | 1035 | dlgName->showMaximized(); |
971 | if ( dlgName->exec() ) { | 1036 | if ( dlgName->exec() ) { |
972 | txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() ); | 1037 | |
1038 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); | ||
1039 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | ||
973 | slotFullNameChange( txtFullName->text() ); | 1040 | slotFullNameChange( txtFullName->text() ); |
974 | useFullName = FALSE; | 1041 | useFullName = FALSE; |
975 | } | 1042 | } |
976 | 1043 | ||
977 | } | 1044 | } |
978 | 1045 | ||
979 | void ContactEditor::setNameFocus() { | 1046 | void ContactEditor::setNameFocus() { |
980 | 1047 | ||
981 | txtFullName->setFocus(); | 1048 | txtFullName->setFocus(); |
982 | 1049 | ||
983 | } | 1050 | } |
984 | 1051 | ||
@@ -1010,25 +1077,39 @@ QString ContactEditor::parseName( const QString fullName, int type ) { | |||
1010 | int spCount; | 1077 | int spCount; |
1011 | int spPos; | 1078 | int spPos; |
1012 | int spPos2; | 1079 | int spPos2; |
1013 | 1080 | ||
1014 | 1081 | ||
1015 | commapos = simplifiedName.find( ',', 0, TRUE); | 1082 | commapos = simplifiedName.find( ',', 0, TRUE); |
1016 | spCount = simplifiedName.contains( ' ', TRUE ); | 1083 | spCount = simplifiedName.contains( ' ', TRUE ); |
1017 | 1084 | ||
1018 | if ( commapos == -1 ) { | 1085 | if ( commapos == -1 ) { |
1019 | 1086 | ||
1020 | switch (spCount) { | 1087 | switch (spCount) { |
1021 | case 0: | 1088 | case 0: |
1022 | return simplifiedName; | 1089 | //return simplifiedName; |
1090 | if (txtLastName->text() != "") { | ||
1091 | strLastName = simplifiedName; | ||
1092 | break; | ||
1093 | } | ||
1094 | if (txtMiddleName->text() != "") { | ||
1095 | strMiddleName = simplifiedName; | ||
1096 | break; | ||
1097 | } | ||
1098 | if (txtSuffix->text() != "") { | ||
1099 | strSuffix = simplifiedName; | ||
1100 | break; | ||
1101 | } | ||
1102 | strFirstName = simplifiedName; | ||
1103 | break; | ||
1023 | 1104 | ||
1024 | case 1: | 1105 | case 1: |
1025 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1106 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1026 | strFirstName = simplifiedName.left( spPos ); | 1107 | strFirstName = simplifiedName.left( spPos ); |
1027 | strLastName = simplifiedName.mid( spPos + 1 ); | 1108 | strLastName = simplifiedName.mid( spPos + 1 ); |
1028 | break; | 1109 | break; |
1029 | 1110 | ||
1030 | case 2: | 1111 | case 2: |
1031 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1112 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1032 | strFirstName = simplifiedName.left( spPos ); | 1113 | strFirstName = simplifiedName.left( spPos ); |
1033 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1114 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1034 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1115 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
@@ -1066,25 +1147,39 @@ QString ContactEditor::parseName( const QString fullName, int type ) { | |||
1066 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); | 1147 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); |
1067 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1148 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1068 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1149 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1069 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1150 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1070 | break; | 1151 | break; |
1071 | } | 1152 | } |
1072 | } else { | 1153 | } else { |
1073 | simplifiedName.replace( commapos, 1, " " ); | 1154 | simplifiedName.replace( commapos, 1, " " ); |
1074 | simplifiedName = simplifiedName.simplifyWhiteSpace(); | 1155 | simplifiedName = simplifiedName.simplifyWhiteSpace(); |
1075 | 1156 | ||
1076 | switch (spCount) { | 1157 | switch (spCount) { |
1077 | case 0: | 1158 | case 0: |
1078 | return simplifiedName; | 1159 | //return simplifiedName; |
1160 | if (txtLastName->text() != "") { | ||
1161 | strLastName = simplifiedName; | ||
1162 | break; | ||
1163 | } | ||
1164 | if (txtMiddleName->text() != "") { | ||
1165 | strMiddleName = simplifiedName; | ||
1166 | break; | ||
1167 | } | ||
1168 | if (txtSuffix->text() != "") { | ||
1169 | strSuffix = simplifiedName; | ||
1170 | break; | ||
1171 | } | ||
1172 | strFirstName = simplifiedName; | ||
1173 | break; | ||
1079 | 1174 | ||
1080 | case 1: | 1175 | case 1: |
1081 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1176 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1082 | strLastName = simplifiedName.left( spPos ); | 1177 | strLastName = simplifiedName.left( spPos ); |
1083 | strFirstName = simplifiedName.mid( spPos + 1 ); | 1178 | strFirstName = simplifiedName.mid( spPos + 1 ); |
1084 | break; | 1179 | break; |
1085 | 1180 | ||
1086 | case 2: | 1181 | case 2: |
1087 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1182 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1088 | strLastName = simplifiedName.left( spPos ); | 1183 | strLastName = simplifiedName.left( spPos ); |
1089 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1184 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1090 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1185 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
@@ -1117,25 +1212,24 @@ QString ContactEditor::parseName( const QString fullName, int type ) { | |||
1117 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1212 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1118 | strLastName = simplifiedName.left( spPos ); | 1213 | strLastName = simplifiedName.left( spPos ); |
1119 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1214 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1120 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1215 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1121 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 1216 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
1122 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 1217 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); |
1123 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 1218 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
1124 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 1219 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
1125 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 1220 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
1126 | break; | 1221 | break; |
1127 | } | 1222 | } |
1128 | } | 1223 | } |
1129 | |||
1130 | switch (type) { | 1224 | switch (type) { |
1131 | case NAME_FL: | 1225 | case NAME_FL: |
1132 | return strFirstName + " " + strLastName; | 1226 | return strFirstName + " " + strLastName; |
1133 | 1227 | ||
1134 | case NAME_LF: | 1228 | case NAME_LF: |
1135 | return strLastName + ", " + strFirstName; | 1229 | return strLastName + ", " + strFirstName; |
1136 | 1230 | ||
1137 | case NAME_LFM: | 1231 | case NAME_LFM: |
1138 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1232 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1139 | 1233 | ||
1140 | case NAME_FMLS: | 1234 | case NAME_FMLS: |
1141 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; | 1235 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; |
@@ -1257,128 +1351,128 @@ void ContactEditor::setEntry( const Contact &entry ) { | |||
1257 | slHomeAddress[5] = ent.homeZip(); | 1351 | slHomeAddress[5] = ent.homeZip(); |
1258 | slBusinessAddress[5] = ent.businessZip(); | 1352 | slBusinessAddress[5] = ent.businessZip(); |
1259 | } | 1353 | } |
1260 | 1354 | ||
1261 | if (hasCountry) { | 1355 | if (hasCountry) { |
1262 | slHomeAddress[6] = ent.homeCountry(); | 1356 | slHomeAddress[6] = ent.homeCountry(); |
1263 | slBusinessAddress[6] = ent.businessCountry(); | 1357 | slBusinessAddress[6] = ent.businessCountry(); |
1264 | } | 1358 | } |
1265 | 1359 | ||
1266 | QStringList::ConstIterator it; | 1360 | QStringList::ConstIterator it; |
1267 | QListIterator<QLineEdit> itLE( listValue ); | 1361 | QListIterator<QLineEdit> itLE( listValue ); |
1268 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { | 1362 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { |
1269 | if ( *it == "Department" ) | 1363 | if ( *it == tr("Department") ) |
1270 | (*itLE)->setText( ent.department() ); | 1364 | (*itLE)->setText( ent.department() ); |
1271 | 1365 | ||
1272 | if ( *it == "Company" ) | 1366 | if ( *it == tr("Company" )) |
1273 | (*itLE)->setText( ent.company() ); | 1367 | (*itLE)->setText( ent.company() ); |
1274 | 1368 | ||
1275 | if ( *it == "Office" ) | 1369 | if ( *it == tr("Office" )) |
1276 | (*itLE)->setText( ent.office() ); | 1370 | (*itLE)->setText( ent.office() ); |
1277 | 1371 | ||
1278 | if ( *it == "Profession" ) | 1372 | if ( *it == tr("Profession" )) |
1279 | (*itLE)->setText( ent.profession() ); | 1373 | (*itLE)->setText( ent.profession() ); |
1280 | 1374 | ||
1281 | if ( *it == "Assistant" ) | 1375 | if ( *it == tr("Assistant" )) |
1282 | (*itLE)->setText( ent.assistant() ); | 1376 | (*itLE)->setText( ent.assistant() ); |
1283 | 1377 | ||
1284 | if ( *it == "Manager" ) | 1378 | if ( *it == tr("Manager" )) |
1285 | (*itLE)->setText( ent.manager() ); | 1379 | (*itLE)->setText( ent.manager() ); |
1286 | 1380 | ||
1287 | if ( *it == "Spouse" ) | 1381 | if ( *it == tr("Spouse" )) |
1288 | (*itLE)->setText( ent.spouse() ); | 1382 | (*itLE)->setText( ent.spouse() ); |
1289 | 1383 | ||
1290 | if ( *it == "Birthday" ) | 1384 | if ( *it == tr("Birthday" )) |
1291 | (*itLE)->setText( ent.birthday() ); | 1385 | (*itLE)->setText( ent.birthday() ); |
1292 | 1386 | ||
1293 | if ( *it == "Anniversary" ) | 1387 | if ( *it == tr("Anniversary" )) |
1294 | (*itLE)->setText( ent.anniversary() ); | 1388 | (*itLE)->setText( ent.anniversary() ); |
1295 | 1389 | ||
1296 | if ( *it == "Nickname" ) | 1390 | if ( *it == tr("Nickname" )) |
1297 | (*itLE)->setText( ent.nickname() ); | 1391 | (*itLE)->setText( ent.nickname() ); |
1298 | 1392 | ||
1299 | if ( *it == "Children" ) | 1393 | if ( *it == tr("Children" )) |
1300 | (*itLE)->setText( ent.children() ); | 1394 | (*itLE)->setText( ent.children() ); |
1301 | 1395 | ||
1302 | } | 1396 | } |
1303 | 1397 | ||
1304 | QStringList::Iterator itV; | 1398 | QStringList::Iterator itV; |
1305 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1399 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1306 | 1400 | ||
1307 | if ( *it == "Business Phone" || *it == "Work Phone" ) | 1401 | if ( *it == tr("Business Phone") || *it == tr("Work Phone" )) |
1308 | *itV = ent.businessPhone(); | 1402 | *itV = ent.businessPhone(); |
1309 | /* | 1403 | /* |
1310 | if ( *it == "Business 2 Phone" ) | 1404 | if ( *it == "Business 2 Phone" ) |
1311 | *itV = ent.business2Phone(); | 1405 | *itV = ent.business2Phone(); |
1312 | */ | 1406 | */ |
1313 | if ( *it == "Business Fax" || *it == "Work Fax" ) | 1407 | if ( *it == tr("Business Fax") || *it == tr("Work Fax" )) |
1314 | *itV = ent.businessFax(); | 1408 | *itV = ent.businessFax(); |
1315 | 1409 | ||
1316 | if ( *it == "Business Mobile" || *it == "work Mobile" ) | 1410 | if ( *it == tr("Business Mobile") || *it == tr("work Mobile" )) |
1317 | *itV = ent.businessMobile(); | 1411 | *itV = ent.businessMobile(); |
1318 | /* | 1412 | /* |
1319 | if ( *it == "Company Phone" ) | 1413 | if ( *it == "Company Phone" ) |
1320 | *itV = ent.companyPhone(); | 1414 | *itV = ent.companyPhone(); |
1321 | */ | 1415 | */ |
1322 | if ( *it == "Default Email" ) | 1416 | if ( *it == tr("Default Email" )) |
1323 | *itV = ent.defaultEmail(); | 1417 | *itV = ent.defaultEmail(); |
1324 | 1418 | ||
1325 | if ( *it == "Emails" ) | 1419 | if ( *it == tr("Emails" )) |
1326 | *itV = ent.emails(); | 1420 | *itV = ent.emails(); |
1327 | 1421 | ||
1328 | if ( *it == "Home Phone" ) | 1422 | if ( *it == tr("Home Phone" )) |
1329 | *itV = ent.homePhone(); | 1423 | *itV = ent.homePhone(); |
1330 | /* | 1424 | /* |
1331 | if ( *it == "Home 2 Phone" ) | 1425 | if ( *it == "Home 2 Phone" ) |
1332 | *itV = ent.home2Phone(); | 1426 | *itV = ent.home2Phone(); |
1333 | */ | 1427 | */ |
1334 | if ( *it == "Home Fax" ) | 1428 | if ( *it == tr("Home Fax" )) |
1335 | *itV = ent.homeFax(); | 1429 | *itV = ent.homeFax(); |
1336 | 1430 | ||
1337 | if ( *it == "Home Mobile" ) | 1431 | if ( *it == tr("Home Mobile" )) |
1338 | *itV = ent.homeMobile(); | 1432 | *itV = ent.homeMobile(); |
1339 | /* | 1433 | /* |
1340 | if ( *it == "Car Phone" ) | 1434 | if ( *it == "Car Phone" ) |
1341 | *itV = ent.carPhone(); | 1435 | *itV = ent.carPhone(); |
1342 | 1436 | ||
1343 | if ( *it == "ISDN Phone" ) | 1437 | if ( *it == "ISDN Phone" ) |
1344 | *itV = ent.ISDNPhone(); | 1438 | *itV = ent.ISDNPhone(); |
1345 | 1439 | ||
1346 | if ( *it == "Other Phone" ) | 1440 | if ( *it == "Other Phone" ) |
1347 | *itV = ent.otherPhone(); | 1441 | *itV = ent.otherPhone(); |
1348 | */ | 1442 | */ |
1349 | if ( *it == "Business Pager" || *it == "Work Pager" ) | 1443 | if ( *it == tr("Business Pager") || *it == tr("Work Pager" )) |
1350 | *itV = ent.businessPager(); | 1444 | *itV = ent.businessPager(); |
1351 | /* | 1445 | /* |
1352 | if ( *it == "Home Pager") | 1446 | if ( *it == "Home Pager") |
1353 | *itV = ent.homePager(); | 1447 | *itV = ent.homePager(); |
1354 | 1448 | ||
1355 | if ( *it == "AIM IM" ) | 1449 | if ( *it == "AIM IM" ) |
1356 | *itV = ent.AIMIM(); | 1450 | *itV = ent.AIMIM(); |
1357 | 1451 | ||
1358 | if ( *it == "ICQ IM" ) | 1452 | if ( *it == "ICQ IM" ) |
1359 | *itV = ent.ICQIM(); | 1453 | *itV = ent.ICQIM(); |
1360 | 1454 | ||
1361 | if ( *it == "Jabber IM" ) | 1455 | if ( *it == "Jabber IM" ) |
1362 | *itV = ent.jabberIM(); | 1456 | *itV = ent.jabberIM(); |
1363 | 1457 | ||
1364 | if ( *it == "MSN IM" ) | 1458 | if ( *it == "MSN IM" ) |
1365 | *itV = ent.MSNIM(); | 1459 | *itV = ent.MSNIM(); |
1366 | 1460 | ||
1367 | if ( *it == "Yahoo IM" ) | 1461 | if ( *it == "Yahoo IM" ) |
1368 | *itV = ent.yahooIM(); | 1462 | *itV = ent.yahooIM(); |
1369 | */ | 1463 | */ |
1370 | if ( *it == "Home Web Page" ) | 1464 | if ( *it == tr("Home Web Page") ) |
1371 | *itV = ent.homeWebpage(); | 1465 | *itV = ent.homeWebpage(); |
1372 | if ( *it == "Business Web Page" || *it == "Work Web Page" ) | 1466 | if ( *it == tr("Business WebPage") || *it == tr("Work Web Page") ) |
1373 | *itV = ent.businessWebpage(); | 1467 | *itV = ent.businessWebpage(); |
1374 | 1468 | ||
1375 | 1469 | ||
1376 | } | 1470 | } |
1377 | 1471 | ||
1378 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1472 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1379 | 1473 | ||
1380 | QString gender = ent.gender(); | 1474 | QString gender = ent.gender(); |
1381 | cmbGender->setCurrentItem( gender.toInt() ); | 1475 | cmbGender->setCurrentItem( gender.toInt() ); |
1382 | 1476 | ||
1383 | txtNote->setText( ent.notes() ); | 1477 | txtNote->setText( ent.notes() ); |
1384 | 1478 | ||
@@ -1454,133 +1548,133 @@ void ContactEditor::saveEntry() { | |||
1454 | ent.setHomeZip( slHomeAddress[5] ); | 1548 | ent.setHomeZip( slHomeAddress[5] ); |
1455 | ent.setBusinessZip( slBusinessAddress[5] ); | 1549 | ent.setBusinessZip( slBusinessAddress[5] ); |
1456 | } | 1550 | } |
1457 | 1551 | ||
1458 | if (hasCountry) { | 1552 | if (hasCountry) { |
1459 | ent.setHomeCountry( slHomeAddress[6] ); | 1553 | ent.setHomeCountry( slHomeAddress[6] ); |
1460 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1554 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1461 | } | 1555 | } |
1462 | 1556 | ||
1463 | QStringList::ConstIterator it; | 1557 | QStringList::ConstIterator it; |
1464 | QListIterator<QLineEdit> itLE( listValue ); | 1558 | QListIterator<QLineEdit> itLE( listValue ); |
1465 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { | 1559 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { |
1466 | if ( *it == "Department" ) | 1560 | if ( *it == tr("Department" )) |
1467 | ent.setDepartment( (*itLE)->text() ); | 1561 | ent.setDepartment( (*itLE)->text() ); |
1468 | 1562 | ||
1469 | if ( *it == "Company" ) | 1563 | if ( *it == tr("Company" )) |
1470 | ent.setCompany( (*itLE)->text() ); | 1564 | ent.setCompany( (*itLE)->text() ); |
1471 | 1565 | ||
1472 | if ( *it == "Office" ) | 1566 | if ( *it == tr("Office" )) |
1473 | ent.setOffice( (*itLE)->text() ); | 1567 | ent.setOffice( (*itLE)->text() ); |
1474 | 1568 | ||
1475 | if ( *it == "Profession" ) | 1569 | if ( *it == tr("Profession" )) |
1476 | ent.setProfession( (*itLE)->text() ); | 1570 | ent.setProfession( (*itLE)->text() ); |
1477 | 1571 | ||
1478 | if ( *it == "Assistant" ) | 1572 | if ( *it == tr("Assistant" )) |
1479 | ent.setAssistant( (*itLE)->text() ); | 1573 | ent.setAssistant( (*itLE)->text() ); |
1480 | 1574 | ||
1481 | if ( *it == "Manager" ) | 1575 | if ( *it == tr("Manager" )) |
1482 | ent.setManager( (*itLE)->text() ); | 1576 | ent.setManager( (*itLE)->text() ); |
1483 | 1577 | ||
1484 | if ( *it == "Spouse" ) | 1578 | if ( *it == tr("Spouse" )) |
1485 | ent.setSpouse( (*itLE)->text() ); | 1579 | ent.setSpouse( (*itLE)->text() ); |
1486 | 1580 | ||
1487 | if ( *it == "Birthday" ) | 1581 | if ( *it == tr("Birthday" )) |
1488 | ent.setBirthday( (*itLE)->text() ); | 1582 | ent.setBirthday( (*itLE)->text() ); |
1489 | 1583 | ||
1490 | if ( *it == "Anniversary" ) | 1584 | if ( *it == tr("Anniversary" )) |
1491 | ent.setAnniversary( (*itLE)->text() ); | 1585 | ent.setAnniversary( (*itLE)->text() ); |
1492 | 1586 | ||
1493 | if ( *it == "Nickname" ) | 1587 | if ( *it == tr("Nickname" )) |
1494 | ent.setNickname( (*itLE)->text() ); | 1588 | ent.setNickname( (*itLE)->text() ); |
1495 | 1589 | ||
1496 | if ( *it == "Children" ) | 1590 | if ( *it == tr("Children" )) |
1497 | ent.setChildren( (*itLE)->text() ); | 1591 | ent.setChildren( (*itLE)->text() ); |
1498 | 1592 | ||
1499 | } | 1593 | } |
1500 | 1594 | ||
1501 | QStringList::ConstIterator itV; | 1595 | QStringList::ConstIterator itV; |
1502 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1596 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1503 | 1597 | ||
1504 | if ( *it == "Business Phone" || *it == "Work Phone" ) | 1598 | if ( *it == tr("Business Phone") || *it == tr("Work Phone" )) |
1505 | ent.setBusinessPhone( *itV ); | 1599 | ent.setBusinessPhone( *itV ); |
1506 | /* | 1600 | /* |
1507 | if ( *it == "Business 2 Phone" ) | 1601 | if ( *it == tr("Business 2 Phone" ) |
1508 | ent.setBusiness2Phone( *itV ); | 1602 | ent.setBusiness2Phone( *itV ); |
1509 | */ | 1603 | */ |
1510 | if ( *it == "Business Fax" || *it == "Work Fax" ) | 1604 | if ( *it == tr("Business Fax") || *it == tr("Work Fax" )) |
1511 | ent.setBusinessFax( *itV ); | 1605 | ent.setBusinessFax( *itV ); |
1512 | 1606 | ||
1513 | if ( *it == "Business Mobile" || *it == "Work Mobile" ) | 1607 | if ( *it == tr("Business Mobile") || *it == tr("Work Mobile" )) |
1514 | ent.setBusinessMobile( *itV ); | 1608 | ent.setBusinessMobile( *itV ); |
1515 | /* | 1609 | /* |
1516 | if ( *it == "Company Phone" ) | 1610 | if ( *it == "Company Phone" ) |
1517 | ent.setCompanyPhone( *itV ); | 1611 | ent.setCompanyPhone( *itV ); |
1518 | */ | 1612 | */ |
1519 | //if ( *it == "Default Email" ) | 1613 | //if ( *it == "Default Email" ) |
1520 | //ent.setDefaultEmail( *itV ); | 1614 | //ent.setDefaultEmail( *itV ); |
1521 | 1615 | ||
1522 | if ( *it == "Emails" ) { | 1616 | if ( *it == tr("Emails" )) { |
1523 | QString allemail; | 1617 | QString allemail; |
1524 | QString defaultmail; | 1618 | QString defaultmail; |
1525 | parseEmailFrom( *itV, defaultmail, allemail ); | 1619 | parseEmailFrom( *itV, defaultmail, allemail ); |
1526 | ent.setDefaultEmail( defaultmail ); | 1620 | ent.setDefaultEmail( defaultmail ); |
1527 | ent.setEmails( *itV ); | 1621 | ent.setEmails( *itV ); |
1528 | } | 1622 | } |
1529 | 1623 | ||
1530 | if ( *it == "Home Phone" ) | 1624 | if ( *it == tr("Home Phone" )) |
1531 | ent.setHomePhone( *itV ); | 1625 | ent.setHomePhone( *itV ); |
1532 | /* | 1626 | /* |
1533 | if ( *it == "Home 2 Phone" ) | 1627 | if ( *it == "Home 2 Phone" ) |
1534 | ent.setHome2Phone( *itV ); | 1628 | ent.setHome2Phone( *itV ); |
1535 | */ | 1629 | */ |
1536 | if ( *it == "Home Fax" ) | 1630 | if ( *it == tr("Home Fax" )) |
1537 | ent.setHomeFax( *itV ); | 1631 | ent.setHomeFax( *itV ); |
1538 | 1632 | ||
1539 | if ( *it == "Home Mobile" ) | 1633 | if ( *it == tr("Home Mobile" )) |
1540 | ent.setHomeMobile( *itV ); | 1634 | ent.setHomeMobile( *itV ); |
1541 | /* | 1635 | /* |
1542 | if ( *it == "Car Phone" ) | 1636 | if ( *it == "Car Phone" ) |
1543 | ent.setCarPhone( *itV ); | 1637 | ent.setCarPhone( *itV ); |
1544 | 1638 | ||
1545 | if ( *it == "ISDN Phone" ) | 1639 | if ( *it == "ISDN Phone" ) |
1546 | ent.setISDNPhone( *itV ); | 1640 | ent.setISDNPhone( *itV ); |
1547 | 1641 | ||
1548 | if ( *it == "Other Phone" ) | 1642 | if ( *it == "Other Phone" ) |
1549 | ent.setOtherPhone( *itV ); | 1643 | ent.setOtherPhone( *itV ); |
1550 | */ | 1644 | */ |
1551 | if ( *it == "Business Pager" || *it == "Work Pager" ) | 1645 | if ( *it == tr("Business Pager") || *it == tr("Work Pager") ) |
1552 | ent.setBusinessPager( *itV ); | 1646 | ent.setBusinessPager( *itV ); |
1553 | /* | 1647 | /* |
1554 | if ( *it == "Home Pager" ) | 1648 | if ( *it == "Home Pager" ) |
1555 | ent.setHomePager( *itV ); | 1649 | ent.setHomePager( *itV ); |
1556 | 1650 | ||
1557 | if ( *it == "AIM IM" ) | 1651 | if ( *it == "AIM IM" ) |
1558 | ent.setAIMIM( *itV ); | 1652 | ent.setAIMIM( *itV ); |
1559 | 1653 | ||
1560 | if ( *it == "ICQ IM" ) | 1654 | if ( *it == "ICQ IM" ) |
1561 | ent.setICQIM( *itV ); | 1655 | ent.setICQIM( *itV ); |
1562 | 1656 | ||
1563 | if ( *it == "Jabber IM" ) | 1657 | if ( *it == "Jabber IM" ) |
1564 | ent.setJabberIM( *itV ); | 1658 | ent.setJabberIM( *itV ); |
1565 | 1659 | ||
1566 | if ( *it == "MSN IM" ) | 1660 | if ( *it == "MSN IM" ) |
1567 | ent.setMSNIM( *itV ); | 1661 | ent.setMSNIM( *itV ); |
1568 | 1662 | ||
1569 | if ( *it == "Yahoo IM" ) | 1663 | if ( *it == "Yahoo IM" ) |
1570 | ent.setYahooIM( *itV ); | 1664 | ent.setYahooIM( *itV ); |
1571 | */ | 1665 | */ |
1572 | if ( *it == "Home Web Page" ) | 1666 | if ( *it == tr("Home Web Page") ) |
1573 | ent.setHomeWebpage( *itV ); | 1667 | ent.setHomeWebpage( *itV ); |
1574 | if ( *it == "Business Web Page" || *it == "Work Web Page" ) | 1668 | if ( *it == tr("Business WebPage") || *it == tr("Work Web Page" )) |
1575 | ent.setBusinessWebpage( *itV ); | 1669 | ent.setBusinessWebpage( *itV ); |
1576 | 1670 | ||
1577 | 1671 | ||
1578 | } | 1672 | } |
1579 | 1673 | ||
1580 | int gender = cmbGender->currentItem(); | 1674 | int gender = cmbGender->currentItem(); |
1581 | ent.setGender( QString::number( gender ) ); | 1675 | ent.setGender( QString::number( gender ) ); |
1582 | 1676 | ||
1583 | QString str = txtNote->text(); | 1677 | QString str = txtNote->text(); |
1584 | if ( !str.isNull() ) | 1678 | if ( !str.isNull() ) |
1585 | ent.setNotes( str ); | 1679 | ent.setNotes( str ); |
1586 | 1680 | ||