author | eilers <eilers> | 2003-03-04 16:55:58 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-03-04 16:55:58 (UTC) |
commit | ca913d1f2035b6ddb77be497516e4dfc2371e5b3 (patch) (unidiff) | |
tree | 8783f481948e488d6103382b201a36fcd8ca2662 | |
parent | bb765b9cd286d85eb8fa1d18199dfb7a29d57fc5 (diff) | |
download | opie-ca913d1f2035b6ddb77be497516e4dfc2371e5b3.zip opie-ca913d1f2035b6ddb77be497516e4dfc2371e5b3.tar.gz opie-ca913d1f2035b6ddb77be497516e4dfc2371e5b3.tar.bz2 |
Some finetuning to behave like the previous release if just one first and
lastname is used..
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 7bc5bde..c4a7b10 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -261,1474 +261,1477 @@ void ContactEditor::init() { | |||
261 | 261 | ||
262 | l = new QLabel( tr( "Country" ), container ); | 262 | l = new QLabel( tr( "Country" ), container ); |
263 | gl->addWidget( l, 5, 0 ); | 263 | gl->addWidget( l, 5, 0 ); |
264 | cmbCountry = new QComboBox( TRUE, container ); | 264 | cmbCountry = new QComboBox( TRUE, container ); |
265 | cmbCountry->insertItem( tr( "" ) ); | 265 | cmbCountry->insertItem( tr( "" ) ); |
266 | cmbCountry->insertItem( tr ( "United States" ) ); | 266 | cmbCountry->insertItem( tr ( "United States" ) ); |
267 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 267 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
268 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 268 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
269 | cmbCountry->insertItem( tr ( "Albania" ) ); | 269 | cmbCountry->insertItem( tr ( "Albania" ) ); |
270 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 270 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
271 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 271 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
272 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 272 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
273 | cmbCountry->insertItem( tr ( "Angola" ) ); | 273 | cmbCountry->insertItem( tr ( "Angola" ) ); |
274 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 274 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
275 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 275 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
276 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 276 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
277 | cmbCountry->insertItem( tr ( "Armenia" ) ); | 277 | cmbCountry->insertItem( tr ( "Armenia" ) ); |
278 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 278 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
279 | cmbCountry->insertItem( tr ( "Australia" ) ); | 279 | cmbCountry->insertItem( tr ( "Australia" ) ); |
280 | cmbCountry->insertItem( tr ( "Austria" ) ); | 280 | cmbCountry->insertItem( tr ( "Austria" ) ); |
281 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 281 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
282 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 282 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
283 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 283 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
284 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 284 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
285 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 285 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
286 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 286 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
287 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 287 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
288 | cmbCountry->insertItem( tr ( "Belize" ) ); | 288 | cmbCountry->insertItem( tr ( "Belize" ) ); |
289 | cmbCountry->insertItem( tr ( "Benin" ) ); | 289 | cmbCountry->insertItem( tr ( "Benin" ) ); |
290 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 290 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
291 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 291 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
292 | cmbCountry->insertItem( tr ( "Bolivia" ) ); | 292 | cmbCountry->insertItem( tr ( "Bolivia" ) ); |
293 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 293 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
294 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 294 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
295 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 295 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
296 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 296 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
297 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 297 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
298 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 298 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
299 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 299 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
300 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 300 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
301 | cmbCountry->insertItem( tr ( "Cameroon" ) ); | 301 | cmbCountry->insertItem( tr ( "Cameroon" ) ); |
302 | cmbCountry->insertItem( tr ( "Canada" ) ); | 302 | cmbCountry->insertItem( tr ( "Canada" ) ); |
303 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 303 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
304 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 304 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
305 | cmbCountry->insertItem( tr ( "Chad" ) ); | 305 | cmbCountry->insertItem( tr ( "Chad" ) ); |
306 | cmbCountry->insertItem( tr ( "Chile" ) ); | 306 | cmbCountry->insertItem( tr ( "Chile" ) ); |
307 | cmbCountry->insertItem( tr ( "China" ) ); | 307 | cmbCountry->insertItem( tr ( "China" ) ); |
308 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 308 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
309 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 309 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
310 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 310 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
311 | cmbCountry->insertItem( tr ( "Congo" ) ); | 311 | cmbCountry->insertItem( tr ( "Congo" ) ); |
312 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 312 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
313 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 313 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
314 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 314 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
315 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 315 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
316 | cmbCountry->insertItem( tr ( "Cuba" ) ); | 316 | cmbCountry->insertItem( tr ( "Cuba" ) ); |
317 | cmbCountry->insertItem( tr ( "Cyprus" ) ); | 317 | cmbCountry->insertItem( tr ( "Cyprus" ) ); |
318 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); | 318 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); |
319 | cmbCountry->insertItem( tr ( "Denmark" ) ); | 319 | cmbCountry->insertItem( tr ( "Denmark" ) ); |
320 | cmbCountry->insertItem( tr ( "Djibouti" ) ); | 320 | cmbCountry->insertItem( tr ( "Djibouti" ) ); |
321 | cmbCountry->insertItem( tr ( "Dominica" ) ); | 321 | cmbCountry->insertItem( tr ( "Dominica" ) ); |
322 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); | 322 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); |
323 | cmbCountry->insertItem( tr ( "East Timor" ) ); | 323 | cmbCountry->insertItem( tr ( "East Timor" ) ); |
324 | cmbCountry->insertItem( tr ( "Ecuador" ) ); | 324 | cmbCountry->insertItem( tr ( "Ecuador" ) ); |
325 | cmbCountry->insertItem( tr ( "Egypt" ) ); | 325 | cmbCountry->insertItem( tr ( "Egypt" ) ); |
326 | cmbCountry->insertItem( tr ( "El Salvador" ) ); | 326 | cmbCountry->insertItem( tr ( "El Salvador" ) ); |
327 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); | 327 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); |
328 | cmbCountry->insertItem( tr ( "Eritrea" ) ); | 328 | cmbCountry->insertItem( tr ( "Eritrea" ) ); |
329 | cmbCountry->insertItem( tr ( "Estonia" ) ); | 329 | cmbCountry->insertItem( tr ( "Estonia" ) ); |
330 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); | 330 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); |
331 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); | 331 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); |
332 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); | 332 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); |
333 | cmbCountry->insertItem( tr ( "Fiji" ) ); | 333 | cmbCountry->insertItem( tr ( "Fiji" ) ); |
334 | cmbCountry->insertItem( tr ( "Finland" ) ); | 334 | cmbCountry->insertItem( tr ( "Finland" ) ); |
335 | cmbCountry->insertItem( tr ( "France" ) ); | 335 | cmbCountry->insertItem( tr ( "France" ) ); |
336 | cmbCountry->insertItem( tr ( "French Guiana" ) ); | 336 | cmbCountry->insertItem( tr ( "French Guiana" ) ); |
337 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); | 337 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); |
338 | cmbCountry->insertItem( tr ( "Gabon" ) ); | 338 | cmbCountry->insertItem( tr ( "Gabon" ) ); |
339 | cmbCountry->insertItem( tr ( "Gambia" ) ); | 339 | cmbCountry->insertItem( tr ( "Gambia" ) ); |
340 | cmbCountry->insertItem( tr ( "Georgia" ) ); | 340 | cmbCountry->insertItem( tr ( "Georgia" ) ); |
341 | cmbCountry->insertItem( tr ( "Germany" ) ); | 341 | cmbCountry->insertItem( tr ( "Germany" ) ); |
342 | cmbCountry->insertItem( tr ( "Ghana" ) ); | 342 | cmbCountry->insertItem( tr ( "Ghana" ) ); |
343 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); | 343 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); |
344 | cmbCountry->insertItem( tr ( "Greece" ) ); | 344 | cmbCountry->insertItem( tr ( "Greece" ) ); |
345 | cmbCountry->insertItem( tr ( "Greenland" ) ); | 345 | cmbCountry->insertItem( tr ( "Greenland" ) ); |
346 | cmbCountry->insertItem( tr ( "Grenada" ) ); | 346 | cmbCountry->insertItem( tr ( "Grenada" ) ); |
347 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); | 347 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); |
348 | cmbCountry->insertItem( tr ( "Guam" ) ); | 348 | cmbCountry->insertItem( tr ( "Guam" ) ); |
349 | cmbCountry->insertItem( tr ( "Guatemala" ) ); | 349 | cmbCountry->insertItem( tr ( "Guatemala" ) ); |
350 | cmbCountry->insertItem( tr ( "Guinea" ) ); | 350 | cmbCountry->insertItem( tr ( "Guinea" ) ); |
351 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); | 351 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); |
352 | cmbCountry->insertItem( tr ( "Guyana" ) ); | 352 | cmbCountry->insertItem( tr ( "Guyana" ) ); |
353 | cmbCountry->insertItem( tr ( "Haiti" ) ); | 353 | cmbCountry->insertItem( tr ( "Haiti" ) ); |
354 | cmbCountry->insertItem( tr ( "Holy See" ) ); | 354 | cmbCountry->insertItem( tr ( "Holy See" ) ); |
355 | cmbCountry->insertItem( tr ( "Honduras" ) ); | 355 | cmbCountry->insertItem( tr ( "Honduras" ) ); |
356 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); | 356 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); |
357 | cmbCountry->insertItem( tr ( "Hungary" ) ); | 357 | cmbCountry->insertItem( tr ( "Hungary" ) ); |
358 | cmbCountry->insertItem( tr ( "Iceland" ) ); | 358 | cmbCountry->insertItem( tr ( "Iceland" ) ); |
359 | cmbCountry->insertItem( tr ( "India" ) ); | 359 | cmbCountry->insertItem( tr ( "India" ) ); |
360 | cmbCountry->insertItem( tr ( "Indonesia" ) ); | 360 | cmbCountry->insertItem( tr ( "Indonesia" ) ); |
361 | cmbCountry->insertItem( tr ( "Ireland" ) ); | 361 | cmbCountry->insertItem( tr ( "Ireland" ) ); |
362 | cmbCountry->insertItem( tr ( "Israel" ) ); | 362 | cmbCountry->insertItem( tr ( "Israel" ) ); |
363 | cmbCountry->insertItem( tr ( "Italy" ) ); | 363 | cmbCountry->insertItem( tr ( "Italy" ) ); |
364 | cmbCountry->insertItem( tr ( "Jamaica" ) ); | 364 | cmbCountry->insertItem( tr ( "Jamaica" ) ); |
365 | cmbCountry->insertItem( tr ( "Japan" ) ); | 365 | cmbCountry->insertItem( tr ( "Japan" ) ); |
366 | cmbCountry->insertItem( tr ( "Jordan" ) ); | 366 | cmbCountry->insertItem( tr ( "Jordan" ) ); |
367 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); | 367 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); |
368 | cmbCountry->insertItem( tr ( "Kenya" ) ); | 368 | cmbCountry->insertItem( tr ( "Kenya" ) ); |
369 | cmbCountry->insertItem( tr ( "Kiribati" ) ); | 369 | cmbCountry->insertItem( tr ( "Kiribati" ) ); |
370 | cmbCountry->insertItem( tr ( "Korea" ) ); | 370 | cmbCountry->insertItem( tr ( "Korea" ) ); |
371 | cmbCountry->insertItem( tr ( "Kuwait" ) ); | 371 | cmbCountry->insertItem( tr ( "Kuwait" ) ); |
372 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); | 372 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); |
373 | cmbCountry->insertItem( tr ( "Laos" ) ); | 373 | cmbCountry->insertItem( tr ( "Laos" ) ); |
374 | cmbCountry->insertItem( tr ( "Latvia" ) ); | 374 | cmbCountry->insertItem( tr ( "Latvia" ) ); |
375 | cmbCountry->insertItem( tr ( "Lebanon" ) ); | 375 | cmbCountry->insertItem( tr ( "Lebanon" ) ); |
376 | cmbCountry->insertItem( tr ( "Lesotho" ) ); | 376 | cmbCountry->insertItem( tr ( "Lesotho" ) ); |
377 | cmbCountry->insertItem( tr ( "Liberia" ) ); | 377 | cmbCountry->insertItem( tr ( "Liberia" ) ); |
378 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); | 378 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); |
379 | cmbCountry->insertItem( tr ( "Lithuania" ) ); | 379 | cmbCountry->insertItem( tr ( "Lithuania" ) ); |
380 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); | 380 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); |
381 | cmbCountry->insertItem( tr ( "Macau" ) ); | 381 | cmbCountry->insertItem( tr ( "Macau" ) ); |
382 | cmbCountry->insertItem( tr ( "Macedonia" ) ); | 382 | cmbCountry->insertItem( tr ( "Macedonia" ) ); |
383 | cmbCountry->insertItem( tr ( "Madagascar" ) ); | 383 | cmbCountry->insertItem( tr ( "Madagascar" ) ); |
384 | cmbCountry->insertItem( tr ( "Malawi" ) ); | 384 | cmbCountry->insertItem( tr ( "Malawi" ) ); |
385 | cmbCountry->insertItem( tr ( "Malaysia" ) ); | 385 | cmbCountry->insertItem( tr ( "Malaysia" ) ); |
386 | cmbCountry->insertItem( tr ( "Maldives" ) ); | 386 | cmbCountry->insertItem( tr ( "Maldives" ) ); |
387 | cmbCountry->insertItem( tr ( "Mali" ) ); | 387 | cmbCountry->insertItem( tr ( "Mali" ) ); |
388 | cmbCountry->insertItem( tr ( "Malta" ) ); | 388 | cmbCountry->insertItem( tr ( "Malta" ) ); |
389 | cmbCountry->insertItem( tr ( "Martinique" ) ); | 389 | cmbCountry->insertItem( tr ( "Martinique" ) ); |
390 | cmbCountry->insertItem( tr ( "Mauritania" ) ); | 390 | cmbCountry->insertItem( tr ( "Mauritania" ) ); |
391 | cmbCountry->insertItem( tr ( "Mauritius" ) ); | 391 | cmbCountry->insertItem( tr ( "Mauritius" ) ); |
392 | cmbCountry->insertItem( tr ( "Mayotte" ) ); | 392 | cmbCountry->insertItem( tr ( "Mayotte" ) ); |
393 | cmbCountry->insertItem( tr ( "Mexico" ) ); | 393 | cmbCountry->insertItem( tr ( "Mexico" ) ); |
394 | cmbCountry->insertItem( tr ( "Micronesia" ) ); | 394 | cmbCountry->insertItem( tr ( "Micronesia" ) ); |
395 | cmbCountry->insertItem( tr ( "Moldova" ) ); | 395 | cmbCountry->insertItem( tr ( "Moldova" ) ); |
396 | cmbCountry->insertItem( tr ( "Monaco" ) ); | 396 | cmbCountry->insertItem( tr ( "Monaco" ) ); |
397 | cmbCountry->insertItem( tr ( "Mongolia" ) ); | 397 | cmbCountry->insertItem( tr ( "Mongolia" ) ); |
398 | cmbCountry->insertItem( tr ( "Montserrat" ) ); | 398 | cmbCountry->insertItem( tr ( "Montserrat" ) ); |
399 | cmbCountry->insertItem( tr ( "Morocco" ) ); | 399 | cmbCountry->insertItem( tr ( "Morocco" ) ); |
400 | cmbCountry->insertItem( tr ( "Mozambique" ) ); | 400 | cmbCountry->insertItem( tr ( "Mozambique" ) ); |
401 | cmbCountry->insertItem( tr ( "Myanmar" ) ); | 401 | cmbCountry->insertItem( tr ( "Myanmar" ) ); |
402 | cmbCountry->insertItem( tr ( "Namibia" ) ); | 402 | cmbCountry->insertItem( tr ( "Namibia" ) ); |
403 | cmbCountry->insertItem( tr ( "Nauru" ) ); | 403 | cmbCountry->insertItem( tr ( "Nauru" ) ); |
404 | cmbCountry->insertItem( tr ( "Nepal" ) ); | 404 | cmbCountry->insertItem( tr ( "Nepal" ) ); |
405 | cmbCountry->insertItem( tr ( "Netherlands" ) ); | 405 | cmbCountry->insertItem( tr ( "Netherlands" ) ); |
406 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); | 406 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); |
407 | cmbCountry->insertItem( tr ( "New Zealand" ) ); | 407 | cmbCountry->insertItem( tr ( "New Zealand" ) ); |
408 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); | 408 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); |
409 | cmbCountry->insertItem( tr ( "Niger" ) ); | 409 | cmbCountry->insertItem( tr ( "Niger" ) ); |
410 | cmbCountry->insertItem( tr ( "Nigeria" ) ); | 410 | cmbCountry->insertItem( tr ( "Nigeria" ) ); |
411 | cmbCountry->insertItem( tr ( "Niue" ) ); | 411 | cmbCountry->insertItem( tr ( "Niue" ) ); |
412 | cmbCountry->insertItem( tr ( "Norway" ) ); | 412 | cmbCountry->insertItem( tr ( "Norway" ) ); |
413 | cmbCountry->insertItem( tr ( "Oman" ) ); | 413 | cmbCountry->insertItem( tr ( "Oman" ) ); |
414 | cmbCountry->insertItem( tr ( "Pakistan" ) ); | 414 | cmbCountry->insertItem( tr ( "Pakistan" ) ); |
415 | cmbCountry->insertItem( tr ( "Palau" ) ); | 415 | cmbCountry->insertItem( tr ( "Palau" ) ); |
416 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); | 416 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); |
417 | cmbCountry->insertItem( tr ( "Panama" ) ); | 417 | cmbCountry->insertItem( tr ( "Panama" ) ); |
418 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); | 418 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); |
419 | cmbCountry->insertItem( tr ( "Paraguay" ) ); | 419 | cmbCountry->insertItem( tr ( "Paraguay" ) ); |
420 | cmbCountry->insertItem( tr ( "Peru" ) ); | 420 | cmbCountry->insertItem( tr ( "Peru" ) ); |
421 | cmbCountry->insertItem( tr ( "Philippines" ) ); | 421 | cmbCountry->insertItem( tr ( "Philippines" ) ); |
422 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); | 422 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); |
423 | cmbCountry->insertItem( tr ( "Poland" ) ); | 423 | cmbCountry->insertItem( tr ( "Poland" ) ); |
424 | cmbCountry->insertItem( tr ( "Portugal" ) ); | 424 | cmbCountry->insertItem( tr ( "Portugal" ) ); |
425 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); | 425 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); |
426 | cmbCountry->insertItem( tr ( "Qatar" ) ); | 426 | cmbCountry->insertItem( tr ( "Qatar" ) ); |
427 | cmbCountry->insertItem( tr ( "Reunion" ) ); | 427 | cmbCountry->insertItem( tr ( "Reunion" ) ); |
428 | cmbCountry->insertItem( tr ( "Romania" ) ); | 428 | cmbCountry->insertItem( tr ( "Romania" ) ); |
429 | cmbCountry->insertItem( tr ( "Russia" ) ); | 429 | cmbCountry->insertItem( tr ( "Russia" ) ); |
430 | cmbCountry->insertItem( tr ( "Rwanda" ) ); | 430 | cmbCountry->insertItem( tr ( "Rwanda" ) ); |
431 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); | 431 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); |
432 | cmbCountry->insertItem( tr ( "Samoa" ) ); | 432 | cmbCountry->insertItem( tr ( "Samoa" ) ); |
433 | cmbCountry->insertItem( tr ( "San Marino" ) ); | 433 | cmbCountry->insertItem( tr ( "San Marino" ) ); |
434 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); | 434 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); |
435 | cmbCountry->insertItem( tr ( "Senegal" ) ); | 435 | cmbCountry->insertItem( tr ( "Senegal" ) ); |
436 | cmbCountry->insertItem( tr ( "Seychelles" ) ); | 436 | cmbCountry->insertItem( tr ( "Seychelles" ) ); |
437 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); | 437 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); |
438 | cmbCountry->insertItem( tr ( "Singapore" ) ); | 438 | cmbCountry->insertItem( tr ( "Singapore" ) ); |
439 | cmbCountry->insertItem( tr ( "Slovakia" ) ); | 439 | cmbCountry->insertItem( tr ( "Slovakia" ) ); |
440 | cmbCountry->insertItem( tr ( "Slovenia" ) ); | 440 | cmbCountry->insertItem( tr ( "Slovenia" ) ); |
441 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); | 441 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); |
442 | cmbCountry->insertItem( tr ( "Somalia" ) ); | 442 | cmbCountry->insertItem( tr ( "Somalia" ) ); |
443 | cmbCountry->insertItem( tr ( "South Africa" ) ); | 443 | cmbCountry->insertItem( tr ( "South Africa" ) ); |
444 | cmbCountry->insertItem( tr ( "Spain" ) ); | 444 | cmbCountry->insertItem( tr ( "Spain" ) ); |
445 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); | 445 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); |
446 | cmbCountry->insertItem( tr ( "St. Helena" ) ); | 446 | cmbCountry->insertItem( tr ( "St. Helena" ) ); |
447 | cmbCountry->insertItem( tr ( "Sudan" ) ); | 447 | cmbCountry->insertItem( tr ( "Sudan" ) ); |
448 | cmbCountry->insertItem( tr ( "Suriname" ) ); | 448 | cmbCountry->insertItem( tr ( "Suriname" ) ); |
449 | cmbCountry->insertItem( tr ( "Swaziland" ) ); | 449 | cmbCountry->insertItem( tr ( "Swaziland" ) ); |
450 | cmbCountry->insertItem( tr ( "Sweden" ) ); | 450 | cmbCountry->insertItem( tr ( "Sweden" ) ); |
451 | cmbCountry->insertItem( tr ( "Switzerland" ) ); | 451 | cmbCountry->insertItem( tr ( "Switzerland" ) ); |
452 | cmbCountry->insertItem( tr ( "Taiwan" ) ); | 452 | cmbCountry->insertItem( tr ( "Taiwan" ) ); |
453 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); | 453 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); |
454 | cmbCountry->insertItem( tr ( "Tanzania" ) ); | 454 | cmbCountry->insertItem( tr ( "Tanzania" ) ); |
455 | cmbCountry->insertItem( tr ( "Thailand" ) ); | 455 | cmbCountry->insertItem( tr ( "Thailand" ) ); |
456 | cmbCountry->insertItem( tr ( "Togo" ) ); | 456 | cmbCountry->insertItem( tr ( "Togo" ) ); |
457 | cmbCountry->insertItem( tr ( "Tokelau" ) ); | 457 | cmbCountry->insertItem( tr ( "Tokelau" ) ); |
458 | cmbCountry->insertItem( tr ( "Tonga" ) ); | 458 | cmbCountry->insertItem( tr ( "Tonga" ) ); |
459 | cmbCountry->insertItem( tr ( "Tunisia" ) ); | 459 | cmbCountry->insertItem( tr ( "Tunisia" ) ); |
460 | cmbCountry->insertItem( tr ( "Turkey" ) ); | 460 | cmbCountry->insertItem( tr ( "Turkey" ) ); |
461 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); | 461 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); |
462 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); | 462 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); |
463 | cmbCountry->insertItem( tr ( "Uganda" ) ); | 463 | cmbCountry->insertItem( tr ( "Uganda" ) ); |
464 | cmbCountry->insertItem( tr ( "Ukraine" ) ); | 464 | cmbCountry->insertItem( tr ( "Ukraine" ) ); |
465 | cmbCountry->insertItem( tr ( "Uruguay" ) ); | 465 | cmbCountry->insertItem( tr ( "Uruguay" ) ); |
466 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); | 466 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); |
467 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); | 467 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); |
468 | cmbCountry->insertItem( tr ( "Venezuela" ) ); | 468 | cmbCountry->insertItem( tr ( "Venezuela" ) ); |
469 | cmbCountry->insertItem( tr ( "Vietnam" ) ); | 469 | cmbCountry->insertItem( tr ( "Vietnam" ) ); |
470 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); | 470 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); |
471 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); | 471 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); |
472 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 472 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
473 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 473 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
474 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 474 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
475 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 475 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
476 | if (cmbCountry->listBox()!=0) | 476 | if (cmbCountry->listBox()!=0) |
477 | cmbCountry->listBox()->sort(); | 477 | cmbCountry->listBox()->sort(); |
478 | 478 | ||
479 | cmbCountry->setMaximumWidth( 135 ); | 479 | cmbCountry->setMaximumWidth( 135 ); |
480 | 480 | ||
481 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 481 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
482 | 482 | ||
483 | // Chooser 4 | 483 | // Chooser 4 |
484 | cmbChooserField4 = new QComboBox( FALSE, container ); | 484 | cmbChooserField4 = new QComboBox( FALSE, container ); |
485 | cmbChooserField4->setMaximumWidth( 90 ); | 485 | cmbChooserField4->setMaximumWidth( 90 ); |
486 | gl->addWidget( cmbChooserField4, 6, 0 ); | 486 | gl->addWidget( cmbChooserField4, 6, 0 ); |
487 | // Textfield for chooser 2 | 487 | // Textfield for chooser 2 |
488 | // Now use WidgetStack to contain the textfield and the default-email combo! | 488 | // Now use WidgetStack to contain the textfield and the default-email combo! |
489 | m_widgetStack4 = new QWidgetStack( container ); | 489 | m_widgetStack4 = new QWidgetStack( container ); |
490 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); | 490 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); |
491 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); | 491 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); |
492 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); | 492 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); |
493 | m_widgetStack4 -> raiseWidget( TextField ); | 493 | m_widgetStack4 -> raiseWidget( TextField ); |
494 | 494 | ||
495 | QSpacerItem *space = new QSpacerItem(1,1, | 495 | QSpacerItem *space = new QSpacerItem(1,1, |
496 | QSizePolicy::Maximum, | 496 | QSizePolicy::Maximum, |
497 | QSizePolicy::MinimumExpanding ); | 497 | QSizePolicy::MinimumExpanding ); |
498 | gl->addItem( space, 7, 0 ); | 498 | gl->addItem( space, 7, 0 ); |
499 | 499 | ||
500 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 500 | tabMain->insertTab( tabViewport, tr( "Address" ) ); |
501 | 501 | ||
502 | tabViewport = new QWidget ( tabMain ); | 502 | tabViewport = new QWidget ( tabMain ); |
503 | 503 | ||
504 | vb = new QVBoxLayout( tabViewport ); | 504 | vb = new QVBoxLayout( tabViewport ); |
505 | 505 | ||
506 | svDetails = new QScrollView( tabViewport ); | 506 | svDetails = new QScrollView( tabViewport ); |
507 | vb->addWidget( svDetails, 0, 0 ); | 507 | vb->addWidget( svDetails, 0, 0 ); |
508 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 508 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
509 | svDetails->setFrameStyle( QFrame::NoFrame ); | 509 | svDetails->setFrameStyle( QFrame::NoFrame ); |
510 | 510 | ||
511 | container = new QWidget( svDetails->viewport() ); | 511 | container = new QWidget( svDetails->viewport() ); |
512 | svDetails->addChild( container ); | 512 | svDetails->addChild( container ); |
513 | 513 | ||
514 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 514 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
515 | 515 | ||
516 | int counter = 0; | 516 | int counter = 0; |
517 | 517 | ||
518 | // Birthday | 518 | // Birthday |
519 | QHBox* hBox = new QHBox( container ); | 519 | QHBox* hBox = new QHBox( container ); |
520 | l = new QLabel( tr("Birthday"), container ); | 520 | l = new QLabel( tr("Birthday"), container ); |
521 | gl->addWidget( l, counter, 0 ); | 521 | gl->addWidget( l, counter, 0 ); |
522 | 522 | ||
523 | QPopupMenu* m1 = new QPopupMenu( container ); | 523 | QPopupMenu* m1 = new QPopupMenu( container ); |
524 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 524 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); |
525 | m1->insertItem( birthdayPicker ); | 525 | m1->insertItem( birthdayPicker ); |
526 | 526 | ||
527 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 527 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
528 | birthdayButton->setPopup( m1 ); | 528 | birthdayButton->setPopup( m1 ); |
529 | birthdayButton->setPopupDelay(0); | 529 | birthdayButton->setPopupDelay(0); |
530 | 530 | ||
531 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 531 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
532 | tr( "Delete" ), | 532 | tr( "Delete" ), |
533 | hBox, 0 ); | 533 | hBox, 0 ); |
534 | 534 | ||
535 | gl->addWidget( hBox, counter , 1 ); | 535 | gl->addWidget( hBox, counter , 1 ); |
536 | 536 | ||
537 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), | 537 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), |
538 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); | 538 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); |
539 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 539 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
540 | 540 | ||
541 | ++counter; | 541 | ++counter; |
542 | 542 | ||
543 | // Anniversary | 543 | // Anniversary |
544 | hBox = new QHBox( container ); | 544 | hBox = new QHBox( container ); |
545 | l = new QLabel( tr("Anniversary"), container ); | 545 | l = new QLabel( tr("Anniversary"), container ); |
546 | gl->addWidget( l, counter, 0 ); | 546 | gl->addWidget( l, counter, 0 ); |
547 | 547 | ||
548 | m1 = new QPopupMenu( container ); | 548 | m1 = new QPopupMenu( container ); |
549 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 549 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); |
550 | m1->insertItem( anniversaryPicker ); | 550 | m1->insertItem( anniversaryPicker ); |
551 | 551 | ||
552 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 552 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
553 | anniversaryButton->setPopup( m1 ); | 553 | anniversaryButton->setPopup( m1 ); |
554 | anniversaryButton->setPopupDelay(0); | 554 | anniversaryButton->setPopupDelay(0); |
555 | 555 | ||
556 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 556 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
557 | tr( "Delete" ), | 557 | tr( "Delete" ), |
558 | hBox, 0 ); | 558 | hBox, 0 ); |
559 | gl->addWidget( hBox, counter , 1 ); | 559 | gl->addWidget( hBox, counter , 1 ); |
560 | 560 | ||
561 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), | 561 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), |
562 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); | 562 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); |
563 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 563 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
564 | 564 | ||
565 | ++counter; | 565 | ++counter; |
566 | 566 | ||
567 | // Gender | 567 | // Gender |
568 | l = new QLabel( tr("Gender"), container ); | 568 | l = new QLabel( tr("Gender"), container ); |
569 | gl->addWidget( l, counter, 0 ); | 569 | gl->addWidget( l, counter, 0 ); |
570 | cmbGender = new QComboBox( container ); | 570 | cmbGender = new QComboBox( container ); |
571 | cmbGender->insertItem( "", 0 ); | 571 | cmbGender->insertItem( "", 0 ); |
572 | cmbGender->insertItem( tr("Male"), 1); | 572 | cmbGender->insertItem( tr("Male"), 1); |
573 | cmbGender->insertItem( tr("Female"), 2); | 573 | cmbGender->insertItem( tr("Female"), 2); |
574 | gl->addWidget( cmbGender, counter, 1 ); | 574 | gl->addWidget( cmbGender, counter, 1 ); |
575 | 575 | ||
576 | ++counter; | 576 | ++counter; |
577 | 577 | ||
578 | // Create Labels and lineedit fields for every dynamic entry | 578 | // Create Labels and lineedit fields for every dynamic entry |
579 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 579 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
580 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); | 580 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); |
581 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); | 581 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); |
582 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { | 582 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { |
583 | 583 | ||
584 | if (((*it) == "Anniversary") || | 584 | if (((*it) == "Anniversary") || |
585 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 585 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
586 | 586 | ||
587 | l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); | 587 | l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); |
588 | listName.append( l ); | 588 | listName.append( l ); |
589 | gl->addWidget( l, i, 0 ); | 589 | gl->addWidget( l, i, 0 ); |
590 | QLineEdit *e = new QLineEdit( container ); | 590 | QLineEdit *e = new QLineEdit( container ); |
591 | listValue.append( e ); | 591 | listValue.append( e ); |
592 | gl->addWidget( e, i, 1); | 592 | gl->addWidget( e, i, 1); |
593 | } | 593 | } |
594 | // Fill labels with names.. | 594 | // Fill labels with names.. |
595 | //loadFields(); | 595 | //loadFields(); |
596 | 596 | ||
597 | 597 | ||
598 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 598 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
599 | 599 | ||
600 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 600 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
601 | dlgNote->setCaption( tr("Enter Note") ); | 601 | dlgNote->setCaption( tr("Enter Note") ); |
602 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 602 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
603 | txtNote = new QMultiLineEdit( dlgNote ); | 603 | txtNote = new QMultiLineEdit( dlgNote ); |
604 | vbNote->addWidget( txtNote ); | 604 | vbNote->addWidget( txtNote ); |
605 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 605 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
606 | 606 | ||
607 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 607 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
608 | dlgName->setCaption( tr("Edit Name") ); | 608 | dlgName->setCaption( tr("Edit Name") ); |
609 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 609 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
610 | 610 | ||
611 | l = new QLabel( tr("First Name"), dlgName ); | 611 | l = new QLabel( tr("First Name"), dlgName ); |
612 | gl->addWidget( l, 0, 0 ); | 612 | gl->addWidget( l, 0, 0 ); |
613 | txtFirstName = new QLineEdit( dlgName ); | 613 | txtFirstName = new QLineEdit( dlgName ); |
614 | gl->addWidget( txtFirstName, 0, 1 ); | 614 | gl->addWidget( txtFirstName, 0, 1 ); |
615 | 615 | ||
616 | l = new QLabel( tr("Middle Name"), dlgName ); | 616 | l = new QLabel( tr("Middle Name"), dlgName ); |
617 | gl->addWidget( l, 1, 0 ); | 617 | gl->addWidget( l, 1, 0 ); |
618 | txtMiddleName = new QLineEdit( dlgName ); | 618 | txtMiddleName = new QLineEdit( dlgName ); |
619 | gl->addWidget( txtMiddleName, 1, 1 ); | 619 | gl->addWidget( txtMiddleName, 1, 1 ); |
620 | 620 | ||
621 | l = new QLabel( tr("Last Name"), dlgName ); | 621 | l = new QLabel( tr("Last Name"), dlgName ); |
622 | gl->addWidget( l, 2, 0 ); | 622 | gl->addWidget( l, 2, 0 ); |
623 | txtLastName = new QLineEdit( dlgName ); | 623 | txtLastName = new QLineEdit( dlgName ); |
624 | gl->addWidget( txtLastName, 2, 1 ); | 624 | gl->addWidget( txtLastName, 2, 1 ); |
625 | 625 | ||
626 | // l = new QLabel( tr("Suffix"), dlgName ); | 626 | // l = new QLabel( tr("Suffix"), dlgName ); |
627 | // gl->addWidget( l, 3, 0 ); | 627 | // gl->addWidget( l, 3, 0 ); |
628 | // txtSuffix = new QLineEdit( dlgName ); | 628 | // txtSuffix = new QLineEdit( dlgName ); |
629 | // gl->addWidget( txtSuffix, 3, 1 ); | 629 | // gl->addWidget( txtSuffix, 3, 1 ); |
630 | space = new QSpacerItem(1,1, | 630 | space = new QSpacerItem(1,1, |
631 | QSizePolicy::Maximum, | 631 | QSizePolicy::Maximum, |
632 | QSizePolicy::MinimumExpanding ); | 632 | QSizePolicy::MinimumExpanding ); |
633 | gl->addItem( space, 4, 0 ); | 633 | gl->addItem( space, 4, 0 ); |
634 | 634 | ||
635 | cmbChooserField1->insertStringList( trlChooserNames ); | 635 | cmbChooserField1->insertStringList( trlChooserNames ); |
636 | cmbChooserField2->insertStringList( trlChooserNames ); | 636 | cmbChooserField2->insertStringList( trlChooserNames ); |
637 | cmbChooserField3->insertStringList( trlChooserNames ); | 637 | cmbChooserField3->insertStringList( trlChooserNames ); |
638 | cmbChooserField4->insertStringList( trlChooserNames ); | 638 | cmbChooserField4->insertStringList( trlChooserNames ); |
639 | 639 | ||
640 | cmbChooserField1->setCurrentItem( 0 ); | 640 | cmbChooserField1->setCurrentItem( 0 ); |
641 | cmbChooserField2->setCurrentItem( 1 ); | 641 | cmbChooserField2->setCurrentItem( 1 ); |
642 | cmbChooserField3->setCurrentItem( 2 ); | 642 | cmbChooserField3->setCurrentItem( 2 ); |
643 | 643 | ||
644 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 644 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
645 | 645 | ||
646 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 646 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); |
647 | 647 | ||
648 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 648 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
649 | this, SLOT(slotChooser1Change(const QString &)) ); | 649 | this, SLOT(slotChooser1Change(const QString &)) ); |
650 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 650 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
651 | this, SLOT(slotChooser2Change(const QString &)) ); | 651 | this, SLOT(slotChooser2Change(const QString &)) ); |
652 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 652 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
653 | this, SLOT(slotChooser3Change(const QString &)) ); | 653 | this, SLOT(slotChooser3Change(const QString &)) ); |
654 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 654 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
655 | this, SLOT(slotChooser4Change(const QString &)) ); | 655 | this, SLOT(slotChooser4Change(const QString &)) ); |
656 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 656 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
657 | this, SLOT(slotAddressChange(const QString &)) ); | 657 | this, SLOT(slotAddressChange(const QString &)) ); |
658 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 658 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
659 | this, SLOT(slotCityChange(const QString &)) ); | 659 | this, SLOT(slotCityChange(const QString &)) ); |
660 | connect( txtState, SIGNAL(textChanged(const QString &)), | 660 | connect( txtState, SIGNAL(textChanged(const QString &)), |
661 | this, SLOT(slotStateChange(const QString &)) ); | 661 | this, SLOT(slotStateChange(const QString &)) ); |
662 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 662 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
663 | this, SLOT(slotZipChange(const QString &)) ); | 663 | this, SLOT(slotZipChange(const QString &)) ); |
664 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 664 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
665 | this, SLOT(slotCountryChange(const QString &)) ); | 665 | this, SLOT(slotCountryChange(const QString &)) ); |
666 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 666 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
667 | this, SLOT(slotCountryChange(const QString &)) ); | 667 | this, SLOT(slotCountryChange(const QString &)) ); |
668 | connect( cmbChooserField1, SIGNAL(activated(int)), | 668 | connect( cmbChooserField1, SIGNAL(activated(int)), |
669 | this, SLOT(slotCmbChooser1Change(int)) ); | 669 | this, SLOT(slotCmbChooser1Change(int)) ); |
670 | connect( cmbChooserField2, SIGNAL(activated(int)), | 670 | connect( cmbChooserField2, SIGNAL(activated(int)), |
671 | this, SLOT(slotCmbChooser2Change(int)) ); | 671 | this, SLOT(slotCmbChooser2Change(int)) ); |
672 | connect( cmbChooserField3, SIGNAL(activated(int)), | 672 | connect( cmbChooserField3, SIGNAL(activated(int)), |
673 | this, SLOT(slotCmbChooser3Change(int)) ); | 673 | this, SLOT(slotCmbChooser3Change(int)) ); |
674 | connect( cmbChooserField4, SIGNAL(activated(int)), | 674 | connect( cmbChooserField4, SIGNAL(activated(int)), |
675 | this, SLOT(slotCmbChooser4Change(int)) ); | 675 | this, SLOT(slotCmbChooser4Change(int)) ); |
676 | connect( cmbAddress, SIGNAL(activated(int)), | 676 | connect( cmbAddress, SIGNAL(activated(int)), |
677 | this, SLOT(slotAddressTypeChange(int)) ); | 677 | this, SLOT(slotAddressTypeChange(int)) ); |
678 | 678 | ||
679 | new QPEDialogListener(this); | 679 | new QPEDialogListener(this); |
680 | 680 | ||
681 | setPersonalView ( m_personalView ); | 681 | setPersonalView ( m_personalView ); |
682 | 682 | ||
683 | qWarning("init() END"); | 683 | qWarning("init() END"); |
684 | } | 684 | } |
685 | 685 | ||
686 | void ContactEditor::defaultEmailChanged(int i){ | 686 | void ContactEditor::defaultEmailChanged(int i){ |
687 | qDebug("defaultEmailChanged"); | 687 | qDebug("defaultEmailChanged"); |
688 | 688 | ||
689 | // was sollte das ? (se) | 689 | // was sollte das ? (se) |
690 | // int index = cmbChooserField1->currentItem(); | 690 | // int index = cmbChooserField1->currentItem(); |
691 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 691 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
692 | 692 | ||
693 | defaultEmail = cmbDefaultEmail->text(i); | 693 | defaultEmail = cmbDefaultEmail->text(i); |
694 | qDebug ("Changed to: %s", defaultEmail.latin1()); | 694 | qDebug ("Changed to: %s", defaultEmail.latin1()); |
695 | 695 | ||
696 | } | 696 | } |
697 | 697 | ||
698 | void ContactEditor::populateDefaultEmailCmb(){ | 698 | void ContactEditor::populateDefaultEmailCmb(){ |
699 | 699 | ||
700 | // if the default-email combo was not selected and therfore not created | 700 | // if the default-email combo was not selected and therfore not created |
701 | // we get a lot of trouble.. Therfore create an invisible one.. | 701 | // we get a lot of trouble.. Therfore create an invisible one.. |
702 | if ( !cmbDefaultEmail ){ | 702 | if ( !cmbDefaultEmail ){ |
703 | cmbDefaultEmail = new QComboBox(this); | 703 | cmbDefaultEmail = new QComboBox(this); |
704 | cmbDefaultEmail -> hide(); | 704 | cmbDefaultEmail -> hide(); |
705 | } | 705 | } |
706 | cmbDefaultEmail->clear(); | 706 | cmbDefaultEmail->clear(); |
707 | cmbDefaultEmail->insertStringList( emails ); | 707 | cmbDefaultEmail->insertStringList( emails ); |
708 | // cmbDefaultEmail->show(); | 708 | // cmbDefaultEmail->show(); |
709 | 709 | ||
710 | // Select default email in combo.. | 710 | // Select default email in combo.. |
711 | bool found = false; | 711 | bool found = false; |
712 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 712 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
713 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", | 713 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", |
714 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); | 714 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); |
715 | 715 | ||
716 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 716 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
717 | cmbDefaultEmail->setCurrentItem( i ); | 717 | cmbDefaultEmail->setCurrentItem( i ); |
718 | qDebug("set"); | 718 | qDebug("set"); |
719 | found = true; | 719 | found = true; |
720 | } | 720 | } |
721 | } | 721 | } |
722 | 722 | ||
723 | // If the current default email is not found in the list, we choose the | 723 | // If the current default email is not found in the list, we choose the |
724 | // first one.. | 724 | // first one.. |
725 | if ( !found ) | 725 | if ( !found ) |
726 | defaultEmail = cmbDefaultEmail->text(0); | 726 | defaultEmail = cmbDefaultEmail->text(0); |
727 | } | 727 | } |
728 | 728 | ||
729 | // Called when any combobox was changed. | 729 | // Called when any combobox was changed. |
730 | // "true" returned if the change was chandled by this function, else it should | 730 | // "true" returned if the change was chandled by this function, else it should |
731 | // be handled by something else.. | 731 | // be handled by something else.. |
732 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { | 732 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { |
733 | QString type = slChooserNames[index]; | 733 | QString type = slChooserNames[index]; |
734 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); | 734 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); |
735 | 735 | ||
736 | if ( !initializing ) | 736 | if ( !initializing ) |
737 | contactfields.setFieldOrder( widgetPos-1, index ); | 737 | contactfields.setFieldOrder( widgetPos-1, index ); |
738 | 738 | ||
739 | // Create and connect combobox for selecting the default email | 739 | // Create and connect combobox for selecting the default email |
740 | if ( type == "Default Email"){ | 740 | if ( type == "Default Email"){ |
741 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); | 741 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); |
742 | 742 | ||
743 | // More than one default-email chooser is not allowed ! | 743 | // More than one default-email chooser is not allowed ! |
744 | if ( ( defaultEmailChooserPosition != -1 ) && | 744 | if ( ( defaultEmailChooserPosition != -1 ) && |
745 | defaultEmailChooserPosition != widgetPos && !initializing){ | 745 | defaultEmailChooserPosition != widgetPos && !initializing){ |
746 | chooserError( widgetPos ); | 746 | chooserError( widgetPos ); |
747 | return true; | 747 | return true; |
748 | } | 748 | } |
749 | 749 | ||
750 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 750 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
751 | if ( cmbo ){ | 751 | if ( cmbo ){ |
752 | inputStack->raiseWidget( TextField ); | 752 | inputStack->raiseWidget( TextField ); |
753 | inputStack -> removeWidget( cmbo ); | 753 | inputStack -> removeWidget( cmbo ); |
754 | delete cmbo; | 754 | delete cmbo; |
755 | } | 755 | } |
756 | cmbo = new QComboBox( inputStack ); | 756 | cmbo = new QComboBox( inputStack ); |
757 | cmbo -> insertStringList( emails ); | 757 | cmbo -> insertStringList( emails ); |
758 | 758 | ||
759 | inputStack -> addWidget( cmbo, Combo ); | 759 | inputStack -> addWidget( cmbo, Combo ); |
760 | inputStack -> raiseWidget( Combo ); | 760 | inputStack -> raiseWidget( Combo ); |
761 | 761 | ||
762 | defaultEmailChooserPosition = widgetPos; | 762 | defaultEmailChooserPosition = widgetPos; |
763 | cmbDefaultEmail = cmbo; | 763 | cmbDefaultEmail = cmbo; |
764 | 764 | ||
765 | connect( cmbo,SIGNAL( activated(int) ), | 765 | connect( cmbo,SIGNAL( activated(int) ), |
766 | SLOT( defaultEmailChanged(int) ) ); | 766 | SLOT( defaultEmailChanged(int) ) ); |
767 | 767 | ||
768 | // Set current default email | 768 | // Set current default email |
769 | populateDefaultEmailCmb(); | 769 | populateDefaultEmailCmb(); |
770 | 770 | ||
771 | 771 | ||
772 | } else { | 772 | } else { |
773 | // Something else was selected: Hide combo.. | 773 | // Something else was selected: Hide combo.. |
774 | qWarning(" Hiding default-email combo" ); | 774 | qWarning(" Hiding default-email combo" ); |
775 | if ( defaultEmailChooserPosition == widgetPos ){ | 775 | if ( defaultEmailChooserPosition == widgetPos ){ |
776 | defaultEmailChooserPosition = -1; | 776 | defaultEmailChooserPosition = -1; |
777 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 777 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
778 | if ( cmbo ){ | 778 | if ( cmbo ){ |
779 | inputStack->raiseWidget( TextField ); | 779 | inputStack->raiseWidget( TextField ); |
780 | inputStack -> removeWidget( cmbo ); | 780 | inputStack -> removeWidget( cmbo ); |
781 | cmbDefaultEmail = 0l; | 781 | cmbDefaultEmail = 0l; |
782 | delete cmbo; | 782 | delete cmbo; |
783 | } | 783 | } |
784 | 784 | ||
785 | } | 785 | } |
786 | 786 | ||
787 | // Caller should initialize the responsible textfield, therefore | 787 | // Caller should initialize the responsible textfield, therefore |
788 | // "false" is returned | 788 | // "false" is returned |
789 | return false; | 789 | return false; |
790 | } | 790 | } |
791 | 791 | ||
792 | // Everything is worked off .. | 792 | // Everything is worked off .. |
793 | return true; | 793 | return true; |
794 | 794 | ||
795 | } | 795 | } |
796 | 796 | ||
797 | // Currently accessed when we select default-email more than once ! | 797 | // Currently accessed when we select default-email more than once ! |
798 | void ContactEditor::chooserError( int index ) | 798 | void ContactEditor::chooserError( int index ) |
799 | { | 799 | { |
800 | qWarning("ContactEditor::chooserError( %d )", index); | 800 | qWarning("ContactEditor::chooserError( %d )", index); |
801 | QMessageBox::warning( this, "Chooser Error", | 801 | QMessageBox::warning( this, "Chooser Error", |
802 | "Multiple selection of this\n" | 802 | "Multiple selection of this\n" |
803 | "Item is not allowed !\n\n" | 803 | "Item is not allowed !\n\n" |
804 | "First deselect the previous one !", | 804 | "First deselect the previous one !", |
805 | "&OK", 0, 0, | 805 | "&OK", 0, 0, |
806 | 0, 0 ); | 806 | 0, 0 ); |
807 | 807 | ||
808 | // Reset the selected Chooser. Unfortunately the chooser | 808 | // Reset the selected Chooser. Unfortunately the chooser |
809 | // generates no signal, therfore we have to | 809 | // generates no signal, therfore we have to |
810 | // call the cmbChooserChange function manually.. | 810 | // call the cmbChooserChange function manually.. |
811 | switch( index ){ | 811 | switch( index ){ |
812 | case 1: | 812 | case 1: |
813 | cmbChooserField1 -> setCurrentItem( 0 ); | 813 | cmbChooserField1 -> setCurrentItem( 0 ); |
814 | slotCmbChooser1Change( 0 ); | 814 | slotCmbChooser1Change( 0 ); |
815 | break; | 815 | break; |
816 | case 2: | 816 | case 2: |
817 | cmbChooserField2 -> setCurrentItem( 0 ); | 817 | cmbChooserField2 -> setCurrentItem( 0 ); |
818 | slotCmbChooser2Change( 0 ); | 818 | slotCmbChooser2Change( 0 ); |
819 | break; | 819 | break; |
820 | case 3: | 820 | case 3: |
821 | cmbChooserField3 -> setCurrentItem( 0 ); | 821 | cmbChooserField3 -> setCurrentItem( 0 ); |
822 | slotCmbChooser3Change( 0 ); | 822 | slotCmbChooser3Change( 0 ); |
823 | break; | 823 | break; |
824 | case 4: | 824 | case 4: |
825 | cmbChooserField4 -> setCurrentItem( 0 ); | 825 | cmbChooserField4 -> setCurrentItem( 0 ); |
826 | slotCmbChooser4Change( 0 ); | 826 | slotCmbChooser4Change( 0 ); |
827 | break; | 827 | break; |
828 | } | 828 | } |
829 | } | 829 | } |
830 | 830 | ||
831 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 831 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
832 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 832 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
833 | QLineEdit* , int widgetPos ) { | 833 | QLineEdit* , int widgetPos ) { |
834 | 834 | ||
835 | QString type = slChooserNames[index]; // :SX | 835 | QString type = slChooserNames[index]; // :SX |
836 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", | 836 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", |
837 | type.latin1(),textChanged.latin1(), index, widgetPos ); | 837 | type.latin1(),textChanged.latin1(), index, widgetPos ); |
838 | 838 | ||
839 | if ( type == "Default Email"){ | 839 | if ( type == "Default Email"){ |
840 | qWarning ("??? Wozu??: %s", textChanged.latin1()); | 840 | qWarning ("??? Wozu??: %s", textChanged.latin1()); |
841 | defaultEmail = textChanged; | 841 | defaultEmail = textChanged; |
842 | 842 | ||
843 | populateDefaultEmailCmb(); | 843 | populateDefaultEmailCmb(); |
844 | 844 | ||
845 | }else if (type == "Emails"){ | 845 | }else if (type == "Emails"){ |
846 | qDebug("emails"); | 846 | qDebug("emails"); |
847 | 847 | ||
848 | QString de; | 848 | QString de; |
849 | emails = QStringList::split (",", textChanged ); | 849 | emails = QStringList::split (",", textChanged ); |
850 | 850 | ||
851 | populateDefaultEmailCmb(); | 851 | populateDefaultEmailCmb(); |
852 | } | 852 | } |
853 | 853 | ||
854 | slChooserValues[index] = textChanged; | 854 | slChooserValues[index] = textChanged; |
855 | 855 | ||
856 | } | 856 | } |
857 | 857 | ||
858 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 858 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
859 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); | 859 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); |
860 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 860 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
861 | } | 861 | } |
862 | 862 | ||
863 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 863 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
864 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); | 864 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); |
865 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 865 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
866 | 866 | ||
867 | } | 867 | } |
868 | 868 | ||
869 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 869 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
870 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); | 870 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); |
871 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 871 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
872 | } | 872 | } |
873 | 873 | ||
874 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 874 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
875 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); | 875 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); |
876 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 876 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
877 | } | 877 | } |
878 | 878 | ||
879 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 879 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
880 | 880 | ||
881 | if ( cmbAddress->currentItem() == 0 ) { | 881 | if ( cmbAddress->currentItem() == 0 ) { |
882 | slBusinessAddress[0] = textChanged; | 882 | slBusinessAddress[0] = textChanged; |
883 | } else { | 883 | } else { |
884 | slHomeAddress[0] = textChanged; | 884 | slHomeAddress[0] = textChanged; |
885 | } | 885 | } |
886 | } | 886 | } |
887 | 887 | ||
888 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 888 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
889 | 889 | ||
890 | if ( cmbAddress->currentItem() == 0 ) { | 890 | if ( cmbAddress->currentItem() == 0 ) { |
891 | slBusinessAddress[1] = textChanged; | 891 | slBusinessAddress[1] = textChanged; |
892 | } else { | 892 | } else { |
893 | slHomeAddress[1] = textChanged; | 893 | slHomeAddress[1] = textChanged; |
894 | } | 894 | } |
895 | } | 895 | } |
896 | 896 | ||
897 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 897 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
898 | 898 | ||
899 | if ( cmbAddress->currentItem() == 0 ) { | 899 | if ( cmbAddress->currentItem() == 0 ) { |
900 | slBusinessAddress[2] = textChanged; | 900 | slBusinessAddress[2] = textChanged; |
901 | } else { | 901 | } else { |
902 | slHomeAddress[2] = textChanged; | 902 | slHomeAddress[2] = textChanged; |
903 | } | 903 | } |
904 | } | 904 | } |
905 | 905 | ||
906 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 906 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
907 | 907 | ||
908 | if ( cmbAddress->currentItem() == 0 ) { | 908 | if ( cmbAddress->currentItem() == 0 ) { |
909 | slBusinessAddress[3] = textChanged; | 909 | slBusinessAddress[3] = textChanged; |
910 | } else { | 910 | } else { |
911 | slHomeAddress[3] = textChanged; | 911 | slHomeAddress[3] = textChanged; |
912 | } | 912 | } |
913 | } | 913 | } |
914 | 914 | ||
915 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 915 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
916 | 916 | ||
917 | 917 | ||
918 | if ( cmbAddress->currentItem() == 0 ) { | 918 | if ( cmbAddress->currentItem() == 0 ) { |
919 | slBusinessAddress[4] = textChanged; | 919 | slBusinessAddress[4] = textChanged; |
920 | } else { | 920 | } else { |
921 | slHomeAddress[4] = textChanged; | 921 | slHomeAddress[4] = textChanged; |
922 | } | 922 | } |
923 | } | 923 | } |
924 | 924 | ||
925 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 925 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
926 | 926 | ||
927 | if ( cmbAddress->currentItem() == 0 ) { | 927 | if ( cmbAddress->currentItem() == 0 ) { |
928 | slBusinessAddress[5] = textChanged; | 928 | slBusinessAddress[5] = textChanged; |
929 | } else { | 929 | } else { |
930 | slHomeAddress[5] = textChanged; | 930 | slHomeAddress[5] = textChanged; |
931 | } | 931 | } |
932 | } | 932 | } |
933 | 933 | ||
934 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 934 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
935 | 935 | ||
936 | if ( cmbAddress->currentItem() == 0 ) { | 936 | if ( cmbAddress->currentItem() == 0 ) { |
937 | slBusinessAddress[6] = textChanged; | 937 | slBusinessAddress[6] = textChanged; |
938 | } else { | 938 | } else { |
939 | slHomeAddress[6] = textChanged; | 939 | slHomeAddress[6] = textChanged; |
940 | } | 940 | } |
941 | } | 941 | } |
942 | 942 | ||
943 | 943 | ||
944 | void ContactEditor::slotCmbChooser1Change( int index ) { | 944 | void ContactEditor::slotCmbChooser1Change( int index ) { |
945 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); | 945 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); |
946 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ | 946 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
947 | 947 | ||
948 | txtChooserField1->setText( slChooserValues[index] ); | 948 | txtChooserField1->setText( slChooserValues[index] ); |
949 | txtChooserField1->setFocus(); | 949 | txtChooserField1->setFocus(); |
950 | 950 | ||
951 | } | 951 | } |
952 | 952 | ||
953 | } | 953 | } |
954 | 954 | ||
955 | void ContactEditor::slotCmbChooser2Change( int index ) { | 955 | void ContactEditor::slotCmbChooser2Change( int index ) { |
956 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); | 956 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); |
957 | 957 | ||
958 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ | 958 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
959 | 959 | ||
960 | txtChooserField2->setText( slChooserValues[index] ); | 960 | txtChooserField2->setText( slChooserValues[index] ); |
961 | txtChooserField2->setFocus(); | 961 | txtChooserField2->setFocus(); |
962 | 962 | ||
963 | } | 963 | } |
964 | } | 964 | } |
965 | 965 | ||
966 | void ContactEditor::slotCmbChooser3Change( int index ) { | 966 | void ContactEditor::slotCmbChooser3Change( int index ) { |
967 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); | 967 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); |
968 | 968 | ||
969 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ | 969 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
970 | 970 | ||
971 | txtChooserField3->setText( slChooserValues[index] ); | 971 | txtChooserField3->setText( slChooserValues[index] ); |
972 | txtChooserField3->setFocus(); | 972 | txtChooserField3->setFocus(); |
973 | 973 | ||
974 | } | 974 | } |
975 | } | 975 | } |
976 | 976 | ||
977 | void ContactEditor::slotCmbChooser4Change( int index ) { | 977 | void ContactEditor::slotCmbChooser4Change( int index ) { |
978 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); | 978 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); |
979 | 979 | ||
980 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ | 980 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
981 | 981 | ||
982 | txtChooserField4->setText( slChooserValues[index] ); | 982 | txtChooserField4->setText( slChooserValues[index] ); |
983 | txtChooserField4->setFocus(); | 983 | txtChooserField4->setFocus(); |
984 | 984 | ||
985 | } | 985 | } |
986 | } | 986 | } |
987 | 987 | ||
988 | void ContactEditor::slotAddressTypeChange( int index ) { | 988 | void ContactEditor::slotAddressTypeChange( int index ) { |
989 | 989 | ||
990 | 990 | ||
991 | if ( !initializing ) | 991 | if ( !initializing ) |
992 | contactfields.setFieldOrder( 4, index ); | 992 | contactfields.setFieldOrder( 4, index ); |
993 | 993 | ||
994 | 994 | ||
995 | if ( index == 0 ) { | 995 | if ( index == 0 ) { |
996 | 996 | ||
997 | txtAddress->setText( slBusinessAddress[0] ); | 997 | txtAddress->setText( slBusinessAddress[0] ); |
998 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 998 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
999 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 999 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
1000 | txtCity->setText( slBusinessAddress[3] ); | 1000 | txtCity->setText( slBusinessAddress[3] ); |
1001 | txtState->setText( slBusinessAddress[4] ); | 1001 | txtState->setText( slBusinessAddress[4] ); |
1002 | txtZip->setText( slBusinessAddress[5] ); | 1002 | txtZip->setText( slBusinessAddress[5] ); |
1003 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1003 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1004 | txtTmp->setText( slBusinessAddress[6] ); | 1004 | txtTmp->setText( slBusinessAddress[6] ); |
1005 | 1005 | ||
1006 | } else { | 1006 | } else { |
1007 | 1007 | ||
1008 | txtAddress->setText( slHomeAddress[0] ); | 1008 | txtAddress->setText( slHomeAddress[0] ); |
1009 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1009 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
1010 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1010 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
1011 | txtCity->setText( slHomeAddress[3] ); | 1011 | txtCity->setText( slHomeAddress[3] ); |
1012 | txtState->setText( slHomeAddress[4] ); | 1012 | txtState->setText( slHomeAddress[4] ); |
1013 | txtZip->setText( slHomeAddress[5] ); | 1013 | txtZip->setText( slHomeAddress[5] ); |
1014 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1014 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1015 | txtTmp->setText( slHomeAddress[6] ); | 1015 | txtTmp->setText( slHomeAddress[6] ); |
1016 | 1016 | ||
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1021 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1022 | 1022 | ||
1023 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); | 1023 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); |
1024 | 1024 | ||
1025 | int index = cmbFileAs->currentItem(); | 1025 | int index = cmbFileAs->currentItem(); |
1026 | 1026 | ||
1027 | cmbFileAs->clear(); | 1027 | cmbFileAs->clear(); |
1028 | 1028 | ||
1029 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | ||
1030 | cmbFileAs->insertItem( parseName( textChanged, NAME_FMLS ) ); | ||
1031 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); | 1029 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1032 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); | 1030 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1031 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | ||
1032 | cmbFileAs->insertItem( parseName( textChanged, NAME_FMLS ) ); | ||
1033 | 1033 | ||
1034 | cmbFileAs->setCurrentItem( index ); | 1034 | cmbFileAs->setCurrentItem( index ); |
1035 | 1035 | ||
1036 | useFullName = true; | 1036 | useFullName = true; |
1037 | 1037 | ||
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | void ContactEditor::accept() { | 1040 | void ContactEditor::accept() { |
1041 | 1041 | ||
1042 | if ( isEmpty() ) { | 1042 | if ( isEmpty() ) { |
1043 | cleanupFields(); | 1043 | cleanupFields(); |
1044 | reject(); | 1044 | reject(); |
1045 | } else { | 1045 | } else { |
1046 | saveEntry(); | 1046 | saveEntry(); |
1047 | cleanupFields(); | 1047 | cleanupFields(); |
1048 | QDialog::accept(); | 1048 | QDialog::accept(); |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | void ContactEditor::slotNote() { | 1053 | void ContactEditor::slotNote() { |
1054 | 1054 | ||
1055 | dlgNote->showMaximized(); | 1055 | dlgNote->showMaximized(); |
1056 | if ( !dlgNote->exec() ) { | 1056 | if ( !dlgNote->exec() ) { |
1057 | txtNote->setText( ent.notes() ); | 1057 | txtNote->setText( ent.notes() ); |
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | void ContactEditor::slotName() { | 1061 | void ContactEditor::slotName() { |
1062 | 1062 | ||
1063 | QString tmpName; | 1063 | QString tmpName; |
1064 | if (useFullName) { | 1064 | if (useFullName) { |
1065 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1065 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1066 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1066 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1067 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1067 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1068 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1068 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1069 | } | 1069 | } |
1070 | dlgName->showMaximized(); | 1070 | dlgName->showMaximized(); |
1071 | if ( dlgName->exec() ) { | 1071 | if ( dlgName->exec() ) { |
1072 | 1072 | ||
1073 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); | 1073 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); |
1074 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1074 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1075 | slotFullNameChange( txtFullName->text() ); | 1075 | slotFullNameChange( txtFullName->text() ); |
1076 | useFullName = false; | 1076 | useFullName = false; |
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | void ContactEditor::setNameFocus() { | 1081 | void ContactEditor::setNameFocus() { |
1082 | 1082 | ||
1083 | txtFullName->setFocus(); | 1083 | txtFullName->setFocus(); |
1084 | 1084 | ||
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | bool ContactEditor::isEmpty() { | 1087 | bool ContactEditor::isEmpty() { |
1088 | // Test and see if the record should be saved. | 1088 | // Test and see if the record should be saved. |
1089 | // More strict than the original qtopia, needs name or fileas to save | 1089 | // More strict than the original qtopia, needs name or fileas to save |
1090 | 1090 | ||
1091 | QString t = txtFullName->text(); | 1091 | QString t = txtFullName->text(); |
1092 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1092 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1093 | return false; | 1093 | return false; |
1094 | 1094 | ||
1095 | t = cmbFileAs->currentText(); | 1095 | t = cmbFileAs->currentText(); |
1096 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1096 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1097 | return false; | 1097 | return false; |
1098 | 1098 | ||
1099 | return true; | 1099 | return true; |
1100 | 1100 | ||
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1103 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1104 | 1104 | ||
1105 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1105 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1106 | QString strFirstName; | 1106 | QString strFirstName; |
1107 | QString strMiddleName; | 1107 | QString strMiddleName; |
1108 | QString strLastName; | 1108 | QString strLastName; |
1109 | QString strSuffix; | 1109 | QString strSuffix; |
1110 | QString strTitle; | 1110 | QString strTitle; |
1111 | int commapos; | 1111 | int commapos; |
1112 | bool haveLastName = false; | 1112 | bool haveLastName = false; |
1113 | 1113 | ||
1114 | qWarning("Fullname: %s", simplifiedName.latin1()); | 1114 | qWarning("Fullname: %s", simplifiedName.latin1()); |
1115 | 1115 | ||
1116 | commapos = simplifiedName.find( ',', 0, TRUE); | 1116 | commapos = simplifiedName.find( ',', 0, TRUE); |
1117 | if ( commapos >= 0 ) { | 1117 | if ( commapos >= 0 ) { |
1118 | qWarning(" Commapos: %d", commapos ); | 1118 | qWarning(" Commapos: %d", commapos ); |
1119 | 1119 | ||
1120 | // A comma (",") separates the lastname from one or | 1120 | // A comma (",") separates the lastname from one or |
1121 | // many first names. Thus, remove the lastname from the | 1121 | // many first names. Thus, remove the lastname from the |
1122 | // String and parse the firstnames. | 1122 | // String and parse the firstnames. |
1123 | 1123 | ||
1124 | strLastName = simplifiedName.left( commapos ); | 1124 | strLastName = simplifiedName.left( commapos ); |
1125 | simplifiedName= simplifiedName.mid( commapos + 1 ); | 1125 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1126 | haveLastName = true; | 1126 | haveLastName = true; |
1127 | qWarning("Fullname without ',': %s", simplifiedName.latin1()); | 1127 | qWarning("Fullname without ',': %s", simplifiedName.latin1()); |
1128 | 1128 | ||
1129 | // If we have any lastname, we should now split all first names. | 1129 | // If we have any lastname, we should now split all first names. |
1130 | // The first one will be the used as first, the rest as "middle names" | 1130 | // The first one will be the used as first, the rest as "middle names" |
1131 | 1131 | ||
1132 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); | 1132 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1133 | QStringList::Iterator it = allFirstNames.begin(); | 1133 | QStringList::Iterator it = allFirstNames.begin(); |
1134 | strFirstName = *it++; | 1134 | strFirstName = *it++; |
1135 | QStringList allSecondNames; | 1135 | QStringList allSecondNames; |
1136 | for ( ; it != allFirstNames.end(); ++it ) | 1136 | for ( ; it != allFirstNames.end(); ++it ) |
1137 | allSecondNames.append( *it ); | 1137 | allSecondNames.append( *it ); |
1138 | 1138 | ||
1139 | strMiddleName = allSecondNames.join(" "); | 1139 | strMiddleName = allSecondNames.join(" "); |
1140 | 1140 | ||
1141 | } else { | 1141 | } else { |
1142 | 1142 | ||
1143 | // No comma separator used: We use the first word as firstname, the | 1143 | // No comma separator used: We use the first word as firstname, the |
1144 | // last as second/lastname and everything in the middle as middlename | 1144 | // last as second/lastname and everything in the middle as middlename |
1145 | 1145 | ||
1146 | QStringList allNames = QStringList::split(" ", simplifiedName); | 1146 | QStringList allNames = QStringList::split(" ", simplifiedName); |
1147 | QStringList::Iterator it = allNames.begin(); | 1147 | QStringList::Iterator it = allNames.begin(); |
1148 | strFirstName = *it++; | 1148 | strFirstName = *it++; |
1149 | QStringList allSecondNames; | 1149 | QStringList allSecondNames; |
1150 | for ( ; it != --allNames.end(); ++it ) | 1150 | for ( ; it != --allNames.end(); ++it ) |
1151 | allSecondNames.append( *it ); | 1151 | allSecondNames.append( *it ); |
1152 | 1152 | ||
1153 | strMiddleName = allSecondNames.join(" "); | 1153 | strMiddleName = allSecondNames.join(" "); |
1154 | strLastName = *(--allNames.end()); | 1154 | strLastName = *(--allNames.end()); |
1155 | 1155 | ||
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | if ( strFirstName == strLastName ) | ||
1159 | strFirstName = ""; | ||
1160 | |||
1158 | qWarning(" strFirstName: %s", strFirstName.latin1()); | 1161 | qWarning(" strFirstName: %s", strFirstName.latin1()); |
1159 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); | 1162 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); |
1160 | qWarning(" strLastName: %s", strLastName.latin1()); | 1163 | qWarning(" strLastName: %s", strLastName.latin1()); |
1161 | qWarning(" strSuffix: %s", strSuffix.latin1()); | 1164 | qWarning(" strSuffix: %s", strSuffix.latin1()); |
1162 | qWarning(" strTitle: %s", strTitle.latin1()); | 1165 | qWarning(" strTitle: %s", strTitle.latin1()); |
1163 | 1166 | ||
1164 | switch (type) { | 1167 | switch (type) { |
1165 | case NAME_FL: | 1168 | case NAME_FL: |
1166 | return strFirstName + " " + strLastName; | 1169 | return strFirstName + " " + strLastName; |
1167 | 1170 | ||
1168 | case NAME_LF: | 1171 | case NAME_LF: |
1169 | return strLastName + ", " + strFirstName; | 1172 | return strLastName + ", " + strFirstName; |
1170 | 1173 | ||
1171 | case NAME_LFM: | 1174 | case NAME_LFM: |
1172 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1175 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1173 | 1176 | ||
1174 | case NAME_FMLS: | 1177 | case NAME_FMLS: |
1175 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; | 1178 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; |
1176 | 1179 | ||
1177 | case NAME_F: | 1180 | case NAME_F: |
1178 | return strFirstName; | 1181 | return strFirstName; |
1179 | 1182 | ||
1180 | case NAME_M: | 1183 | case NAME_M: |
1181 | return strMiddleName; | 1184 | return strMiddleName; |
1182 | 1185 | ||
1183 | case NAME_L: | 1186 | case NAME_L: |
1184 | return strLastName; | 1187 | return strLastName; |
1185 | 1188 | ||
1186 | case NAME_S: | 1189 | case NAME_S: |
1187 | return strSuffix; | 1190 | return strSuffix; |
1188 | 1191 | ||
1189 | } | 1192 | } |
1190 | return QString::null; | 1193 | return QString::null; |
1191 | } | 1194 | } |
1192 | 1195 | ||
1193 | void ContactEditor::cleanupFields() { | 1196 | void ContactEditor::cleanupFields() { |
1194 | QStringList::Iterator it = slChooserValues.begin(); | 1197 | QStringList::Iterator it = slChooserValues.begin(); |
1195 | 1198 | ||
1196 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1199 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1197 | (*it) = ""; | 1200 | (*it) = ""; |
1198 | } | 1201 | } |
1199 | 1202 | ||
1200 | for ( int i = 0; i < 7; i++ ) { | 1203 | for ( int i = 0; i < 7; i++ ) { |
1201 | slHomeAddress[i] = ""; | 1204 | slHomeAddress[i] = ""; |
1202 | slBusinessAddress[i] = ""; | 1205 | slBusinessAddress[i] = ""; |
1203 | } | 1206 | } |
1204 | 1207 | ||
1205 | QListIterator<QLineEdit> itLV( listValue ); | 1208 | QListIterator<QLineEdit> itLV( listValue ); |
1206 | for ( ; itLV.current(); ++itLV ) { | 1209 | for ( ; itLV.current(); ++itLV ) { |
1207 | (*itLV)->setText( "" ); | 1210 | (*itLV)->setText( "" ); |
1208 | } | 1211 | } |
1209 | 1212 | ||
1210 | txtFirstName->setText(""); | 1213 | txtFirstName->setText(""); |
1211 | txtMiddleName->setText(""); | 1214 | txtMiddleName->setText(""); |
1212 | txtLastName->setText(""); | 1215 | txtLastName->setText(""); |
1213 | txtSuffix->setText(""); | 1216 | txtSuffix->setText(""); |
1214 | txtNote->setText(""); | 1217 | txtNote->setText(""); |
1215 | txtFullName->setText(""); | 1218 | txtFullName->setText(""); |
1216 | txtJobTitle->setText(""); | 1219 | txtJobTitle->setText(""); |
1217 | txtOrganization->setText(""); | 1220 | txtOrganization->setText(""); |
1218 | txtChooserField1->setText(""); | 1221 | txtChooserField1->setText(""); |
1219 | txtChooserField2->setText(""); | 1222 | txtChooserField2->setText(""); |
1220 | txtChooserField3->setText(""); | 1223 | txtChooserField3->setText(""); |
1221 | txtAddress->setText(""); | 1224 | txtAddress->setText(""); |
1222 | txtCity->setText(""); | 1225 | txtCity->setText(""); |
1223 | txtState->setText(""); | 1226 | txtState->setText(""); |
1224 | txtZip->setText(""); | 1227 | txtZip->setText(""); |
1225 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1228 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1226 | txtTmp->setText(""); | 1229 | txtTmp->setText(""); |
1227 | txtTmp = cmbFileAs->lineEdit(); | 1230 | txtTmp = cmbFileAs->lineEdit(); |
1228 | txtTmp->setText(""); | 1231 | txtTmp->setText(""); |
1229 | 1232 | ||
1230 | } | 1233 | } |
1231 | 1234 | ||
1232 | void ContactEditor::setEntry( const OContact &entry ) { | 1235 | void ContactEditor::setEntry( const OContact &entry ) { |
1233 | 1236 | ||
1234 | initializing = true; | 1237 | initializing = true; |
1235 | 1238 | ||
1236 | cleanupFields(); | 1239 | cleanupFields(); |
1237 | 1240 | ||
1238 | ent = entry; | 1241 | ent = entry; |
1239 | 1242 | ||
1240 | emails = QStringList(ent.emailList()); | 1243 | emails = QStringList(ent.emailList()); |
1241 | defaultEmail = ent.defaultEmail(); | 1244 | defaultEmail = ent.defaultEmail(); |
1242 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1245 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1243 | qDebug("default email=%s",defaultEmail.latin1()); | 1246 | qDebug("default email=%s",defaultEmail.latin1()); |
1244 | 1247 | ||
1245 | useFullName = false; | 1248 | useFullName = false; |
1246 | txtFirstName->setText( ent.firstName() ); | 1249 | txtFirstName->setText( ent.firstName() ); |
1247 | txtMiddleName->setText( ent.middleName() ); | 1250 | txtMiddleName->setText( ent.middleName() ); |
1248 | txtLastName->setText( ent.lastName() ); | 1251 | txtLastName->setText( ent.lastName() ); |
1249 | txtSuffix->setText( ent.suffix() ); | 1252 | txtSuffix->setText( ent.suffix() ); |
1250 | 1253 | ||
1251 | // QString *tmpString = new QString; | 1254 | // QString *tmpString = new QString; |
1252 | // *tmpString = ent.firstName() + " " + ent.middleName() + | 1255 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1253 | // + " " + ent.lastName() + " " + ent.suffix(); | 1256 | // + " " + ent.lastName() + " " + ent.suffix(); |
1254 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1257 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1255 | 1258 | ||
1256 | // Lastnames with multiple words need to be protected by a comma ! | 1259 | // Lastnames with multiple words need to be protected by a comma ! |
1257 | if ( ent.lastName().contains( ' ', TRUE ) ) | 1260 | if ( ent.lastName().contains( ' ', TRUE ) ) |
1258 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1261 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1259 | else | 1262 | else |
1260 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1263 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); |
1261 | 1264 | ||
1262 | cmbFileAs->setEditText( ent.fileAs() ); | 1265 | cmbFileAs->setEditText( ent.fileAs() ); |
1263 | 1266 | ||
1264 | //if (hasTitle) | 1267 | //if (hasTitle) |
1265 | txtJobTitle->setText( ent.jobTitle() ); | 1268 | txtJobTitle->setText( ent.jobTitle() ); |
1266 | 1269 | ||
1267 | //if (hasCompany) | 1270 | //if (hasCompany) |
1268 | txtOrganization->setText( ent.company() ); | 1271 | txtOrganization->setText( ent.company() ); |
1269 | 1272 | ||
1270 | //if (hasNotes) | 1273 | //if (hasNotes) |
1271 | txtNote->setText( ent.notes() ); | 1274 | txtNote->setText( ent.notes() ); |
1272 | 1275 | ||
1273 | //if (hasStreet) { | 1276 | //if (hasStreet) { |
1274 | slHomeAddress[0] = ent.homeStreet(); | 1277 | slHomeAddress[0] = ent.homeStreet(); |
1275 | slBusinessAddress[0] = ent.businessStreet(); | 1278 | slBusinessAddress[0] = ent.businessStreet(); |
1276 | //} | 1279 | //} |
1277 | 1280 | ||
1278 | //if (hasCity) { | 1281 | //if (hasCity) { |
1279 | slHomeAddress[3] = ent.homeCity(); | 1282 | slHomeAddress[3] = ent.homeCity(); |
1280 | slBusinessAddress[3] = ent.businessCity(); | 1283 | slBusinessAddress[3] = ent.businessCity(); |
1281 | //} | 1284 | //} |
1282 | 1285 | ||
1283 | //if (hasState) { | 1286 | //if (hasState) { |
1284 | slHomeAddress[4] = ent.homeState(); | 1287 | slHomeAddress[4] = ent.homeState(); |
1285 | slBusinessAddress[4] = ent.businessState(); | 1288 | slBusinessAddress[4] = ent.businessState(); |
1286 | //} | 1289 | //} |
1287 | 1290 | ||
1288 | //if (hasZip) { | 1291 | //if (hasZip) { |
1289 | slHomeAddress[5] = ent.homeZip(); | 1292 | slHomeAddress[5] = ent.homeZip(); |
1290 | slBusinessAddress[5] = ent.businessZip(); | 1293 | slBusinessAddress[5] = ent.businessZip(); |
1291 | //} | 1294 | //} |
1292 | 1295 | ||
1293 | //if (hasCountry) { | 1296 | //if (hasCountry) { |
1294 | slHomeAddress[6] = ent.homeCountry(); | 1297 | slHomeAddress[6] = ent.homeCountry(); |
1295 | slBusinessAddress[6] = ent.businessCountry(); | 1298 | slBusinessAddress[6] = ent.businessCountry(); |
1296 | //} | 1299 | //} |
1297 | 1300 | ||
1298 | QStringList::ConstIterator it; | 1301 | QStringList::ConstIterator it; |
1299 | QListIterator<QLineEdit> itLE( listValue ); | 1302 | QListIterator<QLineEdit> itLE( listValue ); |
1300 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1303 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1301 | 1304 | ||
1302 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); | 1305 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); |
1303 | 1306 | ||
1304 | if ( *it == "Department" ) | 1307 | if ( *it == "Department" ) |
1305 | (*itLE)->setText( ent.department() ); | 1308 | (*itLE)->setText( ent.department() ); |
1306 | 1309 | ||
1307 | if ( *it == "Company" ) | 1310 | if ( *it == "Company" ) |
1308 | (*itLE)->setText( ent.company() ); | 1311 | (*itLE)->setText( ent.company() ); |
1309 | 1312 | ||
1310 | if ( *it == "Office" ) | 1313 | if ( *it == "Office" ) |
1311 | (*itLE)->setText( ent.office() ); | 1314 | (*itLE)->setText( ent.office() ); |
1312 | 1315 | ||
1313 | if ( *it == "Profession" ) | 1316 | if ( *it == "Profession" ) |
1314 | (*itLE)->setText( ent.profession() ); | 1317 | (*itLE)->setText( ent.profession() ); |
1315 | 1318 | ||
1316 | if ( *it == "Assistant" ) | 1319 | if ( *it == "Assistant" ) |
1317 | (*itLE)->setText( ent.assistant() ); | 1320 | (*itLE)->setText( ent.assistant() ); |
1318 | 1321 | ||
1319 | if ( *it == "Manager" ) | 1322 | if ( *it == "Manager" ) |
1320 | (*itLE)->setText( ent.manager() ); | 1323 | (*itLE)->setText( ent.manager() ); |
1321 | 1324 | ||
1322 | if ( *it == "Spouse" ) | 1325 | if ( *it == "Spouse" ) |
1323 | (*itLE)->setText( ent.spouse() ); | 1326 | (*itLE)->setText( ent.spouse() ); |
1324 | 1327 | ||
1325 | if ( *it == "Nickname" ){ | 1328 | if ( *it == "Nickname" ){ |
1326 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); | 1329 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); |
1327 | (*itLE)->setText( ent.nickname() ); | 1330 | (*itLE)->setText( ent.nickname() ); |
1328 | } | 1331 | } |
1329 | 1332 | ||
1330 | if ( *it == "Children" ) | 1333 | if ( *it == "Children" ) |
1331 | (*itLE)->setText( ent.children() ); | 1334 | (*itLE)->setText( ent.children() ); |
1332 | 1335 | ||
1333 | } | 1336 | } |
1334 | 1337 | ||
1335 | QStringList::Iterator itV; | 1338 | QStringList::Iterator itV; |
1336 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1339 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1337 | 1340 | ||
1338 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1341 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1339 | *itV = ent.businessPhone(); | 1342 | *itV = ent.businessPhone(); |
1340 | /* | 1343 | /* |
1341 | if ( *it == "Business 2 Phone" ) | 1344 | if ( *it == "Business 2 Phone" ) |
1342 | *itV = ent.business2Phone(); | 1345 | *itV = ent.business2Phone(); |
1343 | */ | 1346 | */ |
1344 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1347 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1345 | *itV = ent.businessFax(); | 1348 | *itV = ent.businessFax(); |
1346 | 1349 | ||
1347 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1350 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1348 | *itV = ent.businessMobile(); | 1351 | *itV = ent.businessMobile(); |
1349 | /* | 1352 | /* |
1350 | if ( *it == "Company Phone" ) | 1353 | if ( *it == "Company Phone" ) |
1351 | *itV = ent.companyPhone(); | 1354 | *itV = ent.companyPhone(); |
1352 | */ | 1355 | */ |
1353 | if ( *it == "Default Email" ) | 1356 | if ( *it == "Default Email" ) |
1354 | *itV = ent.defaultEmail(); | 1357 | *itV = ent.defaultEmail(); |
1355 | 1358 | ||
1356 | if ( *it == "Emails" ) | 1359 | if ( *it == "Emails" ) |
1357 | *itV = ent.emailList().join(", "); // :SX | 1360 | *itV = ent.emailList().join(", "); // :SX |
1358 | 1361 | ||
1359 | if ( *it == "Home Phone" ) | 1362 | if ( *it == "Home Phone" ) |
1360 | *itV = ent.homePhone(); | 1363 | *itV = ent.homePhone(); |
1361 | /* | 1364 | /* |
1362 | if ( *it == "Home 2 Phone" ) | 1365 | if ( *it == "Home 2 Phone" ) |
1363 | *itV = ent.home2Phone(); | 1366 | *itV = ent.home2Phone(); |
1364 | */ | 1367 | */ |
1365 | if ( *it == "Home Fax" ) | 1368 | if ( *it == "Home Fax" ) |
1366 | *itV = ent.homeFax(); | 1369 | *itV = ent.homeFax(); |
1367 | 1370 | ||
1368 | if ( *it == "Home Mobile" ) | 1371 | if ( *it == "Home Mobile" ) |
1369 | *itV = ent.homeMobile(); | 1372 | *itV = ent.homeMobile(); |
1370 | /* | 1373 | /* |
1371 | if ( *it == "Car Phone" ) | 1374 | if ( *it == "Car Phone" ) |
1372 | *itV = ent.carPhone(); | 1375 | *itV = ent.carPhone(); |
1373 | 1376 | ||
1374 | if ( *it == "ISDN Phone" ) | 1377 | if ( *it == "ISDN Phone" ) |
1375 | *itV = ent.ISDNPhone(); | 1378 | *itV = ent.ISDNPhone(); |
1376 | 1379 | ||
1377 | if ( *it == "Other Phone" ) | 1380 | if ( *it == "Other Phone" ) |
1378 | *itV = ent.otherPhone(); | 1381 | *itV = ent.otherPhone(); |
1379 | */ | 1382 | */ |
1380 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1383 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1381 | *itV = ent.businessPager(); | 1384 | *itV = ent.businessPager(); |
1382 | /* | 1385 | /* |
1383 | if ( *it == "Home Pager") | 1386 | if ( *it == "Home Pager") |
1384 | *itV = ent.homePager(); | 1387 | *itV = ent.homePager(); |
1385 | 1388 | ||
1386 | if ( *it == "AIM IM" ) | 1389 | if ( *it == "AIM IM" ) |
1387 | *itV = ent.AIMIM(); | 1390 | *itV = ent.AIMIM(); |
1388 | 1391 | ||
1389 | if ( *it == "ICQ IM" ) | 1392 | if ( *it == "ICQ IM" ) |
1390 | *itV = ent.ICQIM(); | 1393 | *itV = ent.ICQIM(); |
1391 | 1394 | ||
1392 | if ( *it == "Jabber IM" ) | 1395 | if ( *it == "Jabber IM" ) |
1393 | *itV = ent.jabberIM(); | 1396 | *itV = ent.jabberIM(); |
1394 | 1397 | ||
1395 | if ( *it == "MSN IM" ) | 1398 | if ( *it == "MSN IM" ) |
1396 | *itV = ent.MSNIM(); | 1399 | *itV = ent.MSNIM(); |
1397 | 1400 | ||
1398 | if ( *it == "Yahoo IM" ) | 1401 | if ( *it == "Yahoo IM" ) |
1399 | *itV = ent.yahooIM(); | 1402 | *itV = ent.yahooIM(); |
1400 | */ | 1403 | */ |
1401 | if ( *it == "Home Web Page" ) | 1404 | if ( *it == "Home Web Page" ) |
1402 | *itV = ent.homeWebpage(); | 1405 | *itV = ent.homeWebpage(); |
1403 | 1406 | ||
1404 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1407 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1405 | *itV = ent.businessWebpage(); | 1408 | *itV = ent.businessWebpage(); |
1406 | 1409 | ||
1407 | 1410 | ||
1408 | } | 1411 | } |
1409 | 1412 | ||
1410 | 1413 | ||
1411 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1414 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1412 | 1415 | ||
1413 | QString gender = ent.gender(); | 1416 | QString gender = ent.gender(); |
1414 | cmbGender->setCurrentItem( gender.toInt() ); | 1417 | cmbGender->setCurrentItem( gender.toInt() ); |
1415 | 1418 | ||
1416 | txtNote->setText( ent.notes() ); | 1419 | txtNote->setText( ent.notes() ); |
1417 | 1420 | ||
1418 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1421 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1419 | 1422 | ||
1420 | // Calling "show()" to arrange all widgets. Otherwise we will get | 1423 | // Calling "show()" to arrange all widgets. Otherwise we will get |
1421 | // a wrong position of the textfields and are unable to put our | 1424 | // a wrong position of the textfields and are unable to put our |
1422 | // default-email combo over it.. This is very ugly ! | 1425 | // default-email combo over it.. This is very ugly ! |
1423 | // Does anybody has a better solution ? | 1426 | // Does anybody has a better solution ? |
1424 | // Basically we should rethink the strategy to hide | 1427 | // Basically we should rethink the strategy to hide |
1425 | // a textfield with overwriting.. (se) | 1428 | // a textfield with overwriting.. (se) |
1426 | show(); | 1429 | show(); |
1427 | 1430 | ||
1428 | // Get combo-settings from contact and set preset.. | 1431 | // Get combo-settings from contact and set preset.. |
1429 | contactfields.loadFromRecord( ent ); | 1432 | contactfields.loadFromRecord( ent ); |
1430 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); | 1433 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); |
1431 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); | 1434 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); |
1432 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); | 1435 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); |
1433 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); | 1436 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); |
1434 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | 1437 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); |
1435 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1438 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1436 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1439 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1437 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1440 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1438 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | 1441 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); |
1439 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1442 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1440 | 1443 | ||
1441 | updateDatePicker(); | 1444 | updateDatePicker(); |
1442 | 1445 | ||
1443 | initializing = false; | 1446 | initializing = false; |
1444 | } | 1447 | } |
1445 | void ContactEditor::updateDatePicker() | 1448 | void ContactEditor::updateDatePicker() |
1446 | { | 1449 | { |
1447 | // Set DatePicker | 1450 | // Set DatePicker |
1448 | if ( !ent.birthday().isNull() ){ | 1451 | if ( !ent.birthday().isNull() ){ |
1449 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1452 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1450 | birthdayPicker->setDate( ent.birthday() ); | 1453 | birthdayPicker->setDate( ent.birthday() ); |
1451 | } else | 1454 | } else |
1452 | birthdayButton->setText( tr ("Unknown") ); | 1455 | birthdayButton->setText( tr ("Unknown") ); |
1453 | 1456 | ||
1454 | if ( !ent.anniversary().isNull() ){ | 1457 | if ( !ent.anniversary().isNull() ){ |
1455 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); | 1458 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); |
1456 | anniversaryPicker->setDate( ent.anniversary() ); | 1459 | anniversaryPicker->setDate( ent.anniversary() ); |
1457 | } else | 1460 | } else |
1458 | anniversaryButton->setText( tr ("Unknown") ); | 1461 | anniversaryButton->setText( tr ("Unknown") ); |
1459 | 1462 | ||
1460 | } | 1463 | } |
1461 | 1464 | ||
1462 | void ContactEditor::saveEntry() { | 1465 | void ContactEditor::saveEntry() { |
1463 | 1466 | ||
1464 | // Store current combo into contact | 1467 | // Store current combo into contact |
1465 | contactfields.saveToRecord( ent ); | 1468 | contactfields.saveToRecord( ent ); |
1466 | 1469 | ||
1467 | if ( useFullName ) { | 1470 | if ( useFullName ) { |
1468 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1471 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1469 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1472 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1470 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1473 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1471 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1474 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1472 | 1475 | ||
1473 | useFullName = false; | 1476 | useFullName = false; |
1474 | } | 1477 | } |
1475 | 1478 | ||
1476 | ent.setFirstName( txtFirstName->text() ); | 1479 | ent.setFirstName( txtFirstName->text() ); |
1477 | ent.setLastName( txtLastName->text() ); | 1480 | ent.setLastName( txtLastName->text() ); |
1478 | ent.setMiddleName( txtMiddleName->text() ); | 1481 | ent.setMiddleName( txtMiddleName->text() ); |
1479 | ent.setSuffix( txtSuffix->text() ); | 1482 | ent.setSuffix( txtSuffix->text() ); |
1480 | 1483 | ||
1481 | ent.setFileAs( cmbFileAs->currentText() ); | 1484 | ent.setFileAs( cmbFileAs->currentText() ); |
1482 | 1485 | ||
1483 | ent.setCategories( cmbCat->currentCategories() ); | 1486 | ent.setCategories( cmbCat->currentCategories() ); |
1484 | 1487 | ||
1485 | 1488 | ||
1486 | //if (hasTitle) | 1489 | //if (hasTitle) |
1487 | ent.setJobTitle( txtJobTitle->text() ); | 1490 | ent.setJobTitle( txtJobTitle->text() ); |
1488 | 1491 | ||
1489 | //if (hasCompany) | 1492 | //if (hasCompany) |
1490 | ent.setCompany( txtOrganization->text() ); | 1493 | ent.setCompany( txtOrganization->text() ); |
1491 | 1494 | ||
1492 | //if (hasNotes) | 1495 | //if (hasNotes) |
1493 | ent.setNotes( txtNote->text() ); | 1496 | ent.setNotes( txtNote->text() ); |
1494 | 1497 | ||
1495 | //if (hasStreet) { | 1498 | //if (hasStreet) { |
1496 | ent.setHomeStreet( slHomeAddress[0] ); | 1499 | ent.setHomeStreet( slHomeAddress[0] ); |
1497 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1500 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1498 | //} | 1501 | //} |
1499 | 1502 | ||
1500 | //if (hasCity) { | 1503 | //if (hasCity) { |
1501 | ent.setHomeCity( slHomeAddress[3] ); | 1504 | ent.setHomeCity( slHomeAddress[3] ); |
1502 | ent.setBusinessCity( slBusinessAddress[3] ); | 1505 | ent.setBusinessCity( slBusinessAddress[3] ); |
1503 | //} | 1506 | //} |
1504 | 1507 | ||
1505 | //if (hasState) { | 1508 | //if (hasState) { |
1506 | ent.setHomeState( slHomeAddress[4] ); | 1509 | ent.setHomeState( slHomeAddress[4] ); |
1507 | ent.setBusinessState( slBusinessAddress[4] ); | 1510 | ent.setBusinessState( slBusinessAddress[4] ); |
1508 | //} | 1511 | //} |
1509 | 1512 | ||
1510 | //if (hasZip) { | 1513 | //if (hasZip) { |
1511 | ent.setHomeZip( slHomeAddress[5] ); | 1514 | ent.setHomeZip( slHomeAddress[5] ); |
1512 | ent.setBusinessZip( slBusinessAddress[5] ); | 1515 | ent.setBusinessZip( slBusinessAddress[5] ); |
1513 | //} | 1516 | //} |
1514 | 1517 | ||
1515 | //if (hasCountry) { | 1518 | //if (hasCountry) { |
1516 | ent.setHomeCountry( slHomeAddress[6] ); | 1519 | ent.setHomeCountry( slHomeAddress[6] ); |
1517 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1520 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1518 | //} | 1521 | //} |
1519 | 1522 | ||
1520 | QStringList::ConstIterator it; | 1523 | QStringList::ConstIterator it; |
1521 | QListIterator<QLineEdit> itLE( listValue ); | 1524 | QListIterator<QLineEdit> itLE( listValue ); |
1522 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { | 1525 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1523 | 1526 | ||
1524 | if ( *it == "Department" ) | 1527 | if ( *it == "Department" ) |
1525 | ent.setDepartment( (*itLE)->text() ); | 1528 | ent.setDepartment( (*itLE)->text() ); |
1526 | 1529 | ||
1527 | if ( *it == "Company" ) | 1530 | if ( *it == "Company" ) |
1528 | ent.setCompany( (*itLE)->text() ); | 1531 | ent.setCompany( (*itLE)->text() ); |
1529 | 1532 | ||
1530 | if ( *it == "Office" ) | 1533 | if ( *it == "Office" ) |
1531 | ent.setOffice( (*itLE)->text() ); | 1534 | ent.setOffice( (*itLE)->text() ); |
1532 | 1535 | ||
1533 | if ( *it == "Profession" ) | 1536 | if ( *it == "Profession" ) |
1534 | ent.setProfession( (*itLE)->text() ); | 1537 | ent.setProfession( (*itLE)->text() ); |
1535 | 1538 | ||
1536 | if ( *it == "Assistant" ) | 1539 | if ( *it == "Assistant" ) |
1537 | ent.setAssistant( (*itLE)->text() ); | 1540 | ent.setAssistant( (*itLE)->text() ); |
1538 | 1541 | ||
1539 | if ( *it == "Manager" ) | 1542 | if ( *it == "Manager" ) |
1540 | ent.setManager( (*itLE)->text() ); | 1543 | ent.setManager( (*itLE)->text() ); |
1541 | 1544 | ||
1542 | if ( *it == "Spouse" ) | 1545 | if ( *it == "Spouse" ) |
1543 | ent.setSpouse( (*itLE)->text() ); | 1546 | ent.setSpouse( (*itLE)->text() ); |
1544 | 1547 | ||
1545 | if ( *it == "Nickname" ) | 1548 | if ( *it == "Nickname" ) |
1546 | ent.setNickname( (*itLE)->text() ); | 1549 | ent.setNickname( (*itLE)->text() ); |
1547 | 1550 | ||
1548 | if ( *it == "Children" ) | 1551 | if ( *it == "Children" ) |
1549 | ent.setChildren( (*itLE)->text() ); | 1552 | ent.setChildren( (*itLE)->text() ); |
1550 | 1553 | ||
1551 | } | 1554 | } |
1552 | 1555 | ||
1553 | 1556 | ||
1554 | QStringList::ConstIterator itV; | 1557 | QStringList::ConstIterator itV; |
1555 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1558 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1556 | 1559 | ||
1557 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1560 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1558 | ent.setBusinessPhone( *itV ); | 1561 | ent.setBusinessPhone( *itV ); |
1559 | 1562 | ||
1560 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1563 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1561 | ent.setBusinessFax( *itV ); | 1564 | ent.setBusinessFax( *itV ); |
1562 | 1565 | ||
1563 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1566 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1564 | ent.setBusinessMobile( *itV ); | 1567 | ent.setBusinessMobile( *itV ); |
1565 | 1568 | ||
1566 | if ( *it == "Emails" ){ | 1569 | if ( *it == "Emails" ){ |
1567 | QString allemail; | 1570 | QString allemail; |
1568 | QString defaultmail; | 1571 | QString defaultmail; |
1569 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1572 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1570 | if ( defaultEmail.isEmpty() ){ | 1573 | if ( defaultEmail.isEmpty() ){ |
1571 | qWarning("Default email was not set by user!"); | 1574 | qWarning("Default email was not set by user!"); |
1572 | qWarning("Using first email in list: %s", defaultmail.latin1()); | 1575 | qWarning("Using first email in list: %s", defaultmail.latin1()); |
1573 | ent.setDefaultEmail( defaultmail ); | 1576 | ent.setDefaultEmail( defaultmail ); |
1574 | } | 1577 | } |
1575 | ent.setEmails( allemail ); | 1578 | ent.setEmails( allemail ); |
1576 | } | 1579 | } |
1577 | 1580 | ||
1578 | if ( *it == "Default Email") | 1581 | if ( *it == "Default Email") |
1579 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1582 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1580 | 1583 | ||
1581 | if ( *it == "Home Phone" ) | 1584 | if ( *it == "Home Phone" ) |
1582 | ent.setHomePhone( *itV ); | 1585 | ent.setHomePhone( *itV ); |
1583 | 1586 | ||
1584 | if ( *it == "Home Fax" ) | 1587 | if ( *it == "Home Fax" ) |
1585 | ent.setHomeFax( *itV ); | 1588 | ent.setHomeFax( *itV ); |
1586 | 1589 | ||
1587 | if ( *it == "Home Mobile" ) | 1590 | if ( *it == "Home Mobile" ) |
1588 | ent.setHomeMobile( *itV ); | 1591 | ent.setHomeMobile( *itV ); |
1589 | 1592 | ||
1590 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1593 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1591 | ent.setBusinessPager( *itV ); | 1594 | ent.setBusinessPager( *itV ); |
1592 | 1595 | ||
1593 | if ( *it == "Home Web Page" ) | 1596 | if ( *it == "Home Web Page" ) |
1594 | ent.setHomeWebpage( *itV ); | 1597 | ent.setHomeWebpage( *itV ); |
1595 | 1598 | ||
1596 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1599 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1597 | ent.setBusinessWebpage( *itV ); | 1600 | ent.setBusinessWebpage( *itV ); |
1598 | 1601 | ||
1599 | 1602 | ||
1600 | } | 1603 | } |
1601 | 1604 | ||
1602 | int gender = cmbGender->currentItem(); | 1605 | int gender = cmbGender->currentItem(); |
1603 | ent.setGender( QString::number( gender ) ); | 1606 | ent.setGender( QString::number( gender ) ); |
1604 | 1607 | ||
1605 | QString str = txtNote->text(); | 1608 | QString str = txtNote->text(); |
1606 | if ( !str.isNull() ) | 1609 | if ( !str.isNull() ) |
1607 | ent.setNotes( str ); | 1610 | ent.setNotes( str ); |
1608 | 1611 | ||
1609 | } | 1612 | } |
1610 | 1613 | ||
1611 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1614 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1612 | QString &strAll ) | 1615 | QString &strAll ) |
1613 | { | 1616 | { |
1614 | int where, | 1617 | int where, |
1615 | start; | 1618 | start; |
1616 | if ( txt.isEmpty() ) | 1619 | if ( txt.isEmpty() ) |
1617 | return; | 1620 | return; |
1618 | // find the first | 1621 | // find the first |
1619 | where = txt.find( ',' ); | 1622 | where = txt.find( ',' ); |
1620 | if ( where < 0 ) { | 1623 | if ( where < 0 ) { |
1621 | strDefaultEmail = txt; | 1624 | strDefaultEmail = txt; |
1622 | strAll = txt; | 1625 | strAll = txt; |
1623 | } else { | 1626 | } else { |
1624 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1627 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1625 | strAll = strDefaultEmail; | 1628 | strAll = strDefaultEmail; |
1626 | while ( where > -1 ) { | 1629 | while ( where > -1 ) { |
1627 | strAll.append(" "); | 1630 | strAll.append(" "); |
1628 | start = where; | 1631 | start = where; |
1629 | where = txt.find( ',', where + 1 ); | 1632 | where = txt.find( ',', where + 1 ); |
1630 | if ( where > - 1 ) | 1633 | if ( where > - 1 ) |
1631 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1634 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1632 | else // grab until the end... | 1635 | else // grab until the end... |
1633 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1636 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1634 | } | 1637 | } |
1635 | } | 1638 | } |
1636 | } | 1639 | } |
1637 | 1640 | ||
1638 | void parseEmailTo( const QString &strDefaultEmail, | 1641 | void parseEmailTo( const QString &strDefaultEmail, |
1639 | const QString &strOtherEmail, QString &strBack ) | 1642 | const QString &strOtherEmail, QString &strBack ) |
1640 | { | 1643 | { |
1641 | // create a comma dilimeted set of emails... | 1644 | // create a comma dilimeted set of emails... |
1642 | // use the power of short circuiting... | 1645 | // use the power of short circuiting... |
1643 | bool foundDefault = false; | 1646 | bool foundDefault = false; |
1644 | QString strTmp; | 1647 | QString strTmp; |
1645 | int start = 0; | 1648 | int start = 0; |
1646 | int where; | 1649 | int where; |
1647 | // start at the beginng. | 1650 | // start at the beginng. |
1648 | strBack = strDefaultEmail; | 1651 | strBack = strDefaultEmail; |
1649 | where = 0; | 1652 | where = 0; |
1650 | while ( where > -1 ) { | 1653 | while ( where > -1 ) { |
1651 | start = where; | 1654 | start = where; |
1652 | where = strOtherEmail.find( ' ', where + 1 ); | 1655 | where = strOtherEmail.find( ' ', where + 1 ); |
1653 | if ( where > 0 ) { | 1656 | if ( where > 0 ) { |
1654 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1657 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1655 | } else | 1658 | } else |
1656 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1659 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1657 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1660 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1658 | strBack.append( ", " ); | 1661 | strBack.append( ", " ); |
1659 | strBack.append( strTmp ); | 1662 | strBack.append( strTmp ); |
1660 | } else | 1663 | } else |
1661 | foundDefault = true; | 1664 | foundDefault = true; |
1662 | } | 1665 | } |
1663 | } | 1666 | } |
1664 | 1667 | ||
1665 | 1668 | ||
1666 | static inline bool containsAlphaNum( const QString &str ) | 1669 | static inline bool containsAlphaNum( const QString &str ) |
1667 | { | 1670 | { |
1668 | int i, | 1671 | int i, |
1669 | count = str.length(); | 1672 | count = str.length(); |
1670 | for ( i = 0; i < count; i++ ) | 1673 | for ( i = 0; i < count; i++ ) |
1671 | if ( !str[i].isSpace() ) | 1674 | if ( !str[i].isSpace() ) |
1672 | return TRUE; | 1675 | return TRUE; |
1673 | return FALSE; | 1676 | return FALSE; |
1674 | } | 1677 | } |
1675 | 1678 | ||
1676 | static inline bool constainsWhiteSpace( const QString &str ) | 1679 | static inline bool constainsWhiteSpace( const QString &str ) |
1677 | { | 1680 | { |
1678 | int i, | 1681 | int i, |
1679 | count = str.length(); | 1682 | count = str.length(); |
1680 | for (i = 0; i < count; i++ ) | 1683 | for (i = 0; i < count; i++ ) |
1681 | if ( str[i].isSpace() ) | 1684 | if ( str[i].isSpace() ) |
1682 | return TRUE; | 1685 | return TRUE; |
1683 | return FALSE; | 1686 | return FALSE; |
1684 | } | 1687 | } |
1685 | 1688 | ||
1686 | void ContactEditor::setPersonalView( bool personal ) | 1689 | void ContactEditor::setPersonalView( bool personal ) |
1687 | { | 1690 | { |
1688 | m_personalView = personal; | 1691 | m_personalView = personal; |
1689 | 1692 | ||
1690 | // Currently disbled due to the fact that | 1693 | // Currently disbled due to the fact that |
1691 | // show will not work... | 1694 | // show will not work... |
1692 | return; | 1695 | return; |
1693 | 1696 | ||
1694 | if ( personal ){ | 1697 | if ( personal ){ |
1695 | cmbCat->hide(); | 1698 | cmbCat->hide(); |
1696 | labCat->hide(); | 1699 | labCat->hide(); |
1697 | 1700 | ||
1698 | } else{ | 1701 | } else{ |
1699 | cmbCat->show(); | 1702 | cmbCat->show(); |
1700 | labCat->show(); | 1703 | labCat->show(); |
1701 | } | 1704 | } |
1702 | } | 1705 | } |
1703 | 1706 | ||
1704 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | 1707 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) |
1705 | { | 1708 | { |
1706 | QDate date; | 1709 | QDate date; |
1707 | date.setYMD( year, month, day ); | 1710 | date.setYMD( year, month, day ); |
1708 | QString dateString = TimeString::numberDateString( date ); | 1711 | QString dateString = TimeString::numberDateString( date ); |
1709 | anniversaryButton->setText( dateString ); | 1712 | anniversaryButton->setText( dateString ); |
1710 | ent.setAnniversary ( date ); | 1713 | ent.setAnniversary ( date ); |
1711 | } | 1714 | } |
1712 | 1715 | ||
1713 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | 1716 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) |
1714 | { | 1717 | { |
1715 | QDate date; | 1718 | QDate date; |
1716 | date.setYMD( year, month, day ); | 1719 | date.setYMD( year, month, day ); |
1717 | QString dateString = TimeString::numberDateString( date ); | 1720 | QString dateString = TimeString::numberDateString( date ); |
1718 | birthdayButton->setText( dateString ); | 1721 | birthdayButton->setText( dateString ); |
1719 | ent.setBirthday ( date ); | 1722 | ent.setBirthday ( date ); |
1720 | } | 1723 | } |
1721 | 1724 | ||
1722 | void ContactEditor::slotRemoveBirthday() | 1725 | void ContactEditor::slotRemoveBirthday() |
1723 | { | 1726 | { |
1724 | qWarning("void ContactEditor::slotRemoveBirthday()"); | 1727 | qWarning("void ContactEditor::slotRemoveBirthday()"); |
1725 | ent.setBirthday( QDate() ); | 1728 | ent.setBirthday( QDate() ); |
1726 | updateDatePicker(); | 1729 | updateDatePicker(); |
1727 | } | 1730 | } |
1728 | 1731 | ||
1729 | void ContactEditor::slotRemoveAnniversary() | 1732 | void ContactEditor::slotRemoveAnniversary() |
1730 | { | 1733 | { |
1731 | qWarning("void ContactEditor::slotRemoveAnniversary()"); | 1734 | qWarning("void ContactEditor::slotRemoveAnniversary()"); |
1732 | ent.setAnniversary( QDate() ); | 1735 | ent.setAnniversary( QDate() ); |
1733 | updateDatePicker(); | 1736 | updateDatePicker(); |
1734 | } | 1737 | } |