summaryrefslogtreecommitdiff
authordrw <drw>2005-02-07 22:08:38 (UTC)
committer drw <drw>2005-02-07 22:08:38 (UTC)
commit2e4fd59ce900490ccbbb6c0f7b2fcd4811ac8a07 (patch) (unidiff)
treedd1c91d19c4e53fea60245e3d4d535ac176ee2c8
parent7631c91d6c495a6c60e87a9ab131280f31ee4c87 (diff)
downloadopie-2e4fd59ce900490ccbbb6c0f7b2fcd4811ac8a07.zip
opie-2e4fd59ce900490ccbbb6c0f7b2fcd4811ac8a07.tar.gz
opie-2e4fd59ce900490ccbbb6c0f7b2fcd4811ac8a07.tar.bz2
Fix contact edit dialog captioning
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 75e539a..6984501 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -571,238 +571,241 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
571 if (msg == "editPersonal()") { 571 if (msg == "editPersonal()") {
572 editPersonal(); 572 editPersonal();
573 573
574 // Categories might have changed, so reload 574 // Categories might have changed, so reload
575 reloadCategories(); 575 reloadCategories();
576 } else if (msg == "editPersonalAndClose()") { 576 } else if (msg == "editPersonalAndClose()") {
577 editPersonal(); 577 editPersonal();
578 close(); 578 close();
579 } else if ( msg == "addContact(QString,QString)" ) { 579 } else if ( msg == "addContact(QString,QString)" ) {
580 QDataStream stream(data,IO_ReadOnly); 580 QDataStream stream(data,IO_ReadOnly);
581 QString name, email; 581 QString name, email;
582 stream >> name >> email; 582 stream >> name >> email;
583 583
584 Opie::OPimContact cnt; 584 Opie::OPimContact cnt;
585 QString fn, mn, ln; 585 QString fn, mn, ln;
586 parseName( name, &fn, &mn, &ln ); 586 parseName( name, &fn, &mn, &ln );
587 //odebug << " " << fn << " - " << mn " - " << ln << oendl; 587 //odebug << " " << fn << " - " << mn " - " << ln << oendl;
588 cnt.setFirstName( fn ); 588 cnt.setFirstName( fn );
589 cnt.setMiddleName( mn ); 589 cnt.setMiddleName( mn );
590 cnt.setLastName( ln ); 590 cnt.setLastName( ln );
591 cnt.insertEmails( email ); 591 cnt.insertEmails( email );
592 cnt.setDefaultEmail( email ); 592 cnt.setDefaultEmail( email );
593 cnt.setFileAs(); 593 cnt.setFileAs();
594 594
595 m_abView -> addEntry( cnt ); 595 m_abView -> addEntry( cnt );
596 596
597 // :SXm_abView()->init( cnt ); 597 // :SXm_abView()->init( cnt );
598 editEntry( EditEntry ); 598 editEntry( EditEntry );
599 599
600 // Categories might have changed, so reload 600 // Categories might have changed, so reload
601 reloadCategories(); 601 reloadCategories();
602 } else if ( msg == "beamBusinessCard()" ) { 602 } else if ( msg == "beamBusinessCard()" ) {
603 QString beamFilename = addressbookPersonalVCardName(); 603 QString beamFilename = addressbookPersonalVCardName();
604 if ( !QFile::exists( beamFilename ) ) 604 if ( !QFile::exists( beamFilename ) )
605 return; // can't beam a non-existent file 605 return; // can't beam a non-existent file
606 606
607 Ir *ir = new Ir( this ); 607 Ir *ir = new Ir( this );
608 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 608 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
609 QString description = "mycard.vcf"; 609 QString description = "mycard.vcf";
610 ir->send( beamFilename, description, "text/x-vCard" ); 610 ir->send( beamFilename, description, "text/x-vCard" );
611 } else if ( msg == "show(int)" ) { 611 } else if ( msg == "show(int)" ) {
612 raise(); 612 raise();
613 QDataStream stream(data,IO_ReadOnly); 613 QDataStream stream(data,IO_ReadOnly);
614 int uid; 614 int uid;
615 stream >> uid; 615 stream >> uid;
616 616
617 odebug << "Showing uid: " << uid << oendl; 617 odebug << "Showing uid: " << uid << oendl;
618 618
619 // Deactivate Personal View.. 619 // Deactivate Personal View..
620 if ( m_actionPersonal->isOn() ){ 620 if ( m_actionPersonal->isOn() ){
621 m_actionPersonal->setOn( false ); 621 m_actionPersonal->setOn( false );
622 slotPersonalView(); 622 slotPersonalView();
623 } 623 }
624 624
625 // Reset category and show as card.. 625 // Reset category and show as card..
626 m_abView -> setShowByCategory( QString::null ); 626 m_abView -> setShowByCategory( QString::null );
627 m_abView -> setCurrentUid( uid ); 627 m_abView -> setCurrentUid( uid );
628 slotViewSwitched ( AbView::CardView ); 628 slotViewSwitched ( AbView::CardView );
629 629
630 needShow = true; 630 needShow = true;
631 631
632 632
633 } else if ( msg == "edit(int)" ) { 633 } else if ( msg == "edit(int)" ) {
634 QDataStream stream(data,IO_ReadOnly); 634 QDataStream stream(data,IO_ReadOnly);
635 int uid; 635 int uid;
636 stream >> uid; 636 stream >> uid;
637 637
638 // Deactivate Personal View.. 638 // Deactivate Personal View..
639 if ( m_actionPersonal->isOn() ){ 639 if ( m_actionPersonal->isOn() ){
640 m_actionPersonal->setOn( false ); 640 m_actionPersonal->setOn( false );
641 slotPersonalView(); 641 slotPersonalView();
642 } 642 }
643 643
644 // Reset category and edit.. 644 // Reset category and edit..
645 m_abView -> setShowByCategory( QString::null ); 645 m_abView -> setShowByCategory( QString::null );
646 m_abView -> setCurrentUid( uid ); 646 m_abView -> setCurrentUid( uid );
647 slotItemEdit(); 647 slotItemEdit();
648 648
649 // Categories might have changed, so reload 649 // Categories might have changed, so reload
650 reloadCategories(); 650 reloadCategories();
651 } 651 }
652 652
653 if (needShow) 653 if (needShow)
654 QPEApplication::setKeepRunning(); 654 QPEApplication::setKeepRunning();
655} 655}
656 656
657void AddressbookWindow::editEntry( EntryMode entryMode ) 657void AddressbookWindow::editEntry( EntryMode entryMode )
658{ 658{
659 Opie::OPimContact entry; 659 Opie::OPimContact entry;
660 if ( !abEditor ) { 660 if ( !abEditor ) {
661 abEditor = new ContactEditor( entry, this, "editor" ); 661 abEditor = new ContactEditor( entry, this, "editor" );
662 } 662 }
663 if ( entryMode == EditEntry ) 663 if ( entryMode == EditEntry )
664 abEditor->setEntry( m_abView -> currentEntry() ); 664 abEditor->setEntry( m_abView -> currentEntry() );
665 else if ( entryMode == NewEntry ) 665 else if ( entryMode == NewEntry )
666 abEditor->setEntry( entry ); 666 abEditor->setEntry( entry );
667 // other things may change the caption. 667
668 abEditor->setCaption( tr("Edit Address") ); 668 // Set the dialog caption
669 if ( m_actionPersonal->isOn() )
670 abEditor->setCaption( tr( "Edit My Personal Details" ) );
671 else
672 abEditor->setCaption( tr( "Edit Contact" ) );
669 673
670 // fix the focus... 674 // fix the focus...
671 abEditor->setNameFocus(); 675 abEditor->setNameFocus();
672 if ( QPEApplication::execDialog( abEditor ) == QDialog::Accepted ) { 676 if ( QPEApplication::execDialog( abEditor ) == QDialog::Accepted ) {
673 setFocus(); 677 setFocus();
674 if ( entryMode == NewEntry ) { 678 if ( entryMode == NewEntry ) {
675 Opie::OPimContact insertEntry = abEditor->entry(); 679 Opie::OPimContact insertEntry = abEditor->entry();
676 insertEntry.assignUid(); 680 insertEntry.assignUid();
677 m_abView -> addEntry( insertEntry ); 681 m_abView -> addEntry( insertEntry );
678 m_abView -> setCurrentUid( insertEntry.uid() ); 682 m_abView -> setCurrentUid( insertEntry.uid() );
679 } else { 683 } else {
680 Opie::OPimContact replEntry = abEditor->entry(); 684 Opie::OPimContact replEntry = abEditor->entry();
681 685
682 if ( !replEntry.isValidUid() ) 686 if ( !replEntry.isValidUid() )
683 replEntry.assignUid(); 687 replEntry.assignUid();
684 688
685 m_abView -> replaceEntry( replEntry ); 689 m_abView -> replaceEntry( replEntry );
686 } 690 }
687 691
688 // Categories might have changed, so reload 692 // Categories might have changed, so reload
689 reloadCategories(); 693 reloadCategories();
690 } 694 }
691} 695}
692 696
693void AddressbookWindow::editPersonal() 697void AddressbookWindow::editPersonal()
694{ 698{
695 Opie::OPimContact entry; 699 Opie::OPimContact entry;
696 700
697 // Switch to personal view if not selected 701 // Switch to personal view if not selected
698 // but take care of the menu, too 702 // but take care of the menu, too
699 if ( ! m_actionPersonal->isOn() ){ 703 if ( ! m_actionPersonal->isOn() ){
700 odebug << "*** ++++" << oendl; 704 odebug << "*** ++++" << oendl;
701 m_actionPersonal->setOn( true ); 705 m_actionPersonal->setOn( true );
702 slotPersonalView(); 706 slotPersonalView();
703 } 707 }
704 708
705 if ( !abEditor ) { 709 if ( !abEditor ) {
706 abEditor = new ContactEditor( entry, this, "editor" ); 710 abEditor = new ContactEditor( entry, this, "editor" );
707 } 711 }
708 712
709 abEditor->setCaption(tr("Edit My Personal Details")); 713 abEditor->setPersonalView( true );
710 abEditor->setPersonalView( true );
711 editEntry( EditEntry ); 714 editEntry( EditEntry );
712 abEditor->setPersonalView( false ); 715 abEditor->setPersonalView( false );
713 716
714} 717}
715 718
716 719
717void AddressbookWindow::slotPersonalView() 720void AddressbookWindow::slotPersonalView()
718{ 721{
719 odebug << "slotPersonalView()" << oendl; 722 odebug << "slotPersonalView()" << oendl;
720 723
721 bool personal = m_actionPersonal->isOn(); 724 bool personal = m_actionPersonal->isOn();
722 725
723 // Disable actions when showing personal details 726 // Disable actions when showing personal details
724 setItemNewEnabled( !personal ); 727 setItemNewEnabled( !personal );
725 setItemDuplicateEnabled( !personal ); 728 setItemDuplicateEnabled( !personal );
726 setItemDeleteEnabled( !personal ); 729 setItemDeleteEnabled( !personal );
727 m_actionMail->setEnabled( !personal ); 730 m_actionMail->setEnabled( !personal );
728 setShowCategories( !personal ); 731 setShowCategories( !personal );
729 732
730 // Display appropriate view 733 // Display appropriate view
731 m_abView->showPersonal( personal ); 734 m_abView->showPersonal( personal );
732 735
733 if ( personal ) 736 if ( personal )
734 { 737 {
735 setCaption( tr( "Contacts - My Personal Details") ); 738 setCaption( tr( "Contacts - My Personal Details") );
736 739
737 // Set category to 'All' to make sure personal details is visible 740 // Set category to 'All' to make sure personal details is visible
738 setViewCategory( "All" ); 741 setViewCategory( "All" );
739 m_abView->setShowByCategory( "All" ); 742 m_abView->setShowByCategory( "All" );
740 743
741 // Temporarily disable letter picker 744 // Temporarily disable letter picker
742 pLabel->hide(); 745 pLabel->hide();
743 } 746 }
744 else 747 else
745 { 748 {
746 setCaption( tr( "Contacts") ); 749 setCaption( tr( "Contacts") );
747 750
748 // Re-enable letter picker 751 // Re-enable letter picker
749 pLabel->show(); 752 pLabel->show();
750 } 753 }
751} 754}
752 755
753void AddressbookWindow::reload() 756void AddressbookWindow::reload()
754{ 757{
755 syncing = false; 758 syncing = false;
756 m_abView->clear(); 759 m_abView->clear();
757 m_abView->reload(); 760 m_abView->reload();
758} 761}
759 762
760void AddressbookWindow::flush() 763void AddressbookWindow::flush()
761{ 764{
762 syncing = true; 765 syncing = true;
763 m_abView->save(); 766 m_abView->save();
764} 767}
765 768
766 769
767void AddressbookWindow::closeEvent( QCloseEvent *e ) 770void AddressbookWindow::closeEvent( QCloseEvent *e )
768{ 771{
769 if ( active_view == AbView::CardView ) 772 if ( active_view == AbView::CardView )
770 { 773 {
771 if ( !m_actionPersonal->isOn() ) 774 if ( !m_actionPersonal->isOn() )
772 { 775 {
773 // Switch to table view only if not editing personal details 776 // Switch to table view only if not editing personal details
774 slotViewSwitched( AbView::TableView ); 777 slotViewSwitched( AbView::TableView );
775 } 778 }
776 else 779 else
777 { 780 {
778 // If currently editing personal details, switch off personal view 781 // If currently editing personal details, switch off personal view
779 m_actionPersonal->setOn( false ); 782 m_actionPersonal->setOn( false );
780 slotPersonalView(); 783 slotPersonalView();
781 } 784 }
782 785
783 e->ignore(); 786 e->ignore();
784 return; 787 return;
785 } 788 }
786 if(syncing) { 789 if(syncing) {
787 /* shouldn't we save, I hear you say? well its already been set 790 /* shouldn't we save, I hear you say? well its already been set
788 so that an edit can not occur during a sync, and we flushed 791 so that an edit can not occur during a sync, and we flushed
789 at the start of the sync, so there is no need to save 792 at the start of the sync, so there is no need to save
790 Saving however itself would cause problems. */ 793 Saving however itself would cause problems. */
791 e->accept(); 794 e->accept();
792 return; 795 return;
793 } 796 }
794 //################## shouldn't always save 797 //################## shouldn't always save
795 // True, but the database handles this automatically ! (se) 798 // True, but the database handles this automatically ! (se)
796 if ( save() ) 799 if ( save() )
797 e->accept(); 800 e->accept();
798 else 801 else
799 e->ignore(); 802 e->ignore();
800} 803}
801 804
802/* 805/*
803 Returns true if it is OK to exit 806 Returns true if it is OK to exit
804*/ 807*/
805 808
806bool AddressbookWindow::save() 809bool AddressbookWindow::save()
807{ 810{
808 if ( !m_abView->save() ) { 811 if ( !m_abView->save() ) {