author | eilers <eilers> | 2002-12-27 13:03:34 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-12-27 13:03:34 (UTC) |
commit | 158fd475abbc652613d5eed362dae79f94b17803 (patch) (unidiff) | |
tree | 60b38278a274ac97d0ebb1226cfd881418d735bf | |
parent | 8ae81608ed194e36236ea68c5fbed54ac6c0275c (diff) | |
download | opie-158fd475abbc652613d5eed362dae79f94b17803.zip opie-158fd475abbc652613d5eed362dae79f94b17803.tar.gz opie-158fd475abbc652613d5eed362dae79f94b17803.tar.bz2 |
Fixing nullpointer crash if "emails" selected
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 1b83308..b68d88c 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -478,402 +478,406 @@ void ContactEditor::init() { | |||
478 | 478 | ||
479 | int counter = 0; | 479 | int counter = 0; |
480 | 480 | ||
481 | // Birthday | 481 | // Birthday |
482 | QHBox* hBox = new QHBox( container ); | 482 | QHBox* hBox = new QHBox( container ); |
483 | l = new QLabel( tr("Birthday"), container ); | 483 | l = new QLabel( tr("Birthday"), container ); |
484 | gl->addWidget( l, counter, 0 ); | 484 | gl->addWidget( l, counter, 0 ); |
485 | 485 | ||
486 | QPopupMenu* m1 = new QPopupMenu( container ); | 486 | QPopupMenu* m1 = new QPopupMenu( container ); |
487 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 487 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); |
488 | m1->insertItem( birthdayPicker ); | 488 | m1->insertItem( birthdayPicker ); |
489 | 489 | ||
490 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 490 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
491 | birthdayButton->setPopup( m1 ); | 491 | birthdayButton->setPopup( m1 ); |
492 | birthdayButton->setPopupDelay(0); | 492 | birthdayButton->setPopupDelay(0); |
493 | 493 | ||
494 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 494 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
495 | tr( "Delete" ), | 495 | tr( "Delete" ), |
496 | hBox, 0 ); | 496 | hBox, 0 ); |
497 | 497 | ||
498 | gl->addWidget( hBox, counter , 1 ); | 498 | gl->addWidget( hBox, counter , 1 ); |
499 | 499 | ||
500 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), | 500 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), |
501 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); | 501 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); |
502 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 502 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
503 | 503 | ||
504 | ++counter; | 504 | ++counter; |
505 | 505 | ||
506 | // Anniversary | 506 | // Anniversary |
507 | hBox = new QHBox( container ); | 507 | hBox = new QHBox( container ); |
508 | l = new QLabel( tr("Anniversary"), container ); | 508 | l = new QLabel( tr("Anniversary"), container ); |
509 | gl->addWidget( l, counter, 0 ); | 509 | gl->addWidget( l, counter, 0 ); |
510 | 510 | ||
511 | m1 = new QPopupMenu( container ); | 511 | m1 = new QPopupMenu( container ); |
512 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 512 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); |
513 | m1->insertItem( anniversaryPicker ); | 513 | m1->insertItem( anniversaryPicker ); |
514 | 514 | ||
515 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 515 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
516 | anniversaryButton->setPopup( m1 ); | 516 | anniversaryButton->setPopup( m1 ); |
517 | anniversaryButton->setPopupDelay(0); | 517 | anniversaryButton->setPopupDelay(0); |
518 | 518 | ||
519 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 519 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
520 | tr( "Delete" ), | 520 | tr( "Delete" ), |
521 | hBox, 0 ); | 521 | hBox, 0 ); |
522 | gl->addWidget( hBox, counter , 1 ); | 522 | gl->addWidget( hBox, counter , 1 ); |
523 | 523 | ||
524 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), | 524 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), |
525 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); | 525 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); |
526 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 526 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
527 | 527 | ||
528 | ++counter; | 528 | ++counter; |
529 | 529 | ||
530 | // Gender | 530 | // Gender |
531 | l = new QLabel( tr("Gender"), container ); | 531 | l = new QLabel( tr("Gender"), container ); |
532 | gl->addWidget( l, counter, 0 ); | 532 | gl->addWidget( l, counter, 0 ); |
533 | cmbGender = new QComboBox( container ); | 533 | cmbGender = new QComboBox( container ); |
534 | cmbGender->insertItem( "", 0 ); | 534 | cmbGender->insertItem( "", 0 ); |
535 | cmbGender->insertItem( tr("Male"), 1); | 535 | cmbGender->insertItem( tr("Male"), 1); |
536 | cmbGender->insertItem( tr("Female"), 2); | 536 | cmbGender->insertItem( tr("Female"), 2); |
537 | gl->addWidget( cmbGender, counter, 1 ); | 537 | gl->addWidget( cmbGender, counter, 1 ); |
538 | 538 | ||
539 | ++counter; | 539 | ++counter; |
540 | 540 | ||
541 | // Create Labels and lineedit fields for every dynamic entry | 541 | // Create Labels and lineedit fields for every dynamic entry |
542 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 542 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
543 | QStringList::ConstIterator trit = trlDynamicEntries.begin(); | 543 | QStringList::ConstIterator trit = trlDynamicEntries.begin(); |
544 | for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) { | 544 | for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) { |
545 | 545 | ||
546 | if (((*it) == "Anniversary") || | 546 | if (((*it) == "Anniversary") || |
547 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 547 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
548 | 548 | ||
549 | l = new QLabel( (*it).utf8() , container ); | 549 | l = new QLabel( (*it).utf8() , container ); |
550 | listName.append( l ); | 550 | listName.append( l ); |
551 | gl->addWidget( l, i, 0 ); | 551 | gl->addWidget( l, i, 0 ); |
552 | QLineEdit *e = new QLineEdit( container ); | 552 | QLineEdit *e = new QLineEdit( container ); |
553 | listValue.append( e ); | 553 | listValue.append( e ); |
554 | gl->addWidget( e, i, 1); | 554 | gl->addWidget( e, i, 1); |
555 | } | 555 | } |
556 | // Fill labels with names.. | 556 | // Fill labels with names.. |
557 | //loadFields(); | 557 | //loadFields(); |
558 | 558 | ||
559 | 559 | ||
560 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 560 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
561 | 561 | ||
562 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 562 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
563 | dlgNote->setCaption( tr("Enter Note") ); | 563 | dlgNote->setCaption( tr("Enter Note") ); |
564 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 564 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
565 | txtNote = new QMultiLineEdit( dlgNote ); | 565 | txtNote = new QMultiLineEdit( dlgNote ); |
566 | vbNote->addWidget( txtNote ); | 566 | vbNote->addWidget( txtNote ); |
567 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 567 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
568 | 568 | ||
569 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 569 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
570 | dlgName->setCaption( tr("Edit Name") ); | 570 | dlgName->setCaption( tr("Edit Name") ); |
571 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 571 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
572 | 572 | ||
573 | l = new QLabel( tr("First Name"), dlgName ); | 573 | l = new QLabel( tr("First Name"), dlgName ); |
574 | gl->addWidget( l, 0, 0 ); | 574 | gl->addWidget( l, 0, 0 ); |
575 | txtFirstName = new QLineEdit( dlgName ); | 575 | txtFirstName = new QLineEdit( dlgName ); |
576 | gl->addWidget( txtFirstName, 0, 1 ); | 576 | gl->addWidget( txtFirstName, 0, 1 ); |
577 | 577 | ||
578 | l = new QLabel( tr("Middle Name"), dlgName ); | 578 | l = new QLabel( tr("Middle Name"), dlgName ); |
579 | gl->addWidget( l, 1, 0 ); | 579 | gl->addWidget( l, 1, 0 ); |
580 | txtMiddleName = new QLineEdit( dlgName ); | 580 | txtMiddleName = new QLineEdit( dlgName ); |
581 | gl->addWidget( txtMiddleName, 1, 1 ); | 581 | gl->addWidget( txtMiddleName, 1, 1 ); |
582 | 582 | ||
583 | l = new QLabel( tr("Last Name"), dlgName ); | 583 | l = new QLabel( tr("Last Name"), dlgName ); |
584 | gl->addWidget( l, 2, 0 ); | 584 | gl->addWidget( l, 2, 0 ); |
585 | txtLastName = new QLineEdit( dlgName ); | 585 | txtLastName = new QLineEdit( dlgName ); |
586 | gl->addWidget( txtLastName, 2, 1 ); | 586 | gl->addWidget( txtLastName, 2, 1 ); |
587 | 587 | ||
588 | l = new QLabel( tr("Suffix"), dlgName ); | 588 | l = new QLabel( tr("Suffix"), dlgName ); |
589 | gl->addWidget( l, 3, 0 ); | 589 | gl->addWidget( l, 3, 0 ); |
590 | txtSuffix = new QLineEdit( dlgName ); | 590 | txtSuffix = new QLineEdit( dlgName ); |
591 | gl->addWidget( txtSuffix, 3, 1 ); | 591 | gl->addWidget( txtSuffix, 3, 1 ); |
592 | space = new QSpacerItem(1,1, | 592 | space = new QSpacerItem(1,1, |
593 | QSizePolicy::Maximum, | 593 | QSizePolicy::Maximum, |
594 | QSizePolicy::MinimumExpanding ); | 594 | QSizePolicy::MinimumExpanding ); |
595 | gl->addItem( space, 4, 0 ); | 595 | gl->addItem( space, 4, 0 ); |
596 | 596 | ||
597 | cmbChooserField1->insertStringList( trlChooserNames ); | 597 | cmbChooserField1->insertStringList( trlChooserNames ); |
598 | cmbChooserField2->insertStringList( trlChooserNames ); | 598 | cmbChooserField2->insertStringList( trlChooserNames ); |
599 | cmbChooserField3->insertStringList( trlChooserNames ); | 599 | cmbChooserField3->insertStringList( trlChooserNames ); |
600 | cmbChooserField4->insertStringList( trlChooserNames ); | 600 | cmbChooserField4->insertStringList( trlChooserNames ); |
601 | 601 | ||
602 | cmbChooserField1->setCurrentItem( 0 ); | 602 | cmbChooserField1->setCurrentItem( 0 ); |
603 | cmbChooserField2->setCurrentItem( 1 ); | 603 | cmbChooserField2->setCurrentItem( 1 ); |
604 | cmbChooserField3->setCurrentItem( 2 ); | 604 | cmbChooserField3->setCurrentItem( 2 ); |
605 | 605 | ||
606 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 606 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
607 | 607 | ||
608 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 608 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); |
609 | 609 | ||
610 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 610 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
611 | this, SLOT(slotChooser1Change(const QString &)) ); | 611 | this, SLOT(slotChooser1Change(const QString &)) ); |
612 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 612 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
613 | this, SLOT(slotChooser2Change(const QString &)) ); | 613 | this, SLOT(slotChooser2Change(const QString &)) ); |
614 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 614 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
615 | this, SLOT(slotChooser3Change(const QString &)) ); | 615 | this, SLOT(slotChooser3Change(const QString &)) ); |
616 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 616 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
617 | this, SLOT(slotChooser4Change(const QString &)) ); | 617 | this, SLOT(slotChooser4Change(const QString &)) ); |
618 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 618 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
619 | this, SLOT(slotAddressChange(const QString &)) ); | 619 | this, SLOT(slotAddressChange(const QString &)) ); |
620 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 620 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
621 | this, SLOT(slotCityChange(const QString &)) ); | 621 | this, SLOT(slotCityChange(const QString &)) ); |
622 | connect( txtState, SIGNAL(textChanged(const QString &)), | 622 | connect( txtState, SIGNAL(textChanged(const QString &)), |
623 | this, SLOT(slotStateChange(const QString &)) ); | 623 | this, SLOT(slotStateChange(const QString &)) ); |
624 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 624 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
625 | this, SLOT(slotZipChange(const QString &)) ); | 625 | this, SLOT(slotZipChange(const QString &)) ); |
626 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 626 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
627 | this, SLOT(slotCountryChange(const QString &)) ); | 627 | this, SLOT(slotCountryChange(const QString &)) ); |
628 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 628 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
629 | this, SLOT(slotCountryChange(const QString &)) ); | 629 | this, SLOT(slotCountryChange(const QString &)) ); |
630 | connect( cmbChooserField1, SIGNAL(activated(int)), | 630 | connect( cmbChooserField1, SIGNAL(activated(int)), |
631 | this, SLOT(slotCmbChooser1Change(int)) ); | 631 | this, SLOT(slotCmbChooser1Change(int)) ); |
632 | connect( cmbChooserField2, SIGNAL(activated(int)), | 632 | connect( cmbChooserField2, SIGNAL(activated(int)), |
633 | this, SLOT(slotCmbChooser2Change(int)) ); | 633 | this, SLOT(slotCmbChooser2Change(int)) ); |
634 | connect( cmbChooserField3, SIGNAL(activated(int)), | 634 | connect( cmbChooserField3, SIGNAL(activated(int)), |
635 | this, SLOT(slotCmbChooser3Change(int)) ); | 635 | this, SLOT(slotCmbChooser3Change(int)) ); |
636 | connect( cmbChooserField4, SIGNAL(activated(int)), | 636 | connect( cmbChooserField4, SIGNAL(activated(int)), |
637 | this, SLOT(slotCmbChooser4Change(int)) ); | 637 | this, SLOT(slotCmbChooser4Change(int)) ); |
638 | connect( cmbAddress, SIGNAL(activated(int)), | 638 | connect( cmbAddress, SIGNAL(activated(int)), |
639 | this, SLOT(slotAddressTypeChange(int)) ); | 639 | this, SLOT(slotAddressTypeChange(int)) ); |
640 | 640 | ||
641 | new QPEDialogListener(this); | 641 | new QPEDialogListener(this); |
642 | 642 | ||
643 | setPersonalView ( m_personalView ); | 643 | setPersonalView ( m_personalView ); |
644 | } | 644 | } |
645 | 645 | ||
646 | void ContactEditor::defaultEmailChanged(int i){ | 646 | void ContactEditor::defaultEmailChanged(int i){ |
647 | qDebug("defaultEmailChanged"); | 647 | qDebug("defaultEmailChanged"); |
648 | int index = cmbChooserField1->currentItem(); | 648 | int index = cmbChooserField1->currentItem(); |
649 | slChooserValues[index] = cmbDefaultEmail->text(i); | 649 | slChooserValues[index] = cmbDefaultEmail->text(i); |
650 | 650 | ||
651 | } | 651 | } |
652 | 652 | ||
653 | void ContactEditor::populateDefaultEmailCmb(){ | 653 | void ContactEditor::populateDefaultEmailCmb(){ |
654 | cmbDefaultEmail->clear(); | 654 | cmbDefaultEmail->clear(); |
655 | cmbDefaultEmail->insertStringList(emails); | 655 | cmbDefaultEmail->insertStringList(emails); |
656 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 656 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
657 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",cmbDefaultEmail->text( i ).latin1(),defaultEmail.latin1()); | 657 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",cmbDefaultEmail->text( i ).latin1(),defaultEmail.latin1()); |
658 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 658 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
659 | cmbDefaultEmail->setCurrentItem( i ); | 659 | cmbDefaultEmail->setCurrentItem( i ); |
660 | qDebug("set"); | 660 | qDebug("set"); |
661 | } | 661 | } |
662 | } | 662 | } |
663 | } | 663 | } |
664 | 664 | ||
665 | void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { | 665 | void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { |
666 | QString type = slChooserNames[index]; | 666 | QString type = slChooserNames[index]; |
667 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",type.latin1(),textChanged.latin1(), index, widgetPos ); | 667 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",type.latin1(),textChanged.latin1(), index, widgetPos ); |
668 | if ( type == "Default Email"){ | 668 | if ( type == "Default Email"){ |
669 | defaultEmail = textChanged; | 669 | defaultEmail = textChanged; |
670 | if (cmbDefaultEmail) delete cmbDefaultEmail; | 670 | if (cmbDefaultEmail){ |
671 | delete cmbDefaultEmail; | ||
672 | cmbDefaultEmail = 0l; | ||
673 | } | ||
671 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); | 674 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); |
672 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); | 675 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); |
673 | cmbDefaultEmail->show(); | 676 | cmbDefaultEmail->show(); |
674 | populateDefaultEmailCmb(); | 677 | populateDefaultEmailCmb(); |
675 | connect(cmbDefaultEmail,SIGNAL(activated(int)), | 678 | connect(cmbDefaultEmail,SIGNAL(activated(int)), |
676 | SLOT(defaultEmailChanged(int))); | 679 | SLOT(defaultEmailChanged(int))); |
677 | defaultEmailChooserPosition = widgetPos; | 680 | defaultEmailChooserPosition = widgetPos; |
678 | }else if (defaultEmailChooserPosition == widgetPos){ | 681 | }else if (defaultEmailChooserPosition == widgetPos){ |
679 | qDebug("cmbDefaultEmail->hide()"); | 682 | qDebug("cmbDefaultEmail->hide()"); |
680 | if (cmbDefaultEmail) cmbDefaultEmail->hide(); | 683 | if (cmbDefaultEmail) cmbDefaultEmail->hide(); |
681 | widgetPos=-1; | 684 | widgetPos=-1; |
682 | }else if (type == "Emails"){ | 685 | }else if (type == "Emails"){ |
683 | qDebug("emails"); | 686 | qDebug("emails"); |
684 | QString de; | 687 | QString de; |
685 | emails = QStringList::split (",", textChanged ); | 688 | emails = QStringList::split (",", textChanged ); |
686 | 689 | ||
687 | populateDefaultEmailCmb(); | 690 | if ( cmbDefaultEmail ) |
691 | populateDefaultEmailCmb(); | ||
688 | } | 692 | } |
689 | 693 | ||
690 | 694 | ||
691 | 695 | ||
692 | slChooserValues[index] = textChanged; | 696 | slChooserValues[index] = textChanged; |
693 | 697 | ||
694 | } | 698 | } |
695 | 699 | ||
696 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 700 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
697 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 701 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
698 | } | 702 | } |
699 | 703 | ||
700 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 704 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
701 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 705 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
702 | 706 | ||
703 | } | 707 | } |
704 | 708 | ||
705 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 709 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
706 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 710 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
707 | } | 711 | } |
708 | 712 | ||
709 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 713 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
710 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 714 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
711 | } | 715 | } |
712 | 716 | ||
713 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 717 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
714 | 718 | ||
715 | if ( cmbAddress->currentItem() == 0 ) { | 719 | if ( cmbAddress->currentItem() == 0 ) { |
716 | slBusinessAddress[0] = textChanged; | 720 | slBusinessAddress[0] = textChanged; |
717 | } else { | 721 | } else { |
718 | slHomeAddress[0] = textChanged; | 722 | slHomeAddress[0] = textChanged; |
719 | } | 723 | } |
720 | } | 724 | } |
721 | 725 | ||
722 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 726 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
723 | 727 | ||
724 | if ( cmbAddress->currentItem() == 0 ) { | 728 | if ( cmbAddress->currentItem() == 0 ) { |
725 | slBusinessAddress[1] = textChanged; | 729 | slBusinessAddress[1] = textChanged; |
726 | } else { | 730 | } else { |
727 | slHomeAddress[1] = textChanged; | 731 | slHomeAddress[1] = textChanged; |
728 | } | 732 | } |
729 | } | 733 | } |
730 | 734 | ||
731 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 735 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
732 | 736 | ||
733 | if ( cmbAddress->currentItem() == 0 ) { | 737 | if ( cmbAddress->currentItem() == 0 ) { |
734 | slBusinessAddress[2] = textChanged; | 738 | slBusinessAddress[2] = textChanged; |
735 | } else { | 739 | } else { |
736 | slHomeAddress[2] = textChanged; | 740 | slHomeAddress[2] = textChanged; |
737 | } | 741 | } |
738 | } | 742 | } |
739 | 743 | ||
740 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 744 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
741 | 745 | ||
742 | if ( cmbAddress->currentItem() == 0 ) { | 746 | if ( cmbAddress->currentItem() == 0 ) { |
743 | slBusinessAddress[3] = textChanged; | 747 | slBusinessAddress[3] = textChanged; |
744 | } else { | 748 | } else { |
745 | slHomeAddress[3] = textChanged; | 749 | slHomeAddress[3] = textChanged; |
746 | } | 750 | } |
747 | } | 751 | } |
748 | 752 | ||
749 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 753 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
750 | 754 | ||
751 | 755 | ||
752 | if ( cmbAddress->currentItem() == 0 ) { | 756 | if ( cmbAddress->currentItem() == 0 ) { |
753 | slBusinessAddress[4] = textChanged; | 757 | slBusinessAddress[4] = textChanged; |
754 | } else { | 758 | } else { |
755 | slHomeAddress[4] = textChanged; | 759 | slHomeAddress[4] = textChanged; |
756 | } | 760 | } |
757 | } | 761 | } |
758 | 762 | ||
759 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 763 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
760 | 764 | ||
761 | if ( cmbAddress->currentItem() == 0 ) { | 765 | if ( cmbAddress->currentItem() == 0 ) { |
762 | slBusinessAddress[5] = textChanged; | 766 | slBusinessAddress[5] = textChanged; |
763 | } else { | 767 | } else { |
764 | slHomeAddress[5] = textChanged; | 768 | slHomeAddress[5] = textChanged; |
765 | } | 769 | } |
766 | } | 770 | } |
767 | 771 | ||
768 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 772 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
769 | 773 | ||
770 | if ( cmbAddress->currentItem() == 0 ) { | 774 | if ( cmbAddress->currentItem() == 0 ) { |
771 | slBusinessAddress[6] = textChanged; | 775 | slBusinessAddress[6] = textChanged; |
772 | } else { | 776 | } else { |
773 | slHomeAddress[6] = textChanged; | 777 | slHomeAddress[6] = textChanged; |
774 | } | 778 | } |
775 | } | 779 | } |
776 | 780 | ||
777 | 781 | ||
778 | void ContactEditor::slotCmbChooser1Change( int index ) { | 782 | void ContactEditor::slotCmbChooser1Change( int index ) { |
779 | 783 | ||
780 | txtChooserField1->setText( slChooserValues[index] ); | 784 | txtChooserField1->setText( slChooserValues[index] ); |
781 | txtChooserField1->setFocus(); | 785 | txtChooserField1->setFocus(); |
782 | } | 786 | } |
783 | 787 | ||
784 | void ContactEditor::slotCmbChooser2Change( int index ) { | 788 | void ContactEditor::slotCmbChooser2Change( int index ) { |
785 | 789 | ||
786 | txtChooserField2->setText( slChooserValues[index] ); | 790 | txtChooserField2->setText( slChooserValues[index] ); |
787 | txtChooserField2->setFocus(); | 791 | txtChooserField2->setFocus(); |
788 | } | 792 | } |
789 | 793 | ||
790 | void ContactEditor::slotCmbChooser3Change( int index ) { | 794 | void ContactEditor::slotCmbChooser3Change( int index ) { |
791 | 795 | ||
792 | txtChooserField3->setText( slChooserValues[index] ); | 796 | txtChooserField3->setText( slChooserValues[index] ); |
793 | txtChooserField3->setFocus(); | 797 | txtChooserField3->setFocus(); |
794 | 798 | ||
795 | } | 799 | } |
796 | 800 | ||
797 | void ContactEditor::slotCmbChooser4Change( int index ) { | 801 | void ContactEditor::slotCmbChooser4Change( int index ) { |
798 | 802 | ||
799 | txtChooserField4->setText( slChooserValues[index] ); | 803 | txtChooserField4->setText( slChooserValues[index] ); |
800 | txtChooserField4->setFocus(); | 804 | txtChooserField4->setFocus(); |
801 | 805 | ||
802 | } | 806 | } |
803 | 807 | ||
804 | void ContactEditor::slotAddressTypeChange( int index ) { | 808 | void ContactEditor::slotAddressTypeChange( int index ) { |
805 | 809 | ||
806 | if ( index == 0 ) { | 810 | if ( index == 0 ) { |
807 | 811 | ||
808 | txtAddress->setText( slBusinessAddress[0] ); | 812 | txtAddress->setText( slBusinessAddress[0] ); |
809 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 813 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
810 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 814 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
811 | txtCity->setText( slBusinessAddress[3] ); | 815 | txtCity->setText( slBusinessAddress[3] ); |
812 | txtState->setText( slBusinessAddress[4] ); | 816 | txtState->setText( slBusinessAddress[4] ); |
813 | txtZip->setText( slBusinessAddress[5] ); | 817 | txtZip->setText( slBusinessAddress[5] ); |
814 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 818 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
815 | txtTmp->setText( slBusinessAddress[6] ); | 819 | txtTmp->setText( slBusinessAddress[6] ); |
816 | 820 | ||
817 | } else { | 821 | } else { |
818 | 822 | ||
819 | txtAddress->setText( slHomeAddress[0] ); | 823 | txtAddress->setText( slHomeAddress[0] ); |
820 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 824 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
821 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 825 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
822 | txtCity->setText( slHomeAddress[3] ); | 826 | txtCity->setText( slHomeAddress[3] ); |
823 | txtState->setText( slHomeAddress[4] ); | 827 | txtState->setText( slHomeAddress[4] ); |
824 | txtZip->setText( slHomeAddress[5] ); | 828 | txtZip->setText( slHomeAddress[5] ); |
825 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 829 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
826 | txtTmp->setText( slHomeAddress[6] ); | 830 | txtTmp->setText( slHomeAddress[6] ); |
827 | 831 | ||
828 | } | 832 | } |
829 | 833 | ||
830 | } | 834 | } |
831 | 835 | ||
832 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 836 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
833 | 837 | ||
834 | int index = cmbFileAs->currentItem(); | 838 | int index = cmbFileAs->currentItem(); |
835 | 839 | ||
836 | cmbFileAs->clear(); | 840 | cmbFileAs->clear(); |
837 | 841 | ||
838 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); | 842 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); |
839 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); | 843 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); |
840 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); | 844 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); |
841 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); | 845 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); |
842 | 846 | ||
843 | cmbFileAs->setCurrentItem( index ); | 847 | cmbFileAs->setCurrentItem( index ); |
844 | 848 | ||
845 | useFullName = true; | 849 | useFullName = true; |
846 | 850 | ||
847 | } | 851 | } |
848 | 852 | ||
849 | void ContactEditor::accept() { | 853 | void ContactEditor::accept() { |
850 | 854 | ||
851 | if ( isEmpty() ) { | 855 | if ( isEmpty() ) { |
852 | cleanupFields(); | 856 | cleanupFields(); |
853 | reject(); | 857 | reject(); |
854 | } else { | 858 | } else { |
855 | saveEntry(); | 859 | saveEntry(); |
856 | cleanupFields(); | 860 | cleanupFields(); |
857 | QDialog::accept(); | 861 | QDialog::accept(); |
858 | } | 862 | } |
859 | 863 | ||
860 | } | 864 | } |
861 | 865 | ||
862 | void ContactEditor::slotNote() { | 866 | void ContactEditor::slotNote() { |
863 | 867 | ||
864 | dlgNote->showMaximized(); | 868 | dlgNote->showMaximized(); |
865 | if ( !dlgNote->exec() ) { | 869 | if ( !dlgNote->exec() ) { |
866 | txtNote->setText( ent.notes() ); | 870 | txtNote->setText( ent.notes() ); |
867 | } | 871 | } |
868 | } | 872 | } |
869 | 873 | ||
870 | void ContactEditor::slotName() { | 874 | void ContactEditor::slotName() { |
871 | 875 | ||
872 | QString tmpName; | 876 | QString tmpName; |
873 | if (useFullName) { | 877 | if (useFullName) { |
874 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 878 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
875 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 879 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
876 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 880 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
877 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 881 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
878 | } | 882 | } |
879 | dlgName->showMaximized(); | 883 | dlgName->showMaximized(); |