author | eilers <eilers> | 2003-01-13 17:38:53 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-01-13 17:38:53 (UTC) |
commit | 90706ff3edbf0c30856bb9786e69a6d3a0e0867a (patch) (unidiff) | |
tree | 19839cdc38a737724a9228f421cd291cbe45baa1 | |
parent | 6bae3504f8eacd604bc6d543d3eb09f996221dcc (diff) | |
download | opie-90706ff3edbf0c30856bb9786e69a6d3a0e0867a.zip opie-90706ff3edbf0c30856bb9786e69a6d3a0e0867a.tar.gz opie-90706ff3edbf0c30856bb9786e69a6d3a0e0867a.tar.bz2 |
Removed nonsense which corrupted the business phone data
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 37e3a54..d14ac51 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -458,637 +458,637 @@ void ContactEditor::init() { | |||
458 | 458 | ||
459 | QSpacerItem *space = new QSpacerItem(1,1, | 459 | QSpacerItem *space = new QSpacerItem(1,1, |
460 | QSizePolicy::Maximum, | 460 | QSizePolicy::Maximum, |
461 | QSizePolicy::MinimumExpanding ); | 461 | QSizePolicy::MinimumExpanding ); |
462 | gl->addItem( space, 7, 0 ); | 462 | gl->addItem( space, 7, 0 ); |
463 | 463 | ||
464 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 464 | tabMain->insertTab( tabViewport, tr( "Address" ) ); |
465 | 465 | ||
466 | tabViewport = new QWidget ( tabMain ); | 466 | tabViewport = new QWidget ( tabMain ); |
467 | 467 | ||
468 | vb = new QVBoxLayout( tabViewport ); | 468 | vb = new QVBoxLayout( tabViewport ); |
469 | 469 | ||
470 | svDetails = new QScrollView( tabViewport ); | 470 | svDetails = new QScrollView( tabViewport ); |
471 | vb->addWidget( svDetails, 0, 0 ); | 471 | vb->addWidget( svDetails, 0, 0 ); |
472 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 472 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
473 | svDetails->setFrameStyle( QFrame::NoFrame ); | 473 | svDetails->setFrameStyle( QFrame::NoFrame ); |
474 | 474 | ||
475 | container = new QWidget( svDetails->viewport() ); | 475 | container = new QWidget( svDetails->viewport() ); |
476 | svDetails->addChild( container ); | 476 | svDetails->addChild( container ); |
477 | 477 | ||
478 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 478 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
479 | 479 | ||
480 | int counter = 0; | 480 | int counter = 0; |
481 | 481 | ||
482 | // Birthday | 482 | // Birthday |
483 | QHBox* hBox = new QHBox( container ); | 483 | QHBox* hBox = new QHBox( container ); |
484 | l = new QLabel( tr("Birthday"), container ); | 484 | l = new QLabel( tr("Birthday"), container ); |
485 | gl->addWidget( l, counter, 0 ); | 485 | gl->addWidget( l, counter, 0 ); |
486 | 486 | ||
487 | QPopupMenu* m1 = new QPopupMenu( container ); | 487 | QPopupMenu* m1 = new QPopupMenu( container ); |
488 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 488 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); |
489 | m1->insertItem( birthdayPicker ); | 489 | m1->insertItem( birthdayPicker ); |
490 | 490 | ||
491 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 491 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
492 | birthdayButton->setPopup( m1 ); | 492 | birthdayButton->setPopup( m1 ); |
493 | birthdayButton->setPopupDelay(0); | 493 | birthdayButton->setPopupDelay(0); |
494 | 494 | ||
495 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 495 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
496 | tr( "Delete" ), | 496 | tr( "Delete" ), |
497 | hBox, 0 ); | 497 | hBox, 0 ); |
498 | 498 | ||
499 | gl->addWidget( hBox, counter , 1 ); | 499 | gl->addWidget( hBox, counter , 1 ); |
500 | 500 | ||
501 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), | 501 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), |
502 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); | 502 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); |
503 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 503 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
504 | 504 | ||
505 | ++counter; | 505 | ++counter; |
506 | 506 | ||
507 | // Anniversary | 507 | // Anniversary |
508 | hBox = new QHBox( container ); | 508 | hBox = new QHBox( container ); |
509 | l = new QLabel( tr("Anniversary"), container ); | 509 | l = new QLabel( tr("Anniversary"), container ); |
510 | gl->addWidget( l, counter, 0 ); | 510 | gl->addWidget( l, counter, 0 ); |
511 | 511 | ||
512 | m1 = new QPopupMenu( container ); | 512 | m1 = new QPopupMenu( container ); |
513 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 513 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); |
514 | m1->insertItem( anniversaryPicker ); | 514 | m1->insertItem( anniversaryPicker ); |
515 | 515 | ||
516 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 516 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
517 | anniversaryButton->setPopup( m1 ); | 517 | anniversaryButton->setPopup( m1 ); |
518 | anniversaryButton->setPopupDelay(0); | 518 | anniversaryButton->setPopupDelay(0); |
519 | 519 | ||
520 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 520 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
521 | tr( "Delete" ), | 521 | tr( "Delete" ), |
522 | hBox, 0 ); | 522 | hBox, 0 ); |
523 | gl->addWidget( hBox, counter , 1 ); | 523 | gl->addWidget( hBox, counter , 1 ); |
524 | 524 | ||
525 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), | 525 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), |
526 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); | 526 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); |
527 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 527 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
528 | 528 | ||
529 | ++counter; | 529 | ++counter; |
530 | 530 | ||
531 | // Gender | 531 | // Gender |
532 | l = new QLabel( tr("Gender"), container ); | 532 | l = new QLabel( tr("Gender"), container ); |
533 | gl->addWidget( l, counter, 0 ); | 533 | gl->addWidget( l, counter, 0 ); |
534 | cmbGender = new QComboBox( container ); | 534 | cmbGender = new QComboBox( container ); |
535 | cmbGender->insertItem( "", 0 ); | 535 | cmbGender->insertItem( "", 0 ); |
536 | cmbGender->insertItem( tr("Male"), 1); | 536 | cmbGender->insertItem( tr("Male"), 1); |
537 | cmbGender->insertItem( tr("Female"), 2); | 537 | cmbGender->insertItem( tr("Female"), 2); |
538 | gl->addWidget( cmbGender, counter, 1 ); | 538 | gl->addWidget( cmbGender, counter, 1 ); |
539 | 539 | ||
540 | ++counter; | 540 | ++counter; |
541 | 541 | ||
542 | // Create Labels and lineedit fields for every dynamic entry | 542 | // Create Labels and lineedit fields for every dynamic entry |
543 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 543 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
544 | QStringList::ConstIterator trit = trlDynamicEntries.begin(); | 544 | QStringList::ConstIterator trit = trlDynamicEntries.begin(); |
545 | for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) { | 545 | for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) { |
546 | 546 | ||
547 | if (((*it) == "Anniversary") || | 547 | if (((*it) == "Anniversary") || |
548 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 548 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
549 | 549 | ||
550 | l = new QLabel( (*it).utf8() , container ); | 550 | l = new QLabel( (*it).utf8() , container ); |
551 | listName.append( l ); | 551 | listName.append( l ); |
552 | gl->addWidget( l, i, 0 ); | 552 | gl->addWidget( l, i, 0 ); |
553 | QLineEdit *e = new QLineEdit( container ); | 553 | QLineEdit *e = new QLineEdit( container ); |
554 | listValue.append( e ); | 554 | listValue.append( e ); |
555 | gl->addWidget( e, i, 1); | 555 | gl->addWidget( e, i, 1); |
556 | } | 556 | } |
557 | // Fill labels with names.. | 557 | // Fill labels with names.. |
558 | //loadFields(); | 558 | //loadFields(); |
559 | 559 | ||
560 | 560 | ||
561 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 561 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
562 | 562 | ||
563 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 563 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
564 | dlgNote->setCaption( tr("Enter Note") ); | 564 | dlgNote->setCaption( tr("Enter Note") ); |
565 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 565 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
566 | txtNote = new QMultiLineEdit( dlgNote ); | 566 | txtNote = new QMultiLineEdit( dlgNote ); |
567 | vbNote->addWidget( txtNote ); | 567 | vbNote->addWidget( txtNote ); |
568 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 568 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
569 | 569 | ||
570 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 570 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
571 | dlgName->setCaption( tr("Edit Name") ); | 571 | dlgName->setCaption( tr("Edit Name") ); |
572 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 572 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
573 | 573 | ||
574 | l = new QLabel( tr("First Name"), dlgName ); | 574 | l = new QLabel( tr("First Name"), dlgName ); |
575 | gl->addWidget( l, 0, 0 ); | 575 | gl->addWidget( l, 0, 0 ); |
576 | txtFirstName = new QLineEdit( dlgName ); | 576 | txtFirstName = new QLineEdit( dlgName ); |
577 | gl->addWidget( txtFirstName, 0, 1 ); | 577 | gl->addWidget( txtFirstName, 0, 1 ); |
578 | 578 | ||
579 | l = new QLabel( tr("Middle Name"), dlgName ); | 579 | l = new QLabel( tr("Middle Name"), dlgName ); |
580 | gl->addWidget( l, 1, 0 ); | 580 | gl->addWidget( l, 1, 0 ); |
581 | txtMiddleName = new QLineEdit( dlgName ); | 581 | txtMiddleName = new QLineEdit( dlgName ); |
582 | gl->addWidget( txtMiddleName, 1, 1 ); | 582 | gl->addWidget( txtMiddleName, 1, 1 ); |
583 | 583 | ||
584 | l = new QLabel( tr("Last Name"), dlgName ); | 584 | l = new QLabel( tr("Last Name"), dlgName ); |
585 | gl->addWidget( l, 2, 0 ); | 585 | gl->addWidget( l, 2, 0 ); |
586 | txtLastName = new QLineEdit( dlgName ); | 586 | txtLastName = new QLineEdit( dlgName ); |
587 | gl->addWidget( txtLastName, 2, 1 ); | 587 | gl->addWidget( txtLastName, 2, 1 ); |
588 | 588 | ||
589 | l = new QLabel( tr("Suffix"), dlgName ); | 589 | l = new QLabel( tr("Suffix"), dlgName ); |
590 | gl->addWidget( l, 3, 0 ); | 590 | gl->addWidget( l, 3, 0 ); |
591 | txtSuffix = new QLineEdit( dlgName ); | 591 | txtSuffix = new QLineEdit( dlgName ); |
592 | gl->addWidget( txtSuffix, 3, 1 ); | 592 | gl->addWidget( txtSuffix, 3, 1 ); |
593 | space = new QSpacerItem(1,1, | 593 | space = new QSpacerItem(1,1, |
594 | QSizePolicy::Maximum, | 594 | QSizePolicy::Maximum, |
595 | QSizePolicy::MinimumExpanding ); | 595 | QSizePolicy::MinimumExpanding ); |
596 | gl->addItem( space, 4, 0 ); | 596 | gl->addItem( space, 4, 0 ); |
597 | 597 | ||
598 | cmbChooserField1->insertStringList( trlChooserNames ); | 598 | cmbChooserField1->insertStringList( trlChooserNames ); |
599 | cmbChooserField2->insertStringList( trlChooserNames ); | 599 | cmbChooserField2->insertStringList( trlChooserNames ); |
600 | cmbChooserField3->insertStringList( trlChooserNames ); | 600 | cmbChooserField3->insertStringList( trlChooserNames ); |
601 | cmbChooserField4->insertStringList( trlChooserNames ); | 601 | cmbChooserField4->insertStringList( trlChooserNames ); |
602 | 602 | ||
603 | cmbChooserField1->setCurrentItem( 0 ); | 603 | cmbChooserField1->setCurrentItem( 0 ); |
604 | cmbChooserField2->setCurrentItem( 1 ); | 604 | cmbChooserField2->setCurrentItem( 1 ); |
605 | cmbChooserField3->setCurrentItem( 2 ); | 605 | cmbChooserField3->setCurrentItem( 2 ); |
606 | 606 | ||
607 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 607 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
608 | 608 | ||
609 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 609 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); |
610 | 610 | ||
611 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 611 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
612 | this, SLOT(slotChooser1Change(const QString &)) ); | 612 | this, SLOT(slotChooser1Change(const QString &)) ); |
613 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 613 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
614 | this, SLOT(slotChooser2Change(const QString &)) ); | 614 | this, SLOT(slotChooser2Change(const QString &)) ); |
615 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 615 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
616 | this, SLOT(slotChooser3Change(const QString &)) ); | 616 | this, SLOT(slotChooser3Change(const QString &)) ); |
617 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 617 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
618 | this, SLOT(slotChooser4Change(const QString &)) ); | 618 | this, SLOT(slotChooser4Change(const QString &)) ); |
619 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 619 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
620 | this, SLOT(slotAddressChange(const QString &)) ); | 620 | this, SLOT(slotAddressChange(const QString &)) ); |
621 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 621 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
622 | this, SLOT(slotCityChange(const QString &)) ); | 622 | this, SLOT(slotCityChange(const QString &)) ); |
623 | connect( txtState, SIGNAL(textChanged(const QString &)), | 623 | connect( txtState, SIGNAL(textChanged(const QString &)), |
624 | this, SLOT(slotStateChange(const QString &)) ); | 624 | this, SLOT(slotStateChange(const QString &)) ); |
625 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 625 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
626 | this, SLOT(slotZipChange(const QString &)) ); | 626 | this, SLOT(slotZipChange(const QString &)) ); |
627 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 627 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
628 | this, SLOT(slotCountryChange(const QString &)) ); | 628 | this, SLOT(slotCountryChange(const QString &)) ); |
629 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 629 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
630 | this, SLOT(slotCountryChange(const QString &)) ); | 630 | this, SLOT(slotCountryChange(const QString &)) ); |
631 | connect( cmbChooserField1, SIGNAL(activated(int)), | 631 | connect( cmbChooserField1, SIGNAL(activated(int)), |
632 | this, SLOT(slotCmbChooser1Change(int)) ); | 632 | this, SLOT(slotCmbChooser1Change(int)) ); |
633 | connect( cmbChooserField2, SIGNAL(activated(int)), | 633 | connect( cmbChooserField2, SIGNAL(activated(int)), |
634 | this, SLOT(slotCmbChooser2Change(int)) ); | 634 | this, SLOT(slotCmbChooser2Change(int)) ); |
635 | connect( cmbChooserField3, SIGNAL(activated(int)), | 635 | connect( cmbChooserField3, SIGNAL(activated(int)), |
636 | this, SLOT(slotCmbChooser3Change(int)) ); | 636 | this, SLOT(slotCmbChooser3Change(int)) ); |
637 | connect( cmbChooserField4, SIGNAL(activated(int)), | 637 | connect( cmbChooserField4, SIGNAL(activated(int)), |
638 | this, SLOT(slotCmbChooser4Change(int)) ); | 638 | this, SLOT(slotCmbChooser4Change(int)) ); |
639 | connect( cmbAddress, SIGNAL(activated(int)), | 639 | connect( cmbAddress, SIGNAL(activated(int)), |
640 | this, SLOT(slotAddressTypeChange(int)) ); | 640 | this, SLOT(slotAddressTypeChange(int)) ); |
641 | 641 | ||
642 | new QPEDialogListener(this); | 642 | new QPEDialogListener(this); |
643 | 643 | ||
644 | setPersonalView ( m_personalView ); | 644 | setPersonalView ( m_personalView ); |
645 | } | 645 | } |
646 | 646 | ||
647 | void ContactEditor::defaultEmailChanged(int i){ | 647 | void ContactEditor::defaultEmailChanged(int i){ |
648 | qDebug("defaultEmailChanged"); | 648 | qDebug("defaultEmailChanged"); |
649 | 649 | ||
650 | int index = cmbChooserField1->currentItem(); | 650 | // was sollte das ? (se) |
651 | slChooserValues[index] = cmbDefaultEmail->text(i); | 651 | // int index = cmbChooserField1->currentItem(); |
652 | // slChooserValues[index] = cmbDefaultEmail->text(i); | ||
652 | 653 | ||
653 | defaultEmail = cmbDefaultEmail->text(i); | 654 | defaultEmail = cmbDefaultEmail->text(i); |
654 | qDebug ("Changed to: %s", defaultEmail.latin1()); | 655 | qDebug ("Changed to: %s", defaultEmail.latin1()); |
655 | 656 | ||
656 | } | 657 | } |
657 | 658 | ||
658 | void ContactEditor::populateDefaultEmailCmb(){ | 659 | void ContactEditor::populateDefaultEmailCmb(){ |
659 | 660 | ||
660 | // if the default-email combo was not selected and therfore not created | 661 | // if the default-email combo was not selected and therfore not created |
661 | // we get a lot of trouble.. Therfore create an invisible one.. | 662 | // we get a lot of trouble.. Therfore create an invisible one.. |
662 | if ( !cmbDefaultEmail ){ | 663 | if ( !cmbDefaultEmail ){ |
663 | cmbDefaultEmail = new QComboBox(this); | 664 | cmbDefaultEmail = new QComboBox(this); |
664 | cmbDefaultEmail -> hide(); | 665 | cmbDefaultEmail -> hide(); |
665 | } | 666 | } |
666 | cmbDefaultEmail->clear(); | 667 | cmbDefaultEmail->clear(); |
667 | cmbDefaultEmail->insertStringList( emails ); | 668 | cmbDefaultEmail->insertStringList( emails ); |
668 | // cmbDefaultEmail->show(); | 669 | // cmbDefaultEmail->show(); |
669 | 670 | ||
670 | // Select default email in combo.. | 671 | // Select default email in combo.. |
671 | bool found = false; | 672 | bool found = false; |
672 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 673 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
673 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", | 674 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", |
674 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); | 675 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); |
675 | 676 | ||
676 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 677 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
677 | cmbDefaultEmail->setCurrentItem( i ); | 678 | cmbDefaultEmail->setCurrentItem( i ); |
678 | qDebug("set"); | 679 | qDebug("set"); |
679 | found = true; | 680 | found = true; |
680 | } | 681 | } |
681 | } | 682 | } |
682 | 683 | ||
683 | // If the current default email is not found in the list, we choose the | 684 | // If the current default email is not found in the list, we choose the |
684 | // first one.. | 685 | // first one.. |
685 | if ( !found ) | 686 | if ( !found ) |
686 | defaultEmail = cmbDefaultEmail->text(0); | 687 | defaultEmail = cmbDefaultEmail->text(0); |
687 | } | 688 | } |
688 | 689 | ||
689 | // Called when any combobox was changed. | 690 | // Called when any combobox was changed. |
690 | // "true" returned if the change was chandled by this function, else it should | 691 | // "true" returned if the change was chandled by this function, else it should |
691 | // be handled by something else.. | 692 | // be handled by something else.. |
692 | bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) { | 693 | bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) { |
693 | QString type = slChooserNames[index]; | 694 | QString type = slChooserNames[index]; |
694 | qWarning("ContactEditor::cmbChooserChange -> Type: %s", type.latin1() ); | 695 | qWarning("ContactEditor::cmbChooserChange -> Type: %s", type.latin1() ); |
695 | 696 | ||
696 | // Create and connect combobox for selecting the default email | 697 | // Create and connect combobox for selecting the default email |
697 | if ( type == "Default Email"){ | 698 | if ( type == "Default Email"){ |
698 | qWarning("Choosing default-email "); | 699 | qWarning("Choosing default-email "); |
699 | 700 | ||
700 | // More than one defaul-email chooser is not allowed ! | 701 | // More than one defaul-email chooser is not allowed ! |
701 | if ( ( defaultEmailChooserPosition != -1 ) && | 702 | if ( ( defaultEmailChooserPosition != -1 ) && |
702 | defaultEmailChooserPosition != widgetPos ){ | 703 | defaultEmailChooserPosition != widgetPos ){ |
703 | chooserError( widgetPos ); | 704 | chooserError( widgetPos ); |
704 | return true; | 705 | return true; |
705 | } | 706 | } |
706 | 707 | ||
707 | if ( cmbDefaultEmail ){ | 708 | if ( cmbDefaultEmail ){ |
708 | delete cmbDefaultEmail; | 709 | delete cmbDefaultEmail; |
709 | cmbDefaultEmail = 0l; | 710 | cmbDefaultEmail = 0l; |
710 | } | 711 | } |
711 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); | 712 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); |
712 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); | 713 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); |
713 | 714 | ||
714 | connect( cmbDefaultEmail,SIGNAL( activated(int) ), | 715 | connect( cmbDefaultEmail,SIGNAL( activated(int) ), |
715 | SLOT( defaultEmailChanged(int) ) ); | 716 | SLOT( defaultEmailChanged(int) ) ); |
716 | 717 | ||
717 | cmbDefaultEmail->clear(); | 718 | cmbDefaultEmail->clear(); |
718 | cmbDefaultEmail->insertStringList( emails ); | 719 | cmbDefaultEmail->insertStringList( emails ); |
719 | cmbDefaultEmail->show(); | 720 | cmbDefaultEmail->show(); |
720 | 721 | ||
721 | defaultEmailChooserPosition = widgetPos; | 722 | defaultEmailChooserPosition = widgetPos; |
722 | 723 | ||
723 | // Set current default email | 724 | // Set current default email |
724 | populateDefaultEmailCmb(); | 725 | populateDefaultEmailCmb(); |
725 | 726 | ||
726 | 727 | ||
727 | } else { | 728 | } else { |
728 | // Something else was selected: Hide combo.. | 729 | // Something else was selected: Hide combo.. |
729 | qWarning(" Hiding default-email combo" ); | 730 | qWarning(" Hiding default-email combo" ); |
730 | if ( defaultEmailChooserPosition == widgetPos ){ | 731 | if ( defaultEmailChooserPosition == widgetPos ){ |
731 | defaultEmailChooserPosition = -1; | 732 | defaultEmailChooserPosition = -1; |
732 | if ( cmbDefaultEmail ) | 733 | if ( cmbDefaultEmail ) |
733 | cmbDefaultEmail->hide(); | 734 | cmbDefaultEmail->hide(); |
734 | 735 | ||
735 | } | 736 | } |
736 | 737 | ||
737 | // Caller should initialize the responsible textfield, therefore | 738 | // Caller should initialize the responsible textfield, therefore |
738 | // "false" is returned | 739 | // "false" is returned |
739 | return false; | 740 | return false; |
740 | } | 741 | } |
741 | 742 | ||
742 | // Everything is worked off .. | 743 | // Everything is worked off .. |
743 | return true; | 744 | return true; |
744 | 745 | ||
745 | } | 746 | } |
746 | 747 | ||
747 | // Currently accessed when we select default-email more than once ! | 748 | // Currently accessed when we select default-email more than once ! |
748 | void ContactEditor::chooserError( int index ) | 749 | void ContactEditor::chooserError( int index ) |
749 | { | 750 | { |
750 | qWarning("ContactEditor::chooserError( %d )", index); | 751 | qWarning("ContactEditor::chooserError( %d )", index); |
751 | QMessageBox::warning( this, "Chooser Error", | 752 | QMessageBox::warning( this, "Chooser Error", |
752 | "Multiple selection of this\n" | 753 | "Multiple selection of this\n" |
753 | "Item is not allowed !\n\n" | 754 | "Item is not allowed !\n\n" |
754 | "First deselect the previous one !", | 755 | "First deselect the previous one !", |
755 | "&OK", 0, 0, | 756 | "&OK", 0, 0, |
756 | 0, 0 ); | 757 | 0, 0 ); |
757 | 758 | ||
758 | // Reset the selected Chooser. Unfortunately the chooser | 759 | // Reset the selected Chooser. Unfortunately the chooser |
759 | // generates no signal, therfore we have to | 760 | // generates no signal, therfore we have to |
760 | // call the cmbChooserChange function manually.. | 761 | // call the cmbChooserChange function manually.. |
761 | switch( index ){ | 762 | switch( index ){ |
762 | case 1: | 763 | case 1: |
763 | cmbChooserField1 -> setCurrentItem( 0 ); | 764 | cmbChooserField1 -> setCurrentItem( 0 ); |
764 | slotCmbChooser1Change( 0 ); | 765 | slotCmbChooser1Change( 0 ); |
765 | break; | 766 | break; |
766 | case 2: | 767 | case 2: |
767 | cmbChooserField2 -> setCurrentItem( 0 ); | 768 | cmbChooserField2 -> setCurrentItem( 0 ); |
768 | slotCmbChooser2Change( 0 ); | 769 | slotCmbChooser2Change( 0 ); |
769 | break; | 770 | break; |
770 | case 3: | 771 | case 3: |
771 | cmbChooserField3 -> setCurrentItem( 0 ); | 772 | cmbChooserField3 -> setCurrentItem( 0 ); |
772 | slotCmbChooser3Change( 0 ); | 773 | slotCmbChooser3Change( 0 ); |
773 | break; | 774 | break; |
774 | case 4: | 775 | case 4: |
775 | cmbChooserField4 -> setCurrentItem( 0 ); | 776 | cmbChooserField4 -> setCurrentItem( 0 ); |
776 | slotCmbChooser4Change( 0 ); | 777 | slotCmbChooser4Change( 0 ); |
777 | break; | 778 | break; |
778 | } | 779 | } |
779 | } | 780 | } |
780 | 781 | ||
781 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 782 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
782 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 783 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
783 | QLineEdit* , int widgetPos ) { | 784 | QLineEdit* , int widgetPos ) { |
784 | 785 | ||
785 | QString type = slChooserNames[index]; | 786 | QString type = slChooserNames[index]; |
786 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", | 787 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", |
787 | type.latin1(),textChanged.latin1(), index, widgetPos ); | 788 | type.latin1(),textChanged.latin1(), index, widgetPos ); |
788 | 789 | ||
789 | if ( type == "Default Email"){ | 790 | if ( type == "Default Email"){ |
790 | qWarning ("??? Wozu??: %s", textChanged.latin1()); | 791 | qWarning ("??? Wozu??: %s", textChanged.latin1()); |
791 | defaultEmail = textChanged; | 792 | defaultEmail = textChanged; |
792 | 793 | ||
793 | populateDefaultEmailCmb(); | 794 | populateDefaultEmailCmb(); |
794 | 795 | ||
795 | }else if (defaultEmailChooserPosition == widgetPos){ | 796 | }else if (defaultEmailChooserPosition == widgetPos){ |
796 | qDebug("cmbDefaultEmail->hide()"); | 797 | qDebug("cmbDefaultEmail->hide()"); |
797 | 798 | ||
798 | if (cmbDefaultEmail) cmbDefaultEmail->hide(); | 799 | if (cmbDefaultEmail) cmbDefaultEmail->hide(); |
799 | widgetPos=-1; | 800 | widgetPos=-1; |
800 | 801 | ||
801 | }else if (type == "Emails"){ | 802 | }else if (type == "Emails"){ |
802 | qDebug("emails"); | 803 | qDebug("emails"); |
803 | 804 | ||
804 | QString de; | 805 | QString de; |
805 | emails = QStringList::split (",", textChanged ); | 806 | emails = QStringList::split (",", textChanged ); |
806 | 807 | ||
807 | populateDefaultEmailCmb(); | 808 | populateDefaultEmailCmb(); |
808 | } | 809 | } |
809 | 810 | ||
810 | slChooserValues[index] = textChanged; | 811 | slChooserValues[index] = textChanged; |
811 | 812 | ||
812 | } | 813 | } |
813 | 814 | ||
814 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 815 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
815 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); | 816 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); |
816 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 817 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
817 | } | 818 | } |
818 | 819 | ||
819 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 820 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
820 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); | 821 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); |
821 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 822 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
822 | 823 | ||
823 | } | 824 | } |
824 | 825 | ||
825 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 826 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
826 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); | 827 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); |
827 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 828 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
828 | } | 829 | } |
829 | 830 | ||
830 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 831 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
831 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); | 832 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); |
832 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 833 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
833 | } | 834 | } |
834 | 835 | ||
835 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 836 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
836 | 837 | ||
837 | if ( cmbAddress->currentItem() == 0 ) { | 838 | if ( cmbAddress->currentItem() == 0 ) { |
838 | slBusinessAddress[0] = textChanged; | 839 | slBusinessAddress[0] = textChanged; |
839 | } else { | 840 | } else { |
840 | slHomeAddress[0] = textChanged; | 841 | slHomeAddress[0] = textChanged; |
841 | } | 842 | } |
842 | } | 843 | } |
843 | 844 | ||
844 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 845 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
845 | 846 | ||
846 | if ( cmbAddress->currentItem() == 0 ) { | 847 | if ( cmbAddress->currentItem() == 0 ) { |
847 | slBusinessAddress[1] = textChanged; | 848 | slBusinessAddress[1] = textChanged; |
848 | } else { | 849 | } else { |
849 | slHomeAddress[1] = textChanged; | 850 | slHomeAddress[1] = textChanged; |
850 | } | 851 | } |
851 | } | 852 | } |
852 | 853 | ||
853 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 854 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
854 | 855 | ||
855 | if ( cmbAddress->currentItem() == 0 ) { | 856 | if ( cmbAddress->currentItem() == 0 ) { |
856 | slBusinessAddress[2] = textChanged; | 857 | slBusinessAddress[2] = textChanged; |
857 | } else { | 858 | } else { |
858 | slHomeAddress[2] = textChanged; | 859 | slHomeAddress[2] = textChanged; |
859 | } | 860 | } |
860 | } | 861 | } |
861 | 862 | ||
862 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 863 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
863 | 864 | ||
864 | if ( cmbAddress->currentItem() == 0 ) { | 865 | if ( cmbAddress->currentItem() == 0 ) { |
865 | slBusinessAddress[3] = textChanged; | 866 | slBusinessAddress[3] = textChanged; |
866 | } else { | 867 | } else { |
867 | slHomeAddress[3] = textChanged; | 868 | slHomeAddress[3] = textChanged; |
868 | } | 869 | } |
869 | } | 870 | } |
870 | 871 | ||
871 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 872 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
872 | 873 | ||
873 | 874 | ||
874 | if ( cmbAddress->currentItem() == 0 ) { | 875 | if ( cmbAddress->currentItem() == 0 ) { |
875 | slBusinessAddress[4] = textChanged; | 876 | slBusinessAddress[4] = textChanged; |
876 | } else { | 877 | } else { |
877 | slHomeAddress[4] = textChanged; | 878 | slHomeAddress[4] = textChanged; |
878 | } | 879 | } |
879 | } | 880 | } |
880 | 881 | ||
881 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 882 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
882 | 883 | ||
883 | if ( cmbAddress->currentItem() == 0 ) { | 884 | if ( cmbAddress->currentItem() == 0 ) { |
884 | slBusinessAddress[5] = textChanged; | 885 | slBusinessAddress[5] = textChanged; |
885 | } else { | 886 | } else { |
886 | slHomeAddress[5] = textChanged; | 887 | slHomeAddress[5] = textChanged; |
887 | } | 888 | } |
888 | } | 889 | } |
889 | 890 | ||
890 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 891 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
891 | 892 | ||
892 | if ( cmbAddress->currentItem() == 0 ) { | 893 | if ( cmbAddress->currentItem() == 0 ) { |
893 | slBusinessAddress[6] = textChanged; | 894 | slBusinessAddress[6] = textChanged; |
894 | } else { | 895 | } else { |
895 | slHomeAddress[6] = textChanged; | 896 | slHomeAddress[6] = textChanged; |
896 | } | 897 | } |
897 | } | 898 | } |
898 | 899 | ||
899 | 900 | ||
900 | void ContactEditor::slotCmbChooser1Change( int index ) { | 901 | void ContactEditor::slotCmbChooser1Change( int index ) { |
901 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); | 902 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); |
902 | |||
903 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), txtChooserField1, 1) ){ | 903 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), txtChooserField1, 1) ){ |
904 | 904 | ||
905 | txtChooserField1->setText( slChooserValues[index] ); | 905 | txtChooserField1->setText( slChooserValues[index] ); |
906 | txtChooserField1->setFocus(); | 906 | txtChooserField1->setFocus(); |
907 | 907 | ||
908 | } | 908 | } |
909 | 909 | ||
910 | } | 910 | } |
911 | 911 | ||
912 | void ContactEditor::slotCmbChooser2Change( int index ) { | 912 | void ContactEditor::slotCmbChooser2Change( int index ) { |
913 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); | 913 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); |
914 | 914 | ||
915 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), txtChooserField2, 2) ){ | 915 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), txtChooserField2, 2) ){ |
916 | 916 | ||
917 | txtChooserField2->setText( slChooserValues[index] ); | 917 | txtChooserField2->setText( slChooserValues[index] ); |
918 | txtChooserField2->setFocus(); | 918 | txtChooserField2->setFocus(); |
919 | 919 | ||
920 | } | 920 | } |
921 | } | 921 | } |
922 | 922 | ||
923 | void ContactEditor::slotCmbChooser3Change( int index ) { | 923 | void ContactEditor::slotCmbChooser3Change( int index ) { |
924 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); | 924 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); |
925 | 925 | ||
926 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), txtChooserField3, 3) ){ | 926 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), txtChooserField3, 3) ){ |
927 | 927 | ||
928 | txtChooserField3->setText( slChooserValues[index] ); | 928 | txtChooserField3->setText( slChooserValues[index] ); |
929 | txtChooserField3->setFocus(); | 929 | txtChooserField3->setFocus(); |
930 | 930 | ||
931 | } | 931 | } |
932 | } | 932 | } |
933 | 933 | ||
934 | void ContactEditor::slotCmbChooser4Change( int index ) { | 934 | void ContactEditor::slotCmbChooser4Change( int index ) { |
935 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); | 935 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); |
936 | 936 | ||
937 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), txtChooserField4, 4) ){ | 937 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), txtChooserField4, 4) ){ |
938 | 938 | ||
939 | txtChooserField4->setText( slChooserValues[index] ); | 939 | txtChooserField4->setText( slChooserValues[index] ); |
940 | txtChooserField4->setFocus(); | 940 | txtChooserField4->setFocus(); |
941 | 941 | ||
942 | } | 942 | } |
943 | } | 943 | } |
944 | 944 | ||
945 | void ContactEditor::slotAddressTypeChange( int index ) { | 945 | void ContactEditor::slotAddressTypeChange( int index ) { |
946 | 946 | ||
947 | if ( index == 0 ) { | 947 | if ( index == 0 ) { |
948 | 948 | ||
949 | txtAddress->setText( slBusinessAddress[0] ); | 949 | txtAddress->setText( slBusinessAddress[0] ); |
950 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 950 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
951 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 951 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
952 | txtCity->setText( slBusinessAddress[3] ); | 952 | txtCity->setText( slBusinessAddress[3] ); |
953 | txtState->setText( slBusinessAddress[4] ); | 953 | txtState->setText( slBusinessAddress[4] ); |
954 | txtZip->setText( slBusinessAddress[5] ); | 954 | txtZip->setText( slBusinessAddress[5] ); |
955 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 955 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
956 | txtTmp->setText( slBusinessAddress[6] ); | 956 | txtTmp->setText( slBusinessAddress[6] ); |
957 | 957 | ||
958 | } else { | 958 | } else { |
959 | 959 | ||
960 | txtAddress->setText( slHomeAddress[0] ); | 960 | txtAddress->setText( slHomeAddress[0] ); |
961 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 961 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
962 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 962 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
963 | txtCity->setText( slHomeAddress[3] ); | 963 | txtCity->setText( slHomeAddress[3] ); |
964 | txtState->setText( slHomeAddress[4] ); | 964 | txtState->setText( slHomeAddress[4] ); |
965 | txtZip->setText( slHomeAddress[5] ); | 965 | txtZip->setText( slHomeAddress[5] ); |
966 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 966 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
967 | txtTmp->setText( slHomeAddress[6] ); | 967 | txtTmp->setText( slHomeAddress[6] ); |
968 | 968 | ||
969 | } | 969 | } |
970 | 970 | ||
971 | } | 971 | } |
972 | 972 | ||
973 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 973 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
974 | 974 | ||
975 | int index = cmbFileAs->currentItem(); | 975 | int index = cmbFileAs->currentItem(); |
976 | 976 | ||
977 | cmbFileAs->clear(); | 977 | cmbFileAs->clear(); |
978 | 978 | ||
979 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); | 979 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); |
980 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); | 980 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); |
981 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); | 981 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); |
982 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); | 982 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); |
983 | 983 | ||
984 | cmbFileAs->setCurrentItem( index ); | 984 | cmbFileAs->setCurrentItem( index ); |
985 | 985 | ||
986 | useFullName = true; | 986 | useFullName = true; |
987 | 987 | ||
988 | } | 988 | } |
989 | 989 | ||
990 | void ContactEditor::accept() { | 990 | void ContactEditor::accept() { |
991 | 991 | ||
992 | if ( isEmpty() ) { | 992 | if ( isEmpty() ) { |
993 | cleanupFields(); | 993 | cleanupFields(); |
994 | reject(); | 994 | reject(); |
995 | } else { | 995 | } else { |
996 | saveEntry(); | 996 | saveEntry(); |
997 | cleanupFields(); | 997 | cleanupFields(); |
998 | QDialog::accept(); | 998 | QDialog::accept(); |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | void ContactEditor::slotNote() { | 1003 | void ContactEditor::slotNote() { |
1004 | 1004 | ||
1005 | dlgNote->showMaximized(); | 1005 | dlgNote->showMaximized(); |
1006 | if ( !dlgNote->exec() ) { | 1006 | if ( !dlgNote->exec() ) { |
1007 | txtNote->setText( ent.notes() ); | 1007 | txtNote->setText( ent.notes() ); |
1008 | } | 1008 | } |
1009 | } | 1009 | } |
1010 | 1010 | ||
1011 | void ContactEditor::slotName() { | 1011 | void ContactEditor::slotName() { |
1012 | 1012 | ||
1013 | QString tmpName; | 1013 | QString tmpName; |
1014 | if (useFullName) { | 1014 | if (useFullName) { |
1015 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1015 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1016 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1016 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1017 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1017 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1018 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1018 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1019 | } | 1019 | } |
1020 | dlgName->showMaximized(); | 1020 | dlgName->showMaximized(); |
1021 | if ( dlgName->exec() ) { | 1021 | if ( dlgName->exec() ) { |
1022 | 1022 | ||
1023 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); | 1023 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); |
1024 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1024 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1025 | slotFullNameChange( txtFullName->text() ); | 1025 | slotFullNameChange( txtFullName->text() ); |
1026 | useFullName = false; | 1026 | useFullName = false; |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | void ContactEditor::setNameFocus() { | 1031 | void ContactEditor::setNameFocus() { |
1032 | 1032 | ||
1033 | txtFullName->setFocus(); | 1033 | txtFullName->setFocus(); |
1034 | 1034 | ||
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | bool ContactEditor::isEmpty() { | 1037 | bool ContactEditor::isEmpty() { |
1038 | // Test and see if the record should be saved. | 1038 | // Test and see if the record should be saved. |
1039 | // More strict than the original qtopia, needs name or fileas to save | 1039 | // More strict than the original qtopia, needs name or fileas to save |
1040 | 1040 | ||
1041 | QString t = txtFullName->text(); | 1041 | QString t = txtFullName->text(); |
1042 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1042 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1043 | return false; | 1043 | return false; |
1044 | 1044 | ||
1045 | t = cmbFileAs->currentText(); | 1045 | t = cmbFileAs->currentText(); |
1046 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1046 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1047 | return false; | 1047 | return false; |
1048 | 1048 | ||
1049 | return true; | 1049 | return true; |
1050 | 1050 | ||
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1053 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1054 | 1054 | ||
1055 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1055 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1056 | QString strFirstName; | 1056 | QString strFirstName; |
1057 | QString strMiddleName; | 1057 | QString strMiddleName; |
1058 | QString strLastName; | 1058 | QString strLastName; |
1059 | QString strSuffix; | 1059 | QString strSuffix; |
1060 | QString strTitle; | 1060 | QString strTitle; |
1061 | int commapos; | 1061 | int commapos; |
1062 | int spCount; | 1062 | int spCount; |
1063 | int spPos; | 1063 | int spPos; |
1064 | int spPos2; | 1064 | int spPos2; |
1065 | 1065 | ||
1066 | 1066 | ||
1067 | commapos = simplifiedName.find( ',', 0, TRUE); | 1067 | commapos = simplifiedName.find( ',', 0, TRUE); |
1068 | spCount = simplifiedName.contains( ' ', TRUE ); | 1068 | spCount = simplifiedName.contains( ' ', TRUE ); |
1069 | 1069 | ||
1070 | if ( commapos == -1 ) { | 1070 | if ( commapos == -1 ) { |
1071 | 1071 | ||
1072 | switch (spCount) { | 1072 | switch (spCount) { |
1073 | case 0: | 1073 | case 0: |
1074 | //return simplifiedName; | 1074 | //return simplifiedName; |
1075 | if (txtLastName->text() != "") { | 1075 | if (txtLastName->text() != "") { |
1076 | strLastName = simplifiedName; | 1076 | strLastName = simplifiedName; |
1077 | break; | 1077 | break; |
1078 | } | 1078 | } |
1079 | if (txtMiddleName->text() != "") { | 1079 | if (txtMiddleName->text() != "") { |
1080 | strMiddleName = simplifiedName; | 1080 | strMiddleName = simplifiedName; |
1081 | break; | 1081 | break; |
1082 | } | 1082 | } |
1083 | if (txtSuffix->text() != "") { | 1083 | if (txtSuffix->text() != "") { |
1084 | strSuffix = simplifiedName; | 1084 | strSuffix = simplifiedName; |
1085 | break; | 1085 | break; |
1086 | } | 1086 | } |
1087 | strFirstName = simplifiedName; | 1087 | strFirstName = simplifiedName; |
1088 | break; | 1088 | break; |
1089 | 1089 | ||
1090 | case 1: | 1090 | case 1: |
1091 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 1091 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
1092 | strFirstName = simplifiedName.left( spPos ); | 1092 | strFirstName = simplifiedName.left( spPos ); |
1093 | strLastName = simplifiedName.mid( spPos + 1 ); | 1093 | strLastName = simplifiedName.mid( spPos + 1 ); |
1094 | break; | 1094 | break; |
@@ -1294,384 +1294,385 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
1294 | txtSuffix->setText( ent.suffix() ); | 1294 | txtSuffix->setText( ent.suffix() ); |
1295 | 1295 | ||
1296 | QString *tmpString = new QString; | 1296 | QString *tmpString = new QString; |
1297 | *tmpString = ent.firstName() + " " + ent.middleName() + | 1297 | *tmpString = ent.firstName() + " " + ent.middleName() + |
1298 | + " " + ent.lastName() + " " + ent.suffix(); | 1298 | + " " + ent.lastName() + " " + ent.suffix(); |
1299 | 1299 | ||
1300 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1300 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1301 | 1301 | ||
1302 | cmbFileAs->setEditText( ent.fileAs() ); | 1302 | cmbFileAs->setEditText( ent.fileAs() ); |
1303 | 1303 | ||
1304 | //if (hasTitle) | 1304 | //if (hasTitle) |
1305 | txtJobTitle->setText( ent.jobTitle() ); | 1305 | txtJobTitle->setText( ent.jobTitle() ); |
1306 | 1306 | ||
1307 | //if (hasCompany) | 1307 | //if (hasCompany) |
1308 | txtOrganization->setText( ent.company() ); | 1308 | txtOrganization->setText( ent.company() ); |
1309 | 1309 | ||
1310 | //if (hasNotes) | 1310 | //if (hasNotes) |
1311 | txtNote->setText( ent.notes() ); | 1311 | txtNote->setText( ent.notes() ); |
1312 | 1312 | ||
1313 | //if (hasStreet) { | 1313 | //if (hasStreet) { |
1314 | slHomeAddress[0] = ent.homeStreet(); | 1314 | slHomeAddress[0] = ent.homeStreet(); |
1315 | slBusinessAddress[0] = ent.businessStreet(); | 1315 | slBusinessAddress[0] = ent.businessStreet(); |
1316 | //} | 1316 | //} |
1317 | 1317 | ||
1318 | //if (hasCity) { | 1318 | //if (hasCity) { |
1319 | slHomeAddress[3] = ent.homeCity(); | 1319 | slHomeAddress[3] = ent.homeCity(); |
1320 | slBusinessAddress[3] = ent.businessCity(); | 1320 | slBusinessAddress[3] = ent.businessCity(); |
1321 | //} | 1321 | //} |
1322 | 1322 | ||
1323 | //if (hasState) { | 1323 | //if (hasState) { |
1324 | slHomeAddress[4] = ent.homeState(); | 1324 | slHomeAddress[4] = ent.homeState(); |
1325 | slBusinessAddress[4] = ent.businessState(); | 1325 | slBusinessAddress[4] = ent.businessState(); |
1326 | //} | 1326 | //} |
1327 | 1327 | ||
1328 | //if (hasZip) { | 1328 | //if (hasZip) { |
1329 | slHomeAddress[5] = ent.homeZip(); | 1329 | slHomeAddress[5] = ent.homeZip(); |
1330 | slBusinessAddress[5] = ent.businessZip(); | 1330 | slBusinessAddress[5] = ent.businessZip(); |
1331 | //} | 1331 | //} |
1332 | 1332 | ||
1333 | //if (hasCountry) { | 1333 | //if (hasCountry) { |
1334 | slHomeAddress[6] = ent.homeCountry(); | 1334 | slHomeAddress[6] = ent.homeCountry(); |
1335 | slBusinessAddress[6] = ent.businessCountry(); | 1335 | slBusinessAddress[6] = ent.businessCountry(); |
1336 | //} | 1336 | //} |
1337 | 1337 | ||
1338 | QStringList::ConstIterator it; | 1338 | QStringList::ConstIterator it; |
1339 | QListIterator<QLineEdit> itLE( listValue ); | 1339 | QListIterator<QLineEdit> itLE( listValue ); |
1340 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1340 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1341 | 1341 | ||
1342 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); | 1342 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); |
1343 | 1343 | ||
1344 | if ( *it == "Department" ) | 1344 | if ( *it == "Department" ) |
1345 | (*itLE)->setText( ent.department() ); | 1345 | (*itLE)->setText( ent.department() ); |
1346 | 1346 | ||
1347 | if ( *it == "Company" ) | 1347 | if ( *it == "Company" ) |
1348 | (*itLE)->setText( ent.company() ); | 1348 | (*itLE)->setText( ent.company() ); |
1349 | 1349 | ||
1350 | if ( *it == "Office" ) | 1350 | if ( *it == "Office" ) |
1351 | (*itLE)->setText( ent.office() ); | 1351 | (*itLE)->setText( ent.office() ); |
1352 | 1352 | ||
1353 | if ( *it == "Profession" ) | 1353 | if ( *it == "Profession" ) |
1354 | (*itLE)->setText( ent.profession() ); | 1354 | (*itLE)->setText( ent.profession() ); |
1355 | 1355 | ||
1356 | if ( *it == "Assistant" ) | 1356 | if ( *it == "Assistant" ) |
1357 | (*itLE)->setText( ent.assistant() ); | 1357 | (*itLE)->setText( ent.assistant() ); |
1358 | 1358 | ||
1359 | if ( *it == "Manager" ) | 1359 | if ( *it == "Manager" ) |
1360 | (*itLE)->setText( ent.manager() ); | 1360 | (*itLE)->setText( ent.manager() ); |
1361 | 1361 | ||
1362 | if ( *it == "Spouse" ) | 1362 | if ( *it == "Spouse" ) |
1363 | (*itLE)->setText( ent.spouse() ); | 1363 | (*itLE)->setText( ent.spouse() ); |
1364 | 1364 | ||
1365 | if ( *it == "Nickname" ){ | 1365 | if ( *it == "Nickname" ){ |
1366 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); | 1366 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); |
1367 | (*itLE)->setText( ent.nickname() ); | 1367 | (*itLE)->setText( ent.nickname() ); |
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | if ( *it == "Children" ) | 1370 | if ( *it == "Children" ) |
1371 | (*itLE)->setText( ent.children() ); | 1371 | (*itLE)->setText( ent.children() ); |
1372 | 1372 | ||
1373 | } | 1373 | } |
1374 | 1374 | ||
1375 | QStringList::Iterator itV; | 1375 | QStringList::Iterator itV; |
1376 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1376 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1377 | 1377 | ||
1378 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1378 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1379 | *itV = ent.businessPhone(); | 1379 | *itV = ent.businessPhone(); |
1380 | /* | 1380 | /* |
1381 | if ( *it == "Business 2 Phone" ) | 1381 | if ( *it == "Business 2 Phone" ) |
1382 | *itV = ent.business2Phone(); | 1382 | *itV = ent.business2Phone(); |
1383 | */ | 1383 | */ |
1384 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1384 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1385 | *itV = ent.businessFax(); | 1385 | *itV = ent.businessFax(); |
1386 | 1386 | ||
1387 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1387 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1388 | *itV = ent.businessMobile(); | 1388 | *itV = ent.businessMobile(); |
1389 | /* | 1389 | /* |
1390 | if ( *it == "Company Phone" ) | 1390 | if ( *it == "Company Phone" ) |
1391 | *itV = ent.companyPhone(); | 1391 | *itV = ent.companyPhone(); |
1392 | */ | 1392 | */ |
1393 | if ( *it == "Default Email" ) | 1393 | if ( *it == "Default Email" ) |
1394 | *itV = ent.defaultEmail(); | 1394 | *itV = ent.defaultEmail(); |
1395 | 1395 | ||
1396 | if ( *it == "Emails" ) | 1396 | if ( *it == "Emails" ) |
1397 | *itV = ent.emailList().join(", "); // :SX | 1397 | *itV = ent.emailList().join(", "); // :SX |
1398 | 1398 | ||
1399 | if ( *it == "Home Phone" ) | 1399 | if ( *it == "Home Phone" ) |
1400 | *itV = ent.homePhone(); | 1400 | *itV = ent.homePhone(); |
1401 | /* | 1401 | /* |
1402 | if ( *it == "Home 2 Phone" ) | 1402 | if ( *it == "Home 2 Phone" ) |
1403 | *itV = ent.home2Phone(); | 1403 | *itV = ent.home2Phone(); |
1404 | */ | 1404 | */ |
1405 | if ( *it == "Home Fax" ) | 1405 | if ( *it == "Home Fax" ) |
1406 | *itV = ent.homeFax(); | 1406 | *itV = ent.homeFax(); |
1407 | 1407 | ||
1408 | if ( *it == "Home Mobile" ) | 1408 | if ( *it == "Home Mobile" ) |
1409 | *itV = ent.homeMobile(); | 1409 | *itV = ent.homeMobile(); |
1410 | /* | 1410 | /* |
1411 | if ( *it == "Car Phone" ) | 1411 | if ( *it == "Car Phone" ) |
1412 | *itV = ent.carPhone(); | 1412 | *itV = ent.carPhone(); |
1413 | 1413 | ||
1414 | if ( *it == "ISDN Phone" ) | 1414 | if ( *it == "ISDN Phone" ) |
1415 | *itV = ent.ISDNPhone(); | 1415 | *itV = ent.ISDNPhone(); |
1416 | 1416 | ||
1417 | if ( *it == "Other Phone" ) | 1417 | if ( *it == "Other Phone" ) |
1418 | *itV = ent.otherPhone(); | 1418 | *itV = ent.otherPhone(); |
1419 | */ | 1419 | */ |
1420 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1420 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1421 | *itV = ent.businessPager(); | 1421 | *itV = ent.businessPager(); |
1422 | /* | 1422 | /* |
1423 | if ( *it == "Home Pager") | 1423 | if ( *it == "Home Pager") |
1424 | *itV = ent.homePager(); | 1424 | *itV = ent.homePager(); |
1425 | 1425 | ||
1426 | if ( *it == "AIM IM" ) | 1426 | if ( *it == "AIM IM" ) |
1427 | *itV = ent.AIMIM(); | 1427 | *itV = ent.AIMIM(); |
1428 | 1428 | ||
1429 | if ( *it == "ICQ IM" ) | 1429 | if ( *it == "ICQ IM" ) |
1430 | *itV = ent.ICQIM(); | 1430 | *itV = ent.ICQIM(); |
1431 | 1431 | ||
1432 | if ( *it == "Jabber IM" ) | 1432 | if ( *it == "Jabber IM" ) |
1433 | *itV = ent.jabberIM(); | 1433 | *itV = ent.jabberIM(); |
1434 | 1434 | ||
1435 | if ( *it == "MSN IM" ) | 1435 | if ( *it == "MSN IM" ) |
1436 | *itV = ent.MSNIM(); | 1436 | *itV = ent.MSNIM(); |
1437 | 1437 | ||
1438 | if ( *it == "Yahoo IM" ) | 1438 | if ( *it == "Yahoo IM" ) |
1439 | *itV = ent.yahooIM(); | 1439 | *itV = ent.yahooIM(); |
1440 | */ | 1440 | */ |
1441 | if ( *it == "Home Web Page" ) | 1441 | if ( *it == "Home Web Page" ) |
1442 | *itV = ent.homeWebpage(); | 1442 | *itV = ent.homeWebpage(); |
1443 | 1443 | ||
1444 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1444 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1445 | *itV = ent.businessWebpage(); | 1445 | *itV = ent.businessWebpage(); |
1446 | 1446 | ||
1447 | 1447 | ||
1448 | } | 1448 | } |
1449 | 1449 | ||
1450 | 1450 | ||
1451 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1451 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1452 | 1452 | ||
1453 | QString gender = ent.gender(); | 1453 | QString gender = ent.gender(); |
1454 | cmbGender->setCurrentItem( gender.toInt() ); | 1454 | cmbGender->setCurrentItem( gender.toInt() ); |
1455 | 1455 | ||
1456 | txtNote->setText( ent.notes() ); | 1456 | txtNote->setText( ent.notes() ); |
1457 | 1457 | ||
1458 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1458 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1459 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1459 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1460 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1460 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1461 | 1461 | ||
1462 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1462 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1463 | 1463 | ||
1464 | // loadFields(); :SX | 1464 | // loadFields(); :SX |
1465 | updateDatePicker(); | 1465 | updateDatePicker(); |
1466 | } | 1466 | } |
1467 | void ContactEditor::updateDatePicker() | 1467 | void ContactEditor::updateDatePicker() |
1468 | { | 1468 | { |
1469 | // Set DatePicker | 1469 | // Set DatePicker |
1470 | if ( !ent.birthday().isNull() ){ | 1470 | if ( !ent.birthday().isNull() ){ |
1471 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1471 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1472 | birthdayPicker->setDate( ent.birthday() ); | 1472 | birthdayPicker->setDate( ent.birthday() ); |
1473 | } else | 1473 | } else |
1474 | birthdayButton->setText( tr ("Unknown") ); | 1474 | birthdayButton->setText( tr ("Unknown") ); |
1475 | 1475 | ||
1476 | if ( !ent.anniversary().isNull() ){ | 1476 | if ( !ent.anniversary().isNull() ){ |
1477 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); | 1477 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); |
1478 | anniversaryPicker->setDate( ent.anniversary() ); | 1478 | anniversaryPicker->setDate( ent.anniversary() ); |
1479 | } else | 1479 | } else |
1480 | anniversaryButton->setText( tr ("Unknown") ); | 1480 | anniversaryButton->setText( tr ("Unknown") ); |
1481 | 1481 | ||
1482 | } | 1482 | } |
1483 | 1483 | ||
1484 | void ContactEditor::saveEntry() { | 1484 | void ContactEditor::saveEntry() { |
1485 | 1485 | ||
1486 | |||
1486 | if ( useFullName ) { | 1487 | if ( useFullName ) { |
1487 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1488 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1488 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1489 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1489 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1490 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1490 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1491 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1491 | 1492 | ||
1492 | useFullName = false; | 1493 | useFullName = false; |
1493 | } | 1494 | } |
1494 | 1495 | ||
1495 | ent.setFirstName( txtFirstName->text() ); | 1496 | ent.setFirstName( txtFirstName->text() ); |
1496 | ent.setLastName( txtLastName->text() ); | 1497 | ent.setLastName( txtLastName->text() ); |
1497 | ent.setMiddleName( txtMiddleName->text() ); | 1498 | ent.setMiddleName( txtMiddleName->text() ); |
1498 | ent.setSuffix( txtSuffix->text() ); | 1499 | ent.setSuffix( txtSuffix->text() ); |
1499 | 1500 | ||
1500 | ent.setFileAs( cmbFileAs->currentText() ); | 1501 | ent.setFileAs( cmbFileAs->currentText() ); |
1501 | 1502 | ||
1502 | ent.setCategories( cmbCat->currentCategories() ); | 1503 | ent.setCategories( cmbCat->currentCategories() ); |
1503 | 1504 | ||
1504 | 1505 | ||
1505 | //if (hasTitle) | 1506 | //if (hasTitle) |
1506 | ent.setJobTitle( txtJobTitle->text() ); | 1507 | ent.setJobTitle( txtJobTitle->text() ); |
1507 | 1508 | ||
1508 | //if (hasCompany) | 1509 | //if (hasCompany) |
1509 | ent.setCompany( txtOrganization->text() ); | 1510 | ent.setCompany( txtOrganization->text() ); |
1510 | 1511 | ||
1511 | //if (hasNotes) | 1512 | //if (hasNotes) |
1512 | ent.setNotes( txtNote->text() ); | 1513 | ent.setNotes( txtNote->text() ); |
1513 | 1514 | ||
1514 | //if (hasStreet) { | 1515 | //if (hasStreet) { |
1515 | ent.setHomeStreet( slHomeAddress[0] ); | 1516 | ent.setHomeStreet( slHomeAddress[0] ); |
1516 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1517 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1517 | //} | 1518 | //} |
1518 | 1519 | ||
1519 | //if (hasCity) { | 1520 | //if (hasCity) { |
1520 | ent.setHomeCity( slHomeAddress[3] ); | 1521 | ent.setHomeCity( slHomeAddress[3] ); |
1521 | ent.setBusinessCity( slBusinessAddress[3] ); | 1522 | ent.setBusinessCity( slBusinessAddress[3] ); |
1522 | //} | 1523 | //} |
1523 | 1524 | ||
1524 | //if (hasState) { | 1525 | //if (hasState) { |
1525 | ent.setHomeState( slHomeAddress[4] ); | 1526 | ent.setHomeState( slHomeAddress[4] ); |
1526 | ent.setBusinessState( slBusinessAddress[4] ); | 1527 | ent.setBusinessState( slBusinessAddress[4] ); |
1527 | //} | 1528 | //} |
1528 | 1529 | ||
1529 | //if (hasZip) { | 1530 | //if (hasZip) { |
1530 | ent.setHomeZip( slHomeAddress[5] ); | 1531 | ent.setHomeZip( slHomeAddress[5] ); |
1531 | ent.setBusinessZip( slBusinessAddress[5] ); | 1532 | ent.setBusinessZip( slBusinessAddress[5] ); |
1532 | //} | 1533 | //} |
1533 | 1534 | ||
1534 | //if (hasCountry) { | 1535 | //if (hasCountry) { |
1535 | ent.setHomeCountry( slHomeAddress[6] ); | 1536 | ent.setHomeCountry( slHomeAddress[6] ); |
1536 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1537 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1537 | //} | 1538 | //} |
1538 | 1539 | ||
1539 | QStringList::ConstIterator it; | 1540 | QStringList::ConstIterator it; |
1540 | QListIterator<QLineEdit> itLE( listValue ); | 1541 | QListIterator<QLineEdit> itLE( listValue ); |
1541 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { | 1542 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1542 | 1543 | ||
1543 | if ( *it == "Department" ) | 1544 | if ( *it == "Department" ) |
1544 | ent.setDepartment( (*itLE)->text() ); | 1545 | ent.setDepartment( (*itLE)->text() ); |
1545 | 1546 | ||
1546 | if ( *it == "Company" ) | 1547 | if ( *it == "Company" ) |
1547 | ent.setCompany( (*itLE)->text() ); | 1548 | ent.setCompany( (*itLE)->text() ); |
1548 | 1549 | ||
1549 | if ( *it == "Office" ) | 1550 | if ( *it == "Office" ) |
1550 | ent.setOffice( (*itLE)->text() ); | 1551 | ent.setOffice( (*itLE)->text() ); |
1551 | 1552 | ||
1552 | if ( *it == "Profession" ) | 1553 | if ( *it == "Profession" ) |
1553 | ent.setProfession( (*itLE)->text() ); | 1554 | ent.setProfession( (*itLE)->text() ); |
1554 | 1555 | ||
1555 | if ( *it == "Assistant" ) | 1556 | if ( *it == "Assistant" ) |
1556 | ent.setAssistant( (*itLE)->text() ); | 1557 | ent.setAssistant( (*itLE)->text() ); |
1557 | 1558 | ||
1558 | if ( *it == "Manager" ) | 1559 | if ( *it == "Manager" ) |
1559 | ent.setManager( (*itLE)->text() ); | 1560 | ent.setManager( (*itLE)->text() ); |
1560 | 1561 | ||
1561 | if ( *it == "Spouse" ) | 1562 | if ( *it == "Spouse" ) |
1562 | ent.setSpouse( (*itLE)->text() ); | 1563 | ent.setSpouse( (*itLE)->text() ); |
1563 | 1564 | ||
1564 | if ( *it == "Nickname" ) | 1565 | if ( *it == "Nickname" ) |
1565 | ent.setNickname( (*itLE)->text() ); | 1566 | ent.setNickname( (*itLE)->text() ); |
1566 | 1567 | ||
1567 | if ( *it == "Children" ) | 1568 | if ( *it == "Children" ) |
1568 | ent.setChildren( (*itLE)->text() ); | 1569 | ent.setChildren( (*itLE)->text() ); |
1569 | 1570 | ||
1570 | } | 1571 | } |
1571 | 1572 | ||
1572 | 1573 | ||
1573 | QStringList::ConstIterator itV; | 1574 | QStringList::ConstIterator itV; |
1574 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1575 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1575 | 1576 | ||
1576 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1577 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1577 | ent.setBusinessPhone( *itV ); | 1578 | ent.setBusinessPhone( *itV ); |
1578 | 1579 | ||
1579 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1580 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1580 | ent.setBusinessFax( *itV ); | 1581 | ent.setBusinessFax( *itV ); |
1581 | 1582 | ||
1582 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1583 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1583 | ent.setBusinessMobile( *itV ); | 1584 | ent.setBusinessMobile( *itV ); |
1584 | 1585 | ||
1585 | if ( *it == "Emails" ){ | 1586 | if ( *it == "Emails" ){ |
1586 | QString allemail; | 1587 | QString allemail; |
1587 | QString defaultmail; | 1588 | QString defaultmail; |
1588 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1589 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1589 | if ( defaultEmail.isEmpty() ){ | 1590 | if ( defaultEmail.isEmpty() ){ |
1590 | qWarning("Default email was not set by user!"); | 1591 | qWarning("Default email was not set by user!"); |
1591 | qWarning("Using first email in list: %s", defaultmail.latin1()); | 1592 | qWarning("Using first email in list: %s", defaultmail.latin1()); |
1592 | ent.setDefaultEmail( defaultmail ); | 1593 | ent.setDefaultEmail( defaultmail ); |
1593 | } | 1594 | } |
1594 | ent.setEmails( allemail ); | 1595 | ent.setEmails( allemail ); |
1595 | } | 1596 | } |
1596 | 1597 | ||
1597 | if ( *it == "Default Email") | 1598 | if ( *it == "Default Email") |
1598 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1599 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1599 | 1600 | ||
1600 | if ( *it == "Home Phone" ) | 1601 | if ( *it == "Home Phone" ) |
1601 | ent.setHomePhone( *itV ); | 1602 | ent.setHomePhone( *itV ); |
1602 | 1603 | ||
1603 | if ( *it == "Home Fax" ) | 1604 | if ( *it == "Home Fax" ) |
1604 | ent.setHomeFax( *itV ); | 1605 | ent.setHomeFax( *itV ); |
1605 | 1606 | ||
1606 | if ( *it == "Home Mobile" ) | 1607 | if ( *it == "Home Mobile" ) |
1607 | ent.setHomeMobile( *itV ); | 1608 | ent.setHomeMobile( *itV ); |
1608 | 1609 | ||
1609 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1610 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1610 | ent.setBusinessPager( *itV ); | 1611 | ent.setBusinessPager( *itV ); |
1611 | 1612 | ||
1612 | if ( *it == "Home Web Page" ) | 1613 | if ( *it == "Home Web Page" ) |
1613 | ent.setHomeWebpage( *itV ); | 1614 | ent.setHomeWebpage( *itV ); |
1614 | 1615 | ||
1615 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1616 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1616 | ent.setBusinessWebpage( *itV ); | 1617 | ent.setBusinessWebpage( *itV ); |
1617 | 1618 | ||
1618 | 1619 | ||
1619 | } | 1620 | } |
1620 | 1621 | ||
1621 | int gender = cmbGender->currentItem(); | 1622 | int gender = cmbGender->currentItem(); |
1622 | ent.setGender( QString::number( gender ) ); | 1623 | ent.setGender( QString::number( gender ) ); |
1623 | 1624 | ||
1624 | QString str = txtNote->text(); | 1625 | QString str = txtNote->text(); |
1625 | if ( !str.isNull() ) | 1626 | if ( !str.isNull() ) |
1626 | ent.setNotes( str ); | 1627 | ent.setNotes( str ); |
1627 | 1628 | ||
1628 | } | 1629 | } |
1629 | 1630 | ||
1630 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1631 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1631 | QString &strAll ) | 1632 | QString &strAll ) |
1632 | { | 1633 | { |
1633 | int where, | 1634 | int where, |
1634 | start; | 1635 | start; |
1635 | if ( txt.isEmpty() ) | 1636 | if ( txt.isEmpty() ) |
1636 | return; | 1637 | return; |
1637 | // find the first | 1638 | // find the first |
1638 | where = txt.find( ',' ); | 1639 | where = txt.find( ',' ); |
1639 | if ( where < 0 ) { | 1640 | if ( where < 0 ) { |
1640 | strDefaultEmail = txt; | 1641 | strDefaultEmail = txt; |
1641 | strAll = txt; | 1642 | strAll = txt; |
1642 | } else { | 1643 | } else { |
1643 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1644 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1644 | strAll = strDefaultEmail; | 1645 | strAll = strDefaultEmail; |
1645 | while ( where > -1 ) { | 1646 | while ( where > -1 ) { |
1646 | strAll.append(" "); | 1647 | strAll.append(" "); |
1647 | start = where; | 1648 | start = where; |
1648 | where = txt.find( ',', where + 1 ); | 1649 | where = txt.find( ',', where + 1 ); |
1649 | if ( where > - 1 ) | 1650 | if ( where > - 1 ) |
1650 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1651 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1651 | else // grab until the end... | 1652 | else // grab until the end... |
1652 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1653 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1653 | } | 1654 | } |
1654 | } | 1655 | } |
1655 | } | 1656 | } |
1656 | 1657 | ||
1657 | void parseEmailTo( const QString &strDefaultEmail, | 1658 | void parseEmailTo( const QString &strDefaultEmail, |
1658 | const QString &strOtherEmail, QString &strBack ) | 1659 | const QString &strOtherEmail, QString &strBack ) |
1659 | { | 1660 | { |
1660 | // create a comma dilimeted set of emails... | 1661 | // create a comma dilimeted set of emails... |
1661 | // use the power of short circuiting... | 1662 | // use the power of short circuiting... |
1662 | bool foundDefault = false; | 1663 | bool foundDefault = false; |
1663 | QString strTmp; | 1664 | QString strTmp; |
1664 | int start = 0; | 1665 | int start = 0; |
1665 | int where; | 1666 | int where; |
1666 | // start at the beginng. | 1667 | // start at the beginng. |
1667 | strBack = strDefaultEmail; | 1668 | strBack = strDefaultEmail; |
1668 | where = 0; | 1669 | where = 0; |
1669 | while ( where > -1 ) { | 1670 | while ( where > -1 ) { |
1670 | start = where; | 1671 | start = where; |
1671 | where = strOtherEmail.find( ' ', where + 1 ); | 1672 | where = strOtherEmail.find( ' ', where + 1 ); |
1672 | if ( where > 0 ) { | 1673 | if ( where > 0 ) { |
1673 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1674 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1674 | } else | 1675 | } else |
1675 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1676 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1676 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1677 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1677 | strBack.append( ", " ); | 1678 | strBack.append( ", " ); |