summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp34
1 files changed, 1 insertions, 33 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 6d92ac3..0e752ca 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -404,370 +404,338 @@ void ContactEditor::init() {
404 gl->addWidget( e, i, 1); 404 gl->addWidget( e, i, 1);
405 } 405 }
406 406
407 l = new QLabel( tr("Gender"), container ); 407 l = new QLabel( tr("Gender"), container );
408 gl->addWidget( l, slDynamicEntries->count(), 0 ); 408 gl->addWidget( l, slDynamicEntries->count(), 0 );
409 cmbGender = new QComboBox( container ); 409 cmbGender = new QComboBox( container );
410 cmbGender->insertItem( "", 0 ); 410 cmbGender->insertItem( "", 0 );
411 cmbGender->insertItem( tr("Male"), 1); 411 cmbGender->insertItem( tr("Male"), 1);
412 cmbGender->insertItem( tr("Female"), 2); 412 cmbGender->insertItem( tr("Female"), 2);
413 gl->addWidget( cmbGender, slDynamicEntries->count(), 1 ); 413 gl->addWidget( cmbGender, slDynamicEntries->count(), 1 );
414 414
415 tabMain->insertTab( tabViewport, tr( "Details" ) ); 415 tabMain->insertTab( tabViewport, tr( "Details" ) );
416 416
417 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 417 dlgNote = new QDialog( this, "Note Dialog", TRUE );
418 dlgNote->setCaption( tr("Enter Note") ); 418 dlgNote->setCaption( tr("Enter Note") );
419 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 419 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
420 txtNote = new QMultiLineEdit( dlgNote ); 420 txtNote = new QMultiLineEdit( dlgNote );
421 vbNote->addWidget( txtNote ); 421 vbNote->addWidget( txtNote );
422 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 422 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
423 423
424 dlgName = new QDialog( this, "Name Dialog", TRUE ); 424 dlgName = new QDialog( this, "Name Dialog", TRUE );
425 dlgName->setCaption( tr("Edit Name") ); 425 dlgName->setCaption( tr("Edit Name") );
426 gl = new QGridLayout( dlgName, 4, 2, 2, 3 ); 426 gl = new QGridLayout( dlgName, 4, 2, 2, 3 );
427 427
428 l = new QLabel( tr("First Name"), dlgName ); 428 l = new QLabel( tr("First Name"), dlgName );
429 gl->addWidget( l, 0, 0 ); 429 gl->addWidget( l, 0, 0 );
430 txtFirstName = new QLineEdit( dlgName ); 430 txtFirstName = new QLineEdit( dlgName );
431 gl->addWidget( txtFirstName, 0, 1 ); 431 gl->addWidget( txtFirstName, 0, 1 );
432 432
433 l = new QLabel( tr("Middle Name"), dlgName ); 433 l = new QLabel( tr("Middle Name"), dlgName );
434 gl->addWidget( l, 1, 0 ); 434 gl->addWidget( l, 1, 0 );
435 txtMiddleName = new QLineEdit( dlgName ); 435 txtMiddleName = new QLineEdit( dlgName );
436 gl->addWidget( txtMiddleName, 1, 1 ); 436 gl->addWidget( txtMiddleName, 1, 1 );
437 437
438 l = new QLabel( tr("Last Name"), dlgName ); 438 l = new QLabel( tr("Last Name"), dlgName );
439 gl->addWidget( l, 2, 0 ); 439 gl->addWidget( l, 2, 0 );
440 txtLastName = new QLineEdit( dlgName ); 440 txtLastName = new QLineEdit( dlgName );
441 gl->addWidget( txtLastName, 2, 1 ); 441 gl->addWidget( txtLastName, 2, 1 );
442 442
443 l = new QLabel( tr("Suffix"), dlgName ); 443 l = new QLabel( tr("Suffix"), dlgName );
444 gl->addWidget( l, 3, 0 ); 444 gl->addWidget( l, 3, 0 );
445 txtSuffix = new QLineEdit( dlgName ); 445 txtSuffix = new QLineEdit( dlgName );
446 gl->addWidget( txtSuffix, 3, 1 ); 446 gl->addWidget( txtSuffix, 3, 1 );
447 447
448 cmbChooserField1->insertStringList( *slChooserNames ); 448 cmbChooserField1->insertStringList( *slChooserNames );
449 cmbChooserField2->insertStringList( *slChooserNames ); 449 cmbChooserField2->insertStringList( *slChooserNames );
450 cmbChooserField3->insertStringList( *slChooserNames ); 450 cmbChooserField3->insertStringList( *slChooserNames );
451 451
452 cmbChooserField1->setCurrentItem( 0 ); 452 cmbChooserField1->setCurrentItem( 0 );
453 cmbChooserField2->setCurrentItem( 1 ); 453 cmbChooserField2->setCurrentItem( 1 );
454 cmbChooserField3->setCurrentItem( 2 ); 454 cmbChooserField3->setCurrentItem( 2 );
455 455
456 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 456 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
457 457
458 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 458 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
459 459
460 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) ); 460 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) );
461 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) ); 461 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) );
462 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) ); 462 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) );
463 connect( txtAddress, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddressChange(const QString &)) ); 463 connect( txtAddress, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddressChange(const QString &)) );
464 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); 464 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) );
465 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); 465 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) );
466 connect( txtCity, SIGNAL(textChanged(const QString &)), this, SLOT(slotCityChange(const QString &)) ); 466 connect( txtCity, SIGNAL(textChanged(const QString &)), this, SLOT(slotCityChange(const QString &)) );
467 connect( txtState, SIGNAL(textChanged(const QString &)), this, SLOT(slotStateChange(const QString &)) ); 467 connect( txtState, SIGNAL(textChanged(const QString &)), this, SLOT(slotStateChange(const QString &)) );
468 connect( txtZip, SIGNAL(textChanged(const QString &)), this, SLOT(slotZipChange(const QString &)) ); 468 connect( txtZip, SIGNAL(textChanged(const QString &)), this, SLOT(slotZipChange(const QString &)) );
469 connect( cmbCountry, SIGNAL(textChanged(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); 469 connect( cmbCountry, SIGNAL(textChanged(const QString &)), this, SLOT(slotCountryChange(const QString &)) );
470 connect( cmbCountry, SIGNAL(activated(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); 470 connect( cmbCountry, SIGNAL(activated(const QString &)), this, SLOT(slotCountryChange(const QString &)) );
471 connect( cmbChooserField1, SIGNAL(activated(int)), this, SLOT(slotCmbChooser1Change(int)) ); 471 connect( cmbChooserField1, SIGNAL(activated(int)), this, SLOT(slotCmbChooser1Change(int)) );
472 connect( cmbChooserField2, SIGNAL(activated(int)), this, SLOT(slotCmbChooser2Change(int)) ); 472 connect( cmbChooserField2, SIGNAL(activated(int)), this, SLOT(slotCmbChooser2Change(int)) );
473 connect( cmbChooserField3, SIGNAL(activated(int)), this, SLOT(slotCmbChooser3Change(int)) ); 473 connect( cmbChooserField3, SIGNAL(activated(int)), this, SLOT(slotCmbChooser3Change(int)) );
474 connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) ); 474 connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) );
475 new QPEDialogListener(this); 475 new QPEDialogListener(this);
476} 476}
477 477
478void ContactEditor::initMap() 478void ContactEditor::initMap()
479{ 479{
480 /* 480 /*
481 // since the fields and the XML fields exist, create a map 481 // since the fields and the XML fields exist, create a map
482 // between them... 482 // between them...
483 Config cfg1( "AddressBook" ); 483 Config cfg1( "AddressBook" );
484 Config cfg2( "AddressBook" ); 484 Config cfg2( "AddressBook" );
485 QString strCfg1, 485 QString strCfg1,
486 strCfg2; 486 strCfg2;
487 int i; 487 int i;
488 488
489 // This stuff better exist... 489 // This stuff better exist...
490 cfg1.setGroup( "AddressFields" ); 490 cfg1.setGroup( "AddressFields" );
491o cfg2.setGroup( "XMLFields" ); 491o cfg2.setGroup( "XMLFields" );
492 i = 0; 492 i = 0;
493 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); 493 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null );
494 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), 494 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++),
495 QString::null ); 495 QString::null );
496 while ( !strCfg1.isNull() && !strCfg2.isNull() ) { 496 while ( !strCfg1.isNull() && !strCfg2.isNull() ) {
497 mapField.insert( strCfg1, strCfg2 ); 497 mapField.insert( strCfg1, strCfg2 );
498 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), 498 strCfg1 = cfg1.readEntry( "Field" + QString::number(i),
499 QString::null ); 499 QString::null );
500 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), 500 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++),
501 QString::null ); 501 QString::null );
502 } 502 }
503 */ 503 */
504} 504}
505 505
506void ContactEditor::slotChooser1Change( const QString &textChanged ) { 506void ContactEditor::slotChooser1Change( const QString &textChanged ) {
507 507
508 int index = cmbChooserField1->currentItem(); 508 int index = cmbChooserField1->currentItem();
509 509
510 (*slChooserValues)[index] = textChanged; 510 (*slChooserValues)[index] = textChanged;
511 511
512} 512}
513 513
514void ContactEditor::slotChooser2Change( const QString &textChanged ) { 514void ContactEditor::slotChooser2Change( const QString &textChanged ) {
515 515
516 int index = cmbChooserField2->currentItem(); 516 int index = cmbChooserField2->currentItem();
517 517
518 (*slChooserValues)[index] = textChanged; 518 (*slChooserValues)[index] = textChanged;
519 519
520} 520}
521 521
522void ContactEditor::slotChooser3Change( const QString &textChanged ) { 522void ContactEditor::slotChooser3Change( const QString &textChanged ) {
523 523
524 int index = cmbChooserField3->currentItem(); 524 int index = cmbChooserField3->currentItem();
525 525
526 (*slChooserValues)[index] = textChanged; 526 (*slChooserValues)[index] = textChanged;
527 527
528} 528}
529 529
530void ContactEditor::slotAddressChange( const QString &textChanged ) { 530void ContactEditor::slotAddressChange( const QString &textChanged ) {
531 531
532 qDebug((*slBusinessAddress)[0]);
533 qDebug((*slHomeAddress)[0]);
534 qDebug(textChanged);
535 if ( cmbAddress->currentItem() == 0 ) { 532 if ( cmbAddress->currentItem() == 0 ) {
536 (*slBusinessAddress)[0] = textChanged; 533 (*slBusinessAddress)[0] = textChanged;
537 } else { 534 } else {
538 (*slHomeAddress)[0] = textChanged; 535 (*slHomeAddress)[0] = textChanged;
539 } 536 }
540} 537}
541 538
542void ContactEditor::slotAddress2Change( const QString &textChanged ) { 539void ContactEditor::slotAddress2Change( const QString &textChanged ) {
543 540
544 qDebug((*slBusinessAddress)[1]);
545 qDebug((*slHomeAddress)[1]);
546 qDebug(textChanged);
547
548 if ( cmbAddress->currentItem() == 0 ) { 541 if ( cmbAddress->currentItem() == 0 ) {
549 (*slBusinessAddress)[1] = textChanged; 542 (*slBusinessAddress)[1] = textChanged;
550 } else { 543 } else {
551 (*slHomeAddress)[1] = textChanged; 544 (*slHomeAddress)[1] = textChanged;
552 } 545 }
553} 546}
554 547
555void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 548void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
556 549
557 qDebug((*slBusinessAddress)[2]);
558 qDebug((*slHomeAddress)[2]);
559 qDebug(textChanged);
560 if ( cmbAddress->currentItem() == 0 ) { 550 if ( cmbAddress->currentItem() == 0 ) {
561 (*slBusinessAddress)[2] = textChanged; 551 (*slBusinessAddress)[2] = textChanged;
562 } else { 552 } else {
563 (*slHomeAddress)[2] = textChanged; 553 (*slHomeAddress)[2] = textChanged;
564 } 554 }
565} 555}
566 556
567void ContactEditor::slotCityChange( const QString &textChanged ) { 557void ContactEditor::slotCityChange( const QString &textChanged ) {
568 558
569 qDebug((*slBusinessAddress)[3]);
570 qDebug((*slHomeAddress)[3]);
571 qDebug(textChanged);
572 if ( cmbAddress->currentItem() == 0 ) { 559 if ( cmbAddress->currentItem() == 0 ) {
573 (*slBusinessAddress)[3] = textChanged; 560 (*slBusinessAddress)[3] = textChanged;
574 } else { 561 } else {
575 (*slHomeAddress)[3] = textChanged; 562 (*slHomeAddress)[3] = textChanged;
576 } 563 }
577} 564}
578 565
579void ContactEditor::slotStateChange( const QString &textChanged ) { 566void ContactEditor::slotStateChange( const QString &textChanged ) {
580 567
581 568
582 qDebug((*slBusinessAddress)[4]);
583 qDebug((*slHomeAddress)[4]);
584 qDebug(textChanged);
585 if ( cmbAddress->currentItem() == 0 ) { 569 if ( cmbAddress->currentItem() == 0 ) {
586 (*slBusinessAddress)[4] = textChanged; 570 (*slBusinessAddress)[4] = textChanged;
587 } else { 571 } else {
588 (*slHomeAddress)[4] = textChanged; 572 (*slHomeAddress)[4] = textChanged;
589 } 573 }
590} 574}
591 575
592void ContactEditor::slotZipChange( const QString &textChanged ) { 576void ContactEditor::slotZipChange( const QString &textChanged ) {
593 577
594 qDebug((*slBusinessAddress)[5]);
595 qDebug((*slHomeAddress)[5]);
596 qDebug(textChanged);
597 if ( cmbAddress->currentItem() == 0 ) { 578 if ( cmbAddress->currentItem() == 0 ) {
598 (*slBusinessAddress)[5] = textChanged; 579 (*slBusinessAddress)[5] = textChanged;
599 } else { 580 } else {
600 (*slHomeAddress)[5] = textChanged; 581 (*slHomeAddress)[5] = textChanged;
601 } 582 }
602} 583}
603 584
604void ContactEditor::slotCountryChange( const QString &textChanged ) { 585void ContactEditor::slotCountryChange( const QString &textChanged ) {
605 586
606 qDebug((*slBusinessAddress)[6]);
607 qDebug((*slHomeAddress)[6]);
608 qDebug(textChanged);
609 if ( cmbAddress->currentItem() == 0 ) { 587 if ( cmbAddress->currentItem() == 0 ) {
610 (*slBusinessAddress)[6] = textChanged; 588 (*slBusinessAddress)[6] = textChanged;
611 } else { 589 } else {
612 (*slHomeAddress)[6] = textChanged; 590 (*slHomeAddress)[6] = textChanged;
613 } 591 }
614} 592}
615 593
616void ContactEditor::slotCmbChooser1Change( int index ) { 594void ContactEditor::slotCmbChooser1Change( int index ) {
617 595
618 txtChooserField1->setText( (*slChooserValues)[index] ); 596 txtChooserField1->setText( (*slChooserValues)[index] );
619 597
620} 598}
621 599
622void ContactEditor::slotCmbChooser2Change( int index ) { 600void ContactEditor::slotCmbChooser2Change( int index ) {
623 601
624 txtChooserField2->setText( (*slChooserValues)[index] ); 602 txtChooserField2->setText( (*slChooserValues)[index] );
625 603
626} 604}
627 605
628void ContactEditor::slotCmbChooser3Change( int index ) { 606void ContactEditor::slotCmbChooser3Change( int index ) {
629 607
630 txtChooserField3->setText( (*slChooserValues)[index] ); 608 txtChooserField3->setText( (*slChooserValues)[index] );
631 609
632} 610}
633 611
634void ContactEditor::slotAddressTypeChange( int index ) { 612void ContactEditor::slotAddressTypeChange( int index ) {
635 613
636 qDebug((*slBusinessAddress)[0]);
637 qDebug((*slBusinessAddress)[1]);
638 qDebug((*slBusinessAddress)[2]);
639qDebug((*slBusinessAddress)[3]);
640qDebug((*slBusinessAddress)[4]);
641qDebug((*slBusinessAddress)[5]);
642qDebug((*slBusinessAddress)[6]);
643
644
645
646 if ( index == 0 ) { 614 if ( index == 0 ) {
647 615
648 txtAddress->setText( (*slBusinessAddress)[0] ); 616 txtAddress->setText( (*slBusinessAddress)[0] );
649 //txtAddress2->setText( (*slBusinessAddress)[1] ); 617 //txtAddress2->setText( (*slBusinessAddress)[1] );
650 //txtPOBox->setText( (*slBusinessAddress)[2] ); 618 //txtPOBox->setText( (*slBusinessAddress)[2] );
651 txtCity->setText( (*slBusinessAddress)[3] ); 619 txtCity->setText( (*slBusinessAddress)[3] );
652 txtState->setText( (*slBusinessAddress)[4] ); 620 txtState->setText( (*slBusinessAddress)[4] );
653 txtZip->setText( (*slBusinessAddress)[5] ); 621 txtZip->setText( (*slBusinessAddress)[5] );
654 QLineEdit *txtTmp = cmbCountry->lineEdit(); 622 QLineEdit *txtTmp = cmbCountry->lineEdit();
655 txtTmp->setText( (*slBusinessAddress)[6] ); 623 txtTmp->setText( (*slBusinessAddress)[6] );
656 624
657 } else { 625 } else {
658 626
659 txtAddress->setText( (*slHomeAddress)[0] ); 627 txtAddress->setText( (*slHomeAddress)[0] );
660 //txtAddress2->setText( (*slHomeAddress)[1] ); 628 //txtAddress2->setText( (*slHomeAddress)[1] );
661 //txtPOBox->setText( (*slHomeAddress)[2] ); 629 //txtPOBox->setText( (*slHomeAddress)[2] );
662 txtCity->setText( (*slHomeAddress)[3] ); 630 txtCity->setText( (*slHomeAddress)[3] );
663 txtState->setText( (*slHomeAddress)[4] ); 631 txtState->setText( (*slHomeAddress)[4] );
664 txtZip->setText( (*slHomeAddress)[5] ); 632 txtZip->setText( (*slHomeAddress)[5] );
665 QLineEdit *txtTmp = cmbCountry->lineEdit(); 633 QLineEdit *txtTmp = cmbCountry->lineEdit();
666 txtTmp->setText( (*slHomeAddress)[6] ); 634 txtTmp->setText( (*slHomeAddress)[6] );
667 635
668 } 636 }
669 637
670} 638}
671 639
672void ContactEditor::slotFullNameChange( const QString &textChanged ) { 640void ContactEditor::slotFullNameChange( const QString &textChanged ) {
673 641
674 int index = cmbFileAs->currentItem(); 642 int index = cmbFileAs->currentItem();
675 643
676 cmbFileAs->clear(); 644 cmbFileAs->clear();
677 645
678 cmbFileAs->insertItem( parseName( textChanged, 0 ) ); 646 cmbFileAs->insertItem( parseName( textChanged, 0 ) );
679 cmbFileAs->insertItem( parseName( textChanged, 1 ) ); 647 cmbFileAs->insertItem( parseName( textChanged, 1 ) );
680 cmbFileAs->insertItem( parseName( textChanged, 2 ) ); 648 cmbFileAs->insertItem( parseName( textChanged, 2 ) );
681 cmbFileAs->insertItem( parseName( textChanged, 3 ) ); 649 cmbFileAs->insertItem( parseName( textChanged, 3 ) );
682 650
683 cmbFileAs->setCurrentItem( index ); 651 cmbFileAs->setCurrentItem( index );
684 652
685 useFullName = TRUE; 653 useFullName = TRUE;
686 654
687 } 655 }
688 656
689void ContactEditor::loadFields() { 657void ContactEditor::loadFields() {
690 658
691 QStringList::ConstIterator it; 659 QStringList::ConstIterator it;
692 QListIterator<QLabel> lit( listName ); 660 QListIterator<QLabel> lit( listName );
693 for ( it = slDynamicEntries->begin(); *lit; ++lit, ++it) { 661 for ( it = slDynamicEntries->begin(); *lit; ++lit, ++it) {
694 (*lit)->setText( *it ); 662 (*lit)->setText( *it );
695 } 663 }
696} 664}
697 665
698void ContactEditor::accept() { 666void ContactEditor::accept() {
699 667
700 if ( isEmpty() ) { 668 if ( isEmpty() ) {
701 cleanupFields(); 669 cleanupFields();
702 reject(); 670 reject();
703 } else { 671 } else {
704 saveEntry(); 672 saveEntry();
705 cleanupFields(); 673 cleanupFields();
706 QDialog::accept(); 674 QDialog::accept();
707 } 675 }
708 676
709} 677}
710 678
711void ContactEditor::slotNote() { 679void ContactEditor::slotNote() {
712 680
713 dlgNote->showMaximized(); 681 dlgNote->showMaximized();
714 if ( !dlgNote->exec() ) { 682 if ( !dlgNote->exec() ) {
715 txtNote->setText( ent.notes() ); 683 txtNote->setText( ent.notes() );
716 } 684 }
717} 685}
718 686
719void ContactEditor::slotName() { 687void ContactEditor::slotName() {
720 688
721 if (useFullName = TRUE) { 689 if (useFullName = TRUE) {
722 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 690 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
723 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 691 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
724 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 692 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
725 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 693 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
726 } 694 }
727 695
728 dlgName->showMaximized(); 696 dlgName->showMaximized();
729 if ( dlgName->exec() ) { 697 if ( dlgName->exec() ) {
730 txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() ); 698 txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() );
731 slotFullNameChange( txtFullName->text() ); 699 slotFullNameChange( txtFullName->text() );
732 useFullName = FALSE; 700 useFullName = FALSE;
733 } 701 }
734 702
735} 703}
736 704
737void ContactEditor::setNameFocus() { 705void ContactEditor::setNameFocus() {
738 706
739 txtFullName->setFocus(); 707 txtFullName->setFocus();
740 708
741} 709}
742 710
743bool ContactEditor::isEmpty() { 711bool ContactEditor::isEmpty() {
744 // Test and see if the record should be saved. 712 // Test and see if the record should be saved.
745 // More strict than the original qtopia, needs name or fileas to save 713 // More strict than the original qtopia, needs name or fileas to save
746 714
747 QString t = txtFullName->text(); 715 QString t = txtFullName->text();
748 if ( !t.isEmpty() && containsAlphaNum( t ) ) 716 if ( !t.isEmpty() && containsAlphaNum( t ) )
749 return false; 717 return false;
750 718
751 t = cmbFileAs->currentText(); 719 t = cmbFileAs->currentText();
752 if ( !t.isEmpty() && containsAlphaNum( t ) ) 720 if ( !t.isEmpty() && containsAlphaNum( t ) )
753 return false; 721 return false;
754 722
755 return true; 723 return true;
756 724
757} 725}
758 726
759QString ContactEditor::parseName( const QString fullName, int type ) { 727QString ContactEditor::parseName( const QString fullName, int type ) {
760 728
761 QString simplifiedName( fullName.simplifyWhiteSpace() ); 729 QString simplifiedName( fullName.simplifyWhiteSpace() );
762 QString strFirstName; 730 QString strFirstName;
763 QString strMiddleName; 731 QString strMiddleName;
764 QString strLastName; 732 QString strLastName;
765 QString strSuffix; 733 QString strSuffix;
766 QString strTitle; 734 QString strTitle;
767 int commapos; 735 int commapos;
768 int spCount; 736 int spCount;
769 int spPos; 737 int spPos;
770 int spPos2; 738 int spPos2;
771 739
772 740
773 commapos = simplifiedName.find( ',', 0, TRUE); 741 commapos = simplifiedName.find( ',', 0, TRUE);
@@ -877,257 +845,257 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
877 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 845 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
878 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 846 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
879 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 847 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
880 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); 848 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
881 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 849 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
882 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 850 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
883 strSuffix = simplifiedName.mid( spPos2 + 1 ); 851 strSuffix = simplifiedName.mid( spPos2 + 1 );
884 break; 852 break;
885 } 853 }
886 } 854 }
887 855
888 switch (type) { 856 switch (type) {
889 case NAME_FL: 857 case NAME_FL:
890 return strFirstName + " " + strLastName; 858 return strFirstName + " " + strLastName;
891 859
892 case NAME_LF: 860 case NAME_LF:
893 return strLastName + ", " + strFirstName; 861 return strLastName + ", " + strFirstName;
894 862
895 case NAME_LFM: 863 case NAME_LFM:
896 return strLastName + ", " + strFirstName + " " + strMiddleName; 864 return strLastName + ", " + strFirstName + " " + strMiddleName;
897 865
898 case NAME_FMLS: 866 case NAME_FMLS:
899 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; 867 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix;
900 868
901 case NAME_F: 869 case NAME_F:
902 return strFirstName; 870 return strFirstName;
903 871
904 case NAME_M: 872 case NAME_M:
905 return strMiddleName; 873 return strMiddleName;
906 874
907 case NAME_L: 875 case NAME_L:
908 return strLastName; 876 return strLastName;
909 877
910 case NAME_S: 878 case NAME_S:
911 return strSuffix; 879 return strSuffix;
912 880
913 } 881 }
914} 882}
915 883
916void ContactEditor::cleanupFields() { 884void ContactEditor::cleanupFields() {
917 885
918 QStringList::Iterator it = slChooserValues->begin(); 886 QStringList::Iterator it = slChooserValues->begin();
919 for ( int i = 0; it != slChooserValues->end(); i++, ++it ) { 887 for ( int i = 0; it != slChooserValues->end(); i++, ++it ) {
920 (*it) = ""; 888 (*it) = "";
921 } 889 }
922 890
923 for ( int i = 0; i < 7; i++ ) { 891 for ( int i = 0; i < 7; i++ ) {
924 (*slHomeAddress)[i] = ""; 892 (*slHomeAddress)[i] = "";
925 (*slBusinessAddress)[i] = ""; 893 (*slBusinessAddress)[i] = "";
926 } 894 }
927 895
928 QStringList::ConstIterator cit; 896 QStringList::ConstIterator cit;
929 QListIterator<QLineEdit> itLE( listValue ); 897 QListIterator<QLineEdit> itLE( listValue );
930 for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) { 898 for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) {
931 (*itLE)->setText( "" ); 899 (*itLE)->setText( "" );
932 } 900 }
933 901
934 txtFirstName->setText(""); 902 txtFirstName->setText("");
935 txtMiddleName->setText(""); 903 txtMiddleName->setText("");
936 txtLastName->setText(""); 904 txtLastName->setText("");
937 txtSuffix->setText(""); 905 txtSuffix->setText("");
938 txtNote->setText(""); 906 txtNote->setText("");
939 txtFullName->setText(""); 907 txtFullName->setText("");
940 txtJobTitle->setText(""); 908 txtJobTitle->setText("");
941 txtOrganization->setText(""); 909 txtOrganization->setText("");
942 txtChooserField1->setText(""); 910 txtChooserField1->setText("");
943 txtChooserField2->setText(""); 911 txtChooserField2->setText("");
944 txtChooserField3->setText(""); 912 txtChooserField3->setText("");
945 txtAddress->setText(""); 913 txtAddress->setText("");
946 //txtAddress2->setText(""); 914 //txtAddress2->setText("");
947 txtCity->setText(""); 915 txtCity->setText("");
948 //txtPOBox->setText(""); 916 //txtPOBox->setText("");
949 txtState->setText(""); 917 txtState->setText("");
950 txtZip->setText(""); 918 txtZip->setText("");
951 QLineEdit *txtTmp = cmbCountry->lineEdit(); 919 QLineEdit *txtTmp = cmbCountry->lineEdit();
952 txtTmp->setText(""); 920 txtTmp->setText("");
953 txtTmp = cmbFileAs->lineEdit(); 921 txtTmp = cmbFileAs->lineEdit();
954 txtTmp->setText(""); 922 txtTmp->setText("");
955 923
956} 924}
957 925
958void ContactEditor::setEntry( const Contact &entry ) { 926void ContactEditor::setEntry( const Contact &entry ) {
959 927
960 cleanupFields(); 928 cleanupFields();
961 929
962 930
963 ent = entry; 931 ent = entry;
964 932
965 useFullName = FALSE; 933 useFullName = FALSE;
966 txtFirstName->setText( ent.firstName() ); 934 txtFirstName->setText( ent.firstName() );
967 txtMiddleName->setText( ent.middleName() ); 935 txtMiddleName->setText( ent.middleName() );
968 txtLastName->setText( ent.lastName() ); 936 txtLastName->setText( ent.lastName() );
969 txtSuffix->setText( ent.suffix() ); 937 txtSuffix->setText( ent.suffix() );
970 938
971 QString *tmpString = new QString; 939 QString *tmpString = new QString;
972 *tmpString = ent.firstName() + " " + ent.middleName() + 940 *tmpString = ent.firstName() + " " + ent.middleName() +
973 + " " + ent.lastName() + " " + ent.suffix(); 941 + " " + ent.lastName() + " " + ent.suffix();
974 942
975 txtFullName->setText( tmpString->simplifyWhiteSpace() ); 943 txtFullName->setText( tmpString->simplifyWhiteSpace() );
976 944
977 cmbFileAs->setEditText( ent.fileAs() ); 945 cmbFileAs->setEditText( ent.fileAs() );
978 946
979 if (hasTitle) 947 if (hasTitle)
980 txtJobTitle->setText( ent.jobTitle() ); 948 txtJobTitle->setText( ent.jobTitle() );
981 949
982 if (hasCompany) 950 if (hasCompany)
983 txtOrganization->setText( ent.company() ); 951 txtOrganization->setText( ent.company() );
984 952
985 if (hasNotes) 953 if (hasNotes)
986 txtNote->setText( ent.notes() ); 954 txtNote->setText( ent.notes() );
987 955
988 if (hasStreet) { 956 if (hasStreet) {
989 (*slHomeAddress)[0] = ent.homeStreet(); 957 (*slHomeAddress)[0] = ent.homeStreet();
990 (*slBusinessAddress)[0] = ent.businessStreet(); 958 (*slBusinessAddress)[0] = ent.businessStreet();
991 } 959 }
992/* 960/*
993 if (hasStreet2) { 961 if (hasStreet2) {
994 (*slHomeAddress)[1] = ent.homeStreet2(); 962 (*slHomeAddress)[1] = ent.homeStreet2();
995 (*slBusinessAddress)[1] = ent.businessStreet2(); 963 (*slBusinessAddress)[1] = ent.businessStreet2();
996 } 964 }
997 965
998 if (hasPOBox) { 966 if (hasPOBox) {
999 (*slHomeAddress)[2] = ent.homePOBox(); 967 (*slHomeAddress)[2] = ent.homePOBox();
1000 (*slBusinessAddress)[2] = ent.businessPOBox(); 968 (*slBusinessAddress)[2] = ent.businessPOBox();
1001 } 969 }
1002*/ 970*/
1003 if (hasCity) { 971 if (hasCity) {
1004 (*slHomeAddress)[3] = ent.homeCity(); 972 (*slHomeAddress)[3] = ent.homeCity();
1005 (*slBusinessAddress)[3] = ent.homeCity(); 973 (*slBusinessAddress)[3] = ent.businessCity();
1006 } 974 }
1007 975
1008 if (hasState) { 976 if (hasState) {
1009 (*slHomeAddress)[4] = ent.homeState(); 977 (*slHomeAddress)[4] = ent.homeState();
1010 (*slBusinessAddress)[4] = ent.businessState(); 978 (*slBusinessAddress)[4] = ent.businessState();
1011 } 979 }
1012 980
1013 if (hasZip) { 981 if (hasZip) {
1014 (*slHomeAddress)[5] = ent.homeZip(); 982 (*slHomeAddress)[5] = ent.homeZip();
1015 (*slBusinessAddress)[5] = ent.businessZip(); 983 (*slBusinessAddress)[5] = ent.businessZip();
1016 } 984 }
1017 985
1018 if (hasCountry) { 986 if (hasCountry) {
1019 (*slHomeAddress)[6] = ent.homeCountry(); 987 (*slHomeAddress)[6] = ent.homeCountry();
1020 (*slBusinessAddress)[6] = ent.businessCountry(); 988 (*slBusinessAddress)[6] = ent.businessCountry();
1021 } 989 }
1022 990
1023 QStringList::ConstIterator it; 991 QStringList::ConstIterator it;
1024 QListIterator<QLineEdit> itLE( listValue ); 992 QListIterator<QLineEdit> itLE( listValue );
1025 for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { 993 for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) {
1026 if ( *it == "Department" ) 994 if ( *it == "Department" )
1027 (*itLE)->setText( ent.department() ); 995 (*itLE)->setText( ent.department() );
1028 996
1029 if ( *it == "Company" ) 997 if ( *it == "Company" )
1030 (*itLE)->setText( ent.company() ); 998 (*itLE)->setText( ent.company() );
1031 999
1032 if ( *it == "Office" ) 1000 if ( *it == "Office" )
1033 (*itLE)->setText( ent.office() ); 1001 (*itLE)->setText( ent.office() );
1034 1002
1035 if ( *it == "Profession" ) 1003 if ( *it == "Profession" )
1036 (*itLE)->setText( ent.profession() ); 1004 (*itLE)->setText( ent.profession() );
1037 1005
1038 if ( *it == "Assistant" ) 1006 if ( *it == "Assistant" )
1039 (*itLE)->setText( ent.assistant() ); 1007 (*itLE)->setText( ent.assistant() );
1040 1008
1041 if ( *it == "Manager" ) 1009 if ( *it == "Manager" )
1042 (*itLE)->setText( ent.manager() ); 1010 (*itLE)->setText( ent.manager() );
1043 1011
1044 if ( *it == "Spouse" ) 1012 if ( *it == "Spouse" )
1045 (*itLE)->setText( ent.spouse() ); 1013 (*itLE)->setText( ent.spouse() );
1046 1014
1047 if ( *it == "Birthday" ) 1015 if ( *it == "Birthday" )
1048 (*itLE)->setText( ent.birthday() ); 1016 (*itLE)->setText( ent.birthday() );
1049 1017
1050 if ( *it == "Anniversary" ) 1018 if ( *it == "Anniversary" )
1051 (*itLE)->setText( ent.anniversary() ); 1019 (*itLE)->setText( ent.anniversary() );
1052 1020
1053 if ( *it == "Nickname" ) 1021 if ( *it == "Nickname" )
1054 (*itLE)->setText( ent.nickname() ); 1022 (*itLE)->setText( ent.nickname() );
1055 1023
1056 if ( *it == "Children" ) 1024 if ( *it == "Children" )
1057 (*itLE)->setText( ent.children() ); 1025 (*itLE)->setText( ent.children() );
1058 1026
1059 } 1027 }
1060 1028
1061 QStringList::Iterator itV; 1029 QStringList::Iterator itV;
1062 for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { 1030 for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) {
1063 1031
1064 if ( *it == "Business Phone" || *it == "Work Phone" ) 1032 if ( *it == "Business Phone" || *it == "Work Phone" )
1065 *itV = ent.businessPhone(); 1033 *itV = ent.businessPhone();
1066/* 1034/*
1067 if ( *it == "Business 2 Phone" ) 1035 if ( *it == "Business 2 Phone" )
1068 *itV = ent.business2Phone(); 1036 *itV = ent.business2Phone();
1069*/ 1037*/
1070 if ( *it == "Business Fax" || *it == "Work Fax" ) 1038 if ( *it == "Business Fax" || *it == "Work Fax" )
1071 *itV = ent.businessFax(); 1039 *itV = ent.businessFax();
1072 1040
1073 if ( *it == "Business Mobile" || *it == "work Mobile" ) 1041 if ( *it == "Business Mobile" || *it == "work Mobile" )
1074 *itV = ent.businessMobile(); 1042 *itV = ent.businessMobile();
1075/* 1043/*
1076 if ( *it == "Company Phone" ) 1044 if ( *it == "Company Phone" )
1077 *itV = ent.companyPhone(); 1045 *itV = ent.companyPhone();
1078*/ 1046*/
1079 if ( *it == "Default Email" ) 1047 if ( *it == "Default Email" )
1080 *itV = ent.defaultEmail(); 1048 *itV = ent.defaultEmail();
1081 1049
1082 if ( *it == "Emails" ) 1050 if ( *it == "Emails" )
1083 *itV = ent.emails(); 1051 *itV = ent.emails();
1084 1052
1085 if ( *it == "Home Phone" ) 1053 if ( *it == "Home Phone" )
1086 *itV = ent.homePhone(); 1054 *itV = ent.homePhone();
1087/* 1055/*
1088 if ( *it == "Home 2 Phone" ) 1056 if ( *it == "Home 2 Phone" )
1089 *itV = ent.home2Phone(); 1057 *itV = ent.home2Phone();
1090*/ 1058*/
1091 if ( *it == "Home Fax" ) 1059 if ( *it == "Home Fax" )
1092 *itV = ent.homeFax(); 1060 *itV = ent.homeFax();
1093 1061
1094 if ( *it == "Home Mobile" ) 1062 if ( *it == "Home Mobile" )
1095 *itV = ent.homeMobile(); 1063 *itV = ent.homeMobile();
1096/* 1064/*
1097 if ( *it == "Car Phone" ) 1065 if ( *it == "Car Phone" )
1098 *itV = ent.carPhone(); 1066 *itV = ent.carPhone();
1099 1067
1100 if ( *it == "ISDN Phone" ) 1068 if ( *it == "ISDN Phone" )
1101 *itV = ent.ISDNPhone(); 1069 *itV = ent.ISDNPhone();
1102 1070
1103 if ( *it == "Other Phone" ) 1071 if ( *it == "Other Phone" )
1104 *itV = ent.otherPhone(); 1072 *itV = ent.otherPhone();
1105*/ 1073*/
1106 if ( *it == "Business Pager" || *it == "Work Pager" ) 1074 if ( *it == "Business Pager" || *it == "Work Pager" )
1107 *itV = ent.businessPager(); 1075 *itV = ent.businessPager();
1108/* 1076/*
1109 if ( *it == "Home Pager") 1077 if ( *it == "Home Pager")
1110 *itV = ent.homePager(); 1078 *itV = ent.homePager();
1111 1079
1112 if ( *it == "AIM IM" ) 1080 if ( *it == "AIM IM" )
1113 *itV = ent.AIMIM(); 1081 *itV = ent.AIMIM();
1114 1082
1115 if ( *it == "ICQ IM" ) 1083 if ( *it == "ICQ IM" )
1116 *itV = ent.ICQIM(); 1084 *itV = ent.ICQIM();
1117 1085
1118 if ( *it == "Jabber IM" ) 1086 if ( *it == "Jabber IM" )
1119 *itV = ent.jabberIM(); 1087 *itV = ent.jabberIM();
1120 1088
1121 if ( *it == "MSN IM" ) 1089 if ( *it == "MSN IM" )
1122 *itV = ent.MSNIM(); 1090 *itV = ent.MSNIM();
1123 1091
1124 if ( *it == "Yahoo IM" ) 1092 if ( *it == "Yahoo IM" )
1125 *itV = ent.yahooIM(); 1093 *itV = ent.yahooIM();
1126*/ 1094*/
1127 if ( *it == "Home Web Page" ) 1095 if ( *it == "Home Web Page" )
1128 *itV = ent.homeWebpage(); 1096 *itV = ent.homeWebpage();
1129 if ( *it == "Business Web Page" || *it == "Work Web Page" ) 1097 if ( *it == "Business Web Page" || *it == "Work Web Page" )
1130 *itV = ent.businessWebpage(); 1098 *itV = ent.businessWebpage();
1131 1099
1132 1100
1133 } 1101 }