-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index e5addec..c506e98 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -675,258 +675,257 @@ void AddressbookWindow::editEntry( EntryMode entryMode ) | |||
675 | if ( !replEntry.isValidUid() ) | 675 | if ( !replEntry.isValidUid() ) |
676 | replEntry.assignUid(); | 676 | replEntry.assignUid(); |
677 | 677 | ||
678 | m_abView -> replaceEntry( replEntry ); | 678 | m_abView -> replaceEntry( replEntry ); |
679 | } | 679 | } |
680 | } | 680 | } |
681 | // populateCategories(); | 681 | // populateCategories(); |
682 | 682 | ||
683 | } | 683 | } |
684 | 684 | ||
685 | void AddressbookWindow::editPersonal() | 685 | void AddressbookWindow::editPersonal() |
686 | { | 686 | { |
687 | OContact entry; | 687 | OContact entry; |
688 | if ( !abEditor ) { | 688 | if ( !abEditor ) { |
689 | abEditor = new ContactEditor( entry, this, "editor" ); | 689 | abEditor = new ContactEditor( entry, this, "editor" ); |
690 | } | 690 | } |
691 | 691 | ||
692 | abEditor->setCaption(tr("Edit My Personal Details")); | 692 | abEditor->setCaption(tr("Edit My Personal Details")); |
693 | abEditor->setPersonalView( true ); | 693 | abEditor->setPersonalView( true ); |
694 | editEntry( EditEntry ); | 694 | editEntry( EditEntry ); |
695 | abEditor->setPersonalView( false ); | 695 | abEditor->setPersonalView( false ); |
696 | 696 | ||
697 | } | 697 | } |
698 | 698 | ||
699 | 699 | ||
700 | void AddressbookWindow::slotPersonalView() | 700 | void AddressbookWindow::slotPersonalView() |
701 | { | 701 | { |
702 | if (!actionPersonal->isOn()) { | 702 | if (!actionPersonal->isOn()) { |
703 | // we just turned it off | 703 | // we just turned it off |
704 | setCaption( tr("Contacts") ); | 704 | setCaption( tr("Contacts") ); |
705 | actionNew->setEnabled(TRUE); | 705 | actionNew->setEnabled(TRUE); |
706 | actionTrash->setEnabled(TRUE); | 706 | actionTrash->setEnabled(TRUE); |
707 | actionFind->setEnabled(TRUE); | 707 | actionFind->setEnabled(TRUE); |
708 | actionMail->setEnabled(TRUE); | 708 | actionMail->setEnabled(TRUE); |
709 | // slotUpdateToolbar(); | 709 | // slotUpdateToolbar(); |
710 | 710 | ||
711 | m_abView->showPersonal( false ); | 711 | m_abView->showPersonal( false ); |
712 | 712 | ||
713 | return; | 713 | return; |
714 | } | 714 | } |
715 | 715 | ||
716 | // XXX need to disable some QActions. | 716 | // XXX need to disable some QActions. |
717 | actionNew->setEnabled(FALSE); | 717 | actionNew->setEnabled(FALSE); |
718 | actionTrash->setEnabled(FALSE); | 718 | actionTrash->setEnabled(FALSE); |
719 | actionFind->setEnabled(FALSE); | 719 | actionFind->setEnabled(FALSE); |
720 | actionMail->setEnabled(FALSE); | 720 | actionMail->setEnabled(FALSE); |
721 | 721 | ||
722 | setCaption( tr("Contacts - My Personal Details") ); | 722 | setCaption( tr("Contacts - My Personal Details") ); |
723 | 723 | ||
724 | m_abView->showPersonal( true ); | 724 | m_abView->showPersonal( true ); |
725 | 725 | ||
726 | } | 726 | } |
727 | 727 | ||
728 | 728 | ||
729 | void AddressbookWindow::listIsEmpty( bool empty ) | 729 | void AddressbookWindow::listIsEmpty( bool empty ) |
730 | { | 730 | { |
731 | if ( !empty ) { | 731 | if ( !empty ) { |
732 | deleteButton->setEnabled( TRUE ); | 732 | deleteButton->setEnabled( TRUE ); |
733 | } | 733 | } |
734 | } | 734 | } |
735 | 735 | ||
736 | void AddressbookWindow::reload() | 736 | void AddressbookWindow::reload() |
737 | { | 737 | { |
738 | syncing = FALSE; | 738 | syncing = FALSE; |
739 | m_abView->clear(); | 739 | m_abView->clear(); |
740 | m_abView->reload(); | 740 | m_abView->reload(); |
741 | } | 741 | } |
742 | 742 | ||
743 | void AddressbookWindow::flush() | 743 | void AddressbookWindow::flush() |
744 | { | 744 | { |
745 | syncing = TRUE; | 745 | syncing = TRUE; |
746 | m_abView->save(); | 746 | m_abView->save(); |
747 | } | 747 | } |
748 | 748 | ||
749 | 749 | ||
750 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 750 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
751 | { | 751 | { |
752 | 752 | ||
753 | if(syncing) { | 753 | if(syncing) { |
754 | /* shouldn't we save, I hear you say? well its already been set | 754 | /* shouldn't we save, I hear you say? well its already been set |
755 | so that an edit can not occur during a sync, and we flushed | 755 | so that an edit can not occur during a sync, and we flushed |
756 | at the start of the sync, so there is no need to save | 756 | at the start of the sync, so there is no need to save |
757 | Saving however itself would cause problems. */ | 757 | Saving however itself would cause problems. */ |
758 | e->accept(); | 758 | e->accept(); |
759 | return; | 759 | return; |
760 | } | 760 | } |
761 | //################## shouldn't always save | 761 | //################## shouldn't always save |
762 | // True, but the database handles this automatically ! (se) | 762 | // True, but the database handles this automatically ! (se) |
763 | if ( save() ) | 763 | if ( save() ) |
764 | e->accept(); | 764 | e->accept(); |
765 | else | 765 | else |
766 | e->ignore(); | 766 | e->ignore(); |
767 | } | 767 | } |
768 | 768 | ||
769 | /* | 769 | /* |
770 | Returns TRUE if it is OK to exit | 770 | Returns TRUE if it is OK to exit |
771 | */ | 771 | */ |
772 | 772 | ||
773 | bool AddressbookWindow::save() | 773 | bool AddressbookWindow::save() |
774 | { | 774 | { |
775 | if ( !m_abView->save() ) { | 775 | if ( !m_abView->save() ) { |
776 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 776 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
777 | tr("Unable to save information.\n" | 777 | tr("Unable to save information.\n" |
778 | "Free up some space\n" | 778 | "Free up some space\n" |
779 | "and try again.\n" | 779 | "and try again.\n" |
780 | "\nQuit anyway?"), | 780 | "\nQuit anyway?"), |
781 | QMessageBox::Yes|QMessageBox::Escape, | 781 | QMessageBox::Yes|QMessageBox::Escape, |
782 | QMessageBox::No|QMessageBox::Default ) | 782 | QMessageBox::No|QMessageBox::Default ) |
783 | != QMessageBox::No ) | 783 | != QMessageBox::No ) |
784 | return TRUE; | 784 | return TRUE; |
785 | else | 785 | else |
786 | return FALSE; | 786 | return FALSE; |
787 | } | 787 | } |
788 | return TRUE; | 788 | return TRUE; |
789 | } | 789 | } |
790 | 790 | ||
791 | #ifdef __DEBUG_RELEASE | 791 | #ifdef __DEBUG_RELEASE |
792 | void AddressbookWindow::slotSave() | 792 | void AddressbookWindow::slotSave() |
793 | { | 793 | { |
794 | save(); | 794 | save(); |
795 | } | 795 | } |
796 | #endif | 796 | #endif |
797 | 797 | ||
798 | 798 | ||
799 | void AddressbookWindow::slotNotFound() | 799 | void AddressbookWindow::slotNotFound() |
800 | { | 800 | { |
801 | qWarning("Got notfound signal !"); | 801 | qWarning("Got notfound signal !"); |
802 | QMessageBox::information( this, tr( "Not Found" ), | 802 | QMessageBox::information( this, tr( "Not Found" ), |
803 | tr( "Unable to find a contact for this" ) + "\n" | 803 | tr( "Unable to find a contact for this \n search pattern!" ) ); |
804 | + tr( "search pattern !" ) ); | ||
805 | 804 | ||
806 | 805 | ||
807 | } | 806 | } |
808 | void AddressbookWindow::slotWrapAround() | 807 | void AddressbookWindow::slotWrapAround() |
809 | { | 808 | { |
810 | qWarning("Got wrap signal !"); | 809 | qWarning("Got wrap signal !"); |
811 | // if ( doNotifyWrapAround ) | 810 | // if ( doNotifyWrapAround ) |
812 | // QMessageBox::information( this, tr( "End of list" ), | 811 | // QMessageBox::information( this, tr( "End of list" ), |
813 | // tr( "End of list. Wrap around now.. !" ) + "\n" ); | 812 | // tr( "End of list. Wrap around now.. !" ) + "\n" ); |
814 | 813 | ||
815 | } | 814 | } |
816 | 815 | ||
817 | void AddressbookWindow::slotSetCategory( int c ) | 816 | void AddressbookWindow::slotSetCategory( int c ) |
818 | { | 817 | { |
819 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); | 818 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); |
820 | 819 | ||
821 | QString cat, book; | 820 | QString cat, book; |
822 | AbView::Views view = AbView::TableView; | 821 | AbView::Views view = AbView::TableView; |
823 | 822 | ||
824 | if ( c <= 0 ) | 823 | if ( c <= 0 ) |
825 | return; | 824 | return; |
826 | 825 | ||
827 | // Checkmark Book Menu Item Selected | 826 | // Checkmark Book Menu Item Selected |
828 | if ( c < 3 ) | 827 | if ( c < 3 ) |
829 | for ( unsigned int i = 1; i < 3; i++ ) | 828 | for ( unsigned int i = 1; i < 3; i++ ) |
830 | catMenu->setItemChecked( i, c == (int)i ); | 829 | catMenu->setItemChecked( i, c == (int)i ); |
831 | // Checkmark Category Menu Item Selected | 830 | // Checkmark Category Menu Item Selected |
832 | else | 831 | else |
833 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) | 832 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) |
834 | catMenu->setItemChecked( i, c == (int)i ); | 833 | catMenu->setItemChecked( i, c == (int)i ); |
835 | 834 | ||
836 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 835 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
837 | if (catMenu->isItemChecked( i )) { | 836 | if (catMenu->isItemChecked( i )) { |
838 | if ( i == 1 ){ // default List view | 837 | if ( i == 1 ){ // default List view |
839 | book = QString::null; | 838 | book = QString::null; |
840 | view = AbView::TableView; | 839 | view = AbView::TableView; |
841 | }else if ( i == 2 ){ | 840 | }else if ( i == 2 ){ |
842 | book = tr( "Cards" ); | 841 | book = tr( "Cards" ); |
843 | view = AbView::CardView; | 842 | view = AbView::CardView; |
844 | // }else if ( i == 3 ){ | 843 | // }else if ( i == 3 ){ |
845 | // book = tr( "Personal" ); | 844 | // book = tr( "Personal" ); |
846 | // view = AbView:: PersonalView; | 845 | // view = AbView:: PersonalView; |
847 | }else if ( i == 3 ){ // default All Categories | 846 | }else if ( i == 3 ){ // default All Categories |
848 | cat = QString::null; | 847 | cat = QString::null; |
849 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled | 848 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled |
850 | cat = "Unfiled"; | 849 | cat = "Unfiled"; |
851 | qWarning ("Unfiled selected!!!"); | 850 | qWarning ("Unfiled selected!!!"); |
852 | }else{ | 851 | }else{ |
853 | cat = m_abView->categories()[i - 4]; | 852 | cat = m_abView->categories()[i - 4]; |
854 | } | 853 | } |
855 | } | 854 | } |
856 | } | 855 | } |
857 | 856 | ||
858 | slotViewSwitched( view ); | 857 | slotViewSwitched( view ); |
859 | 858 | ||
860 | m_abView -> setShowByCategory( view, cat ); | 859 | m_abView -> setShowByCategory( view, cat ); |
861 | 860 | ||
862 | if ( book.isEmpty() ) | 861 | if ( book.isEmpty() ) |
863 | book = "List"; | 862 | book = "List"; |
864 | if ( cat.isEmpty() ) | 863 | if ( cat.isEmpty() ) |
865 | cat = "All"; | 864 | cat = "All"; |
866 | 865 | ||
867 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); | 866 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); |
868 | } | 867 | } |
869 | 868 | ||
870 | void AddressbookWindow::slotViewSwitched( int view ) | 869 | void AddressbookWindow::slotViewSwitched( int view ) |
871 | { | 870 | { |
872 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); | 871 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); |
873 | int menu = 0; | 872 | int menu = 0; |
874 | switch ( view ){ | 873 | switch ( view ){ |
875 | case AbView::TableView: | 874 | case AbView::TableView: |
876 | menu = 1; | 875 | menu = 1; |
877 | m_tableViewButton->setOn(true); | 876 | m_tableViewButton->setOn(true); |
878 | m_cardViewButton->setOn(false); | 877 | m_cardViewButton->setOn(false); |
879 | break; | 878 | break; |
880 | case AbView::CardView: | 879 | case AbView::CardView: |
881 | menu = 2; | 880 | menu = 2; |
882 | m_tableViewButton->setOn(false); | 881 | m_tableViewButton->setOn(false); |
883 | m_cardViewButton->setOn(true); | 882 | m_cardViewButton->setOn(true); |
884 | break; | 883 | break; |
885 | // case AbView::PersonalView: | 884 | // case AbView::PersonalView: |
886 | // menu = 3; | 885 | // menu = 3; |
887 | // break; | 886 | // break; |
888 | // case AbView::CompanyBook: | 887 | // case AbView::CompanyBook: |
889 | // menu = 3; | 888 | // menu = 3; |
890 | // break; | 889 | // break; |
891 | // case AbView::EmailBook: | 890 | // case AbView::EmailBook: |
892 | // menu = 4; | 891 | // menu = 4; |
893 | // break; | 892 | // break; |
894 | } | 893 | } |
895 | for ( unsigned int i = 1; i < 3; i++ ){ | 894 | for ( unsigned int i = 1; i < 3; i++ ){ |
896 | if ( catMenu ) | 895 | if ( catMenu ) |
897 | catMenu->setItemChecked( i, menu == (int)i ); | 896 | catMenu->setItemChecked( i, menu == (int)i ); |
898 | } | 897 | } |
899 | } | 898 | } |
900 | 899 | ||
901 | 900 | ||
902 | void AddressbookWindow::slotListView() | 901 | void AddressbookWindow::slotListView() |
903 | { | 902 | { |
904 | emit slotSetCategory( AbView::TableView +1 ); | 903 | emit slotSetCategory( AbView::TableView +1 ); |
905 | } | 904 | } |
906 | 905 | ||
907 | void AddressbookWindow::slotCardView() | 906 | void AddressbookWindow::slotCardView() |
908 | { | 907 | { |
909 | emit slotSetCategory( AbView::CardView +1 ); | 908 | emit slotSetCategory( AbView::CardView +1 ); |
910 | } | 909 | } |
911 | 910 | ||
912 | void AddressbookWindow::slotSetLetter( char c ) { | 911 | void AddressbookWindow::slotSetLetter( char c ) { |
913 | 912 | ||
914 | m_abView->setShowByLetter( c ); | 913 | m_abView->setShowByLetter( c ); |
915 | 914 | ||
916 | } | 915 | } |
917 | 916 | ||
918 | 917 | ||
919 | void AddressbookWindow::populateCategories() | 918 | void AddressbookWindow::populateCategories() |
920 | { | 919 | { |
921 | catMenu->clear(); | 920 | catMenu->clear(); |
922 | 921 | ||
923 | int id, rememberId; | 922 | int id, rememberId; |
924 | id = 1; | 923 | id = 1; |
925 | rememberId = 0; | 924 | rememberId = 0; |
926 | 925 | ||
927 | catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ ); | 926 | catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ ); |
928 | catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ ); | 927 | catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ ); |
929 | // catMenu->insertItem( tr( "Personal" ), id++ ); | 928 | // catMenu->insertItem( tr( "Personal" ), id++ ); |
930 | catMenu->insertSeparator(); | 929 | catMenu->insertSeparator(); |
931 | 930 | ||
932 | catMenu->insertItem( tr( "All" ), id++ ); | 931 | catMenu->insertItem( tr( "All" ), id++ ); |