summaryrefslogtreecommitdiff
authordrw <drw>2005-02-07 20:32:51 (UTC)
committer drw <drw>2005-02-07 20:32:51 (UTC)
commite56c7dfec502972fc7efcd9e0357c371d0e9cd15 (patch) (unidiff)
tree7dec179671853b250afdfc6f55decda42d86fc2d
parentaeda5d05178f635c05ce4556e3a0b7f9be7d6401 (diff)
downloadopie-e56c7dfec502972fc7efcd9e0357c371d0e9cd15.zip
opie-e56c7dfec502972fc7efcd9e0357c371d0e9cd15.tar.gz
opie-e56c7dfec502972fc7efcd9e0357c371d0e9cd15.tar.bz2
Disable certain UI elements while editing personal details
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp44
1 files changed, 36 insertions, 8 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index a4c2c6e..7c52ef2 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -687,82 +687,110 @@ void AddressbookWindow::editPersonal()
687 if ( ! m_actionPersonal->isOn() ){ 687 if ( ! m_actionPersonal->isOn() ){
688 odebug << "*** ++++" << oendl; 688 odebug << "*** ++++" << oendl;
689 m_actionPersonal->setOn( true ); 689 m_actionPersonal->setOn( true );
690 slotPersonalView(); 690 slotPersonalView();
691 } 691 }
692 692
693 if ( !abEditor ) { 693 if ( !abEditor ) {
694 abEditor = new ContactEditor( entry, this, "editor" ); 694 abEditor = new ContactEditor( entry, this, "editor" );
695 } 695 }
696 696
697 abEditor->setCaption(tr("Edit My Personal Details")); 697 abEditor->setCaption(tr("Edit My Personal Details"));
698 abEditor->setPersonalView( true ); 698 abEditor->setPersonalView( true );
699 editEntry( EditEntry ); 699 editEntry( EditEntry );
700 abEditor->setPersonalView( false ); 700 abEditor->setPersonalView( false );
701 701
702} 702}
703 703
704 704
705void AddressbookWindow::slotPersonalView() 705void AddressbookWindow::slotPersonalView()
706{ 706{
707 odebug << "slotPersonalView()" << oendl; 707 odebug << "slotPersonalView()" << oendl;
708 708
709 bool personal = m_actionPersonal->isOn(); 709 bool personal = m_actionPersonal->isOn();
710 710
711 // Disable certain menu items when showing personal details 711 // Disable actions when showing personal details
712 setItemNewEnabled( !personal ); 712 setItemNewEnabled( !personal );
713 setItemDuplicateEnabled( !personal ); 713 setItemDuplicateEnabled( !personal );
714 setItemDeleteEnabled( !personal ); 714 setItemDeleteEnabled( !personal );
715 m_actionMail->setEnabled( !personal ); 715 m_actionMail->setEnabled( !personal );
716 setShowCategories( !personal );
716 717
717 // Display appropriate view 718 // Display appropriate view
718 m_abView->showPersonal( personal ); 719 m_abView->showPersonal( personal );
719 720
720 // Set application caption 721 if ( personal )
721 personal ? setCaption( tr( "Contacts - My Personal Details") ) 722 {
722 : setCaption( tr( "Contacts") ); 723 setCaption( tr( "Contacts - My Personal Details") );
724
725 // Set category to 'All' to make sure personal details is visible
726 setViewCategory( "All" );
727 m_abView->setShowByCategory( "All" );
728
729 // Temporarily disable letter picker
730 pLabel->hide();
731 }
732 else
733 {
734 setCaption( tr( "Contacts") );
735
736 // Re-enable letter picker
737 pLabel->show();
738 }
723} 739}
724 740
725void AddressbookWindow::reload() 741void AddressbookWindow::reload()
726{ 742{
727 syncing = false; 743 syncing = false;
728 m_abView->clear(); 744 m_abView->clear();
729 m_abView->reload(); 745 m_abView->reload();
730} 746}
731 747
732void AddressbookWindow::flush() 748void AddressbookWindow::flush()
733{ 749{
734 syncing = true; 750 syncing = true;
735 m_abView->save(); 751 m_abView->save();
736} 752}
737 753
738 754
739void AddressbookWindow::closeEvent( QCloseEvent *e ) 755void AddressbookWindow::closeEvent( QCloseEvent *e )
740{ 756{
741 if(active_view == AbView::CardView){ 757 if ( active_view == AbView::CardView )
742 slotViewSwitched( AbView::TableView ); 758 {
743 e->ignore(); 759 if ( !m_actionPersonal->isOn() )
744 return; 760 {
761 // Switch to table view only if not editing personal details
762 slotViewSwitched( AbView::TableView );
763 }
764 else
765 {
766 // If currently editing personal details, switch off personal view
767 m_actionPersonal->setOn( false );
768 slotPersonalView();
769 }
770
771 e->ignore();
772 return;
745 } 773 }
746 if(syncing) { 774 if(syncing) {
747 /* shouldn't we save, I hear you say? well its already been set 775 /* shouldn't we save, I hear you say? well its already been set
748 so that an edit can not occur during a sync, and we flushed 776 so that an edit can not occur during a sync, and we flushed
749 at the start of the sync, so there is no need to save 777 at the start of the sync, so there is no need to save
750 Saving however itself would cause problems. */ 778 Saving however itself would cause problems. */
751 e->accept(); 779 e->accept();
752 return; 780 return;
753 } 781 }
754 //################## shouldn't always save 782 //################## shouldn't always save
755 // True, but the database handles this automatically ! (se) 783 // True, but the database handles this automatically ! (se)
756 if ( save() ) 784 if ( save() )
757 e->accept(); 785 e->accept();
758 else 786 else
759 e->ignore(); 787 e->ignore();
760} 788}
761 789
762/* 790/*
763 Returns true if it is OK to exit 791 Returns true if it is OK to exit
764*/ 792*/
765 793
766bool AddressbookWindow::save() 794bool AddressbookWindow::save()
767{ 795{
768 if ( !m_abView->save() ) { 796 if ( !m_abView->save() ) {