author | eilers <eilers> | 2003-03-04 17:23:03 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-03-04 17:23:03 (UTC) |
commit | caad9c7b3e7fc0c9046993f6a152cd37f91fdceb (patch) (unidiff) | |
tree | 189006e4f369cf6a373fd20f277966ff42117b5b | |
parent | 55e5d2c95f70d296c541e4f2564713a593c3851c (diff) | |
download | opie-caad9c7b3e7fc0c9046993f6a152cd37f91fdceb.zip opie-caad9c7b3e7fc0c9046993f6a152cd37f91fdceb.tar.gz opie-caad9c7b3e7fc0c9046993f6a152cd37f91fdceb.tar.bz2 |
Fixing suffix handling
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 15 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 1 |
2 files changed, 11 insertions, 5 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index c4a7b10..75dd2c1 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -392,1055 +392,1060 @@ void ContactEditor::init() { | |||
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( txtSuffix, SIGNAL(textChanged(const QString &)), this, SLOT(slotSuffixChange(const QString &)) ); | ||
649 | |||
648 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 650 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
649 | this, SLOT(slotChooser1Change(const QString &)) ); | 651 | this, SLOT(slotChooser1Change(const QString &)) ); |
650 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 652 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
651 | this, SLOT(slotChooser2Change(const QString &)) ); | 653 | this, SLOT(slotChooser2Change(const QString &)) ); |
652 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 654 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
653 | this, SLOT(slotChooser3Change(const QString &)) ); | 655 | this, SLOT(slotChooser3Change(const QString &)) ); |
654 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 656 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
655 | this, SLOT(slotChooser4Change(const QString &)) ); | 657 | this, SLOT(slotChooser4Change(const QString &)) ); |
656 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 658 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
657 | this, SLOT(slotAddressChange(const QString &)) ); | 659 | this, SLOT(slotAddressChange(const QString &)) ); |
658 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 660 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
659 | this, SLOT(slotCityChange(const QString &)) ); | 661 | this, SLOT(slotCityChange(const QString &)) ); |
660 | connect( txtState, SIGNAL(textChanged(const QString &)), | 662 | connect( txtState, SIGNAL(textChanged(const QString &)), |
661 | this, SLOT(slotStateChange(const QString &)) ); | 663 | this, SLOT(slotStateChange(const QString &)) ); |
662 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 664 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
663 | this, SLOT(slotZipChange(const QString &)) ); | 665 | this, SLOT(slotZipChange(const QString &)) ); |
664 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 666 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
665 | this, SLOT(slotCountryChange(const QString &)) ); | 667 | this, SLOT(slotCountryChange(const QString &)) ); |
666 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 668 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
667 | this, SLOT(slotCountryChange(const QString &)) ); | 669 | this, SLOT(slotCountryChange(const QString &)) ); |
668 | connect( cmbChooserField1, SIGNAL(activated(int)), | 670 | connect( cmbChooserField1, SIGNAL(activated(int)), |
669 | this, SLOT(slotCmbChooser1Change(int)) ); | 671 | this, SLOT(slotCmbChooser1Change(int)) ); |
670 | connect( cmbChooserField2, SIGNAL(activated(int)), | 672 | connect( cmbChooserField2, SIGNAL(activated(int)), |
671 | this, SLOT(slotCmbChooser2Change(int)) ); | 673 | this, SLOT(slotCmbChooser2Change(int)) ); |
672 | connect( cmbChooserField3, SIGNAL(activated(int)), | 674 | connect( cmbChooserField3, SIGNAL(activated(int)), |
673 | this, SLOT(slotCmbChooser3Change(int)) ); | 675 | this, SLOT(slotCmbChooser3Change(int)) ); |
674 | connect( cmbChooserField4, SIGNAL(activated(int)), | 676 | connect( cmbChooserField4, SIGNAL(activated(int)), |
675 | this, SLOT(slotCmbChooser4Change(int)) ); | 677 | this, SLOT(slotCmbChooser4Change(int)) ); |
676 | connect( cmbAddress, SIGNAL(activated(int)), | 678 | connect( cmbAddress, SIGNAL(activated(int)), |
677 | this, SLOT(slotAddressTypeChange(int)) ); | 679 | this, SLOT(slotAddressTypeChange(int)) ); |
678 | 680 | ||
679 | new QPEDialogListener(this); | 681 | new QPEDialogListener(this); |
680 | 682 | ||
681 | setPersonalView ( m_personalView ); | 683 | setPersonalView ( m_personalView ); |
682 | 684 | ||
683 | qWarning("init() END"); | 685 | qWarning("init() END"); |
684 | } | 686 | } |
685 | 687 | ||
686 | void ContactEditor::defaultEmailChanged(int i){ | 688 | void ContactEditor::defaultEmailChanged(int i){ |
687 | qDebug("defaultEmailChanged"); | 689 | qDebug("defaultEmailChanged"); |
688 | 690 | ||
689 | // was sollte das ? (se) | 691 | // was sollte das ? (se) |
690 | // int index = cmbChooserField1->currentItem(); | 692 | // int index = cmbChooserField1->currentItem(); |
691 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 693 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
692 | 694 | ||
693 | defaultEmail = cmbDefaultEmail->text(i); | 695 | defaultEmail = cmbDefaultEmail->text(i); |
694 | qDebug ("Changed to: %s", defaultEmail.latin1()); | 696 | qDebug ("Changed to: %s", defaultEmail.latin1()); |
695 | 697 | ||
696 | } | 698 | } |
697 | 699 | ||
698 | void ContactEditor::populateDefaultEmailCmb(){ | 700 | void ContactEditor::populateDefaultEmailCmb(){ |
699 | 701 | ||
700 | // if the default-email combo was not selected and therfore not created | 702 | // if the default-email combo was not selected and therfore not created |
701 | // we get a lot of trouble.. Therfore create an invisible one.. | 703 | // we get a lot of trouble.. Therfore create an invisible one.. |
702 | if ( !cmbDefaultEmail ){ | 704 | if ( !cmbDefaultEmail ){ |
703 | cmbDefaultEmail = new QComboBox(this); | 705 | cmbDefaultEmail = new QComboBox(this); |
704 | cmbDefaultEmail -> hide(); | 706 | cmbDefaultEmail -> hide(); |
705 | } | 707 | } |
706 | cmbDefaultEmail->clear(); | 708 | cmbDefaultEmail->clear(); |
707 | cmbDefaultEmail->insertStringList( emails ); | 709 | cmbDefaultEmail->insertStringList( emails ); |
708 | // cmbDefaultEmail->show(); | 710 | // cmbDefaultEmail->show(); |
709 | 711 | ||
710 | // Select default email in combo.. | 712 | // Select default email in combo.. |
711 | bool found = false; | 713 | bool found = false; |
712 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 714 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
713 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", | 715 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", |
714 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); | 716 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); |
715 | 717 | ||
716 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 718 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
717 | cmbDefaultEmail->setCurrentItem( i ); | 719 | cmbDefaultEmail->setCurrentItem( i ); |
718 | qDebug("set"); | 720 | qDebug("set"); |
719 | found = true; | 721 | found = true; |
720 | } | 722 | } |
721 | } | 723 | } |
722 | 724 | ||
723 | // If the current default email is not found in the list, we choose the | 725 | // If the current default email is not found in the list, we choose the |
724 | // first one.. | 726 | // first one.. |
725 | if ( !found ) | 727 | if ( !found ) |
726 | defaultEmail = cmbDefaultEmail->text(0); | 728 | defaultEmail = cmbDefaultEmail->text(0); |
727 | } | 729 | } |
728 | 730 | ||
729 | // Called when any combobox was changed. | 731 | // Called when any combobox was changed. |
730 | // "true" returned if the change was chandled by this function, else it should | 732 | // "true" returned if the change was chandled by this function, else it should |
731 | // be handled by something else.. | 733 | // be handled by something else.. |
732 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { | 734 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { |
733 | QString type = slChooserNames[index]; | 735 | QString type = slChooserNames[index]; |
734 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); | 736 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); |
735 | 737 | ||
736 | if ( !initializing ) | 738 | if ( !initializing ) |
737 | contactfields.setFieldOrder( widgetPos-1, index ); | 739 | contactfields.setFieldOrder( widgetPos-1, index ); |
738 | 740 | ||
739 | // Create and connect combobox for selecting the default email | 741 | // Create and connect combobox for selecting the default email |
740 | if ( type == "Default Email"){ | 742 | if ( type == "Default Email"){ |
741 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); | 743 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); |
742 | 744 | ||
743 | // More than one default-email chooser is not allowed ! | 745 | // More than one default-email chooser is not allowed ! |
744 | if ( ( defaultEmailChooserPosition != -1 ) && | 746 | if ( ( defaultEmailChooserPosition != -1 ) && |
745 | defaultEmailChooserPosition != widgetPos && !initializing){ | 747 | defaultEmailChooserPosition != widgetPos && !initializing){ |
746 | chooserError( widgetPos ); | 748 | chooserError( widgetPos ); |
747 | return true; | 749 | return true; |
748 | } | 750 | } |
749 | 751 | ||
750 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 752 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
751 | if ( cmbo ){ | 753 | if ( cmbo ){ |
752 | inputStack->raiseWidget( TextField ); | 754 | inputStack->raiseWidget( TextField ); |
753 | inputStack -> removeWidget( cmbo ); | 755 | inputStack -> removeWidget( cmbo ); |
754 | delete cmbo; | 756 | delete cmbo; |
755 | } | 757 | } |
756 | cmbo = new QComboBox( inputStack ); | 758 | cmbo = new QComboBox( inputStack ); |
757 | cmbo -> insertStringList( emails ); | 759 | cmbo -> insertStringList( emails ); |
758 | 760 | ||
759 | inputStack -> addWidget( cmbo, Combo ); | 761 | inputStack -> addWidget( cmbo, Combo ); |
760 | inputStack -> raiseWidget( Combo ); | 762 | inputStack -> raiseWidget( Combo ); |
761 | 763 | ||
762 | defaultEmailChooserPosition = widgetPos; | 764 | defaultEmailChooserPosition = widgetPos; |
763 | cmbDefaultEmail = cmbo; | 765 | cmbDefaultEmail = cmbo; |
764 | 766 | ||
765 | connect( cmbo,SIGNAL( activated(int) ), | 767 | connect( cmbo,SIGNAL( activated(int) ), |
766 | SLOT( defaultEmailChanged(int) ) ); | 768 | SLOT( defaultEmailChanged(int) ) ); |
767 | 769 | ||
768 | // Set current default email | 770 | // Set current default email |
769 | populateDefaultEmailCmb(); | 771 | populateDefaultEmailCmb(); |
770 | 772 | ||
771 | 773 | ||
772 | } else { | 774 | } else { |
773 | // Something else was selected: Hide combo.. | 775 | // Something else was selected: Hide combo.. |
774 | qWarning(" Hiding default-email combo" ); | 776 | qWarning(" Hiding default-email combo" ); |
775 | if ( defaultEmailChooserPosition == widgetPos ){ | 777 | if ( defaultEmailChooserPosition == widgetPos ){ |
776 | defaultEmailChooserPosition = -1; | 778 | defaultEmailChooserPosition = -1; |
777 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 779 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
778 | if ( cmbo ){ | 780 | if ( cmbo ){ |
779 | inputStack->raiseWidget( TextField ); | 781 | inputStack->raiseWidget( TextField ); |
780 | inputStack -> removeWidget( cmbo ); | 782 | inputStack -> removeWidget( cmbo ); |
781 | cmbDefaultEmail = 0l; | 783 | cmbDefaultEmail = 0l; |
782 | delete cmbo; | 784 | delete cmbo; |
783 | } | 785 | } |
784 | 786 | ||
785 | } | 787 | } |
786 | 788 | ||
787 | // Caller should initialize the responsible textfield, therefore | 789 | // Caller should initialize the responsible textfield, therefore |
788 | // "false" is returned | 790 | // "false" is returned |
789 | return false; | 791 | return false; |
790 | } | 792 | } |
791 | 793 | ||
792 | // Everything is worked off .. | 794 | // Everything is worked off .. |
793 | return true; | 795 | return true; |
794 | 796 | ||
795 | } | 797 | } |
796 | 798 | ||
797 | // Currently accessed when we select default-email more than once ! | 799 | // Currently accessed when we select default-email more than once ! |
798 | void ContactEditor::chooserError( int index ) | 800 | void ContactEditor::chooserError( int index ) |
799 | { | 801 | { |
800 | qWarning("ContactEditor::chooserError( %d )", index); | 802 | qWarning("ContactEditor::chooserError( %d )", index); |
801 | QMessageBox::warning( this, "Chooser Error", | 803 | QMessageBox::warning( this, "Chooser Error", |
802 | "Multiple selection of this\n" | 804 | "Multiple selection of this\n" |
803 | "Item is not allowed !\n\n" | 805 | "Item is not allowed !\n\n" |
804 | "First deselect the previous one !", | 806 | "First deselect the previous one !", |
805 | "&OK", 0, 0, | 807 | "&OK", 0, 0, |
806 | 0, 0 ); | 808 | 0, 0 ); |
807 | 809 | ||
808 | // Reset the selected Chooser. Unfortunately the chooser | 810 | // Reset the selected Chooser. Unfortunately the chooser |
809 | // generates no signal, therfore we have to | 811 | // generates no signal, therfore we have to |
810 | // call the cmbChooserChange function manually.. | 812 | // call the cmbChooserChange function manually.. |
811 | switch( index ){ | 813 | switch( index ){ |
812 | case 1: | 814 | case 1: |
813 | cmbChooserField1 -> setCurrentItem( 0 ); | 815 | cmbChooserField1 -> setCurrentItem( 0 ); |
814 | slotCmbChooser1Change( 0 ); | 816 | slotCmbChooser1Change( 0 ); |
815 | break; | 817 | break; |
816 | case 2: | 818 | case 2: |
817 | cmbChooserField2 -> setCurrentItem( 0 ); | 819 | cmbChooserField2 -> setCurrentItem( 0 ); |
818 | slotCmbChooser2Change( 0 ); | 820 | slotCmbChooser2Change( 0 ); |
819 | break; | 821 | break; |
820 | case 3: | 822 | case 3: |
821 | cmbChooserField3 -> setCurrentItem( 0 ); | 823 | cmbChooserField3 -> setCurrentItem( 0 ); |
822 | slotCmbChooser3Change( 0 ); | 824 | slotCmbChooser3Change( 0 ); |
823 | break; | 825 | break; |
824 | case 4: | 826 | case 4: |
825 | cmbChooserField4 -> setCurrentItem( 0 ); | 827 | cmbChooserField4 -> setCurrentItem( 0 ); |
826 | slotCmbChooser4Change( 0 ); | 828 | slotCmbChooser4Change( 0 ); |
827 | break; | 829 | break; |
828 | } | 830 | } |
829 | } | 831 | } |
830 | 832 | ||
831 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 833 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
832 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 834 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
833 | QLineEdit* , int widgetPos ) { | 835 | QLineEdit* , int widgetPos ) { |
834 | 836 | ||
835 | QString type = slChooserNames[index]; // :SX | 837 | QString type = slChooserNames[index]; // :SX |
836 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", | 838 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", |
837 | type.latin1(),textChanged.latin1(), index, widgetPos ); | 839 | type.latin1(),textChanged.latin1(), index, widgetPos ); |
838 | 840 | ||
839 | if ( type == "Default Email"){ | 841 | if ( type == "Default Email"){ |
840 | qWarning ("??? Wozu??: %s", textChanged.latin1()); | 842 | qWarning ("??? Wozu??: %s", textChanged.latin1()); |
841 | defaultEmail = textChanged; | 843 | defaultEmail = textChanged; |
842 | 844 | ||
843 | populateDefaultEmailCmb(); | 845 | populateDefaultEmailCmb(); |
844 | 846 | ||
845 | }else if (type == "Emails"){ | 847 | }else if (type == "Emails"){ |
846 | qDebug("emails"); | 848 | qDebug("emails"); |
847 | 849 | ||
848 | QString de; | 850 | QString de; |
849 | emails = QStringList::split (",", textChanged ); | 851 | emails = QStringList::split (",", textChanged ); |
850 | 852 | ||
851 | populateDefaultEmailCmb(); | 853 | populateDefaultEmailCmb(); |
852 | } | 854 | } |
853 | 855 | ||
854 | slChooserValues[index] = textChanged; | 856 | slChooserValues[index] = textChanged; |
855 | 857 | ||
856 | } | 858 | } |
857 | 859 | ||
858 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 860 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
859 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); | 861 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); |
860 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 862 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
861 | } | 863 | } |
862 | 864 | ||
863 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 865 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
864 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); | 866 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); |
865 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 867 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
866 | 868 | ||
867 | } | 869 | } |
868 | 870 | ||
869 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 871 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
870 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); | 872 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); |
871 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 873 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
872 | } | 874 | } |
873 | 875 | ||
874 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 876 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
875 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); | 877 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); |
876 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 878 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
877 | } | 879 | } |
878 | 880 | ||
879 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 881 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
880 | 882 | ||
881 | if ( cmbAddress->currentItem() == 0 ) { | 883 | if ( cmbAddress->currentItem() == 0 ) { |
882 | slBusinessAddress[0] = textChanged; | 884 | slBusinessAddress[0] = textChanged; |
883 | } else { | 885 | } else { |
884 | slHomeAddress[0] = textChanged; | 886 | slHomeAddress[0] = textChanged; |
885 | } | 887 | } |
886 | } | 888 | } |
887 | 889 | ||
888 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 890 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
889 | 891 | ||
890 | if ( cmbAddress->currentItem() == 0 ) { | 892 | if ( cmbAddress->currentItem() == 0 ) { |
891 | slBusinessAddress[1] = textChanged; | 893 | slBusinessAddress[1] = textChanged; |
892 | } else { | 894 | } else { |
893 | slHomeAddress[1] = textChanged; | 895 | slHomeAddress[1] = textChanged; |
894 | } | 896 | } |
895 | } | 897 | } |
896 | 898 | ||
897 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 899 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
898 | 900 | ||
899 | if ( cmbAddress->currentItem() == 0 ) { | 901 | if ( cmbAddress->currentItem() == 0 ) { |
900 | slBusinessAddress[2] = textChanged; | 902 | slBusinessAddress[2] = textChanged; |
901 | } else { | 903 | } else { |
902 | slHomeAddress[2] = textChanged; | 904 | slHomeAddress[2] = textChanged; |
903 | } | 905 | } |
904 | } | 906 | } |
905 | 907 | ||
906 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 908 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
907 | 909 | ||
908 | if ( cmbAddress->currentItem() == 0 ) { | 910 | if ( cmbAddress->currentItem() == 0 ) { |
909 | slBusinessAddress[3] = textChanged; | 911 | slBusinessAddress[3] = textChanged; |
910 | } else { | 912 | } else { |
911 | slHomeAddress[3] = textChanged; | 913 | slHomeAddress[3] = textChanged; |
912 | } | 914 | } |
913 | } | 915 | } |
914 | 916 | ||
915 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 917 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
916 | 918 | ||
917 | 919 | ||
918 | if ( cmbAddress->currentItem() == 0 ) { | 920 | if ( cmbAddress->currentItem() == 0 ) { |
919 | slBusinessAddress[4] = textChanged; | 921 | slBusinessAddress[4] = textChanged; |
920 | } else { | 922 | } else { |
921 | slHomeAddress[4] = textChanged; | 923 | slHomeAddress[4] = textChanged; |
922 | } | 924 | } |
923 | } | 925 | } |
924 | 926 | ||
925 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 927 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
926 | 928 | ||
927 | if ( cmbAddress->currentItem() == 0 ) { | 929 | if ( cmbAddress->currentItem() == 0 ) { |
928 | slBusinessAddress[5] = textChanged; | 930 | slBusinessAddress[5] = textChanged; |
929 | } else { | 931 | } else { |
930 | slHomeAddress[5] = textChanged; | 932 | slHomeAddress[5] = textChanged; |
931 | } | 933 | } |
932 | } | 934 | } |
933 | 935 | ||
934 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 936 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
935 | 937 | ||
936 | if ( cmbAddress->currentItem() == 0 ) { | 938 | if ( cmbAddress->currentItem() == 0 ) { |
937 | slBusinessAddress[6] = textChanged; | 939 | slBusinessAddress[6] = textChanged; |
938 | } else { | 940 | } else { |
939 | slHomeAddress[6] = textChanged; | 941 | slHomeAddress[6] = textChanged; |
940 | } | 942 | } |
941 | } | 943 | } |
942 | 944 | ||
943 | 945 | ||
944 | void ContactEditor::slotCmbChooser1Change( int index ) { | 946 | void ContactEditor::slotCmbChooser1Change( int index ) { |
945 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); | 947 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); |
946 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ | 948 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
947 | 949 | ||
948 | txtChooserField1->setText( slChooserValues[index] ); | 950 | txtChooserField1->setText( slChooserValues[index] ); |
949 | txtChooserField1->setFocus(); | 951 | txtChooserField1->setFocus(); |
950 | 952 | ||
951 | } | 953 | } |
952 | 954 | ||
953 | } | 955 | } |
954 | 956 | ||
955 | void ContactEditor::slotCmbChooser2Change( int index ) { | 957 | void ContactEditor::slotCmbChooser2Change( int index ) { |
956 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); | 958 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); |
957 | 959 | ||
958 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ | 960 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
959 | 961 | ||
960 | txtChooserField2->setText( slChooserValues[index] ); | 962 | txtChooserField2->setText( slChooserValues[index] ); |
961 | txtChooserField2->setFocus(); | 963 | txtChooserField2->setFocus(); |
962 | 964 | ||
963 | } | 965 | } |
964 | } | 966 | } |
965 | 967 | ||
966 | void ContactEditor::slotCmbChooser3Change( int index ) { | 968 | void ContactEditor::slotCmbChooser3Change( int index ) { |
967 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); | 969 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); |
968 | 970 | ||
969 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ | 971 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
970 | 972 | ||
971 | txtChooserField3->setText( slChooserValues[index] ); | 973 | txtChooserField3->setText( slChooserValues[index] ); |
972 | txtChooserField3->setFocus(); | 974 | txtChooserField3->setFocus(); |
973 | 975 | ||
974 | } | 976 | } |
975 | } | 977 | } |
976 | 978 | ||
977 | void ContactEditor::slotCmbChooser4Change( int index ) { | 979 | void ContactEditor::slotCmbChooser4Change( int index ) { |
978 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); | 980 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); |
979 | 981 | ||
980 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ | 982 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
981 | 983 | ||
982 | txtChooserField4->setText( slChooserValues[index] ); | 984 | txtChooserField4->setText( slChooserValues[index] ); |
983 | txtChooserField4->setFocus(); | 985 | txtChooserField4->setFocus(); |
984 | 986 | ||
985 | } | 987 | } |
986 | } | 988 | } |
987 | 989 | ||
988 | void ContactEditor::slotAddressTypeChange( int index ) { | 990 | void ContactEditor::slotAddressTypeChange( int index ) { |
989 | 991 | ||
990 | 992 | ||
991 | if ( !initializing ) | 993 | if ( !initializing ) |
992 | contactfields.setFieldOrder( 4, index ); | 994 | contactfields.setFieldOrder( 4, index ); |
993 | 995 | ||
994 | 996 | ||
995 | if ( index == 0 ) { | 997 | if ( index == 0 ) { |
996 | 998 | ||
997 | txtAddress->setText( slBusinessAddress[0] ); | 999 | txtAddress->setText( slBusinessAddress[0] ); |
998 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 1000 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
999 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 1001 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
1000 | txtCity->setText( slBusinessAddress[3] ); | 1002 | txtCity->setText( slBusinessAddress[3] ); |
1001 | txtState->setText( slBusinessAddress[4] ); | 1003 | txtState->setText( slBusinessAddress[4] ); |
1002 | txtZip->setText( slBusinessAddress[5] ); | 1004 | txtZip->setText( slBusinessAddress[5] ); |
1003 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1005 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1004 | txtTmp->setText( slBusinessAddress[6] ); | 1006 | txtTmp->setText( slBusinessAddress[6] ); |
1005 | 1007 | ||
1006 | } else { | 1008 | } else { |
1007 | 1009 | ||
1008 | txtAddress->setText( slHomeAddress[0] ); | 1010 | txtAddress->setText( slHomeAddress[0] ); |
1009 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1011 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
1010 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1012 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
1011 | txtCity->setText( slHomeAddress[3] ); | 1013 | txtCity->setText( slHomeAddress[3] ); |
1012 | txtState->setText( slHomeAddress[4] ); | 1014 | txtState->setText( slHomeAddress[4] ); |
1013 | txtZip->setText( slHomeAddress[5] ); | 1015 | txtZip->setText( slHomeAddress[5] ); |
1014 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1016 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1015 | txtTmp->setText( slHomeAddress[6] ); | 1017 | txtTmp->setText( slHomeAddress[6] ); |
1016 | 1018 | ||
1017 | } | 1019 | } |
1018 | 1020 | ||
1019 | } | 1021 | } |
1020 | 1022 | ||
1021 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1023 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1022 | 1024 | ||
1023 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); | 1025 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); |
1024 | 1026 | ||
1025 | int index = cmbFileAs->currentItem(); | 1027 | int index = cmbFileAs->currentItem(); |
1026 | 1028 | ||
1027 | cmbFileAs->clear(); | 1029 | cmbFileAs->clear(); |
1028 | 1030 | ||
1029 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); | 1031 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1030 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); | 1032 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1031 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | 1033 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); |
1032 | cmbFileAs->insertItem( parseName( textChanged, NAME_FMLS ) ); | 1034 | cmbFileAs->insertItem( parseName( textChanged, NAME_FMLS ) ); |
1033 | 1035 | ||
1034 | cmbFileAs->setCurrentItem( index ); | 1036 | cmbFileAs->setCurrentItem( index ); |
1035 | 1037 | ||
1036 | useFullName = true; | 1038 | useFullName = true; |
1037 | 1039 | ||
1038 | } | 1040 | } |
1039 | 1041 | ||
1042 | void ContactEditor::slotSuffixChange( const QString& ) { | ||
1043 | // Just want to update the FileAs combo if the suffix was changed.. | ||
1044 | slotFullNameChange( txtFullName->text() ); | ||
1045 | } | ||
1046 | |||
1040 | void ContactEditor::accept() { | 1047 | void ContactEditor::accept() { |
1041 | 1048 | ||
1042 | if ( isEmpty() ) { | 1049 | if ( isEmpty() ) { |
1043 | cleanupFields(); | 1050 | cleanupFields(); |
1044 | reject(); | 1051 | reject(); |
1045 | } else { | 1052 | } else { |
1046 | saveEntry(); | 1053 | saveEntry(); |
1047 | cleanupFields(); | 1054 | cleanupFields(); |
1048 | QDialog::accept(); | 1055 | QDialog::accept(); |
1049 | } | 1056 | } |
1050 | 1057 | ||
1051 | } | 1058 | } |
1052 | 1059 | ||
1053 | void ContactEditor::slotNote() { | 1060 | void ContactEditor::slotNote() { |
1054 | 1061 | ||
1055 | dlgNote->showMaximized(); | 1062 | dlgNote->showMaximized(); |
1056 | if ( !dlgNote->exec() ) { | 1063 | if ( !dlgNote->exec() ) { |
1057 | txtNote->setText( ent.notes() ); | 1064 | txtNote->setText( ent.notes() ); |
1058 | } | 1065 | } |
1059 | } | 1066 | } |
1060 | 1067 | ||
1061 | void ContactEditor::slotName() { | 1068 | void ContactEditor::slotName() { |
1062 | 1069 | ||
1063 | QString tmpName; | 1070 | QString tmpName; |
1064 | if (useFullName) { | 1071 | if (useFullName) { |
1065 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1072 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1066 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1073 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1067 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1074 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1068 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1075 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1069 | } | 1076 | } |
1070 | dlgName->showMaximized(); | 1077 | dlgName->showMaximized(); |
1071 | if ( dlgName->exec() ) { | 1078 | if ( dlgName->exec() ) { |
1072 | 1079 | ||
1073 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); | 1080 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); |
1074 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1081 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1075 | slotFullNameChange( txtFullName->text() ); | 1082 | slotFullNameChange( txtFullName->text() ); |
1076 | useFullName = false; | 1083 | useFullName = false; |
1077 | } | 1084 | } |
1078 | 1085 | ||
1079 | } | 1086 | } |
1080 | 1087 | ||
1081 | void ContactEditor::setNameFocus() { | 1088 | void ContactEditor::setNameFocus() { |
1082 | 1089 | ||
1083 | txtFullName->setFocus(); | 1090 | txtFullName->setFocus(); |
1084 | 1091 | ||
1085 | } | 1092 | } |
1086 | 1093 | ||
1087 | bool ContactEditor::isEmpty() { | 1094 | bool ContactEditor::isEmpty() { |
1088 | // Test and see if the record should be saved. | 1095 | // Test and see if the record should be saved. |
1089 | // More strict than the original qtopia, needs name or fileas to save | 1096 | // More strict than the original qtopia, needs name or fileas to save |
1090 | 1097 | ||
1091 | QString t = txtFullName->text(); | 1098 | QString t = txtFullName->text(); |
1092 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1099 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1093 | return false; | 1100 | return false; |
1094 | 1101 | ||
1095 | t = cmbFileAs->currentText(); | 1102 | t = cmbFileAs->currentText(); |
1096 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1103 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1097 | return false; | 1104 | return false; |
1098 | 1105 | ||
1099 | return true; | 1106 | return true; |
1100 | 1107 | ||
1101 | } | 1108 | } |
1102 | 1109 | ||
1103 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1110 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1104 | 1111 | ||
1105 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1112 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1106 | QString strFirstName; | 1113 | QString strFirstName; |
1107 | QString strMiddleName; | 1114 | QString strMiddleName; |
1108 | QString strLastName; | 1115 | QString strLastName; |
1109 | QString strSuffix; | ||
1110 | QString strTitle; | 1116 | QString strTitle; |
1111 | int commapos; | 1117 | int commapos; |
1112 | bool haveLastName = false; | 1118 | bool haveLastName = false; |
1113 | 1119 | ||
1114 | qWarning("Fullname: %s", simplifiedName.latin1()); | 1120 | qWarning("Fullname: %s", simplifiedName.latin1()); |
1115 | 1121 | ||
1116 | commapos = simplifiedName.find( ',', 0, TRUE); | 1122 | commapos = simplifiedName.find( ',', 0, TRUE); |
1117 | if ( commapos >= 0 ) { | 1123 | if ( commapos >= 0 ) { |
1118 | qWarning(" Commapos: %d", commapos ); | 1124 | qWarning(" Commapos: %d", commapos ); |
1119 | 1125 | ||
1120 | // A comma (",") separates the lastname from one or | 1126 | // A comma (",") separates the lastname from one or |
1121 | // many first names. Thus, remove the lastname from the | 1127 | // many first names. Thus, remove the lastname from the |
1122 | // String and parse the firstnames. | 1128 | // String and parse the firstnames. |
1123 | 1129 | ||
1124 | strLastName = simplifiedName.left( commapos ); | 1130 | strLastName = simplifiedName.left( commapos ); |
1125 | simplifiedName= simplifiedName.mid( commapos + 1 ); | 1131 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1126 | haveLastName = true; | 1132 | haveLastName = true; |
1127 | qWarning("Fullname without ',': %s", simplifiedName.latin1()); | 1133 | qWarning("Fullname without ',': %s", simplifiedName.latin1()); |
1128 | 1134 | ||
1129 | // If we have any lastname, we should now split all first names. | 1135 | // 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" | 1136 | // The first one will be the used as first, the rest as "middle names" |
1131 | 1137 | ||
1132 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); | 1138 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1133 | QStringList::Iterator it = allFirstNames.begin(); | 1139 | QStringList::Iterator it = allFirstNames.begin(); |
1134 | strFirstName = *it++; | 1140 | strFirstName = *it++; |
1135 | QStringList allSecondNames; | 1141 | QStringList allSecondNames; |
1136 | for ( ; it != allFirstNames.end(); ++it ) | 1142 | for ( ; it != allFirstNames.end(); ++it ) |
1137 | allSecondNames.append( *it ); | 1143 | allSecondNames.append( *it ); |
1138 | 1144 | ||
1139 | strMiddleName = allSecondNames.join(" "); | 1145 | strMiddleName = allSecondNames.join(" "); |
1140 | 1146 | ||
1141 | } else { | 1147 | } else { |
1142 | 1148 | ||
1143 | // No comma separator used: We use the first word as firstname, the | 1149 | // No comma separator used: We use the first word as firstname, the |
1144 | // last as second/lastname and everything in the middle as middlename | 1150 | // last as second/lastname and everything in the middle as middlename |
1145 | 1151 | ||
1146 | QStringList allNames = QStringList::split(" ", simplifiedName); | 1152 | QStringList allNames = QStringList::split(" ", simplifiedName); |
1147 | QStringList::Iterator it = allNames.begin(); | 1153 | QStringList::Iterator it = allNames.begin(); |
1148 | strFirstName = *it++; | 1154 | strFirstName = *it++; |
1149 | QStringList allSecondNames; | 1155 | QStringList allSecondNames; |
1150 | for ( ; it != --allNames.end(); ++it ) | 1156 | for ( ; it != --allNames.end(); ++it ) |
1151 | allSecondNames.append( *it ); | 1157 | allSecondNames.append( *it ); |
1152 | 1158 | ||
1153 | strMiddleName = allSecondNames.join(" "); | 1159 | strMiddleName = allSecondNames.join(" "); |
1154 | strLastName = *(--allNames.end()); | 1160 | strLastName = *(--allNames.end()); |
1155 | 1161 | ||
1156 | } | 1162 | } |
1157 | 1163 | ||
1158 | if ( strFirstName == strLastName ) | 1164 | if ( strFirstName == strLastName ) |
1159 | strFirstName = ""; | 1165 | strFirstName = ""; |
1160 | 1166 | ||
1161 | qWarning(" strFirstName: %s", strFirstName.latin1()); | 1167 | qWarning(" strFirstName: %s", strFirstName.latin1()); |
1162 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); | 1168 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); |
1163 | qWarning(" strLastName: %s", strLastName.latin1()); | 1169 | qWarning(" strLastName: %s", strLastName.latin1()); |
1164 | qWarning(" strSuffix: %s", strSuffix.latin1()); | ||
1165 | qWarning(" strTitle: %s", strTitle.latin1()); | 1170 | qWarning(" strTitle: %s", strTitle.latin1()); |
1166 | 1171 | ||
1167 | switch (type) { | 1172 | switch (type) { |
1168 | case NAME_FL: | 1173 | case NAME_FL: |
1169 | return strFirstName + " " + strLastName; | 1174 | return strFirstName + " " + strLastName; |
1170 | 1175 | ||
1171 | case NAME_LF: | 1176 | case NAME_LF: |
1172 | return strLastName + ", " + strFirstName; | 1177 | return strLastName + ", " + strFirstName; |
1173 | 1178 | ||
1174 | case NAME_LFM: | 1179 | case NAME_LFM: |
1175 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1180 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1176 | 1181 | ||
1177 | case NAME_FMLS: | 1182 | case NAME_FMLS: |
1178 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; | 1183 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + txtSuffix->text(); |
1179 | 1184 | ||
1180 | case NAME_F: | 1185 | case NAME_F: |
1181 | return strFirstName; | 1186 | return strFirstName; |
1182 | 1187 | ||
1183 | case NAME_M: | 1188 | case NAME_M: |
1184 | return strMiddleName; | 1189 | return strMiddleName; |
1185 | 1190 | ||
1186 | case NAME_L: | 1191 | case NAME_L: |
1187 | return strLastName; | 1192 | return strLastName; |
1188 | 1193 | ||
1189 | case NAME_S: | 1194 | case NAME_S: |
1190 | return strSuffix; | 1195 | return txtSuffix->text(); |
1191 | 1196 | ||
1192 | } | 1197 | } |
1193 | return QString::null; | 1198 | return QString::null; |
1194 | } | 1199 | } |
1195 | 1200 | ||
1196 | void ContactEditor::cleanupFields() { | 1201 | void ContactEditor::cleanupFields() { |
1197 | QStringList::Iterator it = slChooserValues.begin(); | 1202 | QStringList::Iterator it = slChooserValues.begin(); |
1198 | 1203 | ||
1199 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1204 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1200 | (*it) = ""; | 1205 | (*it) = ""; |
1201 | } | 1206 | } |
1202 | 1207 | ||
1203 | for ( int i = 0; i < 7; i++ ) { | 1208 | for ( int i = 0; i < 7; i++ ) { |
1204 | slHomeAddress[i] = ""; | 1209 | slHomeAddress[i] = ""; |
1205 | slBusinessAddress[i] = ""; | 1210 | slBusinessAddress[i] = ""; |
1206 | } | 1211 | } |
1207 | 1212 | ||
1208 | QListIterator<QLineEdit> itLV( listValue ); | 1213 | QListIterator<QLineEdit> itLV( listValue ); |
1209 | for ( ; itLV.current(); ++itLV ) { | 1214 | for ( ; itLV.current(); ++itLV ) { |
1210 | (*itLV)->setText( "" ); | 1215 | (*itLV)->setText( "" ); |
1211 | } | 1216 | } |
1212 | 1217 | ||
1213 | txtFirstName->setText(""); | 1218 | txtFirstName->setText(""); |
1214 | txtMiddleName->setText(""); | 1219 | txtMiddleName->setText(""); |
1215 | txtLastName->setText(""); | 1220 | txtLastName->setText(""); |
1216 | txtSuffix->setText(""); | 1221 | txtSuffix->setText(""); |
1217 | txtNote->setText(""); | 1222 | txtNote->setText(""); |
1218 | txtFullName->setText(""); | 1223 | txtFullName->setText(""); |
1219 | txtJobTitle->setText(""); | 1224 | txtJobTitle->setText(""); |
1220 | txtOrganization->setText(""); | 1225 | txtOrganization->setText(""); |
1221 | txtChooserField1->setText(""); | 1226 | txtChooserField1->setText(""); |
1222 | txtChooserField2->setText(""); | 1227 | txtChooserField2->setText(""); |
1223 | txtChooserField3->setText(""); | 1228 | txtChooserField3->setText(""); |
1224 | txtAddress->setText(""); | 1229 | txtAddress->setText(""); |
1225 | txtCity->setText(""); | 1230 | txtCity->setText(""); |
1226 | txtState->setText(""); | 1231 | txtState->setText(""); |
1227 | txtZip->setText(""); | 1232 | txtZip->setText(""); |
1228 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1233 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1229 | txtTmp->setText(""); | 1234 | txtTmp->setText(""); |
1230 | txtTmp = cmbFileAs->lineEdit(); | 1235 | txtTmp = cmbFileAs->lineEdit(); |
1231 | txtTmp->setText(""); | 1236 | txtTmp->setText(""); |
1232 | 1237 | ||
1233 | } | 1238 | } |
1234 | 1239 | ||
1235 | void ContactEditor::setEntry( const OContact &entry ) { | 1240 | void ContactEditor::setEntry( const OContact &entry ) { |
1236 | 1241 | ||
1237 | initializing = true; | 1242 | initializing = true; |
1238 | 1243 | ||
1239 | cleanupFields(); | 1244 | cleanupFields(); |
1240 | 1245 | ||
1241 | ent = entry; | 1246 | ent = entry; |
1242 | 1247 | ||
1243 | emails = QStringList(ent.emailList()); | 1248 | emails = QStringList(ent.emailList()); |
1244 | defaultEmail = ent.defaultEmail(); | 1249 | defaultEmail = ent.defaultEmail(); |
1245 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1250 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1246 | qDebug("default email=%s",defaultEmail.latin1()); | 1251 | qDebug("default email=%s",defaultEmail.latin1()); |
1247 | 1252 | ||
1248 | useFullName = false; | 1253 | useFullName = false; |
1249 | txtFirstName->setText( ent.firstName() ); | 1254 | txtFirstName->setText( ent.firstName() ); |
1250 | txtMiddleName->setText( ent.middleName() ); | 1255 | txtMiddleName->setText( ent.middleName() ); |
1251 | txtLastName->setText( ent.lastName() ); | 1256 | txtLastName->setText( ent.lastName() ); |
1252 | txtSuffix->setText( ent.suffix() ); | 1257 | txtSuffix->setText( ent.suffix() ); |
1253 | 1258 | ||
1254 | // QString *tmpString = new QString; | 1259 | // QString *tmpString = new QString; |
1255 | // *tmpString = ent.firstName() + " " + ent.middleName() + | 1260 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1256 | // + " " + ent.lastName() + " " + ent.suffix(); | 1261 | // + " " + ent.lastName() + " " + ent.suffix(); |
1257 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1262 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1258 | 1263 | ||
1259 | // Lastnames with multiple words need to be protected by a comma ! | 1264 | // Lastnames with multiple words need to be protected by a comma ! |
1260 | if ( ent.lastName().contains( ' ', TRUE ) ) | 1265 | if ( ent.lastName().contains( ' ', TRUE ) ) |
1261 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1266 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1262 | else | 1267 | else |
1263 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1268 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); |
1264 | 1269 | ||
1265 | cmbFileAs->setEditText( ent.fileAs() ); | 1270 | cmbFileAs->setEditText( ent.fileAs() ); |
1266 | 1271 | ||
1267 | //if (hasTitle) | 1272 | //if (hasTitle) |
1268 | txtJobTitle->setText( ent.jobTitle() ); | 1273 | txtJobTitle->setText( ent.jobTitle() ); |
1269 | 1274 | ||
1270 | //if (hasCompany) | 1275 | //if (hasCompany) |
1271 | txtOrganization->setText( ent.company() ); | 1276 | txtOrganization->setText( ent.company() ); |
1272 | 1277 | ||
1273 | //if (hasNotes) | 1278 | //if (hasNotes) |
1274 | txtNote->setText( ent.notes() ); | 1279 | txtNote->setText( ent.notes() ); |
1275 | 1280 | ||
1276 | //if (hasStreet) { | 1281 | //if (hasStreet) { |
1277 | slHomeAddress[0] = ent.homeStreet(); | 1282 | slHomeAddress[0] = ent.homeStreet(); |
1278 | slBusinessAddress[0] = ent.businessStreet(); | 1283 | slBusinessAddress[0] = ent.businessStreet(); |
1279 | //} | 1284 | //} |
1280 | 1285 | ||
1281 | //if (hasCity) { | 1286 | //if (hasCity) { |
1282 | slHomeAddress[3] = ent.homeCity(); | 1287 | slHomeAddress[3] = ent.homeCity(); |
1283 | slBusinessAddress[3] = ent.businessCity(); | 1288 | slBusinessAddress[3] = ent.businessCity(); |
1284 | //} | 1289 | //} |
1285 | 1290 | ||
1286 | //if (hasState) { | 1291 | //if (hasState) { |
1287 | slHomeAddress[4] = ent.homeState(); | 1292 | slHomeAddress[4] = ent.homeState(); |
1288 | slBusinessAddress[4] = ent.businessState(); | 1293 | slBusinessAddress[4] = ent.businessState(); |
1289 | //} | 1294 | //} |
1290 | 1295 | ||
1291 | //if (hasZip) { | 1296 | //if (hasZip) { |
1292 | slHomeAddress[5] = ent.homeZip(); | 1297 | slHomeAddress[5] = ent.homeZip(); |
1293 | slBusinessAddress[5] = ent.businessZip(); | 1298 | slBusinessAddress[5] = ent.businessZip(); |
1294 | //} | 1299 | //} |
1295 | 1300 | ||
1296 | //if (hasCountry) { | 1301 | //if (hasCountry) { |
1297 | slHomeAddress[6] = ent.homeCountry(); | 1302 | slHomeAddress[6] = ent.homeCountry(); |
1298 | slBusinessAddress[6] = ent.businessCountry(); | 1303 | slBusinessAddress[6] = ent.businessCountry(); |
1299 | //} | 1304 | //} |
1300 | 1305 | ||
1301 | QStringList::ConstIterator it; | 1306 | QStringList::ConstIterator it; |
1302 | QListIterator<QLineEdit> itLE( listValue ); | 1307 | QListIterator<QLineEdit> itLE( listValue ); |
1303 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1308 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1304 | 1309 | ||
1305 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); | 1310 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); |
1306 | 1311 | ||
1307 | if ( *it == "Department" ) | 1312 | if ( *it == "Department" ) |
1308 | (*itLE)->setText( ent.department() ); | 1313 | (*itLE)->setText( ent.department() ); |
1309 | 1314 | ||
1310 | if ( *it == "Company" ) | 1315 | if ( *it == "Company" ) |
1311 | (*itLE)->setText( ent.company() ); | 1316 | (*itLE)->setText( ent.company() ); |
1312 | 1317 | ||
1313 | if ( *it == "Office" ) | 1318 | if ( *it == "Office" ) |
1314 | (*itLE)->setText( ent.office() ); | 1319 | (*itLE)->setText( ent.office() ); |
1315 | 1320 | ||
1316 | if ( *it == "Profession" ) | 1321 | if ( *it == "Profession" ) |
1317 | (*itLE)->setText( ent.profession() ); | 1322 | (*itLE)->setText( ent.profession() ); |
1318 | 1323 | ||
1319 | if ( *it == "Assistant" ) | 1324 | if ( *it == "Assistant" ) |
1320 | (*itLE)->setText( ent.assistant() ); | 1325 | (*itLE)->setText( ent.assistant() ); |
1321 | 1326 | ||
1322 | if ( *it == "Manager" ) | 1327 | if ( *it == "Manager" ) |
1323 | (*itLE)->setText( ent.manager() ); | 1328 | (*itLE)->setText( ent.manager() ); |
1324 | 1329 | ||
1325 | if ( *it == "Spouse" ) | 1330 | if ( *it == "Spouse" ) |
1326 | (*itLE)->setText( ent.spouse() ); | 1331 | (*itLE)->setText( ent.spouse() ); |
1327 | 1332 | ||
1328 | if ( *it == "Nickname" ){ | 1333 | if ( *it == "Nickname" ){ |
1329 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); | 1334 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); |
1330 | (*itLE)->setText( ent.nickname() ); | 1335 | (*itLE)->setText( ent.nickname() ); |
1331 | } | 1336 | } |
1332 | 1337 | ||
1333 | if ( *it == "Children" ) | 1338 | if ( *it == "Children" ) |
1334 | (*itLE)->setText( ent.children() ); | 1339 | (*itLE)->setText( ent.children() ); |
1335 | 1340 | ||
1336 | } | 1341 | } |
1337 | 1342 | ||
1338 | QStringList::Iterator itV; | 1343 | QStringList::Iterator itV; |
1339 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1344 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1340 | 1345 | ||
1341 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1346 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1342 | *itV = ent.businessPhone(); | 1347 | *itV = ent.businessPhone(); |
1343 | /* | 1348 | /* |
1344 | if ( *it == "Business 2 Phone" ) | 1349 | if ( *it == "Business 2 Phone" ) |
1345 | *itV = ent.business2Phone(); | 1350 | *itV = ent.business2Phone(); |
1346 | */ | 1351 | */ |
1347 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1352 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1348 | *itV = ent.businessFax(); | 1353 | *itV = ent.businessFax(); |
1349 | 1354 | ||
1350 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1355 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1351 | *itV = ent.businessMobile(); | 1356 | *itV = ent.businessMobile(); |
1352 | /* | 1357 | /* |
1353 | if ( *it == "Company Phone" ) | 1358 | if ( *it == "Company Phone" ) |
1354 | *itV = ent.companyPhone(); | 1359 | *itV = ent.companyPhone(); |
1355 | */ | 1360 | */ |
1356 | if ( *it == "Default Email" ) | 1361 | if ( *it == "Default Email" ) |
1357 | *itV = ent.defaultEmail(); | 1362 | *itV = ent.defaultEmail(); |
1358 | 1363 | ||
1359 | if ( *it == "Emails" ) | 1364 | if ( *it == "Emails" ) |
1360 | *itV = ent.emailList().join(", "); // :SX | 1365 | *itV = ent.emailList().join(", "); // :SX |
1361 | 1366 | ||
1362 | if ( *it == "Home Phone" ) | 1367 | if ( *it == "Home Phone" ) |
1363 | *itV = ent.homePhone(); | 1368 | *itV = ent.homePhone(); |
1364 | /* | 1369 | /* |
1365 | if ( *it == "Home 2 Phone" ) | 1370 | if ( *it == "Home 2 Phone" ) |
1366 | *itV = ent.home2Phone(); | 1371 | *itV = ent.home2Phone(); |
1367 | */ | 1372 | */ |
1368 | if ( *it == "Home Fax" ) | 1373 | if ( *it == "Home Fax" ) |
1369 | *itV = ent.homeFax(); | 1374 | *itV = ent.homeFax(); |
1370 | 1375 | ||
1371 | if ( *it == "Home Mobile" ) | 1376 | if ( *it == "Home Mobile" ) |
1372 | *itV = ent.homeMobile(); | 1377 | *itV = ent.homeMobile(); |
1373 | /* | 1378 | /* |
1374 | if ( *it == "Car Phone" ) | 1379 | if ( *it == "Car Phone" ) |
1375 | *itV = ent.carPhone(); | 1380 | *itV = ent.carPhone(); |
1376 | 1381 | ||
1377 | if ( *it == "ISDN Phone" ) | 1382 | if ( *it == "ISDN Phone" ) |
1378 | *itV = ent.ISDNPhone(); | 1383 | *itV = ent.ISDNPhone(); |
1379 | 1384 | ||
1380 | if ( *it == "Other Phone" ) | 1385 | if ( *it == "Other Phone" ) |
1381 | *itV = ent.otherPhone(); | 1386 | *itV = ent.otherPhone(); |
1382 | */ | 1387 | */ |
1383 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1388 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1384 | *itV = ent.businessPager(); | 1389 | *itV = ent.businessPager(); |
1385 | /* | 1390 | /* |
1386 | if ( *it == "Home Pager") | 1391 | if ( *it == "Home Pager") |
1387 | *itV = ent.homePager(); | 1392 | *itV = ent.homePager(); |
1388 | 1393 | ||
1389 | if ( *it == "AIM IM" ) | 1394 | if ( *it == "AIM IM" ) |
1390 | *itV = ent.AIMIM(); | 1395 | *itV = ent.AIMIM(); |
1391 | 1396 | ||
1392 | if ( *it == "ICQ IM" ) | 1397 | if ( *it == "ICQ IM" ) |
1393 | *itV = ent.ICQIM(); | 1398 | *itV = ent.ICQIM(); |
1394 | 1399 | ||
1395 | if ( *it == "Jabber IM" ) | 1400 | if ( *it == "Jabber IM" ) |
1396 | *itV = ent.jabberIM(); | 1401 | *itV = ent.jabberIM(); |
1397 | 1402 | ||
1398 | if ( *it == "MSN IM" ) | 1403 | if ( *it == "MSN IM" ) |
1399 | *itV = ent.MSNIM(); | 1404 | *itV = ent.MSNIM(); |
1400 | 1405 | ||
1401 | if ( *it == "Yahoo IM" ) | 1406 | if ( *it == "Yahoo IM" ) |
1402 | *itV = ent.yahooIM(); | 1407 | *itV = ent.yahooIM(); |
1403 | */ | 1408 | */ |
1404 | if ( *it == "Home Web Page" ) | 1409 | if ( *it == "Home Web Page" ) |
1405 | *itV = ent.homeWebpage(); | 1410 | *itV = ent.homeWebpage(); |
1406 | 1411 | ||
1407 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1412 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1408 | *itV = ent.businessWebpage(); | 1413 | *itV = ent.businessWebpage(); |
1409 | 1414 | ||
1410 | 1415 | ||
1411 | } | 1416 | } |
1412 | 1417 | ||
1413 | 1418 | ||
1414 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1419 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1415 | 1420 | ||
1416 | QString gender = ent.gender(); | 1421 | QString gender = ent.gender(); |
1417 | cmbGender->setCurrentItem( gender.toInt() ); | 1422 | cmbGender->setCurrentItem( gender.toInt() ); |
1418 | 1423 | ||
1419 | txtNote->setText( ent.notes() ); | 1424 | txtNote->setText( ent.notes() ); |
1420 | 1425 | ||
1421 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1426 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1422 | 1427 | ||
1423 | // Calling "show()" to arrange all widgets. Otherwise we will get | 1428 | // Calling "show()" to arrange all widgets. Otherwise we will get |
1424 | // a wrong position of the textfields and are unable to put our | 1429 | // a wrong position of the textfields and are unable to put our |
1425 | // default-email combo over it.. This is very ugly ! | 1430 | // default-email combo over it.. This is very ugly ! |
1426 | // Does anybody has a better solution ? | 1431 | // Does anybody has a better solution ? |
1427 | // Basically we should rethink the strategy to hide | 1432 | // Basically we should rethink the strategy to hide |
1428 | // a textfield with overwriting.. (se) | 1433 | // a textfield with overwriting.. (se) |
1429 | show(); | 1434 | show(); |
1430 | 1435 | ||
1431 | // Get combo-settings from contact and set preset.. | 1436 | // Get combo-settings from contact and set preset.. |
1432 | contactfields.loadFromRecord( ent ); | 1437 | contactfields.loadFromRecord( ent ); |
1433 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); | 1438 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); |
1434 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); | 1439 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); |
1435 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); | 1440 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); |
1436 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); | 1441 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); |
1437 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | 1442 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); |
1438 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1443 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1439 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1444 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1440 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1445 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1441 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | 1446 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); |
1442 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1447 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1443 | 1448 | ||
1444 | updateDatePicker(); | 1449 | updateDatePicker(); |
1445 | 1450 | ||
1446 | initializing = false; | 1451 | initializing = false; |
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 703e702..954c77e 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h | |||
@@ -1,192 +1,193 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * | 3 | * |
4 | * This file is an add-on for the OPIE Palmtop Environment | 4 | * This file is an add-on for the OPIE Palmtop Environment |
5 | * | 5 | * |
6 | * This file may be distributed and/or modified under the terms of the | 6 | * This file may be distributed and/or modified under the terms of the |
7 | * GNU General Public License version 2 as published by the Free Software | 7 | * GNU General Public License version 2 as published by the Free Software |
8 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 8 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
9 | * of this file. | 9 | * of this file. |
10 | * | 10 | * |
11 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | * | 13 | * |
14 | * | 14 | * |
15 | * This is a rewrite of the abeditor.h file, modified to provide a more | 15 | * This is a rewrite of the abeditor.h file, modified to provide a more |
16 | * intuitive interface to TrollTech's original Address Book editor. This | 16 | * intuitive interface to TrollTech's original Address Book editor. This |
17 | * is made to operate exactly in interface with the exception of name. | 17 | * is made to operate exactly in interface with the exception of name. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef CONTACTEDITOR_H | 21 | #ifndef CONTACTEDITOR_H |
22 | #define CONTACTEDITOR_H | 22 | #define CONTACTEDITOR_H |
23 | 23 | ||
24 | #include <opie/ocontact.h> | 24 | #include <opie/ocontact.h> |
25 | 25 | ||
26 | #include <qpe/datebookmonth.h> | 26 | #include <qpe/datebookmonth.h> |
27 | 27 | ||
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qlist.h> | 29 | #include <qlist.h> |
30 | #include <qmap.h> | 30 | #include <qmap.h> |
31 | #include <qstringlist.h> | 31 | #include <qstringlist.h> |
32 | #include <qwidgetstack.h> | 32 | #include <qwidgetstack.h> |
33 | 33 | ||
34 | #include "ocontactfields.h" | 34 | #include "ocontactfields.h" |
35 | 35 | ||
36 | const int NAME_LF = 0; | 36 | const int NAME_LF = 0; |
37 | const int NAME_LFM = 1; | 37 | const int NAME_LFM = 1; |
38 | const int NAME_FL = 2; | 38 | const int NAME_FL = 2; |
39 | const int NAME_FMLS = 3; | 39 | const int NAME_FMLS = 3; |
40 | 40 | ||
41 | const int NAME_F = 4; | 41 | const int NAME_F = 4; |
42 | const int NAME_M = 5; | 42 | const int NAME_M = 5; |
43 | const int NAME_L = 6; | 43 | const int NAME_L = 6; |
44 | const int NAME_S = 7; | 44 | const int NAME_S = 7; |
45 | 45 | ||
46 | 46 | ||
47 | class QScrollView; | 47 | class QScrollView; |
48 | class QTabWidget; | 48 | class QTabWidget; |
49 | class QMultiLineEdit; | 49 | class QMultiLineEdit; |
50 | class QLineEdit; | 50 | class QLineEdit; |
51 | class QComboBox; | 51 | class QComboBox; |
52 | class QPushButton; | 52 | class QPushButton; |
53 | class CategorySelect; | 53 | class CategorySelect; |
54 | class QLabel; | 54 | class QLabel; |
55 | 55 | ||
56 | class ContactEditor : public QDialog { | 56 | class ContactEditor : public QDialog { |
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | 58 | ||
59 | public: | 59 | public: |
60 | ContactEditor(const OContact &entry, | 60 | ContactEditor(const OContact &entry, |
61 | QWidget *parent = 0, | 61 | QWidget *parent = 0, |
62 | const char *name = 0, | 62 | const char *name = 0, |
63 | WFlags fl = 0 ); | 63 | WFlags fl = 0 ); |
64 | ~ContactEditor(); | 64 | ~ContactEditor(); |
65 | void setNameFocus(); | 65 | void setNameFocus(); |
66 | void setPersonalView( bool personal = true ); | 66 | void setPersonalView( bool personal = true ); |
67 | OContact entry() const { return ent; } | 67 | OContact entry() const { return ent; } |
68 | 68 | ||
69 | public slots: | 69 | public slots: |
70 | void slotNote(); | 70 | void slotNote(); |
71 | void slotName(); | 71 | void slotName(); |
72 | void setEntry(const OContact &entry); | 72 | void setEntry(const OContact &entry); |
73 | 73 | ||
74 | protected slots: | 74 | protected slots: |
75 | void accept(); | 75 | void accept(); |
76 | 76 | ||
77 | private: | 77 | private: |
78 | void init(); | 78 | void init(); |
79 | void saveEntry(); | 79 | void saveEntry(); |
80 | bool isEmpty(); | 80 | bool isEmpty(); |
81 | void cleanupFields(); | 81 | void cleanupFields(); |
82 | void updateDatePicker(); | 82 | void updateDatePicker(); |
83 | QString parseName( QString fullName, int type ); | 83 | QString parseName( QString fullName, int type ); |
84 | void chooserError( int index ); | 84 | void chooserError( int index ); |
85 | private slots: | 85 | private slots: |
86 | void slotChooser1Change( const QString &textChanged ); | 86 | void slotChooser1Change( const QString &textChanged ); |
87 | void slotChooser2Change( const QString &textChanged ); | 87 | void slotChooser2Change( const QString &textChanged ); |
88 | void slotChooser3Change( const QString &textChanged ); | 88 | void slotChooser3Change( const QString &textChanged ); |
89 | void slotChooser4Change( const QString &textChanged ); | 89 | void slotChooser4Change( const QString &textChanged ); |
90 | void slotCmbChooser1Change( int index ); | 90 | void slotCmbChooser1Change( int index ); |
91 | void slotCmbChooser2Change( int index ); | 91 | void slotCmbChooser2Change( int index ); |
92 | void slotCmbChooser3Change( int index ); | 92 | void slotCmbChooser3Change( int index ); |
93 | void slotCmbChooser4Change( int index ); | 93 | void slotCmbChooser4Change( int index ); |
94 | void slotAddressTypeChange( int index ); | 94 | void slotAddressTypeChange( int index ); |
95 | void slotAddressChange( const QString &textChanged ); | 95 | void slotAddressChange( const QString &textChanged ); |
96 | void slotAddress2Change( const QString &textChanged ); | 96 | void slotAddress2Change( const QString &textChanged ); |
97 | void slotPOBoxChange( const QString &textChanged ); | 97 | void slotPOBoxChange( const QString &textChanged ); |
98 | void slotCityChange( const QString &textChanged ); | 98 | void slotCityChange( const QString &textChanged ); |
99 | void slotStateChange( const QString &textChanged ); | 99 | void slotStateChange( const QString &textChanged ); |
100 | void slotZipChange( const QString &textChanged ); | 100 | void slotZipChange( const QString &textChanged ); |
101 | void slotCountryChange( const QString &textChanged ); | 101 | void slotCountryChange( const QString &textChanged ); |
102 | void slotFullNameChange( const QString &textChanged ); | 102 | void slotFullNameChange( const QString &textChanged ); |
103 | void slotSuffixChange( const QString &textChanged ); | ||
103 | void slotAnniversaryDateChanged( int year, int month, int day); | 104 | void slotAnniversaryDateChanged( int year, int month, int day); |
104 | void slotBirthdayDateChanged( int year, int month, int day); | 105 | void slotBirthdayDateChanged( int year, int month, int day); |
105 | void slotRemoveBirthday(); | 106 | void slotRemoveBirthday(); |
106 | void slotRemoveAnniversary(); | 107 | void slotRemoveAnniversary(); |
107 | void defaultEmailChanged(int); | 108 | void defaultEmailChanged(int); |
108 | 109 | ||
109 | private: | 110 | private: |
110 | enum StackWidgets { TextField = 1, Combo }; | 111 | enum StackWidgets { TextField = 1, Combo }; |
111 | int defaultEmailChooserPosition; | 112 | int defaultEmailChooserPosition; |
112 | void populateDefaultEmailCmb(); | 113 | void populateDefaultEmailCmb(); |
113 | void chooserChange( const QString&, int , QLineEdit*, int ); | 114 | void chooserChange( const QString&, int , QLineEdit*, int ); |
114 | bool cmbChooserChange( int , QWidgetStack*, int ); | 115 | bool cmbChooserChange( int , QWidgetStack*, int ); |
115 | OContactFields contactfields; | 116 | OContactFields contactfields; |
116 | 117 | ||
117 | bool useFullName; | 118 | bool useFullName; |
118 | 119 | ||
119 | OContact ent; | 120 | OContact ent; |
120 | 121 | ||
121 | QDialog *dlgNote; | 122 | QDialog *dlgNote; |
122 | QDialog *dlgName; | 123 | QDialog *dlgName; |
123 | 124 | ||
124 | QList<QLineEdit> listValue; | 125 | QList<QLineEdit> listValue; |
125 | QList<QLabel> listName; | 126 | QList<QLabel> listName; |
126 | 127 | ||
127 | QStringList slDynamicEntries; | 128 | QStringList slDynamicEntries; |
128 | QStringList trlDynamicEntries; | 129 | QStringList trlDynamicEntries; |
129 | 130 | ||
130 | bool m_personalView; | 131 | bool m_personalView; |
131 | 132 | ||
132 | QStringList slHomeAddress; | 133 | QStringList slHomeAddress; |
133 | QStringList slBusinessAddress; | 134 | QStringList slBusinessAddress; |
134 | QStringList slChooserNames; | 135 | QStringList slChooserNames; |
135 | QStringList slChooserValues; | 136 | QStringList slChooserValues; |
136 | QStringList emails; | 137 | QStringList emails; |
137 | QString defaultEmail; | 138 | QString defaultEmail; |
138 | 139 | ||
139 | QMultiLineEdit *txtNote; | 140 | QMultiLineEdit *txtNote; |
140 | QLabel *lblNote; | 141 | QLabel *lblNote; |
141 | 142 | ||
142 | //QLineEdit *txtTitle; | 143 | //QLineEdit *txtTitle; |
143 | QLineEdit *txtFirstName; | 144 | QLineEdit *txtFirstName; |
144 | QLineEdit *txtMiddleName; | 145 | QLineEdit *txtMiddleName; |
145 | QLineEdit *txtLastName; | 146 | QLineEdit *txtLastName; |
146 | QLineEdit *txtSuffix; | 147 | QLineEdit *txtSuffix; |
147 | 148 | ||
148 | QTabWidget *tabMain; | 149 | QTabWidget *tabMain; |
149 | QScrollView *svGeneral; | 150 | QScrollView *svGeneral; |
150 | QPushButton *btnFullName; | 151 | QPushButton *btnFullName; |
151 | QPushButton *btnNote; | 152 | QPushButton *btnNote; |
152 | QLineEdit *txtFullName; | 153 | QLineEdit *txtFullName; |
153 | QLineEdit *txtJobTitle; | 154 | QLineEdit *txtJobTitle; |
154 | QLineEdit *txtOrganization; | 155 | QLineEdit *txtOrganization; |
155 | QLineEdit *txtChooserField1; | 156 | QLineEdit *txtChooserField1; |
156 | QLineEdit *txtChooserField2; | 157 | QLineEdit *txtChooserField2; |
157 | QLineEdit *txtChooserField3; | 158 | QLineEdit *txtChooserField3; |
158 | QLineEdit *txtChooserField4; | 159 | QLineEdit *txtChooserField4; |
159 | QWidgetStack* m_widgetStack1; | 160 | QWidgetStack* m_widgetStack1; |
160 | QWidgetStack* m_widgetStack2; | 161 | QWidgetStack* m_widgetStack2; |
161 | QWidgetStack* m_widgetStack3; | 162 | QWidgetStack* m_widgetStack3; |
162 | QWidgetStack* m_widgetStack4; | 163 | QWidgetStack* m_widgetStack4; |
163 | QComboBox *cmbChooserField1; | 164 | QComboBox *cmbChooserField1; |
164 | QComboBox *cmbChooserField2; | 165 | QComboBox *cmbChooserField2; |
165 | QComboBox *cmbChooserField3; | 166 | QComboBox *cmbChooserField3; |
166 | QComboBox *cmbChooserField4; | 167 | QComboBox *cmbChooserField4; |
167 | QComboBox *cmbDefaultEmail; | 168 | QComboBox *cmbDefaultEmail; |
168 | QComboBox *cmbFileAs; | 169 | QComboBox *cmbFileAs; |
169 | CategorySelect *cmbCat; | 170 | CategorySelect *cmbCat; |
170 | QLabel *labCat; | 171 | QLabel *labCat; |
171 | 172 | ||
172 | QScrollView *svAddress; | 173 | QScrollView *svAddress; |
173 | QLineEdit *txtAddress; | 174 | QLineEdit *txtAddress; |
174 | //QLineEdit *txtAddress2; | 175 | //QLineEdit *txtAddress2; |
175 | //QLineEdit *txtPOBox; | 176 | //QLineEdit *txtPOBox; |
176 | QLineEdit *txtCity; | 177 | QLineEdit *txtCity; |
177 | QLineEdit *txtState; | 178 | QLineEdit *txtState; |
178 | QLineEdit *txtZip; | 179 | QLineEdit *txtZip; |
179 | QComboBox *cmbAddress; | 180 | QComboBox *cmbAddress; |
180 | QComboBox *cmbCountry; | 181 | QComboBox *cmbCountry; |
181 | 182 | ||
182 | QScrollView *svDetails; | 183 | QScrollView *svDetails; |
183 | QComboBox *cmbGender; | 184 | QComboBox *cmbGender; |
184 | DateBookMonth* birthdayPicker; | 185 | DateBookMonth* birthdayPicker; |
185 | QToolButton* birthdayButton; | 186 | QToolButton* birthdayButton; |
186 | DateBookMonth* anniversaryPicker; | 187 | DateBookMonth* anniversaryPicker; |
187 | QToolButton* anniversaryButton; | 188 | QToolButton* anniversaryButton; |
188 | 189 | ||
189 | bool initializing; | 190 | bool initializing; |
190 | }; | 191 | }; |
191 | 192 | ||
192 | #endif | 193 | #endif |