summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp6
-rw-r--r--kaddressbook/extensionmanager.cpp7
-rw-r--r--kaddressbook/filter.cpp21
-rw-r--r--kaddressbook/kabcore.cpp87
-rw-r--r--kaddressbook/kabcore.h3
-rw-r--r--kaddressbook/kabprefs.cpp2
-rw-r--r--kaddressbook/kcmconfigs/addresseewidget.cpp11
-rw-r--r--kaddressbook/nameeditdialog.cpp8
8 files changed, 113 insertions, 32 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 3397e06..c6993e9 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -728,619 +728,621 @@ void AddresseeEditorWidget::setupTab2_1()
728 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 ); 728 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 );
729 layout->setMargin( KDialogBase::marginHintSmall() ); 729 layout->setMargin( KDialogBase::marginHintSmall() );
730 layout->setSpacing( KDialogBase::spacingHintSmall() ); 730 layout->setSpacing( KDialogBase::spacingHintSmall() );
731 731
732 QLabel *label; 732 QLabel *label;
733 KSeparator* bar; 733 KSeparator* bar;
734 734
735/*US 735/*US
736 /////////////////////// 736 ///////////////////////
737 // Office info 737 // Office info
738 738
739 // Department 739 // Department
740 label = new QLabel( tab2 ); 740 label = new QLabel( tab2 );
741//US loadIcon call is ambiguous. Add one more parameter 741//US loadIcon call is ambiguous. Add one more parameter
742//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 742//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
743 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 743 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
744 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 744 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
745 745
746 label = new QLabel( i18n( "Department:" ), tab2 ); 746 label = new QLabel( i18n( "Department:" ), tab2 );
747 layout->addWidget( label, 0, 1 ); 747 layout->addWidget( label, 0, 1 );
748 mDepartmentEdit = new KLineEdit( tab2 ); 748 mDepartmentEdit = new KLineEdit( tab2 );
749 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 749 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
750 SLOT( textChanged( const QString& ) ) ); 750 SLOT( textChanged( const QString& ) ) );
751 label->setBuddy( mDepartmentEdit ); 751 label->setBuddy( mDepartmentEdit );
752 layout->addWidget( mDepartmentEdit, 0, 2 ); 752 layout->addWidget( mDepartmentEdit, 0, 2 );
753 753
754 label = new QLabel( i18n( "Office:" ), tab2 ); 754 label = new QLabel( i18n( "Office:" ), tab2 );
755 layout->addWidget( label, 1, 1 ); 755 layout->addWidget( label, 1, 1 );
756 mOfficeEdit = new KLineEdit( tab2 ); 756 mOfficeEdit = new KLineEdit( tab2 );
757 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 757 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
758 SLOT( textChanged( const QString& ) ) ); 758 SLOT( textChanged( const QString& ) ) );
759 label->setBuddy( mOfficeEdit ); 759 label->setBuddy( mOfficeEdit );
760 layout->addWidget( mOfficeEdit, 1, 2 ); 760 layout->addWidget( mOfficeEdit, 1, 2 );
761 761
762 label = new QLabel( i18n( "Profession:" ), tab2 ); 762 label = new QLabel( i18n( "Profession:" ), tab2 );
763 layout->addWidget( label, 2, 1 ); 763 layout->addWidget( label, 2, 1 );
764 mProfessionEdit = new KLineEdit( tab2 ); 764 mProfessionEdit = new KLineEdit( tab2 );
765 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 765 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
766 SLOT( textChanged( const QString& ) ) ); 766 SLOT( textChanged( const QString& ) ) );
767 label->setBuddy( mProfessionEdit ); 767 label->setBuddy( mProfessionEdit );
768 layout->addWidget( mProfessionEdit, 2, 2 ); 768 layout->addWidget( mProfessionEdit, 2, 2 );
769 769
770 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 770 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
771 layout->addWidget( label, 0, 3 ); 771 layout->addWidget( label, 0, 3 );
772 mManagerEdit = new KLineEdit( tab2 ); 772 mManagerEdit = new KLineEdit( tab2 );
773 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 773 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
774 SLOT( textChanged( const QString& ) ) ); 774 SLOT( textChanged( const QString& ) ) );
775 label->setBuddy( mManagerEdit ); 775 label->setBuddy( mManagerEdit );
776 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 776 layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
777 777
778 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 778 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
779 layout->addWidget( label, 1, 3 ); 779 layout->addWidget( label, 1, 3 );
780 mAssistantEdit = new KLineEdit( tab2 ); 780 mAssistantEdit = new KLineEdit( tab2 );
781 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 781 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
782 SLOT( textChanged( const QString& ) ) ); 782 SLOT( textChanged( const QString& ) ) );
783 label->setBuddy( mAssistantEdit ); 783 label->setBuddy( mAssistantEdit );
784 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 784 layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
785 785
786 bar = new KSeparator( KSeparator::HLine, tab2 ); 786 bar = new KSeparator( KSeparator::HLine, tab2 );
787 layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 787 layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
788 788
789 ///////////////////////////////////////////////// 789 /////////////////////////////////////////////////
790 // Personal info 790 // Personal info
791 791
792 label = new QLabel( tab2 ); 792 label = new QLabel( tab2 );
793//US loadIcon call is ambiguous. Add one more parameter 793//US loadIcon call is ambiguous. Add one more parameter
794//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 794//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
795 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 795 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
796 layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 796 layout->addMultiCellWidget( label, 4, 5, 0, 0 );
797 797
798 label = new QLabel( i18n( "Nick name:" ), tab2 ); 798 label = new QLabel( i18n( "Nick name:" ), tab2 );
799 layout->addWidget( label, 4, 1 ); 799 layout->addWidget( label, 4, 1 );
800 mNicknameEdit = new KLineEdit( tab2 ); 800 mNicknameEdit = new KLineEdit( tab2 );
801 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 801 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
802 SLOT( textChanged( const QString& ) ) ); 802 SLOT( textChanged( const QString& ) ) );
803 label->setBuddy( mNicknameEdit ); 803 label->setBuddy( mNicknameEdit );
804 layout->addWidget( mNicknameEdit, 4, 2 ); 804 layout->addWidget( mNicknameEdit, 4, 2 );
805 805
806 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 806 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
807 layout->addWidget( label, 5, 1 ); 807 layout->addWidget( label, 5, 1 );
808 mSpouseEdit = new KLineEdit( tab2 ); 808 mSpouseEdit = new KLineEdit( tab2 );
809 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 809 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
810 SLOT( textChanged( const QString& ) ) ); 810 SLOT( textChanged( const QString& ) ) );
811 label->setBuddy( mSpouseEdit ); 811 label->setBuddy( mSpouseEdit );
812 layout->addWidget( mSpouseEdit, 5, 2 ); 812 layout->addWidget( mSpouseEdit, 5, 2 );
813 813
814 label = new QLabel( i18n( "Birthday:" ), tab2 ); 814 label = new QLabel( i18n( "Birthday:" ), tab2 );
815 layout->addWidget( label, 4, 3 ); 815 layout->addWidget( label, 4, 3 );
816 mBirthdayPicker = new KDateEdit( tab2 ); 816 mBirthdayPicker = new KDateEdit( tab2 );
817 mBirthdayPicker->setHandleInvalid( true ); 817 mBirthdayPicker->setHandleInvalid( true );
818 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 818 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
819 SLOT( dateChanged( QDate ) ) ); 819 SLOT( dateChanged( QDate ) ) );
820 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ), 820 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ),
821 SLOT( invalidDate() ) ); 821 SLOT( invalidDate() ) );
822 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ), 822 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ),
823 SLOT( emitModified() ) ); 823 SLOT( emitModified() ) );
824 label->setBuddy( mBirthdayPicker ); 824 label->setBuddy( mBirthdayPicker );
825 layout->addWidget( mBirthdayPicker, 4, 4 ); 825 layout->addWidget( mBirthdayPicker, 4, 4 );
826 826
827 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 827 label = new QLabel( i18n( "Anniversary:" ), tab2 );
828 layout->addWidget( label, 5, 3 ); 828 layout->addWidget( label, 5, 3 );
829 mAnniversaryPicker = new KDateEdit( tab2 ); 829 mAnniversaryPicker = new KDateEdit( tab2 );
830 mAnniversaryPicker->setHandleInvalid( true ); 830 mAnniversaryPicker->setHandleInvalid( true );
831 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 831 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
832 SLOT( dateChanged( QDate ) ) ); 832 SLOT( dateChanged( QDate ) ) );
833 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ), 833 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ),
834 SLOT( invalidDate() ) ); 834 SLOT( invalidDate() ) );
835 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ), 835 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ),
836 SLOT( emitModified() ) ); 836 SLOT( emitModified() ) );
837 label->setBuddy( mAnniversaryPicker ); 837 label->setBuddy( mAnniversaryPicker );
838 layout->addWidget( mAnniversaryPicker, 5, 4 ); 838 layout->addWidget( mAnniversaryPicker, 5, 4 );
839 839
840 bar = new KSeparator( KSeparator::HLine, tab2 ); 840 bar = new KSeparator( KSeparator::HLine, tab2 );
841 layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); 841 layout->addMultiCellWidget( bar, 6, 6, 0, 5 );
842*/ 842*/
843 ////////////////////////////////////// 843 //////////////////////////////////////
844 // Notes 844 // Notes
845 label = new QLabel( i18n( "Note:" ), tab2_2 ); 845 label = new QLabel( i18n( "Note:" ), tab2_2 );
846 label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); 846 label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
847//US layout->addWidget( label, 7, 0 ); 847//US layout->addWidget( label, 7, 0 );
848 layout->addWidget( label, 0, 0 ); 848 layout->addWidget( label, 0, 0 );
849#ifndef KAB_EMBEDDED 849#ifndef KAB_EMBEDDED
850 mNoteEdit = new QTextEdit( tab2_2 ); 850 mNoteEdit = new QTextEdit( tab2_2 );
851 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); 851 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
852 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 852 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
853#else //KAB_EMBEDDED 853#else //KAB_EMBEDDED
854 mNoteEdit = new QMultiLineEdit( tab2_2 ); 854 mNoteEdit = new QMultiLineEdit( tab2_2 );
855 mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth ); 855 mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth );
856 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 856 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
857#endif //KAB_EMBEDDED 857#endif //KAB_EMBEDDED
858 858
859 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) ); 859 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) );
860 label->setBuddy( mNoteEdit ); 860 label->setBuddy( mNoteEdit );
861//US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 ); 861//US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 );
862 layout->addWidget( mNoteEdit, 1, 0); 862 layout->addWidget( mNoteEdit, 1, 0);
863 863
864 // Build the layout and add to the tab widget 864 // Build the layout and add to the tab widget
865 layout->activate(); // required 865 layout->activate(); // required
866 866
867 mTabWidget->addTab( tab2_2, i18n( "&Notes" ) ); 867 mTabWidget->addTab( tab2_2, i18n( "&Notes" ) );
868} 868}
869 869
870 870
871 871
872void AddresseeEditorWidget::setupTab3() 872void AddresseeEditorWidget::setupTab3()
873{ 873{
874 // This is the Misc tab 874 // This is the Misc tab
875 QWidget *tab3 = new QWidget( mTabWidget ); 875 QWidget *tab3 = new QWidget( mTabWidget );
876 876
877 QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); 877 QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
878 layout->setMargin( KDialogBase::marginHintSmall() ); 878 layout->setMargin( KDialogBase::marginHintSmall() );
879 layout->setSpacing( KDialogBase::spacingHintSmall() ); 879 layout->setSpacing( KDialogBase::spacingHintSmall() );
880//US layout->setColStretch( 2, 1 ); 880//US layout->setColStretch( 2, 1 );
881 881
882 ////////////////////////////////////// 882 //////////////////////////////////////
883 // Geo 883 // Geo
884 mGeoWidget = new GeoWidget( tab3 ); 884 mGeoWidget = new GeoWidget( tab3 );
885 // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); 885 // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
886 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 886 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
887 layout->addWidget( mGeoWidget, 0, 0 ); 887 layout->addWidget( mGeoWidget, 0, 0 );
888/*US 888/*US
889 ////////////////////////////////////// 889 //////////////////////////////////////
890 // Sound 890 // Sound
891#ifndef KAB_EMBEDDED 891#ifndef KAB_EMBEDDED
892 mSoundWidget = new SoundWidget( tab3 ); 892 mSoundWidget = new SoundWidget( tab3 );
893 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 893 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
894 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 894 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
895 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 895 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
896#else //KAB_EMBEDDED 896#else //KAB_EMBEDDED
897qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 897qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
898#endif //KAB_EMBEDDED 898#endif //KAB_EMBEDDED
899 899
900 ////////////////////////////////////// 900 //////////////////////////////////////
901 // Images 901 // Images
902 mImageWidget = new ImageWidget( tab3 ); 902 mImageWidget = new ImageWidget( tab3 );
903 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 903 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
904 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 904 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
905 layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop ); 905 layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop );
906*/ 906*/
907//US 907//US
908/* 908/*
909 KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 ); 909 KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 );
910 layout->addMultiCellWidget( bar, 1, 1, 0, 0 ); 910 layout->addMultiCellWidget( bar, 1, 1, 0, 0 );
911*/ 911*/
912 ////////////////////////////////////// 912 //////////////////////////////////////
913 // Keys 913 // Keys
914 mKeyWidget = new KeyWidget( tab3 ); 914 mKeyWidget = new KeyWidget( tab3 );
915 //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 915 //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
916 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 916 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
917//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 917//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
918 layout->addWidget( mKeyWidget, 1, 0 ); 918 layout->addWidget( mKeyWidget, 1, 0 );
919 919
920 mTabWidget->addTab( tab3, i18n( "&Misc" ) ); 920 mTabWidget->addTab( tab3, i18n( "&Misc" ) );
921} 921}
922 922
923void AddresseeEditorWidget::setupTab3_1() 923void AddresseeEditorWidget::setupTab3_1()
924{ 924{
925 // This is the Misc tab 925 // This is the Misc tab
926 QWidget *tab3 = new QWidget( mTabWidget ); 926 QWidget *tab3 = new QWidget( mTabWidget );
927 927
928//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 ); 928//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 );
929 QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); 929 QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
930 layout->setMargin( KDialogBase::marginHint() ); 930 layout->setMargin( KDialogBase::marginHint() );
931 layout->setSpacing( KDialogBase::spacingHint() ); 931 layout->setSpacing( KDialogBase::spacingHint() );
932//US layout->setColStretch( 2, 1 ); 932//US layout->setColStretch( 2, 1 );
933 933
934/*US 934/*US
935 ////////////////////////////////////// 935 //////////////////////////////////////
936 // Geo 936 // Geo
937 mGeoWidget = new GeoWidget( tab3 ); 937 mGeoWidget = new GeoWidget( tab3 );
938 mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); 938 mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
939 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 939 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
940 layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop ); 940 layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop );
941*/ 941*/
942 ////////////////////////////////////// 942 //////////////////////////////////////
943 // Sound 943 // Sound
944#ifndef KAB_EMBEDDED 944#ifndef KAB_EMBEDDED
945 mSoundWidget = new SoundWidget( tab3 ); 945 mSoundWidget = new SoundWidget( tab3 );
946 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 946 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
947 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 947 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
948 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 948 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
949#else //KAB_EMBEDDED 949#else //KAB_EMBEDDED
950//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 950//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
951#endif //KAB_EMBEDDED 951#endif //KAB_EMBEDDED
952 952
953 ////////////////////////////////////// 953 //////////////////////////////////////
954 // Images 954 // Images
955 mImageWidget = new ImageWidget( tab3 ); 955 mImageWidget = new ImageWidget( tab3 );
956 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 956 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
957 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 957 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
958 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop ); 958 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop );
959/*US 959/*US
960 ////////////////////////////////////// 960 //////////////////////////////////////
961 // Keys 961 // Keys
962 mKeyWidget = new KeyWidget( tab3 ); 962 mKeyWidget = new KeyWidget( tab3 );
963 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 963 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
964 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 964 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
965 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 965 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
966*/ 966*/
967 mTabWidget->addTab( tab3, i18n( "&Images" ) ); 967 mTabWidget->addTab( tab3, i18n( "&Images" ) );
968} 968}
969 969
970 970
971void AddresseeEditorWidget::load() 971void AddresseeEditorWidget::load()
972{ 972{
973 973
974 // Block signals in case anything tries to emit modified 974 // Block signals in case anything tries to emit modified
975 // CS: This doesn't seem to work. 975 // CS: This doesn't seem to work.
976 bool block = signalsBlocked(); 976 bool block = signalsBlocked();
977 blockSignals( true ); 977 blockSignals( true );
978 mBlockSignals = true; // used for internal signal blocking 978 mBlockSignals = true; // used for internal signal blocking
979 979
980 mNameEdit->setText( mAddressee.assembledName() ); 980 mNameEdit->setText( mAddressee.assembledName() );
981 981
982 if ( mAddressee.formattedName().isEmpty() ) { 982 if ( mAddressee.formattedName().isEmpty() ) {
983//US KConfig config( "kaddressbookrc" ); 983//US KConfig config( "kaddressbookrc" );
984 KConfig config( locateLocal("config", "kaddressbookrc") ); 984 KConfig config( locateLocal("config", "kabcrc") );
985 config.setGroup( "General" ); 985 config.setGroup( "General" );
986 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 ); 986 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 );
987 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 987 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
988 } else { 988 } else {;
989 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) ) 989 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) )
990 mFormattedNameType = NameEditDialog::SimpleName; 990 mFormattedNameType = NameEditDialog::SimpleName;
991 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) ) 991 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) )
992 mFormattedNameType = NameEditDialog::FullName; 992 mFormattedNameType = NameEditDialog::FullName;
993 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) ) 993 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) )
994 mFormattedNameType = NameEditDialog::ReverseName; 994 mFormattedNameType = NameEditDialog::ReverseName;
995 else 995 else
996 mFormattedNameType = NameEditDialog::CustomName; 996 mFormattedNameType = NameEditDialog::CustomName;
997 } 997 }
998 998
999 mFormattedNameLabel->setText( mAddressee.formattedName() ); 999 mFormattedNameLabel->setText( mAddressee.formattedName() );
1000 1000
1001 mRoleEdit->setText( mAddressee.role() ); 1001 mRoleEdit->setText( mAddressee.role() );
1002 mOrgEdit->setText( mAddressee.organization() ); 1002 mOrgEdit->setText( mAddressee.organization() );
1003 1003
1004//US mURLEdit->setURL( mAddressee.url().url() ); 1004//US mURLEdit->setURL( mAddressee.url().url() );
1005 mURLEdit->setText( mAddressee.url().prettyURL() ); 1005 mURLEdit->setText( mAddressee.url().prettyURL() );
1006//US?? mURLEdit->home( false ); 1006//US?? mURLEdit->home( false );
1007 1007
1008 // mNoteEdit->setText( mAddressee.note() ); 1008 // mNoteEdit->setText( mAddressee.note() );
1009 mNoteEdit->setText( mAddressee.note() ); 1009 mNoteEdit->setText( mAddressee.note() );
1010 mEmailWidget->setEmails( mAddressee.emails() ); 1010 mEmailWidget->setEmails( mAddressee.emails() );
1011 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() ); 1011 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() );
1012 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() ); 1012 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() );
1013 mBirthdayPicker->setDate( mAddressee.birthday().date() ); 1013 mBirthdayPicker->setDate( mAddressee.birthday().date() );
1014 1014
1015//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom( 1015//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom(
1016//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) ); 1016//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) );
1017 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 1017 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1018 "%Y-%m-%d"); // = Qt::ISODate 1018 "%Y-%m-%d"); // = Qt::ISODate
1019 mAnniversaryPicker->setDate( dt ); 1019 mAnniversaryPicker->setDate( dt );
1020 1020
1021 1021
1022 mNicknameEdit->setText( mAddressee.nickName() ); 1022 mNicknameEdit->setText( mAddressee.nickName() );
1023 mCategoryEdit->setText( mAddressee.categories().join( "," ) ); 1023 mCategoryEdit->setText( mAddressee.categories().join( "," ) );
1024 1024
1025 mGeoWidget->setGeo( mAddressee.geo() ); 1025 mGeoWidget->setGeo( mAddressee.geo() );
1026 mImageWidget->setPhoto( mAddressee.photo() ); 1026 mImageWidget->setPhoto( mAddressee.photo() );
1027 mImageWidget->setLogo( mAddressee.logo() ); 1027 mImageWidget->setLogo( mAddressee.logo() );
1028 mKeyWidget->setKeys( mAddressee.keys() ); 1028 mKeyWidget->setKeys( mAddressee.keys() );
1029 mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); 1029 mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
1030#ifndef KAB_EMBEDDED 1030#ifndef KAB_EMBEDDED
1031 mSoundWidget->setSound( mAddressee.sound() ); 1031 mSoundWidget->setSound( mAddressee.sound() );
1032#else //KAB_EMBEDDED 1032#else //KAB_EMBEDDED
1033//US qDebug("AddresseeEditorWidget::load has to be changed 2"); 1033//US qDebug("AddresseeEditorWidget::load has to be changed 2");
1034#endif //KAB_EMBEDDED 1034#endif //KAB_EMBEDDED
1035 1035
1036 // Load customs 1036 // Load customs
1037 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); 1037 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
1038 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); 1038 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
1039 mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) ); 1039 mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) );
1040 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); 1040 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) );
1041 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); 1041 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) );
1042 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); 1042 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
1043 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); 1043 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
1044 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); 1044 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
1045 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); 1045 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
1046 if ( gen == "female" ) 1046 if ( gen == "female" )
1047 mGenderBox->setCurrentItem ( 1 ); 1047 mGenderBox->setCurrentItem ( 1 );
1048 else if ( gen == "male" ) 1048 else if ( gen == "male" )
1049 mGenderBox->setCurrentItem ( 2 ); 1049 mGenderBox->setCurrentItem ( 2 );
1050 else 1050 else
1051 mGenderBox->setCurrentItem ( 0 ); 1051 mGenderBox->setCurrentItem ( 0 );
1052 blockSignals( block ); 1052 blockSignals( block );
1053 mBlockSignals = false; 1053 mBlockSignals = false;
1054 1054
1055 mDirty = false; 1055 mDirty = false;
1056} 1056}
1057 1057
1058void AddresseeEditorWidget::save() 1058void AddresseeEditorWidget::save()
1059{ 1059{
1060 if ( !dirty() ) { 1060 if ( !dirty() ) {
1061 return; 1061 return;
1062 } 1062 }
1063 1063
1064 mAddressee.setRevision( QDateTime::currentDateTime() ); 1064 mAddressee.setRevision( QDateTime::currentDateTime() );
1065 1065
1066 mAddressee.setRole( mRoleEdit->text() ); 1066 mAddressee.setRole( mRoleEdit->text() );
1067 mAddressee.setOrganization( mOrgEdit->text() ); 1067 mAddressee.setOrganization( mOrgEdit->text() );
1068 mAddressee.setUrl( KURL( mURLEdit->text() ) ); 1068 mAddressee.setUrl( KURL( mURLEdit->text() ) );
1069 mAddressee.setNote( mNoteEdit->text() ); 1069 mAddressee.setNote( mNoteEdit->text() );
1070 if ( mBirthdayPicker->inputIsValid() ) { 1070 if ( mBirthdayPicker->inputIsValid() ) {
1071 QDate da = mBirthdayPicker->date(); 1071 QDate da = mBirthdayPicker->date();
1072 if ( da > QDate::currentDate() ) 1072 if ( da > QDate::currentDate() )
1073 da.setYMD(da.year()-100, da.month(), da.day() ); 1073 da.setYMD(da.year()-100, da.month(), da.day() );
1074 mAddressee.setBirthday( QDateTime( da ) ); 1074 mAddressee.setBirthday( QDateTime( da ) );
1075 //qDebug("bday %s ",da.toString().latin1()); 1075 //qDebug("bday %s ",da.toString().latin1());
1076 } 1076 }
1077 else { 1077 else {
1078 mAddressee.setBirthday( QDateTime() ); 1078 mAddressee.setBirthday( QDateTime() );
1079 mBirthdayPicker->clear(); 1079 mBirthdayPicker->clear();
1080 } 1080 }
1081 mAddressee.setNickName( mNicknameEdit->text() ); 1081 mAddressee.setNickName( mNicknameEdit->text() );
1082 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); 1082 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
1083 1083
1084 mAddressee.setGeo( mGeoWidget->geo() ); 1084 mAddressee.setGeo( mGeoWidget->geo() );
1085 mAddressee.setPhoto( mImageWidget->photo() ); 1085 mAddressee.setPhoto( mImageWidget->photo() );
1086 mAddressee.setLogo( mImageWidget->logo() ); 1086 mAddressee.setLogo( mImageWidget->logo() );
1087 mAddressee.setKeys( mKeyWidget->keys() ); 1087 mAddressee.setKeys( mKeyWidget->keys() );
1088#ifndef KAB_EMBEDDED 1088#ifndef KAB_EMBEDDED
1089 mAddressee.setSound( mSoundWidget->sound() ); 1089 mAddressee.setSound( mSoundWidget->sound() );
1090#else //KAB_EMBEDDED 1090#else //KAB_EMBEDDED
1091//US qDebug("AddresseeEditorWidget::save sound not supported"); 1091//US qDebug("AddresseeEditorWidget::save sound not supported");
1092#endif //KAB_EMBEDDED 1092#endif //KAB_EMBEDDED
1093 mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); 1093 mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
1094 1094
1095 // save custom fields 1095 // save custom fields
1096 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); 1096 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
1097 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); 1097 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
1098 mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); 1098 mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() );
1099 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); 1099 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
1100 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); 1100 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
1101 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); 1101 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
1102 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); 1102 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
1103 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); 1103 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
1104 if ( mAnniversaryPicker->inputIsValid() ) { 1104 if ( mAnniversaryPicker->inputIsValid() ) {
1105 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); 1105 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
1106 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 1106 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
1107 } 1107 }
1108 else { 1108 else {
1109 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); 1109 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
1110 mAnniversaryPicker->clear(); 1110 mAnniversaryPicker->clear();
1111 } 1111 }
1112 int gen = mGenderBox->currentItem (); 1112 int gen = mGenderBox->currentItem ();
1113 if ( gen == 1 ) 1113 if ( gen == 1 )
1114 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); 1114 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female");
1115 else if ( gen == 2 ) 1115 else if ( gen == 2 )
1116 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); 1116 mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
1117 else 1117 else
1118 mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); 1118 mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" );
1119 1119
1120 // Save the email addresses 1120 // Save the email addresses
1121 QStringList emails = mAddressee.emails(); 1121 QStringList emails = mAddressee.emails();
1122 QStringList::Iterator iter; 1122 QStringList::Iterator iter;
1123 for ( iter = emails.begin(); iter != emails.end(); ++iter ) 1123 for ( iter = emails.begin(); iter != emails.end(); ++iter )
1124 mAddressee.removeEmail( *iter ); 1124 mAddressee.removeEmail( *iter );
1125 1125
1126 emails = mEmailWidget->emails(); 1126 emails = mEmailWidget->emails();
1127 bool first = true; 1127 bool first = true;
1128 for ( iter = emails.begin(); iter != emails.end(); ++iter ) { 1128 for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
1129 mAddressee.insertEmail( *iter, first ); 1129 mAddressee.insertEmail( *iter, first );
1130 first = false; 1130 first = false;
1131 } 1131 }
1132 1132
1133 // Save the phone numbers 1133 // Save the phone numbers
1134 KABC::PhoneNumber::List phoneNumbers; 1134 KABC::PhoneNumber::List phoneNumbers;
1135 KABC::PhoneNumber::List::Iterator phoneIter; 1135 KABC::PhoneNumber::List::Iterator phoneIter;
1136 phoneNumbers = mAddressee.phoneNumbers(); 1136 phoneNumbers = mAddressee.phoneNumbers();
1137 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1137 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1138 ++phoneIter ) 1138 ++phoneIter )
1139 mAddressee.removePhoneNumber( *phoneIter ); 1139 mAddressee.removePhoneNumber( *phoneIter );
1140 1140
1141 phoneNumbers = mPhoneEditWidget->phoneNumbers(); 1141 phoneNumbers = mPhoneEditWidget->phoneNumbers();
1142 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1142 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1143 ++phoneIter ) 1143 ++phoneIter )
1144 mAddressee.insertPhoneNumber( *phoneIter ); 1144 mAddressee.insertPhoneNumber( *phoneIter );
1145 1145
1146 // Save the addresses 1146 // Save the addresses
1147 KABC::Address::List addresses; 1147 KABC::Address::List addresses;
1148 KABC::Address::List::Iterator addressIter; 1148 KABC::Address::List::Iterator addressIter;
1149 addresses = mAddressee.addresses(); 1149 addresses = mAddressee.addresses();
1150 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1150 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1151 ++addressIter ) 1151 ++addressIter )
1152 mAddressee.removeAddress( *addressIter ); 1152 mAddressee.removeAddress( *addressIter );
1153 1153
1154 addresses = mAddressEditWidget->addresses(); 1154 addresses = mAddressEditWidget->addresses();
1155 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1155 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1156 ++addressIter ) 1156 ++addressIter )
1157 mAddressee.insertAddress( *addressIter ); 1157 mAddressee.insertAddress( *addressIter );
1158 mDirty = false; 1158 mDirty = false;
1159} 1159}
1160 1160
1161bool AddresseeEditorWidget::dirty() 1161bool AddresseeEditorWidget::dirty()
1162{ 1162{
1163 1163
1164 if ( ! mDirty ) { 1164 if ( ! mDirty ) {
1165 if ( mBirthdayPicker->inputIsValid() ) { 1165 if ( mBirthdayPicker->inputIsValid() ) {
1166 QDate da = mBirthdayPicker->date(); 1166 QDate da = mBirthdayPicker->date();
1167 if ( !(da == mAddressee.birthday().date())) 1167 if ( !(da == mAddressee.birthday().date()))
1168 mDirty = true; 1168 mDirty = true;
1169 } 1169 }
1170 else { 1170 else {
1171 mBirthdayPicker->clear(); 1171 mBirthdayPicker->clear();
1172 } 1172 }
1173 if ( mAnniversaryPicker->inputIsValid() ) { 1173 if ( mAnniversaryPicker->inputIsValid() ) {
1174 QDate da = mAnniversaryPicker->date(); 1174 QDate da = mAnniversaryPicker->date();
1175 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 1175 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1176 "%Y-%m-%d")) 1176 "%Y-%m-%d"))
1177 mDirty = true; 1177 mDirty = true;
1178 } 1178 }
1179 else { 1179 else {
1180 mAnniversaryPicker->clear(); 1180 mAnniversaryPicker->clear();
1181 } 1181 }
1182 } 1182 }
1183 return mDirty; 1183 return mDirty;
1184} 1184}
1185 1185
1186void AddresseeEditorWidget::nameTextChanged( const QString &text ) 1186void AddresseeEditorWidget::nameTextChanged( const QString &text )
1187{ 1187{
1188 if ( mBlockSignals )
1189 return;
1188 // use the addressee class to parse the name for us 1190 // use the addressee class to parse the name for us
1189 mAConfig->setUid( mAddressee.uid() ); 1191 mAConfig->setUid( mAddressee.uid() );
1190 if ( mAConfig->automaticNameParsing() ) { 1192 if ( mAConfig->automaticNameParsing() ) {
1191 if ( !mAddressee.formattedName().isEmpty() ) { 1193 if ( !mAddressee.formattedName().isEmpty() ) {
1192 QString fn = mAddressee.formattedName(); 1194 QString fn = mAddressee.formattedName();
1193 mAddressee.setNameFromString( text ); 1195 mAddressee.setNameFromString( text );
1194 mAddressee.setFormattedName( fn ); 1196 mAddressee.setFormattedName( fn );
1195 } else { 1197 } else {
1196 // use extra addressee to avoid a formatted name assignment 1198 // use extra addressee to avoid a formatted name assignment
1197 Addressee addr; 1199 Addressee addr;
1198 addr.setNameFromString( text ); 1200 addr.setNameFromString( text );
1199 mAddressee.setPrefix( addr.prefix() ); 1201 mAddressee.setPrefix( addr.prefix() );
1200 mAddressee.setGivenName( addr.givenName() ); 1202 mAddressee.setGivenName( addr.givenName() );
1201 mAddressee.setAdditionalName( addr.additionalName() ); 1203 mAddressee.setAdditionalName( addr.additionalName() );
1202 mAddressee.setFamilyName( addr.familyName() ); 1204 mAddressee.setFamilyName( addr.familyName() );
1203 mAddressee.setSuffix( addr.suffix() ); 1205 mAddressee.setSuffix( addr.suffix() );
1204 } 1206 }
1205 } 1207 }
1206 1208
1207 nameBoxChanged(); 1209 nameBoxChanged();
1208 1210
1209 emitModified(); 1211 emitModified();
1210} 1212}
1211 1213
1212void AddresseeEditorWidget::nameBoxChanged() 1214void AddresseeEditorWidget::nameBoxChanged()
1213{ 1215{
1214 KABC::Addressee addr; 1216 KABC::Addressee addr;
1215 mAConfig->setUid( mAddressee.uid() ); 1217 mAConfig->setUid( mAddressee.uid() );
1216 if ( mAConfig->automaticNameParsing() ) { 1218 if ( mAConfig->automaticNameParsing() ) {
1217 addr.setNameFromString( mNameEdit->text() ); 1219 addr.setNameFromString( mNameEdit->text() );
1218 mNameLabel->hide(); 1220 mNameLabel->hide();
1219 mNameEdit->show(); 1221 mNameEdit->show();
1220 } else { 1222 } else {
1221 addr = mAddressee; 1223 addr = mAddressee;
1222 mNameEdit->hide(); 1224 mNameEdit->hide();
1223 mNameLabel->setText( mNameEdit->text() ); 1225 mNameLabel->setText( mNameEdit->text() );
1224 mNameLabel->show(); 1226 mNameLabel->show();
1225 } 1227 }
1226 1228
1227 if ( mFormattedNameType != NameEditDialog::CustomName ) { 1229 if ( mFormattedNameType != NameEditDialog::CustomName ) {
1228 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1230 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1229 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1231 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1230 } 1232 }
1231} 1233}
1232 1234
1233void AddresseeEditorWidget::nameButtonClicked() 1235void AddresseeEditorWidget::nameButtonClicked()
1234{ 1236{
1235 // show the name dialog. 1237 // show the name dialog.
1236 NameEditDialog dialog( mAddressee, mFormattedNameType, this ); 1238 NameEditDialog dialog( mAddressee, mFormattedNameType, this );
1237 1239
1238 if ( KApplication::execDialog( &dialog) ) { 1240 if ( KApplication::execDialog( &dialog) ) {
1239 if ( dialog.changed() ) { 1241 if ( dialog.changed() ) {
1240 mAddressee.setFamilyName( dialog.familyName() ); 1242 mAddressee.setFamilyName( dialog.familyName() );
1241 mAddressee.setGivenName( dialog.givenName() ); 1243 mAddressee.setGivenName( dialog.givenName() );
1242 mAddressee.setPrefix( dialog.prefix() ); 1244 mAddressee.setPrefix( dialog.prefix() );
1243 mAddressee.setSuffix( dialog.suffix() ); 1245 mAddressee.setSuffix( dialog.suffix() );
1244 mAddressee.setAdditionalName( dialog.additionalName() ); 1246 mAddressee.setAdditionalName( dialog.additionalName() );
1245 mFormattedNameType = dialog.formattedNameType(); 1247 mFormattedNameType = dialog.formattedNameType();
1246 if ( mFormattedNameType == NameEditDialog::CustomName ) { 1248 if ( mFormattedNameType == NameEditDialog::CustomName ) {
1247 mFormattedNameLabel->setText( dialog.customFormattedName() ); 1249 mFormattedNameLabel->setText( dialog.customFormattedName() );
1248 mAddressee.setFormattedName( dialog.customFormattedName() ); 1250 mAddressee.setFormattedName( dialog.customFormattedName() );
1249 } 1251 }
1250 // Update the name edit. 1252 // Update the name edit.
1251 bool block = mNameEdit->signalsBlocked(); 1253 bool block = mNameEdit->signalsBlocked();
1252 mNameEdit->blockSignals( true ); 1254 mNameEdit->blockSignals( true );
1253 mNameEdit->setText( mAddressee.assembledName() ); 1255 mNameEdit->setText( mAddressee.assembledName() );
1254 mNameEdit->blockSignals( block ); 1256 mNameEdit->blockSignals( block );
1255 1257
1256 // Update the combo box. 1258 // Update the combo box.
1257 nameBoxChanged(); 1259 nameBoxChanged();
1258 1260
1259 emitModified(); 1261 emitModified();
1260 } 1262 }
1261 } 1263 }
1262} 1264}
1263 1265
1264void AddresseeEditorWidget::categoryButtonClicked() 1266void AddresseeEditorWidget::categoryButtonClicked()
1265{ 1267{
1266 // Show the category dialog 1268 // Show the category dialog
1267 if ( mCategoryDialog == 0 ) { 1269 if ( mCategoryDialog == 0 ) {
1268 mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this ); 1270 mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this );
1269 connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ), 1271 connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ),
1270 SLOT(categoriesSelected( const QStringList& ) ) ); 1272 SLOT(categoriesSelected( const QStringList& ) ) );
1271 connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) ); 1273 connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) );
1272 } 1274 }
1273 1275
1274 mCategoryDialog->setCategories(); 1276 mCategoryDialog->setCategories();
1275 mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) ); 1277 mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) );
1276 mCategoryDialog->show(); 1278 mCategoryDialog->show();
1277 mCategoryDialog->raise(); 1279 mCategoryDialog->raise();
1278} 1280}
1279 1281
1280void AddresseeEditorWidget::categoriesSelected( const QStringList &list ) 1282void AddresseeEditorWidget::categoriesSelected( const QStringList &list )
1281{ 1283{
1282 mCategoryEdit->setText( list.join( "," ) ); 1284 mCategoryEdit->setText( list.join( "," ) );
1283} 1285}
1284 1286
1285void AddresseeEditorWidget::editCategories() 1287void AddresseeEditorWidget::editCategories()
1286{ 1288{
1287 if ( mCategoryEditDialog == 0 ) { 1289 if ( mCategoryEditDialog == 0 ) {
1288 mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this ); 1290 mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this );
1289 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ), 1291 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ),
1290 SLOT( categoryButtonClicked() ) ); 1292 SLOT( categoryButtonClicked() ) );
1291 } 1293 }
1292 1294
1293 mCategoryEditDialog->show(); 1295 mCategoryEditDialog->show();
1294 mCategoryEditDialog->raise(); 1296 mCategoryEditDialog->raise();
1295} 1297}
1296 1298
1297void AddresseeEditorWidget::emitModified() 1299void AddresseeEditorWidget::emitModified()
1298{ 1300{
1299 mDirty = true; 1301 mDirty = true;
1300 1302
1301 KABC::Addressee::List list; 1303 KABC::Addressee::List list;
1302 1304
1303 if ( mIsExtension && !mBlockSignals ) { 1305 if ( mIsExtension && !mBlockSignals ) {
1304 save(); 1306 save();
1305 list.append( mAddressee ); 1307 list.append( mAddressee );
1306 } 1308 }
1307 1309
1308 emit modified( list ); 1310 emit modified( list );
1309} 1311}
1310 1312
1311void AddresseeEditorWidget::dateChanged( QDate ) 1313void AddresseeEditorWidget::dateChanged( QDate )
1312{ 1314{
1313 emitModified(); 1315 emitModified();
1314} 1316}
1315 1317
1316//US invalid dates are handdled by the KDateEdit widget itself 1318//US invalid dates are handdled by the KDateEdit widget itself
1317void AddresseeEditorWidget::invalidDate() 1319void AddresseeEditorWidget::invalidDate()
1318{ 1320{
1319 KMessageBox::sorry( this, i18n( "You must specify a valid date" ) ); 1321 KMessageBox::sorry( this, i18n( "You must specify a valid date" ) );
1320} 1322}
1321 1323
1322 1324
1323void AddresseeEditorWidget::pageChanged( QWidget *wdg ) 1325void AddresseeEditorWidget::pageChanged( QWidget *wdg )
1324{ 1326{
1325#ifndef KAB_EMBEDDED 1327#ifndef KAB_EMBEDDED
1326 if ( wdg ) 1328 if ( wdg )
1327 KAcceleratorManager::manage( wdg ); 1329 KAcceleratorManager::manage( wdg );
1328#else //KAB_EMBEDDED 1330#else //KAB_EMBEDDED
1329//US 1331//US
1330#endif //KAB_EMBEDDED 1332#endif //KAB_EMBEDDED
1331 1333
1332} 1334}
1333 1335
1334QString AddresseeEditorWidget::title() const 1336QString AddresseeEditorWidget::title() const
1335{ 1337{
1336 return i18n( "Contact Editor" ); 1338 return i18n( "Contact Editor" );
1337} 1339}
1338 1340
1339QString AddresseeEditorWidget::identifier() const 1341QString AddresseeEditorWidget::identifier() const
1340{ 1342{
1341 return i18n( "contact_editor" ); 1343 return i18n( "contact_editor" );
1342} 1344}
1343 1345
1344#ifndef KAB_EMBEDDED 1346#ifndef KAB_EMBEDDED
1345#include "addresseeeditorwidget.moc" 1347#include "addresseeeditorwidget.moc"
1346#endif //KAB_EMBEDDED 1348#endif //KAB_EMBEDDED
diff --git a/kaddressbook/extensionmanager.cpp b/kaddressbook/extensionmanager.cpp
index 98561dc..efbdf17 100644
--- a/kaddressbook/extensionmanager.cpp
+++ b/kaddressbook/extensionmanager.cpp
@@ -1,248 +1,249 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#include <qlayout.h> 23#include <qlayout.h>
24#include <qapplication.h> 24#include <qapplication.h>
25#include <kactionclasses.h> 25#include <kactionclasses.h>
26#include <kconfig.h> 26#include <kconfig.h>
27#include <kdebug.h> 27#include <kdebug.h>
28#include <klocale.h> 28#include <klocale.h>
29 29
30#ifndef KAB_EMBEDDED 30#ifndef KAB_EMBEDDED
31#include <ktrader.h> 31#include <ktrader.h>
32#else //KAB_EMBEDDED 32#else //KAB_EMBEDDED
33#include <features/mergewidget.h> 33#include <features/mergewidget.h>
34#include <features/distributionlistwidget.h> 34#include <features/distributionlistwidget.h>
35#endif //KAB_EMBEDDED 35#endif //KAB_EMBEDDED
36 36
37#include "addresseeeditorwidget.h" 37#include "addresseeeditorwidget.h"
38#include "kabcore.h" 38#include "kabcore.h"
39#include "kabprefs.h" 39#include "kabprefs.h"
40 40
41#include "extensionmanager.h" 41#include "extensionmanager.h"
42 42
43ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent, 43ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent,
44 const char *name ) 44 const char *name )
45 : QScrollView( parent, name ), mCore( core ), mCurrentExtensionWidget( 0 ) 45 : QScrollView( parent, name ), mCore( core ), mCurrentExtensionWidget( 0 )
46{ 46{
47#ifdef KAB_EMBEDDED 47#ifdef KAB_EMBEDDED
48//US QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); 48//US QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu();
49 QWidget *settingsmenu = (QWidget*)mCore->getSettingsMenu(); 49 QWidget *settingsmenu = (QWidget*)mCore->getSettingsMenu();
50#endif //KAB_EMBEDDED 50#endif //KAB_EMBEDDED
51 51
52 mActionExtensions = new KSelectAction( i18n( "Show Extension Bar" ), 0, 52 mActionExtensions = new KSelectAction( i18n( "Show Extension Bar" ), 0,
53 mCore->actionCollection(), 53 mCore->actionCollection(),
54 "options_show_extensions" ); 54 "options_show_extensions" );
55 55
56 mActionExtensions->plug( settingsmenu ); 56 mActionExtensions->plug( settingsmenu );
57 57
58 connect( mActionExtensions, SIGNAL( activated( int ) ), 58 connect( mActionExtensions, SIGNAL( activated( int ) ),
59 SLOT( setActiveExtension( int ) ) ); 59 SLOT( setActiveExtension( int ) ) );
60 mWidgetBox = new QWidget( viewport() ); 60 mWidgetBox = new QWidget( viewport() );
61 new QHBoxLayout (mWidgetBox );
61 addChild( mWidgetBox ); 62 addChild( mWidgetBox );
62 setResizePolicy(AutoOneFit); 63 setResizePolicy(AutoOneFit);
63 createExtensionWidgets(); 64 createExtensionWidgets();
64 hide(); 65 hide();
65} 66}
66 67
67ExtensionManager::~ExtensionManager() 68ExtensionManager::~ExtensionManager()
68{ 69{
69} 70}
70 71
71void ExtensionManager::restoreSettings() 72void ExtensionManager::restoreSettings()
72{ 73{
73 mActionExtensions->setCurrentItem( KABPrefs::instance()->mCurrentExtension ); 74 mActionExtensions->setCurrentItem( KABPrefs::instance()->mCurrentExtension );
74 int i = 1; 75 int i = 1;
75 mCurrentExtensionWidget = mExtensionWidgetList.at( i-1 ); 76 mCurrentExtensionWidget = mExtensionWidgetList.at( i-1 );
76 while ( mCurrentExtensionWidget ) { 77 while ( mCurrentExtensionWidget ) {
77 if( i != KABPrefs::instance()->mCurrentExtension ) 78 if( i != KABPrefs::instance()->mCurrentExtension )
78 mCurrentExtensionWidget->hide(); 79 mCurrentExtensionWidget->hide();
79 mCurrentExtensionWidget = mExtensionWidgetList.at( ++i-1 ); 80 mCurrentExtensionWidget = mExtensionWidgetList.at( ++i-1 );
80 81
81 } 82 }
82 setActiveExtension( mActionExtensions->currentItem() ); 83 setActiveExtension( mActionExtensions->currentItem() );
83} 84}
84 85
85void ExtensionManager::saveSettings() 86void ExtensionManager::saveSettings()
86{ 87{
87 KABPrefs::instance()->mCurrentExtension = mActionExtensions->currentItem(); 88 KABPrefs::instance()->mCurrentExtension = mActionExtensions->currentItem();
88} 89}
89 90
90void ExtensionManager::reconfigure() 91void ExtensionManager::reconfigure()
91{ 92{
92 saveSettings(); 93 saveSettings();
93 createExtensionWidgets(); 94 createExtensionWidgets();
94 restoreSettings(); 95 restoreSettings();
95} 96}
96 97
97bool ExtensionManager::isQuickEditVisible() const 98bool ExtensionManager::isQuickEditVisible() const
98{ 99{
99 return ( mCurrentExtensionWidget && 100 return ( mCurrentExtensionWidget &&
100 mCurrentExtensionWidget->identifier() == "contact_editor" ); 101 mCurrentExtensionWidget->identifier() == "contact_editor" );
101} 102}
102 103
103void ExtensionManager::setSelectionChanged() 104void ExtensionManager::setSelectionChanged()
104{ 105{
105 if ( mCurrentExtensionWidget ) 106 if ( mCurrentExtensionWidget )
106 mCurrentExtensionWidget->contactsSelectionChanged(); 107 mCurrentExtensionWidget->contactsSelectionChanged();
107} 108}
108 109
109void ExtensionManager::setActiveExtension( int id ) 110void ExtensionManager::setActiveExtension( int id )
110{ 111{
111 //qDebug("+++++++++++++++++++ExtensionManager::setActiveExtension %d ", id); 112 //qDebug("+++++++++++++++++++ExtensionManager::setActiveExtension %d ", id);
112 if ( id == 0 ) { 113 if ( id == 0 ) {
113 hide(); 114 hide();
114 mCurrentExtensionWidget = 0; 115 mCurrentExtensionWidget = 0;
115#ifndef DESKTOP_VERSION 116#ifndef DESKTOP_VERSION
116//US our screen is so small, that we better hide the detailscreen, just in case. 117//US our screen is so small, that we better hide the detailscreen, just in case.
117//US mCore->setDetailsToState( ); 118//US mCore->setDetailsToState( );
118#endif //KAB_EMBEDDED 119#endif //KAB_EMBEDDED
119 } else if ( id > 0 ) { 120 } else if ( id > 0 ) {
120 if ( mCurrentExtensionWidget ) 121 if ( mCurrentExtensionWidget )
121 mCurrentExtensionWidget->hide(); 122 mCurrentExtensionWidget->hide();
122 123
123 mCurrentExtensionWidget = mExtensionWidgetList.at( id - 1 ); 124 mCurrentExtensionWidget = mExtensionWidgetList.at( id - 1 );
124 125
125 if ( mCurrentExtensionWidget ) { 126 if ( mCurrentExtensionWidget ) {
126#ifndef DESKTOP_VERSION 127#ifndef DESKTOP_VERSION
127//US our screen is so small, that we better hide the detailscreen, just in case. 128//US our screen is so small, that we better hide the detailscreen, just in case.
128//US mCore->setDetailsVisible( false ); 129//US mCore->setDetailsVisible( false );
129#endif //KAB_EMBEDDED 130#endif //KAB_EMBEDDED
130 show(); 131 show();
131 mWidgetBox->show(); 132 mWidgetBox->show();
132 mCurrentExtensionWidget->show(); 133 mCurrentExtensionWidget->show();
133 } else { 134 } else {
134 hide(); 135 hide();
135 mCurrentExtensionWidget = 0; 136 mCurrentExtensionWidget = 0;
136#ifndef DESKTOP_VERSION 137#ifndef DESKTOP_VERSION
137//US our screen is so small, that we better hide the detailscreen, just in case. 138//US our screen is so small, that we better hide the detailscreen, just in case.
138//US mCore->setDetailsToState( ); 139//US mCore->setDetailsToState( );
139#endif //KAB_EMBEDDED 140#endif //KAB_EMBEDDED
140 } 141 }
141 } 142 }
142 143
143 emit changedActiveExtension( id ); 144 emit changedActiveExtension( id );
144} 145}
145 146
146void ExtensionManager::createExtensionWidgets() 147void ExtensionManager::createExtensionWidgets()
147{ 148{
148 // clear extension widget list 149 // clear extension widget list
149 mExtensionWidgetList.setAutoDelete( true ); 150 mExtensionWidgetList.setAutoDelete( true );
150 QPtrListIterator<ExtensionWidget> wdgIt( mExtensionWidgetList ); 151 QPtrListIterator<ExtensionWidget> wdgIt( mExtensionWidgetList );
151 ExtensionWidget *wdg = 0; 152 ExtensionWidget *wdg = 0;
152 while ( ( wdg = wdgIt.current() ) != 0 ) 153 while ( ( wdg = wdgIt.current() ) != 0 )
153 mExtensionWidgetList.remove( wdg ); 154 mExtensionWidgetList.remove( wdg );
154 155
155 mExtensionWidgetList.setAutoDelete( false ); 156 mExtensionWidgetList.setAutoDelete( false );
156 157
157 QStringList extensionNames( i18n( "None" ) ); 158 QStringList extensionNames( i18n( "None" ) );
158 159
159 // add addressee editor as default 160 // add addressee editor as default
160 161
161 QHBoxLayout *hbl = new QHBoxLayout (mWidgetBox ); 162 QHBoxLayout *hbl = (QHBoxLayout *) mWidgetBox->layout();;
162 163
163 wdg = new AddresseeEditorWidget( mCore, true, mWidgetBox ); 164 wdg = new AddresseeEditorWidget( mCore, true, mWidgetBox );
164 hbl->addWidget( wdg ); 165 hbl->addWidget( wdg );
165 //wdg->hide(); 166 //wdg->hide();
166 connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), 167 connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
167 SIGNAL( modified( const KABC::Addressee::List& ) ) ); 168 SIGNAL( modified( const KABC::Addressee::List& ) ) );
168 mExtensionWidgetList.append( wdg ); 169 mExtensionWidgetList.append( wdg );
169 extensionNames.append( wdg->title() ); 170 extensionNames.append( wdg->title() );
170 171
171 // load the other extensions 172 // load the other extensions
172 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 173 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
173 174
174#ifndef KAB_EMBEDDED 175#ifndef KAB_EMBEDDED
175 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); 176 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
176 KTrader::OfferList::ConstIterator it; 177 KTrader::OfferList::ConstIterator it;
177 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 178 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
178 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) 179 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
179 continue; 180 continue;
180 181
181 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); 182 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() );
182 if ( !factory ) { 183 if ( !factory ) {
183 kdDebug(5720) << "ExtensionManager::loadExtensions(): Factory creation failed" << endl; 184 //kdDebug(5720) << "ExtensionManager::loadExtensions(): Factory creation failed" << endl;
184 continue; 185 continue;
185 } 186 }
186 187
187 ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); 188 ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory );
188 189
189 if ( !extensionFactory ) { 190 if ( !extensionFactory ) {
190 kdDebug(5720) << "ExtensionManager::loadExtensions(): Cast failed" << endl; 191 //kdDebug(5720) << "ExtensionManager::loadExtensions(): Cast failed" << endl;
191 continue; 192 continue;
192 } 193 }
193 194
194 if ( !activeExtensions.contains( extensionFactory->identifier() ) ) 195 if ( !activeExtensions.contains( extensionFactory->identifier() ) )
195 continue; 196 continue;
196 197
197 wdg = extensionFactory->extension( mCore, this ); 198 wdg = extensionFactory->extension( mCore, this );
198 if ( wdg ) { 199 if ( wdg ) {
199 //wdg->hide(); 200 //wdg->hide();
200 connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), 201 connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
201 SIGNAL( modified( const KABC::Addressee::List& ) ) ); 202 SIGNAL( modified( const KABC::Addressee::List& ) ) );
202 mExtensionWidgetList.append( wdg ); 203 mExtensionWidgetList.append( wdg );
203 extensionNames.append( wdg->title() ); 204 extensionNames.append( wdg->title() );
204 } 205 }
205 } 206 }
206#else //KAB_EMBEDDED 207#else //KAB_EMBEDDED
207 //load Mergefactory/extension 208 //load Mergefactory/extension
208 ExtensionFactory *extensionFactory = new MergeFactory(); 209 ExtensionFactory *extensionFactory = new MergeFactory();
209 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 210 if ( activeExtensions.contains( extensionFactory->identifier() ) )
210 { 211 {
211 wdg = extensionFactory->extension( mCore, mWidgetBox ); 212 wdg = extensionFactory->extension( mCore, mWidgetBox );
212 if ( wdg ) { 213 if ( wdg ) {
213 hbl->addWidget( wdg ); 214 hbl->addWidget( wdg );
214 //wdg->hide(); 215 //wdg->hide();
215 connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), 216 connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
216 SIGNAL( modified( const KABC::Addressee::List& ) ) ); 217 SIGNAL( modified( const KABC::Addressee::List& ) ) );
217 mExtensionWidgetList.append( wdg ); 218 mExtensionWidgetList.append( wdg );
218 extensionNames.append( wdg->title() ); 219 extensionNames.append( wdg->title() );
219 } 220 }
220 } 221 }
221 222
222 //load DistributionListfactory/extension 223 //load DistributionListfactory/extension
223 extensionFactory = new DistributionListFactory(); 224 extensionFactory = new DistributionListFactory();
224 if (activeExtensions.contains( extensionFactory->identifier() ) ) 225 if (activeExtensions.contains( extensionFactory->identifier() ) )
225 { 226 {
226 wdg = extensionFactory->extension( mCore, mWidgetBox ); 227 wdg = extensionFactory->extension( mCore, mWidgetBox );
227 if ( wdg ) { 228 if ( wdg ) {
228 hbl->addWidget( wdg ); 229 hbl->addWidget( wdg );
229 //wdg->hide(); 230 //wdg->hide();
230 connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), 231 connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
231 SIGNAL( modified( const KABC::Addressee::List& ) ) ); 232 SIGNAL( modified( const KABC::Addressee::List& ) ) );
232 mExtensionWidgetList.append( wdg ); 233 mExtensionWidgetList.append( wdg );
233 extensionNames.append( wdg->title() ); 234 extensionNames.append( wdg->title() );
234 } 235 }
235 } 236 }
236 237
237 hbl->addStretch(); 238 hbl->addStretch();
238 239
239#endif //KAB_EMBEDDED 240#endif //KAB_EMBEDDED
240 241
241 242
242 mActionExtensions->setItems( extensionNames ); 243 mActionExtensions->setItems( extensionNames );
243 mCurrentExtensionWidget = 0; 244 mCurrentExtensionWidget = 0;
244} 245}
245 246
246#ifndef KAB_EMBEDDED 247#ifndef KAB_EMBEDDED
247#include "extensionmanager.moc" 248#include "extensionmanager.moc"
248#endif //KAB_EMBEDDED 249#endif //KAB_EMBEDDED
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp
index b0d04ca..39d2ae4 100644
--- a/kaddressbook/filter.cpp
+++ b/kaddressbook/filter.cpp
@@ -1,205 +1,206 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <kconfig.h> 24#include <kconfig.h>
25#include <kconfigbase.h> 25#include <kconfigbase.h>
26#include <kdebug.h> 26#include <kdebug.h>
27 27
28#include "kabprefs.h" 28#include "kabprefs.h"
29 29
30#include "filter.h" 30#include "filter.h"
31 31
32Filter::Filter() 32Filter::Filter()
33 : mName( QString::null ), mMatchRule( Matching ), mEnabled( true ), 33 : mName( QString::null ), mMatchRule( Matching ), mEnabled( true ),
34 mInternal( false ) 34 mInternal( false )
35{ 35{
36} 36}
37 37
38Filter::Filter( const QString &name ) 38Filter::Filter( const QString &name )
39 : mName( name ), mMatchRule( Matching ), mEnabled( true ), 39 : mName( name ), mMatchRule( Matching ), mEnabled( true ),
40 mInternal( false ) 40 mInternal( false )
41{ 41{
42} 42}
43 43
44Filter::~Filter() 44Filter::~Filter()
45{ 45{
46} 46}
47 47
48void Filter::setName( const QString &name ) 48void Filter::setName( const QString &name )
49{ 49{
50 mName = name; 50 mName = name;
51} 51}
52 52
53const QString &Filter::name() const 53const QString &Filter::name() const
54{ 54{
55 return mName; 55 return mName;
56} 56}
57 57
58bool Filter::isInternal() const 58bool Filter::isInternal() const
59{ 59{
60 return mInternal; 60 return mInternal;
61} 61}
62 62
63void Filter::apply( KABC::Addressee::List &addresseeList ) 63void Filter::apply( KABC::Addressee::List &addresseeList )
64{ 64{
65 KABC::Addressee::List::Iterator iter; 65 KABC::Addressee::List::Iterator iter;
66 for ( iter = addresseeList.begin(); iter != addresseeList.end(); ) { 66 for ( iter = addresseeList.begin(); iter != addresseeList.end(); ) {
67 if ( filterAddressee( *iter ) ) 67 if ( filterAddressee( *iter ) )
68 ++iter; 68 ++iter;
69 else 69 else
70 { 70 {
71#ifndef KAB_EMBEDDED 71#ifndef KAB_EMBEDDED
72 iter = addresseeList.erase( iter ); 72 iter = addresseeList.erase( iter );
73#else //KAB_EMBEDDED 73#else //KAB_EMBEDDED
74 iter = addresseeList.remove( iter ); 74 iter = addresseeList.remove( iter );
75#endif //KAB_EMBEDDED 75#endif //KAB_EMBEDDED
76 } 76 }
77 } 77 }
78} 78}
79 79
80bool Filter::filterAddressee( const KABC::Addressee &a ) 80bool Filter::filterAddressee( const KABC::Addressee &a )
81{ 81{
82 QStringList::Iterator iter; 82 QStringList::Iterator iter;
83 iter = mCategoryList.begin(); 83 iter = mCategoryList.begin();
84 // empty filter always matches 84 // empty filter always matches
85 85
86 if ( iter == mCategoryList.end() ) 86 if ( iter == mCategoryList.end() )
87 return true; 87 return true;
88 88
89 for ( ; iter != mCategoryList.end(); ++iter ) { 89 for ( ; iter != mCategoryList.end(); ++iter ) {
90 if ( a.hasCategory( *iter ) ) 90 if ( a.hasCategory( *iter ) )
91 return ( mMatchRule == Matching ); 91 return ( mMatchRule == Matching );
92 } 92 }
93 93
94 return !( mMatchRule == Matching ); 94 return !( mMatchRule == Matching );
95} 95}
96 96
97void Filter::setEnabled( bool on ) 97void Filter::setEnabled( bool on )
98{ 98{
99 mEnabled = on; 99 mEnabled = on;
100} 100}
101 101
102bool Filter::isEnabled() const 102bool Filter::isEnabled() const
103{ 103{
104 return mEnabled; 104 return mEnabled;
105} 105}
106 106
107void Filter::setCategories( const QStringList &list ) 107void Filter::setCategories( const QStringList &list )
108{ 108{
109 mCategoryList = list; 109 mCategoryList = list;
110} 110}
111 111
112const QStringList &Filter::categories() const 112const QStringList &Filter::categories() const
113{ 113{
114 return mCategoryList; 114 return mCategoryList;
115} 115}
116 116
117void Filter::save( KConfig *config ) 117void Filter::save( KConfig *config )
118{ 118{
119 config->writeEntry( "Name", mName ); 119 config->writeEntry( "Name", mName );
120 config->writeEntry( "Enabled", mEnabled ); 120 config->writeEntry( "Enabled", mEnabled );
121 config->writeEntry( "Categories", mCategoryList ); 121 config->writeEntry( "Categories", mCategoryList );
122 config->writeEntry( "MatchRule", (int)mMatchRule ); 122 config->writeEntry( "MatchRule", (int)mMatchRule );
123} 123}
124 124
125void Filter::restore( KConfig *config ) 125void Filter::restore( KConfig *config )
126{ 126{
127 mName = config->readEntry( "Name", "<internal error>" ); 127 mName = config->readEntry( "Name", "<internal error>" );
128 mEnabled = config->readBoolEntry( "Enabled", true ); 128 mEnabled = config->readBoolEntry( "Enabled", true );
129 mCategoryList = config->readListEntry( "Categories" ); 129 mCategoryList = config->readListEntry( "Categories" );
130 mMatchRule = (MatchRule)config->readNumEntry( "MatchRule", Matching ); 130 mMatchRule = (MatchRule)config->readNumEntry( "MatchRule", Matching );
131} 131}
132 132
133void Filter::save( KConfig *config, QString baseGroup, Filter::List &list ) 133void Filter::save( KConfig *config, QString baseGroup, Filter::List &list )
134{ 134{
135 { 135 {
136 KConfigGroupSaver s( config, baseGroup ); 136 KConfigGroupSaver s( config, baseGroup );
137 137
138 // remove the old filters 138 // remove the old filters
139 uint count = config->readNumEntry( "Count" ); 139 uint count = config->readNumEntry( "Count" );
140 /* // memory access violation here 140 /* // memory access violation here
141 for ( uint i = 0; i < count; ++i ) 141 for ( uint i = 0; i < count; ++i )
142 config->deleteGroup( QString( "%1_%2" ).arg( baseGroup ).arg( i ) ); 142 config->deleteGroup( QString( "%1_%2" ).arg( baseGroup ).arg( i ) );
143 */ 143 */
144 } 144 }
145 145
146 int index = 0; 146 int index = 0;
147 Filter::List::Iterator iter; 147 Filter::List::Iterator iter;
148 for ( iter = list.begin(); iter != list.end(); ++iter ) { 148 for ( iter = list.begin(); iter != list.end(); ++iter ) {
149 if ( !(*iter).mInternal ) { 149 if ( !(*iter).mInternal ) {
150 KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( index ) ); 150 KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( index ) );
151 151
152 (*iter).save( config ); 152 (*iter).save( config );
153 index++; 153 index++;
154 } 154 }
155 } 155 }
156 156
157 KConfigGroupSaver s( config, baseGroup ); 157 KConfigGroupSaver s( config, baseGroup );
158 158
159 config->writeEntry( "Count", index ); 159 config->writeEntry( "Count", index );
160 160
161} 161}
162 162
163Filter::List Filter::restore( KConfig *config, QString baseGroup ) 163Filter::List Filter::restore( KConfig *config, QString baseGroup )
164{ 164{
165 Filter::List list; 165 Filter::List list;
166 int count = 0; 166 int count = 0;
167 Filter f; 167 Filter f;
168 168
169 { 169 {
170 KConfigGroupSaver s( config, baseGroup ); 170 KConfigGroupSaver s( config, baseGroup );
171 count = config->readNumEntry( "Count", 0 ); 171 count = config->readNumEntry( "Count", 0 );
172 } 172 }
173 173
174 for ( int i = 0; i < count; i++ ) { 174 for ( int i = 0; i < count; i++ ) {
175 { 175 {
176 KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( i ) ); 176 KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( i ) );
177 f.restore( config ); 177 f.restore( config );
178 } 178 }
179 179
180 list.append( f ); 180 list.append( f );
181 } 181 }
182 182
183 QStringList cats = KABPrefs::instance()->mCustomCategories; 183 if ( list.isEmpty()) {
184 for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { 184 QStringList cats = KABPrefs::instance()->mCustomCategories;
185 Filter filter; 185 for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) {
186 filter.mName = *it; 186 Filter filter;
187 filter.mEnabled = true; 187 filter.mName = *it;
188 filter.mCategoryList = *it; 188 filter.mEnabled = true;
189 filter.mMatchRule = Matching; 189 filter.mCategoryList = *it;
190 filter.mInternal = true; 190 filter.mMatchRule = Matching;
191 list.append( filter ); 191 filter.mInternal = true;
192 list.append( filter );
193 }
192 } 194 }
193
194 return list; 195 return list;
195} 196}
196 197
197void Filter::setMatchRule( MatchRule rule ) 198void Filter::setMatchRule( MatchRule rule )
198{ 199{
199 mMatchRule = rule; 200 mMatchRule = rule;
200} 201}
201 202
202Filter::MatchRule Filter::matchRule() const 203Filter::MatchRule Filter::matchRule() const
203{ 204{
204 return mMatchRule; 205 return mMatchRule;
205} 206}
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index e14e579..c6288fa 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,454 +1,490 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/*s 24/*s
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include "kabcore.h" 31#include "kabcore.h"
32 32
33#include <stdaddressbook.h> 33#include <stdaddressbook.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kfiledialog.h> 35#include <kfiledialog.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qregexp.h> 38#include <qregexp.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qprogressbar.h> 42#include <qprogressbar.h>
43#include <libkdepim/phoneaccess.h> 43#include <libkdepim/phoneaccess.h>
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46#include <qclipboard.h> 46#include <qclipboard.h>
47#include <qdir.h> 47#include <qdir.h>
48#include <qfile.h> 48#include <qfile.h>
49#include <qapplicaton.h> 49#include <qapplicaton.h>
50#include <qprogressbar.h> 50#include <qprogressbar.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qregexp.h> 52#include <qregexp.h>
53#include <qvbox.h> 53#include <qvbox.h>
54#include <kabc/addresseelist.h> 54#include <kabc/addresseelist.h>
55#include <kabc/errorhandler.h> 55#include <kabc/errorhandler.h>
56#include <kabc/resource.h> 56#include <kabc/resource.h>
57#include <kabc/vcardconverter.h> 57#include <kabc/vcardconverter.h>
58#include <kapplication.h> 58#include <kapplication.h>
59#include <kactionclasses.h> 59#include <kactionclasses.h>
60#include <kcmultidialog.h> 60#include <kcmultidialog.h>
61#include <kdebug.h> 61#include <kdebug.h>
62#include <kdeversion.h> 62#include <kdeversion.h>
63#include <kkeydialog.h> 63#include <kkeydialog.h>
64#include <kmessagebox.h> 64#include <kmessagebox.h>
65#include <kprinter.h> 65#include <kprinter.h>
66#include <kprotocolinfo.h> 66#include <kprotocolinfo.h>
67#include <kresources/selectdialog.h> 67#include <kresources/selectdialog.h>
68#include <kstandarddirs.h> 68#include <kstandarddirs.h>
69#include <ktempfile.h> 69#include <ktempfile.h>
70#include <kxmlguiclient.h> 70#include <kxmlguiclient.h>
71#include <kaboutdata.h> 71#include <kaboutdata.h>
72#include <libkdepim/categoryselectdialog.h> 72#include <libkdepim/categoryselectdialog.h>
73 73
74#include "addresseeutil.h" 74#include "addresseeutil.h"
75#include "addresseeeditordialog.h" 75#include "addresseeeditordialog.h"
76#include "extensionmanager.h" 76#include "extensionmanager.h"
77#include "kstdaction.h" 77#include "kstdaction.h"
78#include "kaddressbookservice.h" 78#include "kaddressbookservice.h"
79#include "ldapsearchdialog.h" 79#include "ldapsearchdialog.h"
80#include "printing/printingwizard.h" 80#include "printing/printingwizard.h"
81#else // KAB_EMBEDDED 81#else // KAB_EMBEDDED
82 82
83#include <kapplication.h> 83#include <kapplication.h>
84#include "KDGanttMinimizeSplitter.h" 84#include "KDGanttMinimizeSplitter.h"
85#include "kaddressbookmain.h" 85#include "kaddressbookmain.h"
86#include "kactioncollection.h" 86#include "kactioncollection.h"
87#include "addresseedialog.h" 87#include "addresseedialog.h"
88//US 88//US
89#include <addresseeview.h> 89#include <addresseeview.h>
90 90
91#include <qapp.h> 91#include <qapp.h>
92#include <qmenubar.h> 92#include <qmenubar.h>
93//#include <qtoolbar.h> 93//#include <qtoolbar.h>
94#include <qmessagebox.h> 94#include <qmessagebox.h>
95#include <kdebug.h> 95#include <kdebug.h>
96#include <kiconloader.h> // needed for SmallIcon 96#include <kiconloader.h> // needed for SmallIcon
97#include <kresources/kcmkresources.h> 97#include <kresources/kcmkresources.h>
98#include <ktoolbar.h> 98#include <ktoolbar.h>
99 99
100 100
101//#include <qlabel.h> 101//#include <qlabel.h>
102 102
103 103
104#ifndef DESKTOP_VERSION 104#ifndef DESKTOP_VERSION
105#include <qpe/ir.h> 105#include <qpe/ir.h>
106#include <qpe/qpemenubar.h> 106#include <qpe/qpemenubar.h>
107#include <qtopia/qcopenvelope_qws.h> 107#include <qtopia/qcopenvelope_qws.h>
108#else 108#else
109 109
110#include <qmenubar.h> 110#include <qmenubar.h>
111#endif 111#endif
112 112
113#endif // KAB_EMBEDDED 113#endif // KAB_EMBEDDED
114#include "kcmconfigs/kcmkabconfig.h" 114#include "kcmconfigs/kcmkabconfig.h"
115#include "kcmconfigs/kcmkdepimconfig.h" 115#include "kcmconfigs/kcmkdepimconfig.h"
116#include "kpimglobalprefs.h" 116#include "kpimglobalprefs.h"
117#include "externalapphandler.h" 117#include "externalapphandler.h"
118#include "xxportselectdialog.h" 118#include "xxportselectdialog.h"
119 119
120 120
121#include <kresources/selectdialog.h> 121#include <kresources/selectdialog.h>
122#include <kmessagebox.h> 122#include <kmessagebox.h>
123 123
124#include <picture.h> 124#include <picture.h>
125#include <resource.h> 125#include <resource.h>
126 126
127//US#include <qsplitter.h> 127//US#include <qsplitter.h>
128#include <qmap.h> 128#include <qmap.h>
129#include <qdir.h> 129#include <qdir.h>
130#include <qfile.h> 130#include <qfile.h>
131#include <qvbox.h> 131#include <qvbox.h>
132#include <qlayout.h> 132#include <qlayout.h>
133#include <qclipboard.h> 133#include <qclipboard.h>
134#include <qtextstream.h> 134#include <qtextstream.h>
135#include <qradiobutton.h> 135#include <qradiobutton.h>
136#include <qbuttongroup.h> 136#include <qbuttongroup.h>
137 137
138#include <libkdepim/categoryselectdialog.h> 138#include <libkdepim/categoryselectdialog.h>
139#include <libkdepim/categoryeditdialog.h> 139#include <libkdepim/categoryeditdialog.h>
140#include <kabc/vcardconverter.h> 140#include <kabc/vcardconverter.h>
141 141
142 142
143#include "addresseeutil.h" 143#include "addresseeutil.h"
144#include "undocmds.h" 144#include "undocmds.h"
145#include "addresseeeditordialog.h" 145#include "addresseeeditordialog.h"
146#include "viewmanager.h" 146#include "viewmanager.h"
147#include "details/detailsviewcontainer.h" 147#include "details/detailsviewcontainer.h"
148#include "kabprefs.h" 148#include "kabprefs.h"
149#include "xxportmanager.h" 149#include "xxportmanager.h"
150#include "incsearchwidget.h" 150#include "incsearchwidget.h"
151#include "jumpbuttonbar.h" 151#include "jumpbuttonbar.h"
152#include "extensionmanager.h" 152#include "extensionmanager.h"
153#include "addresseeconfig.h" 153#include "addresseeconfig.h"
154#include "nameeditdialog.h"
154#include <kcmultidialog.h> 155#include <kcmultidialog.h>
155 156
156#ifdef _WIN32_ 157#ifdef _WIN32_
157 158
158#include "kaimportoldialog.h" 159#include "kaimportoldialog.h"
159#else 160#else
160#include <unistd.h> 161#include <unistd.h>
161#endif 162#endif
162// sync includes 163// sync includes
163#include <libkdepim/ksyncprofile.h> 164#include <libkdepim/ksyncprofile.h>
164#include <libkdepim/ksyncprefsdialog.h> 165#include <libkdepim/ksyncprefsdialog.h>
165 166
166 167
167class KABCatPrefs : public QDialog 168class KABCatPrefs : public QDialog
168{ 169{
169 public: 170 public:
170 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 171 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
171 QDialog( parent, name, true ) 172 QDialog( parent, name, true )
172 { 173 {
173 setCaption( i18n("Manage new Categories") ); 174 setCaption( i18n("Manage new Categories") );
174 QVBoxLayout* lay = new QVBoxLayout( this ); 175 QVBoxLayout* lay = new QVBoxLayout( this );
175 lay->setSpacing( 3 ); 176 lay->setSpacing( 3 );
176 lay->setMargin( 3 ); 177 lay->setMargin( 3 );
177 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 178 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
178 lay->addWidget( lab ); 179 lay->addWidget( lab );
179 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 180 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
180 lay->addWidget( format ); 181 lay->addWidget( format );
181 format->setExclusive ( true ) ; 182 format->setExclusive ( true ) ;
182 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 183 addCatBut = new QRadioButton(i18n("Add to category list"), format );
183 new QRadioButton(i18n("Remove from addressees"), format ); 184 new QRadioButton(i18n("Remove from addressees"), format );
184 addCatBut->setChecked( true ); 185 addCatBut->setChecked( true );
185 QPushButton * ok = new QPushButton( i18n("OK"), this ); 186 QPushButton * ok = new QPushButton( i18n("OK"), this );
186 lay->addWidget( ok ); 187 lay->addWidget( ok );
187 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 188 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
188 lay->addWidget( cancel ); 189 lay->addWidget( cancel );
189 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 190 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
190 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 191 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
191 resize( 200, 200 ); 192 resize( 200, 200 );
192 } 193 }
193 194
194 bool addCat() { return addCatBut->isChecked(); } 195 bool addCat() { return addCatBut->isChecked(); }
195private: 196private:
196 QRadioButton* addCatBut; 197 QRadioButton* addCatBut;
197}; 198};
198 199
200class KABFormatPrefs : public QDialog
201{
202 public:
203 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) :
204 QDialog( parent, name, true )
205 {
206 setCaption( i18n("Set formatted name") );
207 QVBoxLayout* lay = new QVBoxLayout( this );
208 lay->setSpacing( 3 );
209 lay->setMargin( 3 );
210 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this );
211 lay->addWidget( lab );
212 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this );
213 lay->addWidget( format );
214 format->setExclusive ( true ) ;
215 simple = new QRadioButton(i18n("Simple: James Bond"), format );
216 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
217 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
218 company = new QRadioButton(i18n("Organization: MI6"), format );
219 simple->setChecked( true );
220 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
221 lay->addWidget( setCompany );
222 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
223 lay->addWidget( ok );
224 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
225 lay->addWidget( cancel );
226 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
227 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
228 resize( 200, 200 );
229 }
230public:
231 QRadioButton* simple, *full, *reverse, *company;
232 QCheckBox* setCompany;
233};
234
199 235
200 236
201class KAex2phonePrefs : public QDialog 237class KAex2phonePrefs : public QDialog
202{ 238{
203 public: 239 public:
204 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 240 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
205 QDialog( parent, name, true ) 241 QDialog( parent, name, true )
206 { 242 {
207 setCaption( i18n("Export to phone options") ); 243 setCaption( i18n("Export to phone options") );
208 QVBoxLayout* lay = new QVBoxLayout( this ); 244 QVBoxLayout* lay = new QVBoxLayout( this );
209 lay->setSpacing( 3 ); 245 lay->setSpacing( 3 );
210 lay->setMargin( 3 ); 246 lay->setMargin( 3 );
211 QLabel *lab; 247 QLabel *lab;
212 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 248 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
213 lab->setAlignment (AlignHCenter ); 249 lab->setAlignment (AlignHCenter );
214 QHBox* temphb; 250 QHBox* temphb;
215 temphb = new QHBox( this ); 251 temphb = new QHBox( this );
216 new QLabel( i18n("I/O device: "), temphb ); 252 new QLabel( i18n("I/O device: "), temphb );
217 mPhoneDevice = new QLineEdit( temphb); 253 mPhoneDevice = new QLineEdit( temphb);
218 lay->addWidget( temphb ); 254 lay->addWidget( temphb );
219 temphb = new QHBox( this ); 255 temphb = new QHBox( this );
220 new QLabel( i18n("Connection: "), temphb ); 256 new QLabel( i18n("Connection: "), temphb );
221 mPhoneConnection = new QLineEdit( temphb); 257 mPhoneConnection = new QLineEdit( temphb);
222 lay->addWidget( temphb ); 258 lay->addWidget( temphb );
223 temphb = new QHBox( this ); 259 temphb = new QHBox( this );
224 new QLabel( i18n("Model(opt.): "), temphb ); 260 new QLabel( i18n("Model(opt.): "), temphb );
225 mPhoneModel = new QLineEdit( temphb); 261 mPhoneModel = new QLineEdit( temphb);
226 lay->addWidget( temphb ); 262 lay->addWidget( temphb );
227 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 263 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
228 // lay->addWidget( mWriteToSim ); 264 // lay->addWidget( mWriteToSim );
229 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 265 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
230 lab->setAlignment (AlignHCenter ); 266 lab->setAlignment (AlignHCenter );
231 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 267 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
232 lay->addWidget( ok ); 268 lay->addWidget( ok );
233 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 269 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
234 lay->addWidget( cancel ); 270 lay->addWidget( cancel );
235 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 271 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
236 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 272 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
237 resize( 220, 240 ); 273 resize( 220, 240 );
238 274
239 } 275 }
240 276
241public: 277public:
242 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 278 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
243 QCheckBox* mWriteToSim; 279 QCheckBox* mWriteToSim;
244}; 280};
245 281
246 282
247bool pasteWithNewUid = true; 283bool pasteWithNewUid = true;
248 284
249#ifdef KAB_EMBEDDED 285#ifdef KAB_EMBEDDED
250KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 286KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
251 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 287 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
252 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 288 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
253 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 289 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
254#else //KAB_EMBEDDED 290#else //KAB_EMBEDDED
255KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 291KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
256 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 292 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
257 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 293 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
258 mReadWrite( readWrite ), mModified( false ) 294 mReadWrite( readWrite ), mModified( false )
259#endif //KAB_EMBEDDED 295#endif //KAB_EMBEDDED
260{ 296{
261 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 297 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
262 // syncManager->setBlockSave(false); 298 // syncManager->setBlockSave(false);
263 mMiniSplitter = 0; 299 mMiniSplitter = 0;
264 mExtensionBarSplitter = 0; 300 mExtensionBarSplitter = 0;
265 mIsPart = !parent->inherits( "KAddressBookMain" ); 301 mIsPart = !parent->inherits( "KAddressBookMain" );
266 mAddressBook = KABC::StdAddressBook::self(); 302 mAddressBook = KABC::StdAddressBook::self();
267 KABC::StdAddressBook::setAutomaticSave( false ); 303 KABC::StdAddressBook::setAutomaticSave( false );
268 304
269#ifndef KAB_EMBEDDED 305#ifndef KAB_EMBEDDED
270 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 306 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
271#endif //KAB_EMBEDDED 307#endif //KAB_EMBEDDED
272 308
273 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 309 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
274 SLOT( addressBookChanged() ) ); 310 SLOT( addressBookChanged() ) );
275 311
276#if 0 312#if 0
277 // LP moved to addressbook init method 313 // LP moved to addressbook init method
278 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 314 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
279 "X-Department", "KADDRESSBOOK" ); 315 "X-Department", "KADDRESSBOOK" );
280 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 316 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
281 "X-Profession", "KADDRESSBOOK" ); 317 "X-Profession", "KADDRESSBOOK" );
282 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 318 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
283 "X-AssistantsName", "KADDRESSBOOK" ); 319 "X-AssistantsName", "KADDRESSBOOK" );
284 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 320 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
285 "X-ManagersName", "KADDRESSBOOK" ); 321 "X-ManagersName", "KADDRESSBOOK" );
286 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 322 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
287 "X-SpousesName", "KADDRESSBOOK" ); 323 "X-SpousesName", "KADDRESSBOOK" );
288 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 324 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
289 "X-Office", "KADDRESSBOOK" ); 325 "X-Office", "KADDRESSBOOK" );
290 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 326 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
291 "X-IMAddress", "KADDRESSBOOK" ); 327 "X-IMAddress", "KADDRESSBOOK" );
292 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 328 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
293 "X-Anniversary", "KADDRESSBOOK" ); 329 "X-Anniversary", "KADDRESSBOOK" );
294 330
295 //US added this field to become compatible with Opie/qtopia addressbook 331 //US added this field to become compatible with Opie/qtopia addressbook
296 // values can be "female" or "male" or "". An empty field represents undefined. 332 // values can be "female" or "male" or "". An empty field represents undefined.
297 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 333 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
298 "X-Gender", "KADDRESSBOOK" ); 334 "X-Gender", "KADDRESSBOOK" );
299 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 335 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
300 "X-Children", "KADDRESSBOOK" ); 336 "X-Children", "KADDRESSBOOK" );
301 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 337 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
302 "X-FreeBusyUrl", "KADDRESSBOOK" ); 338 "X-FreeBusyUrl", "KADDRESSBOOK" );
303#endif 339#endif
304 initGUI(); 340 initGUI();
305 341
306 mIncSearchWidget->setFocus(); 342 mIncSearchWidget->setFocus();
307 343
308 344
309 connect( mViewManager, SIGNAL( selected( const QString& ) ), 345 connect( mViewManager, SIGNAL( selected( const QString& ) ),
310 SLOT( setContactSelected( const QString& ) ) ); 346 SLOT( setContactSelected( const QString& ) ) );
311 connect( mViewManager, SIGNAL( executed( const QString& ) ), 347 connect( mViewManager, SIGNAL( executed( const QString& ) ),
312 SLOT( executeContact( const QString& ) ) ); 348 SLOT( executeContact( const QString& ) ) );
313 349
314 connect( mViewManager, SIGNAL( deleteRequest( ) ), 350 connect( mViewManager, SIGNAL( deleteRequest( ) ),
315 SLOT( deleteContacts( ) ) ); 351 SLOT( deleteContacts( ) ) );
316 connect( mViewManager, SIGNAL( modified() ), 352 connect( mViewManager, SIGNAL( modified() ),
317 SLOT( setModified() ) ); 353 SLOT( setModified() ) );
318 354
319 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 355 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
320 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 356 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
321 357
322 connect( mXXPortManager, SIGNAL( modified() ), 358 connect( mXXPortManager, SIGNAL( modified() ),
323 SLOT( setModified() ) ); 359 SLOT( setModified() ) );
324 360
325 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 361 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
326 SLOT( incrementalSearch( const QString& ) ) ); 362 SLOT( incrementalSearch( const QString& ) ) );
327 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 363 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
328 mJumpButtonBar, SLOT( recreateButtons() ) ); 364 mJumpButtonBar, SLOT( recreateButtons() ) );
329 365
330 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 366 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
331 SLOT( sendMail( const QString& ) ) ); 367 SLOT( sendMail( const QString& ) ) );
332 368
333 369
334 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 370 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
335 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 371 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
336 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 372 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
337 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 373 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
338 374
339 375
340#ifndef KAB_EMBEDDED 376#ifndef KAB_EMBEDDED
341 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 377 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
342 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 378 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
343 379
344 connect( mDetails, SIGNAL( browse( const QString& ) ), 380 connect( mDetails, SIGNAL( browse( const QString& ) ),
345 SLOT( browse( const QString& ) ) ); 381 SLOT( browse( const QString& ) ) );
346 382
347 383
348 mAddressBookService = new KAddressBookService( this ); 384 mAddressBookService = new KAddressBookService( this );
349 385
350#endif //KAB_EMBEDDED 386#endif //KAB_EMBEDDED
351 387
352 mMessageTimer = new QTimer( this ); 388 mMessageTimer = new QTimer( this );
353 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 389 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
354 mEditorDialog = 0; 390 mEditorDialog = 0;
355 createAddresseeEditorDialog( this ); 391 createAddresseeEditorDialog( this );
356 setModified( false ); 392 setModified( false );
357 mBRdisabled = false; 393 mBRdisabled = false;
358#ifndef DESKTOP_VERSION 394#ifndef DESKTOP_VERSION
359 infrared = 0; 395 infrared = 0;
360#endif 396#endif
361 //toggleBeamReceive( ); 397 //toggleBeamReceive( );
362 //mMainWindow->toolBar()->show(); 398 //mMainWindow->toolBar()->show();
363 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 399 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
364 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 400 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
365} 401}
366 402
367void KABCore::updateToolBar() 403void KABCore::updateToolBar()
368{ 404{
369 static int iii = 0; 405 static int iii = 0;
370 ++iii; 406 ++iii;
371 mMainWindow->toolBar()->repaintMe(); 407 mMainWindow->toolBar()->repaintMe();
372 if ( iii < 5 ) 408 if ( iii < 5 )
373 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 409 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
374} 410}
375KABCore::~KABCore() 411KABCore::~KABCore()
376{ 412{
377 // save(); 413 // save();
378 //saveSettings(); 414 //saveSettings();
379 //KABPrefs::instance()->writeConfig(); 415 //KABPrefs::instance()->writeConfig();
380 delete AddresseeConfig::instance(); 416 delete AddresseeConfig::instance();
381 mAddressBook = 0; 417 mAddressBook = 0;
382 KABC::StdAddressBook::close(); 418 KABC::StdAddressBook::close();
383 419
384 delete syncManager; 420 delete syncManager;
385#ifndef DESKTOP_VERSION 421#ifndef DESKTOP_VERSION
386 if ( infrared ) 422 if ( infrared )
387 delete infrared; 423 delete infrared;
388#endif 424#endif
389} 425}
390void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 426void KABCore::receive( const QCString& cmsg, const QByteArray& data )
391{ 427{
392 qDebug("KA: QCOP message received: %s ", cmsg.data() ); 428 qDebug("KA: QCOP message received: %s ", cmsg.data() );
393 if ( cmsg == "setDocument(QString)" ) { 429 if ( cmsg == "setDocument(QString)" ) {
394 QDataStream stream( data, IO_ReadOnly ); 430 QDataStream stream( data, IO_ReadOnly );
395 QString fileName; 431 QString fileName;
396 stream >> fileName; 432 stream >> fileName;
397 recieve( fileName ); 433 recieve( fileName );
398 return; 434 return;
399 } 435 }
400} 436}
401void KABCore::toggleBeamReceive( ) 437void KABCore::toggleBeamReceive( )
402{ 438{
403 if ( mBRdisabled ) 439 if ( mBRdisabled )
404 return; 440 return;
405#ifndef DESKTOP_VERSION 441#ifndef DESKTOP_VERSION
406 if ( infrared ) { 442 if ( infrared ) {
407 qDebug("AB disable BeamReceive "); 443 qDebug("AB disable BeamReceive ");
408 delete infrared; 444 delete infrared;
409 infrared = 0; 445 infrared = 0;
410 mActionBR->setChecked(false); 446 mActionBR->setChecked(false);
411 return; 447 return;
412 } 448 }
413 qDebug("AB enable BeamReceive "); 449 qDebug("AB enable BeamReceive ");
414 mActionBR->setChecked(true); 450 mActionBR->setChecked(true);
415 451
416 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 452 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
417 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 453 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
418#endif 454#endif
419} 455}
420 456
421 457
422void KABCore::disableBR(bool b) 458void KABCore::disableBR(bool b)
423{ 459{
424#ifndef DESKTOP_VERSION 460#ifndef DESKTOP_VERSION
425 if ( b ) { 461 if ( b ) {
426 if ( infrared ) { 462 if ( infrared ) {
427 toggleBeamReceive( ); 463 toggleBeamReceive( );
428 } 464 }
429 mBRdisabled = true; 465 mBRdisabled = true;
430 } else { 466 } else {
431 if ( mBRdisabled ) { 467 if ( mBRdisabled ) {
432 mBRdisabled = false; 468 mBRdisabled = false;
433 //toggleBeamReceive( ); 469 //toggleBeamReceive( );
434 } 470 }
435 } 471 }
436#endif 472#endif
437 473
438} 474}
439void KABCore::recieve( QString fn ) 475void KABCore::recieve( QString fn )
440{ 476{
441 //qDebug("KABCore::recieve "); 477 //qDebug("KABCore::recieve ");
442 int count = mAddressBook->importFromFile( fn, true ); 478 int count = mAddressBook->importFromFile( fn, true );
443 if ( count ) 479 if ( count )
444 setModified( true ); 480 setModified( true );
445 mViewManager->refreshView(); 481 mViewManager->refreshView();
446 message(i18n("%1 contact(s) received!").arg( count )); 482 message(i18n("%1 contact(s) received!").arg( count ));
447 topLevelWidget()->showMaximized(); 483 topLevelWidget()->showMaximized();
448 topLevelWidget()->raise(); 484 topLevelWidget()->raise();
449} 485}
450void KABCore::restoreSettings() 486void KABCore::restoreSettings()
451{ 487{
452 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 488 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
453 489
454 bool state; 490 bool state;
@@ -893,1673 +929,1714 @@ void KABCore::beamVCard(const QStringList& uids)
893#else 929#else
894 QString fileName = "/tmp/kapibeamfile.vcf"; 930 QString fileName = "/tmp/kapibeamfile.vcf";
895#endif 931#endif
896 932
897 KABC::VCardConverter converter; 933 KABC::VCardConverter converter;
898 QString description; 934 QString description;
899 QString datastream; 935 QString datastream;
900 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 936 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
901 KABC::Addressee a = mAddressBook->findByUid( *it ); 937 KABC::Addressee a = mAddressBook->findByUid( *it );
902 938
903 if ( a.isEmpty() ) 939 if ( a.isEmpty() )
904 continue; 940 continue;
905 941
906 if (description.isEmpty()) 942 if (description.isEmpty())
907 description = a.formattedName(); 943 description = a.formattedName();
908 944
909 QString vcard; 945 QString vcard;
910 converter.addresseeToVCard( a, vcard ); 946 converter.addresseeToVCard( a, vcard );
911 int start = 0; 947 int start = 0;
912 int next; 948 int next;
913 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 949 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
914 int semi = vcard.find(";", next); 950 int semi = vcard.find(";", next);
915 int dopp = vcard.find(":", next); 951 int dopp = vcard.find(":", next);
916 int sep; 952 int sep;
917 if ( semi < dopp && semi >= 0 ) 953 if ( semi < dopp && semi >= 0 )
918 sep = semi ; 954 sep = semi ;
919 else 955 else
920 sep = dopp; 956 sep = dopp;
921 datastream +=vcard.mid( start, next - start); 957 datastream +=vcard.mid( start, next - start);
922 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 958 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
923 start = sep; 959 start = sep;
924 } 960 }
925 datastream += vcard.mid( start,vcard.length() ); 961 datastream += vcard.mid( start,vcard.length() );
926 } 962 }
927#ifndef DESKTOP_VERSION 963#ifndef DESKTOP_VERSION
928 QFile outFile(fileName); 964 QFile outFile(fileName);
929 if ( outFile.open(IO_WriteOnly) ) { 965 if ( outFile.open(IO_WriteOnly) ) {
930 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 966 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
931 QTextStream t( &outFile ); // use a text stream 967 QTextStream t( &outFile ); // use a text stream
932 //t.setEncoding( QTextStream::UnicodeUTF8 ); 968 //t.setEncoding( QTextStream::UnicodeUTF8 );
933 t.setEncoding( QTextStream::Latin1 ); 969 t.setEncoding( QTextStream::Latin1 );
934 t <<datastream.latin1(); 970 t <<datastream.latin1();
935 outFile.close(); 971 outFile.close();
936 Ir *ir = new Ir( this ); 972 Ir *ir = new Ir( this );
937 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 973 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
938 ir->send( fileName, description, "text/x-vCard" ); 974 ir->send( fileName, description, "text/x-vCard" );
939 } else { 975 } else {
940 qDebug("Error open temp beam file "); 976 qDebug("Error open temp beam file ");
941 return; 977 return;
942 } 978 }
943#endif 979#endif
944 980
945} 981}
946 982
947void KABCore::beamDone( Ir *ir ) 983void KABCore::beamDone( Ir *ir )
948{ 984{
949#ifndef DESKTOP_VERSION 985#ifndef DESKTOP_VERSION
950 delete ir; 986 delete ir;
951#endif 987#endif
952 topLevelWidget()->raise(); 988 topLevelWidget()->raise();
953 message( i18n("Beaming finished!") ); 989 message( i18n("Beaming finished!") );
954} 990}
955 991
956 992
957void KABCore::browse( const QString& url ) 993void KABCore::browse( const QString& url )
958{ 994{
959#ifndef KAB_EMBEDDED 995#ifndef KAB_EMBEDDED
960 kapp->invokeBrowser( url ); 996 kapp->invokeBrowser( url );
961#else //KAB_EMBEDDED 997#else //KAB_EMBEDDED
962 qDebug("KABCore::browse must be fixed"); 998 qDebug("KABCore::browse must be fixed");
963#endif //KAB_EMBEDDED 999#endif //KAB_EMBEDDED
964} 1000}
965 1001
966void KABCore::selectAllContacts() 1002void KABCore::selectAllContacts()
967{ 1003{
968 mViewManager->setSelected( QString::null, true ); 1004 mViewManager->setSelected( QString::null, true );
969} 1005}
970 1006
971void KABCore::deleteContacts() 1007void KABCore::deleteContacts()
972{ 1008{
973 QStringList uidList = mViewManager->selectedUids(); 1009 QStringList uidList = mViewManager->selectedUids();
974 deleteContacts( uidList ); 1010 deleteContacts( uidList );
975} 1011}
976 1012
977void KABCore::deleteContacts( const QStringList &uids ) 1013void KABCore::deleteContacts( const QStringList &uids )
978{ 1014{
979 if ( uids.count() > 0 ) { 1015 if ( uids.count() > 0 ) {
980 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 1016 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
981 UndoStack::instance()->push( command ); 1017 UndoStack::instance()->push( command );
982 RedoStack::instance()->clear(); 1018 RedoStack::instance()->clear();
983 1019
984 // now if we deleted anything, refresh 1020 // now if we deleted anything, refresh
985 setContactSelected( QString::null ); 1021 setContactSelected( QString::null );
986 setModified( true ); 1022 setModified( true );
987 } 1023 }
988} 1024}
989 1025
990void KABCore::copyContacts() 1026void KABCore::copyContacts()
991{ 1027{
992 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1028 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
993 1029
994 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 1030 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
995 1031
996 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 1032 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
997 1033
998 QClipboard *cb = QApplication::clipboard(); 1034 QClipboard *cb = QApplication::clipboard();
999 cb->setText( clipText ); 1035 cb->setText( clipText );
1000} 1036}
1001 1037
1002void KABCore::cutContacts() 1038void KABCore::cutContacts()
1003{ 1039{
1004 QStringList uidList = mViewManager->selectedUids(); 1040 QStringList uidList = mViewManager->selectedUids();
1005 1041
1006//US if ( uidList.size() > 0 ) { 1042//US if ( uidList.size() > 0 ) {
1007 if ( uidList.count() > 0 ) { 1043 if ( uidList.count() > 0 ) {
1008 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 1044 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
1009 UndoStack::instance()->push( command ); 1045 UndoStack::instance()->push( command );
1010 RedoStack::instance()->clear(); 1046 RedoStack::instance()->clear();
1011 1047
1012 setModified( true ); 1048 setModified( true );
1013 } 1049 }
1014} 1050}
1015 1051
1016void KABCore::pasteContacts() 1052void KABCore::pasteContacts()
1017{ 1053{
1018 QClipboard *cb = QApplication::clipboard(); 1054 QClipboard *cb = QApplication::clipboard();
1019 1055
1020 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 1056 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
1021 1057
1022 pasteContacts( list ); 1058 pasteContacts( list );
1023} 1059}
1024 1060
1025void KABCore::pasteContacts( KABC::Addressee::List &list ) 1061void KABCore::pasteContacts( KABC::Addressee::List &list )
1026{ 1062{
1027 KABC::Resource *resource = requestResource( this ); 1063 KABC::Resource *resource = requestResource( this );
1028 KABC::Addressee::List::Iterator it; 1064 KABC::Addressee::List::Iterator it;
1029 for ( it = list.begin(); it != list.end(); ++it ) 1065 for ( it = list.begin(); it != list.end(); ++it )
1030 (*it).setResource( resource ); 1066 (*it).setResource( resource );
1031 1067
1032 PwPasteCommand *command = new PwPasteCommand( this, list ); 1068 PwPasteCommand *command = new PwPasteCommand( this, list );
1033 UndoStack::instance()->push( command ); 1069 UndoStack::instance()->push( command );
1034 RedoStack::instance()->clear(); 1070 RedoStack::instance()->clear();
1035 1071
1036 setModified( true ); 1072 setModified( true );
1037} 1073}
1038 1074
1039void KABCore::setWhoAmI() 1075void KABCore::setWhoAmI()
1040{ 1076{
1041 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1077 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1042 1078
1043 if ( addrList.count() > 1 ) { 1079 if ( addrList.count() > 1 ) {
1044 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 1080 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
1045 return; 1081 return;
1046 } 1082 }
1047 1083
1048 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 1084 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
1049 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 1085 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
1050 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 1086 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
1051} 1087}
1052void KABCore::editCategories() 1088void KABCore::editCategories()
1053{ 1089{
1054 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1090 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1055 dlg.exec(); 1091 dlg.exec();
1056} 1092}
1057void KABCore::setCategories() 1093void KABCore::setCategories()
1058{ 1094{
1059 1095
1060 QStringList uids; 1096 QStringList uids;
1061 XXPortSelectDialog dlgx( this, false, this ); 1097 XXPortSelectDialog dlgx( this, false, this );
1062 if ( dlgx.exec() ) 1098 if ( dlgx.exec() )
1063 uids = dlgx.uids(); 1099 uids = dlgx.uids();
1064 else 1100 else
1065 return; 1101 return;
1066 if ( uids.isEmpty() ) 1102 if ( uids.isEmpty() )
1067 return; 1103 return;
1068 // qDebug("count %d ", uids.count()); 1104 // qDebug("count %d ", uids.count());
1069 1105
1070 1106
1071 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1107 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1072 if ( !dlg.exec() ) { 1108 if ( !dlg.exec() ) {
1073 message( i18n("Setting categories cancelled") ); 1109 message( i18n("Setting categories cancelled") );
1074 return; 1110 return;
1075 } 1111 }
1076 bool merge = false; 1112 bool merge = false;
1077 QString msg = i18n( "Merge with existing categories?" ); 1113 QString msg = i18n( "Merge with existing categories?" );
1078 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1114 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
1079 merge = true; 1115 merge = true;
1080 1116
1081 message( i18n("Setting categories ... please wait!") ); 1117 message( i18n("Setting categories ... please wait!") );
1082 QStringList categories = dlg.selectedCategories(); 1118 QStringList categories = dlg.selectedCategories();
1083 1119
1084 //QStringList uids = mViewManager->selectedUids(); 1120 //QStringList uids = mViewManager->selectedUids();
1085 QStringList::Iterator it; 1121 QStringList::Iterator it;
1086 for ( it = uids.begin(); it != uids.end(); ++it ) { 1122 for ( it = uids.begin(); it != uids.end(); ++it ) {
1087 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1123 KABC::Addressee addr = mAddressBook->findByUid( *it );
1088 if ( !addr.isEmpty() ) { 1124 if ( !addr.isEmpty() ) {
1089 if ( !merge ) 1125 if ( !merge )
1090 addr.setCategories( categories ); 1126 addr.setCategories( categories );
1091 else { 1127 else {
1092 QStringList addrCategories = addr.categories(); 1128 QStringList addrCategories = addr.categories();
1093 QStringList::Iterator catIt; 1129 QStringList::Iterator catIt;
1094 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1130 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
1095 if ( !addrCategories.contains( *catIt ) ) 1131 if ( !addrCategories.contains( *catIt ) )
1096 addrCategories.append( *catIt ); 1132 addrCategories.append( *catIt );
1097 } 1133 }
1098 addr.setCategories( addrCategories ); 1134 addr.setCategories( addrCategories );
1099 } 1135 }
1100 mAddressBook->insertAddressee( addr ); 1136 mAddressBook->insertAddressee( addr );
1101 } 1137 }
1102 } 1138 }
1103 1139
1104 if ( uids.count() > 0 ) 1140 if ( uids.count() > 0 )
1105 setModified( true ); 1141 setModified( true );
1106 message( i18n("Setting categories completed!") ); 1142 message( i18n("Setting categories completed!") );
1107} 1143}
1108 1144
1109void KABCore::setSearchFields( const KABC::Field::List &fields ) 1145void KABCore::setSearchFields( const KABC::Field::List &fields )
1110{ 1146{
1111 mIncSearchWidget->setFields( fields ); 1147 mIncSearchWidget->setFields( fields );
1112} 1148}
1113 1149
1114void KABCore::incrementalSearch( const QString& text ) 1150void KABCore::incrementalSearch( const QString& text )
1115{ 1151{
1116 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1152 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1117} 1153}
1118 1154
1119void KABCore::setModified() 1155void KABCore::setModified()
1120{ 1156{
1121 setModified( true ); 1157 setModified( true );
1122} 1158}
1123 1159
1124void KABCore::setModifiedWOrefresh() 1160void KABCore::setModifiedWOrefresh()
1125{ 1161{
1126 // qDebug("KABCore::setModifiedWOrefresh() "); 1162 // qDebug("KABCore::setModifiedWOrefresh() ");
1127 mModified = true; 1163 mModified = true;
1128 mActionSave->setEnabled( mModified ); 1164 mActionSave->setEnabled( mModified );
1129 1165
1130 1166
1131} 1167}
1132void KABCore::setModified( bool modified ) 1168void KABCore::setModified( bool modified )
1133{ 1169{
1134 mModified = modified; 1170 mModified = modified;
1135 mActionSave->setEnabled( mModified ); 1171 mActionSave->setEnabled( mModified );
1136 1172
1137 if ( modified ) 1173 if ( modified )
1138 mJumpButtonBar->recreateButtons(); 1174 mJumpButtonBar->recreateButtons();
1139 1175
1140 mViewManager->refreshView(); 1176 mViewManager->refreshView();
1141 1177
1142} 1178}
1143 1179
1144bool KABCore::modified() const 1180bool KABCore::modified() const
1145{ 1181{
1146 return mModified; 1182 return mModified;
1147} 1183}
1148 1184
1149void KABCore::contactModified( const KABC::Addressee &addr ) 1185void KABCore::contactModified( const KABC::Addressee &addr )
1186{
1187 addrModified( addr );
1188}
1189
1190void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
1150{ 1191{
1151 1192
1152 Command *command = 0; 1193 Command *command = 0;
1153 QString uid; 1194 QString uid;
1154 1195
1155 // check if it exists already 1196 // check if it exists already
1156 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1197 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1157 if ( origAddr.isEmpty() ) 1198 if ( origAddr.isEmpty() )
1158 command = new PwNewCommand( mAddressBook, addr ); 1199 command = new PwNewCommand( mAddressBook, addr );
1159 else { 1200 else {
1160 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1201 command = new PwEditCommand( mAddressBook, origAddr, addr );
1161 uid = addr.uid(); 1202 uid = addr.uid();
1162 } 1203 }
1163 1204
1164 UndoStack::instance()->push( command ); 1205 UndoStack::instance()->push( command );
1165 RedoStack::instance()->clear(); 1206 RedoStack::instance()->clear();
1166 mDetails->setAddressee( addr ); 1207 if ( updateDetails )
1208 mDetails->setAddressee( addr );
1167 setModified( true ); 1209 setModified( true );
1168} 1210}
1169 1211
1170void KABCore::newContact() 1212void KABCore::newContact()
1171{ 1213{
1172 1214
1173 1215
1174 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1216 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1175 1217
1176 QPtrList<KRES::Resource> kresResources; 1218 QPtrList<KRES::Resource> kresResources;
1177 QPtrListIterator<KABC::Resource> it( kabcResources ); 1219 QPtrListIterator<KABC::Resource> it( kabcResources );
1178 KABC::Resource *resource; 1220 KABC::Resource *resource;
1179 while ( ( resource = it.current() ) != 0 ) { 1221 while ( ( resource = it.current() ) != 0 ) {
1180 ++it; 1222 ++it;
1181 if ( !resource->readOnly() ) { 1223 if ( !resource->readOnly() ) {
1182 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1224 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1183 if ( res ) 1225 if ( res )
1184 kresResources.append( res ); 1226 kresResources.append( res );
1185 } 1227 }
1186 } 1228 }
1187 1229
1188 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1230 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1189 resource = static_cast<KABC::Resource*>( res ); 1231 resource = static_cast<KABC::Resource*>( res );
1190 1232
1191 if ( resource ) { 1233 if ( resource ) {
1192 KABC::Addressee addr; 1234 KABC::Addressee addr;
1193 addr.setResource( resource ); 1235 addr.setResource( resource );
1194 mEditorDialog->setAddressee( addr ); 1236 mEditorDialog->setAddressee( addr );
1195 KApplication::execDialog ( mEditorDialog ); 1237 KApplication::execDialog ( mEditorDialog );
1196 1238
1197 } else 1239 } else
1198 return; 1240 return;
1199 1241
1200 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1242 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1201 1243
1202 1244
1203} 1245}
1204 1246
1205void KABCore::addEmail( QString aStr ) 1247void KABCore::addEmail( QString aStr )
1206{ 1248{
1207#ifndef KAB_EMBEDDED 1249#ifndef KAB_EMBEDDED
1208 QString fullName, email; 1250 QString fullName, email;
1209 1251
1210 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1252 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1211 1253
1212 // Try to lookup the addressee matching the email address 1254 // Try to lookup the addressee matching the email address
1213 bool found = false; 1255 bool found = false;
1214 QStringList emailList; 1256 QStringList emailList;
1215 KABC::AddressBook::Iterator it; 1257 KABC::AddressBook::Iterator it;
1216 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1258 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1217 emailList = (*it).emails(); 1259 emailList = (*it).emails();
1218 if ( emailList.contains( email ) > 0 ) { 1260 if ( emailList.contains( email ) > 0 ) {
1219 found = true; 1261 found = true;
1220 (*it).setNameFromString( fullName ); 1262 (*it).setNameFromString( fullName );
1221 editContact( (*it).uid() ); 1263 editContact( (*it).uid() );
1222 } 1264 }
1223 } 1265 }
1224 1266
1225 if ( !found ) { 1267 if ( !found ) {
1226 KABC::Addressee addr; 1268 KABC::Addressee addr;
1227 addr.setNameFromString( fullName ); 1269 addr.setNameFromString( fullName );
1228 addr.insertEmail( email, true ); 1270 addr.insertEmail( email, true );
1229 1271
1230 mAddressBook->insertAddressee( addr ); 1272 mAddressBook->insertAddressee( addr );
1231 mViewManager->refreshView( addr.uid() ); 1273 mViewManager->refreshView( addr.uid() );
1232 editContact( addr.uid() ); 1274 editContact( addr.uid() );
1233 } 1275 }
1234#else //KAB_EMBEDDED 1276#else //KAB_EMBEDDED
1235 qDebug("KABCore::addEmail finsih method"); 1277 qDebug("KABCore::addEmail finsih method");
1236#endif //KAB_EMBEDDED 1278#endif //KAB_EMBEDDED
1237} 1279}
1238 1280
1239void KABCore::importVCard( const KURL &url, bool showPreview ) 1281void KABCore::importVCard( const KURL &url, bool showPreview )
1240{ 1282{
1241 mXXPortManager->importVCard( url, showPreview ); 1283 mXXPortManager->importVCard( url, showPreview );
1242} 1284}
1243void KABCore::importFromOL() 1285void KABCore::importFromOL()
1244{ 1286{
1245#ifdef _WIN32_ 1287#ifdef _WIN32_
1246 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1288 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1247 idgl->exec(); 1289 idgl->exec();
1248 KABC::Addressee::List list = idgl->getAddressList(); 1290 KABC::Addressee::List list = idgl->getAddressList();
1249 if ( list.count() > 0 ) { 1291 if ( list.count() > 0 ) {
1250 KABC::Addressee::List listNew; 1292 KABC::Addressee::List listNew;
1251 KABC::Addressee::List listExisting; 1293 KABC::Addressee::List listExisting;
1252 KABC::Addressee::List::Iterator it; 1294 KABC::Addressee::List::Iterator it;
1253 KABC::AddressBook::Iterator iter; 1295 KABC::AddressBook::Iterator iter;
1254 for ( it = list.begin(); it != list.end(); ++it ) { 1296 for ( it = list.begin(); it != list.end(); ++it ) {
1255 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1297 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1256 listNew.append( (*it) ); 1298 listNew.append( (*it) );
1257 else 1299 else
1258 listExisting.append( (*it) ); 1300 listExisting.append( (*it) );
1259 } 1301 }
1260 if ( listExisting.count() > 0 ) 1302 if ( listExisting.count() > 0 )
1261 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1303 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1262 if ( listNew.count() > 0 ) { 1304 if ( listNew.count() > 0 ) {
1263 pasteWithNewUid = false; 1305 pasteWithNewUid = false;
1264 pasteContacts( listNew ); 1306 pasteContacts( listNew );
1265 pasteWithNewUid = true; 1307 pasteWithNewUid = true;
1266 } 1308 }
1267 } 1309 }
1268 delete idgl; 1310 delete idgl;
1269#endif 1311#endif
1270} 1312}
1271 1313
1272void KABCore::importVCard( const QString &vCard, bool showPreview ) 1314void KABCore::importVCard( const QString &vCard, bool showPreview )
1273{ 1315{
1274 mXXPortManager->importVCard( vCard, showPreview ); 1316 mXXPortManager->importVCard( vCard, showPreview );
1275} 1317}
1276 1318
1277//US added a second method without defaultparameter 1319//US added a second method without defaultparameter
1278void KABCore::editContact2() { 1320void KABCore::editContact2() {
1279 editContact( QString::null ); 1321 editContact( QString::null );
1280} 1322}
1281 1323
1282void KABCore::editContact( const QString &uid ) 1324void KABCore::editContact( const QString &uid )
1283{ 1325{
1284 1326
1285 if ( mExtensionManager->isQuickEditVisible() ) 1327 if ( mExtensionManager->isQuickEditVisible() )
1286 return; 1328 return;
1287 1329
1288 // First, locate the contact entry 1330 // First, locate the contact entry
1289 QString localUID = uid; 1331 QString localUID = uid;
1290 if ( localUID.isNull() ) { 1332 if ( localUID.isNull() ) {
1291 QStringList uidList = mViewManager->selectedUids(); 1333 QStringList uidList = mViewManager->selectedUids();
1292 if ( uidList.count() > 0 ) 1334 if ( uidList.count() > 0 )
1293 localUID = *( uidList.at( 0 ) ); 1335 localUID = *( uidList.at( 0 ) );
1294 } 1336 }
1295 1337
1296 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1338 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1297 if ( !addr.isEmpty() ) { 1339 if ( !addr.isEmpty() ) {
1298 mEditorDialog->setAddressee( addr ); 1340 mEditorDialog->setAddressee( addr );
1299 KApplication::execDialog ( mEditorDialog ); 1341 KApplication::execDialog ( mEditorDialog );
1300 } 1342 }
1301} 1343}
1302 1344
1303/** 1345/**
1304 Shows or edits the detail view for the given uid. If the uid is QString::null, 1346 Shows or edits the detail view for the given uid. If the uid is QString::null,
1305 the method will try to find a selected addressee in the view. 1347 the method will try to find a selected addressee in the view.
1306 */ 1348 */
1307void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1349void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1308{ 1350{
1309 if ( mMultipleViewsAtOnce ) 1351 if ( mMultipleViewsAtOnce )
1310 { 1352 {
1311 editContact( uid ); 1353 editContact( uid );
1312 } 1354 }
1313 else 1355 else
1314 { 1356 {
1315 setDetailsVisible( true ); 1357 setDetailsVisible( true );
1316 mActionDetails->setChecked(true); 1358 mActionDetails->setChecked(true);
1317 } 1359 }
1318 1360
1319} 1361}
1320 1362
1321void KABCore::save() 1363void KABCore::save()
1322{ 1364{
1323 if (syncManager->blockSave()) 1365 if (syncManager->blockSave())
1324 return; 1366 return;
1325 if ( !mModified ) 1367 if ( !mModified )
1326 return; 1368 return;
1327 1369
1328 syncManager->setBlockSave(true); 1370 syncManager->setBlockSave(true);
1329 QString text = i18n( "There was an error while attempting to save\n the " 1371 QString text = i18n( "There was an error while attempting to save\n the "
1330 "address book. Please check that some \nother application is " 1372 "address book. Please check that some \nother application is "
1331 "not using it. " ); 1373 "not using it. " );
1332 message(i18n("Saving addressbook ... ")); 1374 message(i18n("Saving addressbook ... "));
1333#ifndef KAB_EMBEDDED 1375#ifndef KAB_EMBEDDED
1334 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1376 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1335 if ( !b || !b->save() ) { 1377 if ( !b || !b->save() ) {
1336 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1378 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1337 } 1379 }
1338#else //KAB_EMBEDDED 1380#else //KAB_EMBEDDED
1339 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1381 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1340 if ( !b || !b->save() ) { 1382 if ( !b || !b->save() ) {
1341 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1383 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1342 } 1384 }
1343#endif //KAB_EMBEDDED 1385#endif //KAB_EMBEDDED
1344 1386
1345 message(i18n("Addressbook saved!")); 1387 message(i18n("Addressbook saved!"));
1346 setModified( false ); 1388 setModified( false );
1347 syncManager->setBlockSave(false); 1389 syncManager->setBlockSave(false);
1348} 1390}
1349 1391
1350 1392
1351void KABCore::undo() 1393void KABCore::undo()
1352{ 1394{
1353 UndoStack::instance()->undo(); 1395 UndoStack::instance()->undo();
1354 1396
1355 // Refresh the view 1397 // Refresh the view
1356 mViewManager->refreshView(); 1398 mViewManager->refreshView();
1357} 1399}
1358 1400
1359void KABCore::redo() 1401void KABCore::redo()
1360{ 1402{
1361 RedoStack::instance()->redo(); 1403 RedoStack::instance()->redo();
1362 1404
1363 // Refresh the view 1405 // Refresh the view
1364 mViewManager->refreshView(); 1406 mViewManager->refreshView();
1365} 1407}
1366 1408
1367void KABCore::setJumpButtonBarVisible( bool visible ) 1409void KABCore::setJumpButtonBarVisible( bool visible )
1368{ 1410{
1369 if (mMultipleViewsAtOnce) 1411 if (mMultipleViewsAtOnce)
1370 { 1412 {
1371 if ( visible ) 1413 if ( visible )
1372 mJumpButtonBar->show(); 1414 mJumpButtonBar->show();
1373 else 1415 else
1374 mJumpButtonBar->hide(); 1416 mJumpButtonBar->hide();
1375 } 1417 }
1376 else 1418 else
1377 { 1419 {
1378 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1420 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1379 if (mViewManager->isVisible()) 1421 if (mViewManager->isVisible())
1380 { 1422 {
1381 if ( visible ) 1423 if ( visible )
1382 mJumpButtonBar->show(); 1424 mJumpButtonBar->show();
1383 else 1425 else
1384 mJumpButtonBar->hide(); 1426 mJumpButtonBar->hide();
1385 } 1427 }
1386 else 1428 else
1387 { 1429 {
1388 mJumpButtonBar->hide(); 1430 mJumpButtonBar->hide();
1389 } 1431 }
1390 } 1432 }
1391} 1433}
1392 1434
1393 1435
1394void KABCore::setDetailsToState() 1436void KABCore::setDetailsToState()
1395{ 1437{
1396 setDetailsVisible( mActionDetails->isChecked() ); 1438 setDetailsVisible( mActionDetails->isChecked() );
1397} 1439}
1398void KABCore::setDetailsToggle() 1440void KABCore::setDetailsToggle()
1399{ 1441{
1400 mActionDetails->setChecked( !mActionDetails->isChecked() ); 1442 mActionDetails->setChecked( !mActionDetails->isChecked() );
1401 setDetailsToState(); 1443 setDetailsToState();
1402} 1444}
1403 1445
1404 1446
1405 1447
1406void KABCore::setDetailsVisible( bool visible ) 1448void KABCore::setDetailsVisible( bool visible )
1407{ 1449{
1408 if (visible && mDetails->isHidden()) 1450 if (visible && mDetails->isHidden())
1409 { 1451 {
1410 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1452 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1411 if ( addrList.count() > 0 ) 1453 if ( addrList.count() > 0 )
1412 mDetails->setAddressee( addrList[ 0 ] ); 1454 mDetails->setAddressee( addrList[ 0 ] );
1413 } 1455 }
1414 1456
1415 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1457 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1416 // the listview and the detailview. We do that by changing the splitbar size. 1458 // the listview and the detailview. We do that by changing the splitbar size.
1417 if (mMultipleViewsAtOnce) 1459 if (mMultipleViewsAtOnce)
1418 { 1460 {
1419 if ( visible ) 1461 if ( visible )
1420 mDetails->show(); 1462 mDetails->show();
1421 else 1463 else
1422 mDetails->hide(); 1464 mDetails->hide();
1423 } 1465 }
1424 else 1466 else
1425 { 1467 {
1426 if ( visible ) { 1468 if ( visible ) {
1427 mViewManager->hide(); 1469 mViewManager->hide();
1428 mDetails->show(); 1470 mDetails->show();
1429 mIncSearchWidget->setFocus(); 1471 mIncSearchWidget->setFocus();
1430 } 1472 }
1431 else { 1473 else {
1432 mViewManager->show(); 1474 mViewManager->show();
1433 mDetails->hide(); 1475 mDetails->hide();
1434 mViewManager->setFocusAV(); 1476 mViewManager->setFocusAV();
1435 } 1477 }
1436 setJumpButtonBarVisible( !visible ); 1478 setJumpButtonBarVisible( !visible );
1437 } 1479 }
1438 1480
1439} 1481}
1440 1482
1441void KABCore::extensionChanged( int id ) 1483void KABCore::extensionChanged( int id )
1442{ 1484{
1443 //change the details view only for non desktop systems 1485 //change the details view only for non desktop systems
1444#ifndef DESKTOP_VERSION 1486#ifndef DESKTOP_VERSION
1445 1487
1446 if (id == 0) 1488 if (id == 0)
1447 { 1489 {
1448 //the user disabled the extension. 1490 //the user disabled the extension.
1449 1491
1450 if (mMultipleViewsAtOnce) 1492 if (mMultipleViewsAtOnce)
1451 { // enable detailsview again 1493 { // enable detailsview again
1452 setDetailsVisible( true ); 1494 setDetailsVisible( true );
1453 mActionDetails->setChecked( true ); 1495 mActionDetails->setChecked( true );
1454 } 1496 }
1455 else 1497 else
1456 { //go back to the listview 1498 { //go back to the listview
1457 setDetailsVisible( false ); 1499 setDetailsVisible( false );
1458 mActionDetails->setChecked( false ); 1500 mActionDetails->setChecked( false );
1459 mActionDetails->setEnabled(true); 1501 mActionDetails->setEnabled(true);
1460 } 1502 }
1461 1503
1462 } 1504 }
1463 else 1505 else
1464 { 1506 {
1465 //the user enabled the extension. 1507 //the user enabled the extension.
1466 setDetailsVisible( false ); 1508 setDetailsVisible( false );
1467 mActionDetails->setChecked( false ); 1509 mActionDetails->setChecked( false );
1468 1510
1469 if (!mMultipleViewsAtOnce) 1511 if (!mMultipleViewsAtOnce)
1470 { 1512 {
1471 mActionDetails->setEnabled(false); 1513 mActionDetails->setEnabled(false);
1472 } 1514 }
1473 1515
1474 mExtensionManager->setSelectionChanged(); 1516 mExtensionManager->setSelectionChanged();
1475 1517
1476 } 1518 }
1477 1519
1478#endif// DESKTOP_VERSION 1520#endif// DESKTOP_VERSION
1479 1521
1480} 1522}
1481 1523
1482 1524
1483void KABCore::extensionModified( const KABC::Addressee::List &list ) 1525void KABCore::extensionModified( const KABC::Addressee::List &list )
1484{ 1526{
1485 1527
1486 if ( list.count() != 0 ) { 1528 if ( list.count() != 0 ) {
1487 KABC::Addressee::List::ConstIterator it; 1529 KABC::Addressee::List::ConstIterator it;
1488 for ( it = list.begin(); it != list.end(); ++it ) 1530 for ( it = list.begin(); it != list.end(); ++it )
1489 mAddressBook->insertAddressee( *it ); 1531 mAddressBook->insertAddressee( *it );
1490 if ( list.count() > 1 ) 1532 if ( list.count() > 1 )
1491 setModified(); 1533 setModified();
1492 else 1534 else
1493 setModifiedWOrefresh(); 1535 setModifiedWOrefresh();
1494 } 1536 }
1495 if ( list.count() == 0 ) 1537 if ( list.count() == 0 )
1496 mViewManager->refreshView(); 1538 mViewManager->refreshView();
1497 else 1539 else
1498 mViewManager->refreshView( list[ 0 ].uid() ); 1540 mViewManager->refreshView( list[ 0 ].uid() );
1499 1541
1500 1542
1501 1543
1502} 1544}
1503 1545
1504QString KABCore::getNameByPhone( const QString &phone ) 1546QString KABCore::getNameByPhone( const QString &phone )
1505{ 1547{
1506#ifndef KAB_EMBEDDED 1548#ifndef KAB_EMBEDDED
1507 QRegExp r( "[/*/-/ ]" ); 1549 QRegExp r( "[/*/-/ ]" );
1508 QString localPhone( phone ); 1550 QString localPhone( phone );
1509 1551
1510 bool found = false; 1552 bool found = false;
1511 QString ownerName = ""; 1553 QString ownerName = "";
1512 KABC::AddressBook::Iterator iter; 1554 KABC::AddressBook::Iterator iter;
1513 KABC::PhoneNumber::List::Iterator phoneIter; 1555 KABC::PhoneNumber::List::Iterator phoneIter;
1514 KABC::PhoneNumber::List phoneList; 1556 KABC::PhoneNumber::List phoneList;
1515 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1557 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1516 phoneList = (*iter).phoneNumbers(); 1558 phoneList = (*iter).phoneNumbers();
1517 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1559 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1518 ++phoneIter) { 1560 ++phoneIter) {
1519 // Get rid of separator chars so just the numbers are compared. 1561 // Get rid of separator chars so just the numbers are compared.
1520 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1562 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1521 ownerName = (*iter).formattedName(); 1563 ownerName = (*iter).formattedName();
1522 found = true; 1564 found = true;
1523 } 1565 }
1524 } 1566 }
1525 } 1567 }
1526 1568
1527 return ownerName; 1569 return ownerName;
1528#else //KAB_EMBEDDED 1570#else //KAB_EMBEDDED
1529 qDebug("KABCore::getNameByPhone finsih method"); 1571 qDebug("KABCore::getNameByPhone finsih method");
1530 return ""; 1572 return "";
1531#endif //KAB_EMBEDDED 1573#endif //KAB_EMBEDDED
1532 1574
1533} 1575}
1534 1576
1535void KABCore::openConfigDialog() 1577void KABCore::openConfigDialog()
1536{ 1578{
1537 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1579 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1538 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1580 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1539 ConfigureDialog->addModule(kabcfg ); 1581 ConfigureDialog->addModule(kabcfg );
1540 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 1582 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1541 ConfigureDialog->addModule(kdelibcfg ); 1583 ConfigureDialog->addModule(kdelibcfg );
1542 1584
1543 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1585 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1544 this, SLOT( configurationChanged() ) ); 1586 this, SLOT( configurationChanged() ) );
1545 connect( ConfigureDialog, SIGNAL( okClicked() ), 1587 connect( ConfigureDialog, SIGNAL( okClicked() ),
1546 this, SLOT( configurationChanged() ) ); 1588 this, SLOT( configurationChanged() ) );
1547 saveSettings(); 1589 saveSettings();
1548#ifndef DESKTOP_VERSION 1590#ifndef DESKTOP_VERSION
1549 ConfigureDialog->showMaximized(); 1591 ConfigureDialog->showMaximized();
1550#endif 1592#endif
1551 if ( ConfigureDialog->exec() ) 1593 if ( ConfigureDialog->exec() )
1552 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1594 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1553 delete ConfigureDialog; 1595 delete ConfigureDialog;
1554} 1596}
1555 1597
1556void KABCore::openLDAPDialog() 1598void KABCore::openLDAPDialog()
1557{ 1599{
1558#ifndef KAB_EMBEDDED 1600#ifndef KAB_EMBEDDED
1559 if ( !mLdapSearchDialog ) { 1601 if ( !mLdapSearchDialog ) {
1560 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1602 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1561 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1603 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1562 SLOT( refreshView() ) ); 1604 SLOT( refreshView() ) );
1563 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1605 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1564 SLOT( setModified() ) ); 1606 SLOT( setModified() ) );
1565 } else 1607 } else
1566 mLdapSearchDialog->restoreSettings(); 1608 mLdapSearchDialog->restoreSettings();
1567 1609
1568 if ( mLdapSearchDialog->isOK() ) 1610 if ( mLdapSearchDialog->isOK() )
1569 mLdapSearchDialog->exec(); 1611 mLdapSearchDialog->exec();
1570#else //KAB_EMBEDDED 1612#else //KAB_EMBEDDED
1571 qDebug("KABCore::openLDAPDialog() finsih method"); 1613 qDebug("KABCore::openLDAPDialog() finsih method");
1572#endif //KAB_EMBEDDED 1614#endif //KAB_EMBEDDED
1573} 1615}
1574 1616
1575void KABCore::print() 1617void KABCore::print()
1576{ 1618{
1577#ifndef KAB_EMBEDDED 1619#ifndef KAB_EMBEDDED
1578 KPrinter printer; 1620 KPrinter printer;
1579 if ( !printer.setup( this ) ) 1621 if ( !printer.setup( this ) )
1580 return; 1622 return;
1581 1623
1582 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1624 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1583 mViewManager->selectedUids(), this ); 1625 mViewManager->selectedUids(), this );
1584 1626
1585 wizard.exec(); 1627 wizard.exec();
1586#else //KAB_EMBEDDED 1628#else //KAB_EMBEDDED
1587 qDebug("KABCore::print() finsih method"); 1629 qDebug("KABCore::print() finsih method");
1588#endif //KAB_EMBEDDED 1630#endif //KAB_EMBEDDED
1589 1631
1590} 1632}
1591 1633
1592 1634
1593void KABCore::addGUIClient( KXMLGUIClient *client ) 1635void KABCore::addGUIClient( KXMLGUIClient *client )
1594{ 1636{
1595 if ( mGUIClient ) 1637 if ( mGUIClient )
1596 mGUIClient->insertChildClient( client ); 1638 mGUIClient->insertChildClient( client );
1597 else 1639 else
1598 KMessageBox::error( this, "no KXMLGUICLient"); 1640 KMessageBox::error( this, "no KXMLGUICLient");
1599} 1641}
1600 1642
1601 1643
1602void KABCore::configurationChanged() 1644void KABCore::configurationChanged()
1603{ 1645{
1604 mExtensionManager->reconfigure(); 1646 mExtensionManager->reconfigure();
1605} 1647}
1606 1648
1607void KABCore::addressBookChanged() 1649void KABCore::addressBookChanged()
1608{ 1650{
1609/*US 1651/*US
1610 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1652 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1611 while ( it.current() ) { 1653 while ( it.current() ) {
1612 if ( it.current()->dirty() ) { 1654 if ( it.current()->dirty() ) {
1613 QString text = i18n( "Data has been changed externally. Unsaved " 1655 QString text = i18n( "Data has been changed externally. Unsaved "
1614 "changes will be lost." ); 1656 "changes will be lost." );
1615 KMessageBox::information( this, text ); 1657 KMessageBox::information( this, text );
1616 } 1658 }
1617 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1659 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1618 ++it; 1660 ++it;
1619 } 1661 }
1620*/ 1662*/
1621 if (mEditorDialog) 1663 if (mEditorDialog)
1622 { 1664 {
1623 if (mEditorDialog->dirty()) 1665 if (mEditorDialog->dirty())
1624 { 1666 {
1625 QString text = i18n( "Data has been changed externally. Unsaved " 1667 QString text = i18n( "Data has been changed externally. Unsaved "
1626 "changes will be lost." ); 1668 "changes will be lost." );
1627 KMessageBox::information( this, text ); 1669 KMessageBox::information( this, text );
1628 } 1670 }
1629 QString currentuid = mEditorDialog->addressee().uid(); 1671 QString currentuid = mEditorDialog->addressee().uid();
1630 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1672 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1631 } 1673 }
1632 mViewManager->refreshView(); 1674 mViewManager->refreshView();
1633 1675
1634 1676
1635} 1677}
1636 1678
1637AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1679AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1638 const char *name ) 1680 const char *name )
1639{ 1681{
1640 1682
1641 if ( mEditorDialog == 0 ) { 1683 if ( mEditorDialog == 0 ) {
1642 mEditorDialog = new AddresseeEditorDialog( this, parent, 1684 mEditorDialog = new AddresseeEditorDialog( this, parent,
1643 name ? name : "editorDialog" ); 1685 name ? name : "editorDialog" );
1644 1686
1645 1687
1646 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1688 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1647 SLOT( contactModified( const KABC::Addressee& ) ) ); 1689 SLOT( contactModified( const KABC::Addressee& ) ) );
1648 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1690 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1649 // SLOT( slotEditorDestroyed( const QString& ) ) ; 1691 // SLOT( slotEditorDestroyed( const QString& ) ) ;
1650 } 1692 }
1651 1693
1652 return mEditorDialog; 1694 return mEditorDialog;
1653} 1695}
1654 1696
1655void KABCore::slotEditorDestroyed( const QString &uid ) 1697void KABCore::slotEditorDestroyed( const QString &uid )
1656{ 1698{
1657 //mEditorDict.remove( uid ); 1699 //mEditorDict.remove( uid );
1658} 1700}
1659 1701
1660void KABCore::initGUI() 1702void KABCore::initGUI()
1661{ 1703{
1662#ifndef KAB_EMBEDDED 1704#ifndef KAB_EMBEDDED
1663 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1705 QHBoxLayout *topLayout = new QHBoxLayout( this );
1664 topLayout->setSpacing( KDialogBase::spacingHint() ); 1706 topLayout->setSpacing( KDialogBase::spacingHint() );
1665 1707
1666 mExtensionBarSplitter = new QSplitter( this ); 1708 mExtensionBarSplitter = new QSplitter( this );
1667 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1709 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1668 1710
1669 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1711 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1670 1712
1671 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1713 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1672 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1714 mIncSearchWidget = new IncSearchWidget( viewSpace );
1673 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1715 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1674 SLOT( incrementalSearch( const QString& ) ) ); 1716 SLOT( incrementalSearch( const QString& ) ) );
1675 1717
1676 mViewManager = new ViewManager( this, viewSpace ); 1718 mViewManager = new ViewManager( this, viewSpace );
1677 viewSpace->setStretchFactor( mViewManager, 1 ); 1719 viewSpace->setStretchFactor( mViewManager, 1 );
1678 1720
1679 mDetails = new ViewContainer( mDetailsSplitter ); 1721 mDetails = new ViewContainer( mDetailsSplitter );
1680 1722
1681 mJumpButtonBar = new JumpButtonBar( this, this ); 1723 mJumpButtonBar = new JumpButtonBar( this, this );
1682 1724
1683 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1725 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1684 1726
1685 topLayout->addWidget( mExtensionBarSplitter ); 1727 topLayout->addWidget( mExtensionBarSplitter );
1686 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1728 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1687 topLayout->addWidget( mJumpButtonBar ); 1729 topLayout->addWidget( mJumpButtonBar );
1688 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1730 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1689 1731
1690 mXXPortManager = new XXPortManager( this, this ); 1732 mXXPortManager = new XXPortManager( this, this );
1691 1733
1692#else //KAB_EMBEDDED 1734#else //KAB_EMBEDDED
1693 //US initialize viewMenu before settingup viewmanager. 1735 //US initialize viewMenu before settingup viewmanager.
1694 // Viewmanager needs this menu to plugin submenues. 1736 // Viewmanager needs this menu to plugin submenues.
1695 viewMenu = new QPopupMenu( this ); 1737 viewMenu = new QPopupMenu( this );
1696 settingsMenu = new QPopupMenu( this ); 1738 settingsMenu = new QPopupMenu( this );
1697 //filterMenu = new QPopupMenu( this ); 1739 //filterMenu = new QPopupMenu( this );
1698 ImportMenu = new QPopupMenu( this ); 1740 ImportMenu = new QPopupMenu( this );
1699 ExportMenu = new QPopupMenu( this ); 1741 ExportMenu = new QPopupMenu( this );
1700 syncMenu = new QPopupMenu( this ); 1742 syncMenu = new QPopupMenu( this );
1701 changeMenu= new QPopupMenu( this ); 1743 changeMenu= new QPopupMenu( this );
1702 beamMenu= new QPopupMenu( this ); 1744 beamMenu= new QPopupMenu( this );
1703 1745
1704//US since we have no splitter for the embedded system, setup 1746//US since we have no splitter for the embedded system, setup
1705// a layout with two frames. One left and one right. 1747// a layout with two frames. One left and one right.
1706 1748
1707 QBoxLayout *topLayout; 1749 QBoxLayout *topLayout;
1708 1750
1709 // = new QHBoxLayout( this ); 1751 // = new QHBoxLayout( this );
1710// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1752// QBoxLayout *topLayout = (QBoxLayout*)layout();
1711 1753
1712// QWidget *mainBox = new QWidget( this ); 1754// QWidget *mainBox = new QWidget( this );
1713// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1755// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1714 1756
1715#ifdef DESKTOP_VERSION 1757#ifdef DESKTOP_VERSION
1716 topLayout = new QHBoxLayout( this ); 1758 topLayout = new QHBoxLayout( this );
1717 1759
1718 1760
1719 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1761 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1720 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1762 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1721 1763
1722 topLayout->addWidget(mMiniSplitter ); 1764 topLayout->addWidget(mMiniSplitter );
1723 1765
1724 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1766 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1725 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1767 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1726 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1768 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1727 mDetails = new ViewContainer( mMiniSplitter ); 1769 mDetails = new ViewContainer( mMiniSplitter );
1728 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1770 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1729#else 1771#else
1730 if ( QApplication::desktop()->width() > 480 ) { 1772 if ( QApplication::desktop()->width() > 480 ) {
1731 topLayout = new QHBoxLayout( this ); 1773 topLayout = new QHBoxLayout( this );
1732 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1774 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1733 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1775 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1734 } else { 1776 } else {
1735 1777
1736 topLayout = new QHBoxLayout( this ); 1778 topLayout = new QHBoxLayout( this );
1737 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1779 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1738 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1780 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1739 } 1781 }
1740 1782
1741 topLayout->addWidget(mMiniSplitter ); 1783 topLayout->addWidget(mMiniSplitter );
1742 mViewManager = new ViewManager( this, mMiniSplitter ); 1784 mViewManager = new ViewManager( this, mMiniSplitter );
1743 mDetails = new ViewContainer( mMiniSplitter ); 1785 mDetails = new ViewContainer( mMiniSplitter );
1744 1786
1745 1787
1746 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1788 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1747#endif 1789#endif
1748 //eh->hide(); 1790 //eh->hide();
1749 // topLayout->addWidget(mExtensionManager ); 1791 // topLayout->addWidget(mExtensionManager );
1750 1792
1751 1793
1752/*US 1794/*US
1753#ifndef KAB_NOSPLITTER 1795#ifndef KAB_NOSPLITTER
1754 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1796 QHBoxLayout *topLayout = new QHBoxLayout( this );
1755//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1797//US topLayout->setSpacing( KDialogBase::spacingHint() );
1756 topLayout->setSpacing( 10 ); 1798 topLayout->setSpacing( 10 );
1757 1799
1758 mDetailsSplitter = new QSplitter( this ); 1800 mDetailsSplitter = new QSplitter( this );
1759 1801
1760 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1802 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1761 1803
1762 mViewManager = new ViewManager( this, viewSpace ); 1804 mViewManager = new ViewManager( this, viewSpace );
1763 viewSpace->setStretchFactor( mViewManager, 1 ); 1805 viewSpace->setStretchFactor( mViewManager, 1 );
1764 1806
1765 mDetails = new ViewContainer( mDetailsSplitter ); 1807 mDetails = new ViewContainer( mDetailsSplitter );
1766 1808
1767 topLayout->addWidget( mDetailsSplitter ); 1809 topLayout->addWidget( mDetailsSplitter );
1768 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1810 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1769#else //KAB_NOSPLITTER 1811#else //KAB_NOSPLITTER
1770 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1812 QHBoxLayout *topLayout = new QHBoxLayout( this );
1771//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1813//US topLayout->setSpacing( KDialogBase::spacingHint() );
1772 topLayout->setSpacing( 10 ); 1814 topLayout->setSpacing( 10 );
1773 1815
1774// mDetailsSplitter = new QSplitter( this ); 1816// mDetailsSplitter = new QSplitter( this );
1775 1817
1776 QVBox *viewSpace = new QVBox( this ); 1818 QVBox *viewSpace = new QVBox( this );
1777 1819
1778 mViewManager = new ViewManager( this, viewSpace ); 1820 mViewManager = new ViewManager( this, viewSpace );
1779 viewSpace->setStretchFactor( mViewManager, 1 ); 1821 viewSpace->setStretchFactor( mViewManager, 1 );
1780 1822
1781 mDetails = new ViewContainer( this ); 1823 mDetails = new ViewContainer( this );
1782 1824
1783 topLayout->addWidget( viewSpace ); 1825 topLayout->addWidget( viewSpace );
1784// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1826// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1785 topLayout->addWidget( mDetails ); 1827 topLayout->addWidget( mDetails );
1786#endif //KAB_NOSPLITTER 1828#endif //KAB_NOSPLITTER
1787*/ 1829*/
1788 1830
1789 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1831 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1790 syncManager->setBlockSave(false); 1832 syncManager->setBlockSave(false);
1791 1833
1792 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1834 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1793 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1835 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1794 QString sync_file = sentSyncFile(); 1836 QString sync_file = sentSyncFile();
1795 qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); 1837 qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1());
1796 syncManager->setDefaultFileName( sync_file ); 1838 syncManager->setDefaultFileName( sync_file );
1797 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1839 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1798 1840
1799#endif //KAB_EMBEDDED 1841#endif //KAB_EMBEDDED
1800 initActions(); 1842 initActions();
1801 1843
1802#ifdef KAB_EMBEDDED 1844#ifdef KAB_EMBEDDED
1803 addActionsManually(); 1845 addActionsManually();
1804 //US make sure the export and import menues are initialized before creating the xxPortManager. 1846 //US make sure the export and import menues are initialized before creating the xxPortManager.
1805 mXXPortManager = new XXPortManager( this, this ); 1847 mXXPortManager = new XXPortManager( this, this );
1806 1848
1807 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1849 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1808 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1850 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1809 // mActionQuit->plug ( mMainWindow->toolBar()); 1851 // mActionQuit->plug ( mMainWindow->toolBar());
1810 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1852 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1811 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1853 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1812 // mIncSearchWidget->hide(); 1854 // mIncSearchWidget->hide();
1813 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1855 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1814 SLOT( incrementalSearch( const QString& ) ) ); 1856 SLOT( incrementalSearch( const QString& ) ) );
1815 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1857 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1816 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1858 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1817 1859
1818 mJumpButtonBar = new JumpButtonBar( this, this ); 1860 mJumpButtonBar = new JumpButtonBar( this, this );
1819 1861
1820 topLayout->addWidget( mJumpButtonBar ); 1862 topLayout->addWidget( mJumpButtonBar );
1821//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1863//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1822 1864
1823// mMainWindow->getIconToolBar()->raise(); 1865// mMainWindow->getIconToolBar()->raise();
1824 1866
1825#endif //KAB_EMBEDDED 1867#endif //KAB_EMBEDDED
1826 1868
1827} 1869}
1828void KABCore::initActions() 1870void KABCore::initActions()
1829{ 1871{
1830//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1872//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1831 1873
1832#ifndef KAB_EMBEDDED 1874#ifndef KAB_EMBEDDED
1833 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1875 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1834 SLOT( clipboardDataChanged() ) ); 1876 SLOT( clipboardDataChanged() ) );
1835#endif //KAB_EMBEDDED 1877#endif //KAB_EMBEDDED
1836 1878
1837 // file menu 1879 // file menu
1838 if ( mIsPart ) { 1880 if ( mIsPart ) {
1839 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1881 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1840 SLOT( sendMail() ), actionCollection(), 1882 SLOT( sendMail() ), actionCollection(),
1841 "kaddressbook_mail" ); 1883 "kaddressbook_mail" );
1842 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1884 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1843 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1885 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1844 1886
1845 } else { 1887 } else {
1846 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1888 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1847 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1889 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1848 } 1890 }
1849 1891
1850 1892
1851 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1893 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1852 SLOT( save() ), actionCollection(), "file_sync" ); 1894 SLOT( save() ), actionCollection(), "file_sync" );
1853 1895
1854 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1896 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1855 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1897 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1856 1898
1857 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1899 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1858 this, SLOT( mailVCard() ), 1900 this, SLOT( mailVCard() ),
1859 actionCollection(), "file_mail_vcard"); 1901 actionCollection(), "file_mail_vcard");
1860 1902
1861 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 1903 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1862 SLOT( export2phone() ), actionCollection(), 1904 SLOT( export2phone() ), actionCollection(),
1863 "kaddressbook_ex2phone" ); 1905 "kaddressbook_ex2phone" );
1864 1906
1865 mActionBeamVCard = 0; 1907 mActionBeamVCard = 0;
1866 mActionBeam = 0; 1908 mActionBeam = 0;
1867 1909
1868#ifndef DESKTOP_VERSION 1910#ifndef DESKTOP_VERSION
1869 if ( Ir::supported() ) { 1911 if ( Ir::supported() ) {
1870 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, 1912 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
1871 SLOT( beamVCard() ), actionCollection(), 1913 SLOT( beamVCard() ), actionCollection(),
1872 "kaddressbook_beam_vcard" ); 1914 "kaddressbook_beam_vcard" );
1873 1915
1874 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1916 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1875 SLOT( beamMySelf() ), actionCollection(), 1917 SLOT( beamMySelf() ), actionCollection(),
1876 "kaddressbook_beam_myself" ); 1918 "kaddressbook_beam_myself" );
1877 } 1919 }
1878#endif 1920#endif
1879 1921
1880 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1922 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1881 this, SLOT( editContact2() ), 1923 this, SLOT( editContact2() ),
1882 actionCollection(), "file_properties" ); 1924 actionCollection(), "file_properties" );
1883 1925
1884#ifdef KAB_EMBEDDED 1926#ifdef KAB_EMBEDDED
1885 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1927 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1886 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1928 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1887 mMainWindow, SLOT( exit() ), 1929 mMainWindow, SLOT( exit() ),
1888 actionCollection(), "quit" ); 1930 actionCollection(), "quit" );
1889#endif //KAB_EMBEDDED 1931#endif //KAB_EMBEDDED
1890 1932
1891 // edit menu 1933 // edit menu
1892 if ( mIsPart ) { 1934 if ( mIsPart ) {
1893 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1935 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1894 SLOT( copyContacts() ), actionCollection(), 1936 SLOT( copyContacts() ), actionCollection(),
1895 "kaddressbook_copy" ); 1937 "kaddressbook_copy" );
1896 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1938 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1897 SLOT( cutContacts() ), actionCollection(), 1939 SLOT( cutContacts() ), actionCollection(),
1898 "kaddressbook_cut" ); 1940 "kaddressbook_cut" );
1899 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1941 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1900 SLOT( pasteContacts() ), actionCollection(), 1942 SLOT( pasteContacts() ), actionCollection(),
1901 "kaddressbook_paste" ); 1943 "kaddressbook_paste" );
1902 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1944 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1903 SLOT( selectAllContacts() ), actionCollection(), 1945 SLOT( selectAllContacts() ), actionCollection(),
1904 "kaddressbook_select_all" ); 1946 "kaddressbook_select_all" );
1905 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1947 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1906 SLOT( undo() ), actionCollection(), 1948 SLOT( undo() ), actionCollection(),
1907 "kaddressbook_undo" ); 1949 "kaddressbook_undo" );
1908 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1950 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1909 this, SLOT( redo() ), actionCollection(), 1951 this, SLOT( redo() ), actionCollection(),
1910 "kaddressbook_redo" ); 1952 "kaddressbook_redo" );
1911 } else { 1953 } else {
1912 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1954 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1913 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1955 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1914 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1956 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1915 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1957 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1916 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1958 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1917 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1959 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1918 } 1960 }
1919 1961
1920 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1962 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1921 Key_Delete, this, SLOT( deleteContacts() ), 1963 Key_Delete, this, SLOT( deleteContacts() ),
1922 actionCollection(), "edit_delete" ); 1964 actionCollection(), "edit_delete" );
1923 1965
1924 mActionUndo->setEnabled( false ); 1966 mActionUndo->setEnabled( false );
1925 mActionRedo->setEnabled( false ); 1967 mActionRedo->setEnabled( false );
1926 1968
1927 // settings menu 1969 // settings menu
1928#ifdef KAB_EMBEDDED 1970#ifdef KAB_EMBEDDED
1929//US special menuentry to configure the addressbook resources. On KDE 1971//US special menuentry to configure the addressbook resources. On KDE
1930// you do that through the control center !!! 1972// you do that through the control center !!!
1931 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1973 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1932 SLOT( configureResources() ), actionCollection(), 1974 SLOT( configureResources() ), actionCollection(),
1933 "kaddressbook_configure_resources" ); 1975 "kaddressbook_configure_resources" );
1934#endif //KAB_EMBEDDED 1976#endif //KAB_EMBEDDED
1935 1977
1936 if ( mIsPart ) { 1978 if ( mIsPart ) {
1937 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1979 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1938 SLOT( openConfigDialog() ), actionCollection(), 1980 SLOT( openConfigDialog() ), actionCollection(),
1939 "kaddressbook_configure" ); 1981 "kaddressbook_configure" );
1940 1982
1941 //US not implemented yet 1983 //US not implemented yet
1942 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1984 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1943 // this, SLOT( configureKeyBindings() ), actionCollection(), 1985 // this, SLOT( configureKeyBindings() ), actionCollection(),
1944 // "kaddressbook_configure_shortcuts" ); 1986 // "kaddressbook_configure_shortcuts" );
1945#ifdef KAB_EMBEDDED 1987#ifdef KAB_EMBEDDED
1946 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1988 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1947 mActionConfigureToolbars->setEnabled( false ); 1989 mActionConfigureToolbars->setEnabled( false );
1948#endif //KAB_EMBEDDED 1990#endif //KAB_EMBEDDED
1949 1991
1950 } else { 1992 } else {
1951 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1993 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1952 1994
1953 //US not implemented yet 1995 //US not implemented yet
1954 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1996 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1955 } 1997 }
1956 1998
1957 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1999 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1958 actionCollection(), "options_show_jump_bar" ); 2000 actionCollection(), "options_show_jump_bar" );
1959 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 2001 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1960 2002
1961 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 2003 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1962 actionCollection(), "options_show_details" ); 2004 actionCollection(), "options_show_details" );
1963 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 2005 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1964 2006
1965 2007
1966 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 2008 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
1967 SLOT( toggleBeamReceive() ), actionCollection(), 2009 SLOT( toggleBeamReceive() ), actionCollection(),
1968 "kaddressbook_beam_rec" ); 2010 "kaddressbook_beam_rec" );
1969 2011
1970 2012
1971 // misc 2013 // misc
1972 // only enable LDAP lookup if we can handle the protocol 2014 // only enable LDAP lookup if we can handle the protocol
1973#ifndef KAB_EMBEDDED 2015#ifndef KAB_EMBEDDED
1974 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 2016 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1975 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 2017 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1976 this, SLOT( openLDAPDialog() ), actionCollection(), 2018 this, SLOT( openLDAPDialog() ), actionCollection(),
1977 "ldap_lookup" ); 2019 "ldap_lookup" );
1978 } 2020 }
1979#else //KAB_EMBEDDED 2021#else //KAB_EMBEDDED
1980 //qDebug("KABCore::initActions() LDAP has to be implemented"); 2022 //qDebug("KABCore::initActions() LDAP has to be implemented");
1981#endif //KAB_EMBEDDED 2023#endif //KAB_EMBEDDED
1982 2024
1983 2025
1984 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 2026 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1985 SLOT( setWhoAmI() ), actionCollection(), 2027 SLOT( setWhoAmI() ), actionCollection(),
1986 "set_personal" ); 2028 "set_personal" );
1987 2029
1988 2030
1989 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 2031 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1990 SLOT( setCategories() ), actionCollection(), 2032 SLOT( setCategories() ), actionCollection(),
1991 "edit_set_categories" ); 2033 "edit_set_categories" );
1992 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this, 2034 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this,
1993 SLOT( editCategories() ), actionCollection(), 2035 SLOT( editCategories() ), actionCollection(),
1994 "edit__categories" ); 2036 "edit__categories" );
1995 2037
1996 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 2038 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1997 SLOT( removeVoice() ), actionCollection(), 2039 SLOT( removeVoice() ), actionCollection(),
1998 "remove_voice" ); 2040 "remove_voice" );
2041 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this,
2042 SLOT( setFormattedName() ), actionCollection(),
2043 "set_formatted" );
1999 2044
2000 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 2045 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
2001 SLOT( manageCategories() ), actionCollection(), 2046 SLOT( manageCategories() ), actionCollection(),
2002 "remove_voice" ); 2047 "remove_voice" );
2003 2048
2004 2049
2005 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 2050 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
2006 SLOT( importFromOL() ), actionCollection(), 2051 SLOT( importFromOL() ), actionCollection(),
2007 "import_OL" ); 2052 "import_OL" );
2008#ifdef KAB_EMBEDDED 2053#ifdef KAB_EMBEDDED
2009 mActionLicence = new KAction( i18n( "Licence" ), 0, 2054 mActionLicence = new KAction( i18n( "Licence" ), 0,
2010 this, SLOT( showLicence() ), actionCollection(), 2055 this, SLOT( showLicence() ), actionCollection(),
2011 "licence_about_data" ); 2056 "licence_about_data" );
2012 mActionFaq = new KAction( i18n( "Faq" ), 0, 2057 mActionFaq = new KAction( i18n( "Faq" ), 0,
2013 this, SLOT( faq() ), actionCollection(), 2058 this, SLOT( faq() ), actionCollection(),
2014 "faq_about_data" ); 2059 "faq_about_data" );
2015 mActionWN = new KAction( i18n( "What's New?" ), 0, 2060 mActionWN = new KAction( i18n( "What's New?" ), 0,
2016 this, SLOT( whatsnew() ), actionCollection(), 2061 this, SLOT( whatsnew() ), actionCollection(),
2017 "wn" ); 2062 "wn" );
2018 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 2063 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
2019 this, SLOT( synchowto() ), actionCollection(), 2064 this, SLOT( synchowto() ), actionCollection(),
2020 "sync" ); 2065 "sync" );
2021 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 2066 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
2022 this, SLOT( kdesynchowto() ), actionCollection(), 2067 this, SLOT( kdesynchowto() ), actionCollection(),
2023 "kdesync" ); 2068 "kdesync" );
2024 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 2069 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
2025 this, SLOT( multisynchowto() ), actionCollection(), 2070 this, SLOT( multisynchowto() ), actionCollection(),
2026 "multisync" ); 2071 "multisync" );
2027 2072
2028 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 2073 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
2029 this, SLOT( createAboutData() ), actionCollection(), 2074 this, SLOT( createAboutData() ), actionCollection(),
2030 "kaddressbook_about_data" ); 2075 "kaddressbook_about_data" );
2031#endif //KAB_EMBEDDED 2076#endif //KAB_EMBEDDED
2032 2077
2033 clipboardDataChanged(); 2078 clipboardDataChanged();
2034 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2079 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2035 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2080 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2036} 2081}
2037 2082
2038//US we need this function, to plug all actions into the correct menues. 2083//US we need this function, to plug all actions into the correct menues.
2039// KDE uses a XML format to plug the actions, but we work her without this overhead. 2084// KDE uses a XML format to plug the actions, but we work her without this overhead.
2040void KABCore::addActionsManually() 2085void KABCore::addActionsManually()
2041{ 2086{
2042//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 2087//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
2043 2088
2044#ifdef KAB_EMBEDDED 2089#ifdef KAB_EMBEDDED
2045 QPopupMenu *fileMenu = new QPopupMenu( this ); 2090 QPopupMenu *fileMenu = new QPopupMenu( this );
2046 QPopupMenu *editMenu = new QPopupMenu( this ); 2091 QPopupMenu *editMenu = new QPopupMenu( this );
2047 QPopupMenu *helpMenu = new QPopupMenu( this ); 2092 QPopupMenu *helpMenu = new QPopupMenu( this );
2048 2093
2049 KToolBar* tb = mMainWindow->toolBar(); 2094 KToolBar* tb = mMainWindow->toolBar();
2050 2095
2051#ifndef DESKTOP_VERSION 2096#ifndef DESKTOP_VERSION
2052 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 2097 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
2053#endif 2098#endif
2054 QMenuBar* mb = mMainWindow->menuBar(); 2099 QMenuBar* mb = mMainWindow->menuBar();
2055 2100
2056 //US setup menubar. 2101 //US setup menubar.
2057 //Disable the following block if you do not want to have a menubar. 2102 //Disable the following block if you do not want to have a menubar.
2058 mb->insertItem( i18n("&File"), fileMenu ); 2103 mb->insertItem( i18n("&File"), fileMenu );
2059 mb->insertItem( i18n("&Edit"), editMenu ); 2104 mb->insertItem( i18n("&Edit"), editMenu );
2060 mb->insertItem( i18n("&View"), viewMenu ); 2105 mb->insertItem( i18n("&View"), viewMenu );
2061 mb->insertItem( i18n("&Settings"), settingsMenu ); 2106 mb->insertItem( i18n("&Settings"), settingsMenu );
2062 mb->insertItem( i18n("Synchronize"), syncMenu ); 2107 mb->insertItem( i18n("Synchronize"), syncMenu );
2063 //mb->insertItem( i18n("&Change"), changeMenu ); 2108 //mb->insertItem( i18n("&Change"), changeMenu );
2064 mb->insertItem( i18n("&Help"), helpMenu ); 2109 mb->insertItem( i18n("&Help"), helpMenu );
2065 mIncSearchWidget = new IncSearchWidget( tb ); 2110 mIncSearchWidget = new IncSearchWidget( tb );
2066 // tb->insertWidget(-1, 0, mIncSearchWidget); 2111 // tb->insertWidget(-1, 0, mIncSearchWidget);
2067#ifndef DESKTOP_VERSION 2112#ifndef DESKTOP_VERSION
2068 } else { 2113 } else {
2069 //US setup toolbar 2114 //US setup toolbar
2070 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2115 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2071 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2116 QPopupMenu *popupBarTB = new QPopupMenu( this );
2072 menuBarTB->insertItem( "ME", popupBarTB); 2117 menuBarTB->insertItem( "ME", popupBarTB);
2073 tb->insertWidget(-1, 0, menuBarTB); 2118 tb->insertWidget(-1, 0, menuBarTB);
2074 mIncSearchWidget = new IncSearchWidget( tb ); 2119 mIncSearchWidget = new IncSearchWidget( tb );
2075 2120
2076 tb->enableMoving(false); 2121 tb->enableMoving(false);
2077 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2122 popupBarTB->insertItem( i18n("&File"), fileMenu );
2078 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2123 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2079 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2124 popupBarTB->insertItem( i18n("&View"), viewMenu );
2080 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2125 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2081 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2126 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2082 mViewManager->getFilterAction()->plug ( popupBarTB); 2127 mViewManager->getFilterAction()->plug ( popupBarTB);
2083 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2128 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2084 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2129 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2085 if (QApplication::desktop()->width() > 320 ) { 2130 if (QApplication::desktop()->width() > 320 ) {
2086 // mViewManager->getFilterAction()->plug ( tb); 2131 // mViewManager->getFilterAction()->plug ( tb);
2087 } 2132 }
2088 } 2133 }
2089#endif 2134#endif
2090 // mActionQuit->plug ( mMainWindow->toolBar()); 2135 // mActionQuit->plug ( mMainWindow->toolBar());
2091 2136
2092 2137
2093 2138
2094 //US Now connect the actions with the menue entries. 2139 //US Now connect the actions with the menue entries.
2095 mActionPrint->plug( fileMenu ); 2140 mActionPrint->plug( fileMenu );
2096 mActionMail->plug( fileMenu ); 2141 mActionMail->plug( fileMenu );
2097 fileMenu->insertSeparator(); 2142 fileMenu->insertSeparator();
2098 2143
2099 mActionNewContact->plug( fileMenu ); 2144 mActionNewContact->plug( fileMenu );
2100 mActionNewContact->plug( tb ); 2145 mActionNewContact->plug( tb );
2101 2146
2102 mActionEditAddressee->plug( fileMenu ); 2147 mActionEditAddressee->plug( fileMenu );
2103 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2148 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2104 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2149 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2105 mActionEditAddressee->plug( tb ); 2150 mActionEditAddressee->plug( tb );
2106 2151
2107 fileMenu->insertSeparator(); 2152 fileMenu->insertSeparator();
2108 mActionSave->plug( fileMenu ); 2153 mActionSave->plug( fileMenu );
2109 fileMenu->insertItem( "&Import", ImportMenu ); 2154 fileMenu->insertItem( "&Import", ImportMenu );
2110 fileMenu->insertItem( "&Export", ExportMenu ); 2155 fileMenu->insertItem( "&Export", ExportMenu );
2111 fileMenu->insertItem( i18n("&Change"), changeMenu ); 2156 fileMenu->insertItem( i18n("&Change"), changeMenu );
2112#ifndef DESKTOP_VERSION 2157#ifndef DESKTOP_VERSION
2113 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); 2158 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
2114#endif 2159#endif
2115 2160
2116 fileMenu->insertSeparator(); 2161 fileMenu->insertSeparator();
2117 mActionMailVCard->plug( fileMenu ); 2162 mActionMailVCard->plug( fileMenu );
2118#ifndef DESKTOP_VERSION 2163#ifndef DESKTOP_VERSION
2119 if ( Ir::supported() ) mActionBR->plug( beamMenu ); 2164 if ( Ir::supported() ) mActionBR->plug( beamMenu );
2120 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); 2165 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
2121 if ( Ir::supported() ) mActionBeam->plug( beamMenu ); 2166 if ( Ir::supported() ) mActionBeam->plug( beamMenu );
2122#endif 2167#endif
2123 fileMenu->insertSeparator(); 2168 fileMenu->insertSeparator();
2124 mActionQuit->plug( fileMenu ); 2169 mActionQuit->plug( fileMenu );
2125#ifdef _WIN32_ 2170#ifdef _WIN32_
2126 mActionImportOL->plug( ImportMenu ); 2171 mActionImportOL->plug( ImportMenu );
2127#endif 2172#endif
2128 // edit menu 2173 // edit menu
2129 mActionUndo->plug( editMenu ); 2174 mActionUndo->plug( editMenu );
2130 mActionRedo->plug( editMenu ); 2175 mActionRedo->plug( editMenu );
2131 editMenu->insertSeparator(); 2176 editMenu->insertSeparator();
2132 mActionCut->plug( editMenu ); 2177 mActionCut->plug( editMenu );
2133 mActionCopy->plug( editMenu ); 2178 mActionCopy->plug( editMenu );
2134 mActionPaste->plug( editMenu ); 2179 mActionPaste->plug( editMenu );
2135 mActionDelete->plug( editMenu ); 2180 mActionDelete->plug( editMenu );
2136 editMenu->insertSeparator(); 2181 editMenu->insertSeparator();
2137 mActionSelectAll->plug( editMenu ); 2182 mActionSelectAll->plug( editMenu );
2138 2183
2184 mActionSetFormattedName->plug( changeMenu );
2139 mActionRemoveVoice->plug( changeMenu ); 2185 mActionRemoveVoice->plug( changeMenu );
2140 // settings menu 2186 // settings menu
2141//US special menuentry to configure the addressbook resources. On KDE 2187//US special menuentry to configure the addressbook resources. On KDE
2142// you do that through the control center !!! 2188// you do that through the control center !!!
2143 mActionConfigResources->plug( settingsMenu ); 2189 mActionConfigResources->plug( settingsMenu );
2144 settingsMenu->insertSeparator(); 2190 settingsMenu->insertSeparator();
2145 2191
2146 mActionConfigKAddressbook->plug( settingsMenu ); 2192 mActionConfigKAddressbook->plug( settingsMenu );
2147 2193
2148 if ( mIsPart ) { 2194 if ( mIsPart ) {
2149 //US not implemented yet 2195 //US not implemented yet
2150 //mActionConfigShortcuts->plug( settingsMenu ); 2196 //mActionConfigShortcuts->plug( settingsMenu );
2151 //mActionConfigureToolbars->plug( settingsMenu ); 2197 //mActionConfigureToolbars->plug( settingsMenu );
2152 2198
2153 } else { 2199 } else {
2154 //US not implemented yet 2200 //US not implemented yet
2155 //mActionKeyBindings->plug( settingsMenu ); 2201 //mActionKeyBindings->plug( settingsMenu );
2156 } 2202 }
2157 2203
2158 settingsMenu->insertSeparator(); 2204 settingsMenu->insertSeparator();
2159 2205
2160 mActionJumpBar->plug( settingsMenu ); 2206 mActionJumpBar->plug( settingsMenu );
2161 mActionDetails->plug( settingsMenu ); 2207 mActionDetails->plug( settingsMenu );
2162 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2208 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2163 mActionDetails->plug( tb ); 2209 mActionDetails->plug( tb );
2164 settingsMenu->insertSeparator(); 2210 settingsMenu->insertSeparator();
2165#ifndef DESKTOP_VERSION 2211#ifndef DESKTOP_VERSION
2166 if ( Ir::supported() ) mActionBR->plug(settingsMenu ); 2212 if ( Ir::supported() ) mActionBR->plug(settingsMenu );
2167#endif 2213#endif
2168 settingsMenu->insertSeparator(); 2214 settingsMenu->insertSeparator();
2169 2215
2170 mActionWhoAmI->plug( settingsMenu ); 2216 mActionWhoAmI->plug( settingsMenu );
2171 mActionEditCategories->plug( settingsMenu ); 2217 mActionEditCategories->plug( settingsMenu );
2172 mActionEditCategories->plug( changeMenu ); 2218 mActionEditCategories->plug( changeMenu );
2173 mActionCategories->plug( changeMenu ); 2219 mActionCategories->plug( changeMenu );
2174 mActionManageCategories->plug( changeMenu ); 2220 mActionManageCategories->plug( changeMenu );
2175 2221
2176 mActionCategories->plug( settingsMenu ); 2222 mActionCategories->plug( settingsMenu );
2177 mActionManageCategories->plug( settingsMenu ); 2223 mActionManageCategories->plug( settingsMenu );
2178 2224
2179 2225
2180 mActionWN->plug( helpMenu ); 2226 mActionWN->plug( helpMenu );
2181 mActionSyncHowto->plug( helpMenu ); 2227 mActionSyncHowto->plug( helpMenu );
2182 mActionKdeSyncHowto->plug( helpMenu ); 2228 mActionKdeSyncHowto->plug( helpMenu );
2183 mActionMultiSyncHowto->plug( helpMenu ); 2229 mActionMultiSyncHowto->plug( helpMenu );
2184 mActionFaq->plug( helpMenu ); 2230 mActionFaq->plug( helpMenu );
2185 mActionLicence->plug( helpMenu ); 2231 mActionLicence->plug( helpMenu );
2186 mActionAboutKAddressbook->plug( helpMenu ); 2232 mActionAboutKAddressbook->plug( helpMenu );
2187 2233
2188 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2234 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2189 2235
2190 mActionSave->plug( tb ); 2236 mActionSave->plug( tb );
2191 mViewManager->getFilterAction()->plug ( tb); 2237 mViewManager->getFilterAction()->plug ( tb);
2192 //LR hide filteraction on started in 480x640 2238 //LR hide filteraction on started in 480x640
2193 if (QApplication::desktop()->width() == 480 ) { 2239 if (QApplication::desktop()->width() == 480 ) {
2194 mViewManager->getFilterAction()->setComboWidth( 0 ); 2240 mViewManager->getFilterAction()->setComboWidth( 0 );
2195 } 2241 }
2196 mActionUndo->plug( tb ); 2242 mActionUndo->plug( tb );
2197 mActionDelete->plug( tb ); 2243 mActionDelete->plug( tb );
2198 mActionRedo->plug( tb ); 2244 mActionRedo->plug( tb );
2199 } else { 2245 } else {
2200 mActionSave->plug( tb ); 2246 mActionSave->plug( tb );
2201 tb->enableMoving(false); 2247 tb->enableMoving(false);
2202 } 2248 }
2203 //mActionQuit->plug ( tb ); 2249 //mActionQuit->plug ( tb );
2204 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2250 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2205 2251
2206 //US link the searchwidget first to this. 2252 //US link the searchwidget first to this.
2207 // The real linkage to the toolbar happens later. 2253 // The real linkage to the toolbar happens later.
2208//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2254//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2209//US tb->insertItem( mIncSearchWidget ); 2255//US tb->insertItem( mIncSearchWidget );
2210/*US 2256/*US
2211 mIncSearchWidget = new IncSearchWidget( tb ); 2257 mIncSearchWidget = new IncSearchWidget( tb );
2212 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2258 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2213 SLOT( incrementalSearch( const QString& ) ) ); 2259 SLOT( incrementalSearch( const QString& ) ) );
2214 2260
2215 mJumpButtonBar = new JumpButtonBar( this, this ); 2261 mJumpButtonBar = new JumpButtonBar( this, this );
2216 2262
2217//US topLayout->addWidget( mJumpButtonBar ); 2263//US topLayout->addWidget( mJumpButtonBar );
2218 this->layout()->add( mJumpButtonBar ); 2264 this->layout()->add( mJumpButtonBar );
2219*/ 2265*/
2220 2266
2221#endif //KAB_EMBEDDED 2267#endif //KAB_EMBEDDED
2222 2268
2223 mActionExport2phone->plug( ExportMenu ); 2269 mActionExport2phone->plug( ExportMenu );
2224 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2270 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2225 syncManager->fillSyncMenu(); 2271 syncManager->fillSyncMenu();
2226 2272
2227} 2273}
2228void KABCore::showLicence() 2274void KABCore::showLicence()
2229{ 2275{
2230 KApplication::showLicence(); 2276 KApplication::showLicence();
2231} 2277}
2232 2278
2233void KABCore::manageCategories( ) 2279void KABCore::manageCategories( )
2234{ 2280{
2235 KABCatPrefs* cp = new KABCatPrefs(); 2281 KABCatPrefs* cp = new KABCatPrefs();
2236 cp->show(); 2282 cp->show();
2237 int w =cp->sizeHint().width() ; 2283 int w =cp->sizeHint().width() ;
2238 int h = cp->sizeHint().height() ; 2284 int h = cp->sizeHint().height() ;
2239 int dw = QApplication::desktop()->width(); 2285 int dw = QApplication::desktop()->width();
2240 int dh = QApplication::desktop()->height(); 2286 int dh = QApplication::desktop()->height();
2241 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2287 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2242 if ( !cp->exec() ) { 2288 if ( !cp->exec() ) {
2243 delete cp; 2289 delete cp;
2244 return; 2290 return;
2245 } 2291 }
2246 int count = 0; 2292 int count = 0;
2247 message( i18n("Please wait, processing categories...")); 2293 message( i18n("Please wait, processing categories..."));
2248 if ( cp->addCat() ) { 2294 if ( cp->addCat() ) {
2249 KABC::AddressBook::Iterator it; 2295 KABC::AddressBook::Iterator it;
2250 QStringList catList = KABPrefs::instance()->mCustomCategories; 2296 QStringList catList = KABPrefs::instance()->mCustomCategories;
2251 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2297 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2252 QStringList catIncList = (*it).categories(); 2298 QStringList catIncList = (*it).categories();
2253 int i; 2299 int i;
2254 for( i = 0; i< catIncList.count(); ++i ) { 2300 for( i = 0; i< catIncList.count(); ++i ) {
2255 if ( !catList.contains (catIncList[i])) { 2301 if ( !catList.contains (catIncList[i])) {
2256 catList.append( catIncList[i] ); 2302 catList.append( catIncList[i] );
2257 //qDebug("add cat %s ", catIncList[i].latin1()); 2303 //qDebug("add cat %s ", catIncList[i].latin1());
2258 ++count; 2304 ++count;
2259 } 2305 }
2260 } 2306 }
2261 } 2307 }
2262 catList.sort(); 2308 catList.sort();
2263 KABPrefs::instance()->mCustomCategories = catList; 2309 KABPrefs::instance()->mCustomCategories = catList;
2264 KABPrefs::instance()->writeConfig(); 2310 KABPrefs::instance()->writeConfig();
2265 message(QString::number( count )+ i18n(" categories added to list! ")); 2311 message(QString::number( count )+ i18n(" categories added to list! "));
2266 } else { 2312 } else {
2267 QStringList catList = KABPrefs::instance()->mCustomCategories; 2313 QStringList catList = KABPrefs::instance()->mCustomCategories;
2268 QStringList catIncList; 2314 QStringList catIncList;
2269 QStringList newCatList; 2315 QStringList newCatList;
2270 KABC::AddressBook::Iterator it; 2316 KABC::AddressBook::Iterator it;
2271 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2317 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2272 QStringList catIncList = (*it).categories(); 2318 QStringList catIncList = (*it).categories();
2273 int i; 2319 int i;
2274 if ( catIncList.count() ) { 2320 if ( catIncList.count() ) {
2275 newCatList.clear(); 2321 newCatList.clear();
2276 for( i = 0; i< catIncList.count(); ++i ) { 2322 for( i = 0; i< catIncList.count(); ++i ) {
2277 if ( catList.contains (catIncList[i])) { 2323 if ( catList.contains (catIncList[i])) {
2278 newCatList.append( catIncList[i] ); 2324 newCatList.append( catIncList[i] );
2279 } 2325 }
2280 } 2326 }
2281 newCatList.sort(); 2327 newCatList.sort();
2282 (*it).setCategories( newCatList ); 2328 (*it).setCategories( newCatList );
2283 mAddressBook->insertAddressee( (*it) ); 2329 mAddressBook->insertAddressee( (*it) );
2284 } 2330 }
2285 } 2331 }
2286 setModified( true ); 2332 setModified( true );
2287 mViewManager->refreshView(); 2333 mViewManager->refreshView();
2288 message( i18n("Removing categories done!")); 2334 message( i18n("Removing categories done!"));
2289 } 2335 }
2290 delete cp; 2336 delete cp;
2291} 2337}
2292void KABCore::removeVoice() 2338void KABCore::removeVoice()
2293{ 2339{
2294 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2340 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2295 return; 2341 return;
2296 KABC::Addressee::List list; 2342 KABC::Addressee::List list;
2297 XXPortSelectDialog dlg( this, false, this ); 2343 XXPortSelectDialog dlg( this, false, this );
2298 if ( dlg.exec() ) 2344 if ( dlg.exec() )
2299 list = dlg.contacts(); 2345 list = dlg.contacts();
2300 else 2346 else
2301 return; 2347 return;
2302 KABC::Addressee::List::Iterator it; 2348 KABC::Addressee::List::Iterator it;
2303 for ( it = list.begin(); it != list.end(); ++it ) { 2349 for ( it = list.begin(); it != list.end(); ++it ) {
2304 if ( (*it).removeVoice() ) 2350 if ( (*it).removeVoice() )
2305 contactModified((*it) ); 2351 addrModified((*it), false );
2306 } 2352 }
2307} 2353}
2308 2354
2309 2355void KABCore::setFormattedName()
2356{
2357 KABFormatPrefs setpref;
2358 if ( !setpref.exec() ) {
2359 return;
2360 }
2361 KABC::Addressee::List list;
2362 XXPortSelectDialog dlg( this, false, this );
2363 if ( dlg.exec() )
2364 list = dlg.contacts();
2365 else
2366 return;
2367 KABC::Addressee::List::Iterator it;
2368 for ( it = list.begin(); it != list.end(); ++it ) {
2369 QString fName;
2370 if ( setpref.simple->isChecked() )
2371 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2372 else if ( setpref.full->isChecked() )
2373 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2374 else if ( setpref.reverse->isChecked() )
2375 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
2376 else
2377 fName = (*it).organization();
2378 if ( setpref.setCompany->isChecked() )
2379 if ( fName.isEmpty() || fName =="," )
2380 fName = (*it).organization();
2381 (*it).setFormattedName( fName );
2382 addrModified((*it),false );
2383 }
2384 Addressee add;
2385 mDetails->setAddressee( add );
2386}
2310 2387
2311void KABCore::clipboardDataChanged() 2388void KABCore::clipboardDataChanged()
2312{ 2389{
2313 2390
2314 if ( mReadWrite ) 2391 if ( mReadWrite )
2315 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2392 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2316 2393
2317} 2394}
2318 2395
2319void KABCore::updateActionMenu() 2396void KABCore::updateActionMenu()
2320{ 2397{
2321 UndoStack *undo = UndoStack::instance(); 2398 UndoStack *undo = UndoStack::instance();
2322 RedoStack *redo = RedoStack::instance(); 2399 RedoStack *redo = RedoStack::instance();
2323 2400
2324 if ( undo->isEmpty() ) 2401 if ( undo->isEmpty() )
2325 mActionUndo->setText( i18n( "Undo" ) ); 2402 mActionUndo->setText( i18n( "Undo" ) );
2326 else 2403 else
2327 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2404 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2328 2405
2329 mActionUndo->setEnabled( !undo->isEmpty() ); 2406 mActionUndo->setEnabled( !undo->isEmpty() );
2330 2407
2331 if ( !redo->top() ) 2408 if ( !redo->top() )
2332 mActionRedo->setText( i18n( "Redo" ) ); 2409 mActionRedo->setText( i18n( "Redo" ) );
2333 else 2410 else
2334 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2411 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2335 2412
2336 mActionRedo->setEnabled( !redo->isEmpty() ); 2413 mActionRedo->setEnabled( !redo->isEmpty() );
2337} 2414}
2338 2415
2339void KABCore::configureKeyBindings() 2416void KABCore::configureKeyBindings()
2340{ 2417{
2341#ifndef KAB_EMBEDDED 2418#ifndef KAB_EMBEDDED
2342 KKeyDialog::configure( actionCollection(), true ); 2419 KKeyDialog::configure( actionCollection(), true );
2343#else //KAB_EMBEDDED 2420#else //KAB_EMBEDDED
2344 qDebug("KABCore::configureKeyBindings() not implemented"); 2421 qDebug("KABCore::configureKeyBindings() not implemented");
2345#endif //KAB_EMBEDDED 2422#endif //KAB_EMBEDDED
2346} 2423}
2347 2424
2348#ifdef KAB_EMBEDDED 2425#ifdef KAB_EMBEDDED
2349void KABCore::configureResources() 2426void KABCore::configureResources()
2350{ 2427{
2351 KRES::KCMKResources dlg( this, "" , 0 ); 2428 KRES::KCMKResources dlg( this, "" , 0 );
2352 2429
2353 if ( !dlg.exec() ) 2430 if ( !dlg.exec() )
2354 return; 2431 return;
2355 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2432 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2356} 2433}
2357#endif //KAB_EMBEDDED 2434#endif //KAB_EMBEDDED
2358 2435
2359 2436
2360/* this method will be called through the QCop interface from Ko/Pi to select addresses 2437/* this method will be called through the QCop interface from Ko/Pi to select addresses
2361 * for the attendees list of an event. 2438 * for the attendees list of an event.
2362 */ 2439 */
2363void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2440void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2364{ 2441{
2365 QStringList nameList; 2442 QStringList nameList;
2366 QStringList emailList; 2443 QStringList emailList;
2367 QStringList uidList; 2444 QStringList uidList;
2368 2445
2369 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2446 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2370 uint i=0; 2447 uint i=0;
2371 for (i=0; i < list.count(); i++) 2448 for (i=0; i < list.count(); i++)
2372 { 2449 {
2373 nameList.append(list[i].realName()); 2450 nameList.append(list[i].realName());
2374 emailList.append(list[i].preferredEmail()); 2451 emailList.append(list[i].preferredEmail());
2375 uidList.append(list[i].uid()); 2452 uidList.append(list[i].uid());
2376 } 2453 }
2377 2454
2378 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2455 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2379 2456
2380} 2457}
2381 2458
2382/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2459/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2383 * to put them into the calendar. 2460 * to put them into the calendar.
2384 */ 2461 */
2385void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2462void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2386{ 2463{
2387 // qDebug("KABCore::requestForBirthdayList"); 2464 // qDebug("KABCore::requestForBirthdayList");
2388 QStringList birthdayList; 2465 QStringList birthdayList;
2389 QStringList anniversaryList; 2466 QStringList anniversaryList;
2390 QStringList realNameList; 2467 QStringList realNameList;
2391 QStringList preferredEmailList; 2468 QStringList preferredEmailList;
2392 QStringList assembledNameList; 2469 QStringList assembledNameList;
2393 QStringList uidList; 2470 QStringList uidList;
2394 2471
2395 KABC::AddressBook::Iterator it; 2472 KABC::AddressBook::Iterator it;
2396 2473
2397 int count = 0; 2474 int count = 0;
2398 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2475 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2399 ++count; 2476 ++count;
2400 } 2477 }
2401 QProgressBar bar(count,0 ); 2478 QProgressBar bar(count,0 );
2402 int w = 300; 2479 int w = 300;
2403 if ( QApplication::desktop()->width() < 320 ) 2480 if ( QApplication::desktop()->width() < 320 )
2404 w = 220; 2481 w = 220;
2405 int h = bar.sizeHint().height() ; 2482 int h = bar.sizeHint().height() ;
2406 int dw = QApplication::desktop()->width(); 2483 int dw = QApplication::desktop()->width();
2407 int dh = QApplication::desktop()->height(); 2484 int dh = QApplication::desktop()->height();
2408 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2485 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2409 bar.show(); 2486 bar.show();
2410 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2487 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2411 qApp->processEvents(); 2488 qApp->processEvents();
2412 2489
2413 QDate bday; 2490 QDate bday;
2414 QString anni; 2491 QString anni;
2415 QString formattedbday; 2492 QString formattedbday;
2416 2493
2417 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2494 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2418 { 2495 {
2419 if ( ! bar.isVisible() ) 2496 if ( ! bar.isVisible() )
2420 return; 2497 return;
2421 bar.setProgress( count++ ); 2498 bar.setProgress( count++ );
2422 qApp->processEvents(); 2499 qApp->processEvents();
2423 bday = (*it).birthday().date(); 2500 bday = (*it).birthday().date();
2424 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2501 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2425 2502
2426 if ( bday.isValid() || !anni.isEmpty()) 2503 if ( bday.isValid() || !anni.isEmpty())
2427 { 2504 {
2428 if (bday.isValid()) 2505 if (bday.isValid())
2429 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2506 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2430 else 2507 else
2431 formattedbday = "NOTVALID"; 2508 formattedbday = "NOTVALID";
2432 if (anni.isEmpty()) 2509 if (anni.isEmpty())
2433 anni = "INVALID"; 2510 anni = "INVALID";
2434 2511
2435 birthdayList.append(formattedbday); 2512 birthdayList.append(formattedbday);
2436 anniversaryList.append(anni); //should be ISODate 2513 anniversaryList.append(anni); //should be ISODate
2437 realNameList.append((*it).realName()); 2514 realNameList.append((*it).realName());
2438 preferredEmailList.append((*it).preferredEmail()); 2515 preferredEmailList.append((*it).preferredEmail());
2439 assembledNameList.append((*it).assembledName()); 2516 assembledNameList.append((*it).assembledName());
2440 uidList.append((*it).uid()); 2517 uidList.append((*it).uid());
2441 2518
2442 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); 2519 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() );
2443 } 2520 }
2444 } 2521 }
2445 2522
2446 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2523 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2447 2524
2448} 2525}
2449 2526
2450/* this method will be called through the QCop interface from other apps to show details of a contact. 2527/* this method will be called through the QCop interface from other apps to show details of a contact.
2451 */ 2528 */
2452void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2529void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2453{ 2530{
2454 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2531 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2455 2532
2456 QString foundUid = QString::null; 2533 QString foundUid = QString::null;
2457 if ( ! uid.isEmpty() ) { 2534 if ( ! uid.isEmpty() ) {
2458 Addressee adrr = mAddressBook->findByUid( uid ); 2535 Addressee adrr = mAddressBook->findByUid( uid );
2459 if ( !adrr.isEmpty() ) { 2536 if ( !adrr.isEmpty() ) {
2460 foundUid = uid; 2537 foundUid = uid;
2461 } 2538 }
2462 if ( email == "sendbacklist" ) { 2539 if ( email == "sendbacklist" ) {
2463 //qDebug("ssssssssssssssssssssssend "); 2540 //qDebug("ssssssssssssssssssssssend ");
2464 QStringList nameList; 2541 QStringList nameList;
2465 QStringList emailList; 2542 QStringList emailList;
2466 QStringList uidList; 2543 QStringList uidList;
2467 nameList.append(adrr.realName()); 2544 nameList.append(adrr.realName());
2468 emailList = adrr.emails(); 2545 emailList = adrr.emails();
2469 uidList.append( adrr.preferredEmail()); 2546 uidList.append( adrr.preferredEmail());
2470 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2547 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2471 return; 2548 return;
2472 } 2549 }
2473 2550
2474 } 2551 }
2475 2552
2476 if ( email == "sendbacklist" ) 2553 if ( email == "sendbacklist" )
2477 return; 2554 return;
2478 if (foundUid.isEmpty()) 2555 if (foundUid.isEmpty())
2479 { 2556 {
2480 //find the uid of the person first 2557 //find the uid of the person first
2481 Addressee::List namelist; 2558 Addressee::List namelist;
2482 Addressee::List emaillist; 2559 Addressee::List emaillist;
2483 2560
2484 if (!name.isEmpty()) 2561 if (!name.isEmpty())
2485 namelist = mAddressBook->findByName( name ); 2562 namelist = mAddressBook->findByName( name );
2486 2563
2487 if (!email.isEmpty()) 2564 if (!email.isEmpty())
2488 emaillist = mAddressBook->findByEmail( email ); 2565 emaillist = mAddressBook->findByEmail( email );
2489 //qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2566 //qDebug("count %d %d ", namelist.count(),emaillist.count() );
2490 //check if we have a match in Namelist and Emaillist 2567 //check if we have a match in Namelist and Emaillist
2491 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2568 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2492 foundUid = emaillist[0].uid(); 2569 foundUid = emaillist[0].uid();
2493 } 2570 }
2494 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2571 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2495 foundUid = namelist[0].uid(); 2572 foundUid = namelist[0].uid();
2496 else 2573 else
2497 { 2574 {
2498 for (int i = 0; i < namelist.count(); i++) 2575 for (int i = 0; i < namelist.count(); i++)
2499 { 2576 {
2500 for (int j = 0; j < emaillist.count(); j++) 2577 for (int j = 0; j < emaillist.count(); j++)
2501 { 2578 {
2502 if (namelist[i] == emaillist[j]) 2579 if (namelist[i] == emaillist[j])
2503 { 2580 {
2504 foundUid = namelist[i].uid(); 2581 foundUid = namelist[i].uid();
2505 } 2582 }
2506 } 2583 }
2507 } 2584 }
2508 } 2585 }
2509 } 2586 }
2510 else 2587 else
2511 { 2588 {
2512 foundUid = uid; 2589 foundUid = uid;
2513 } 2590 }
2514 2591
2515 if (!foundUid.isEmpty()) 2592 if (!foundUid.isEmpty())
2516 { 2593 {
2517 2594
2518 // raise Ka/Pi if it is in the background 2595 // raise Ka/Pi if it is in the background
2519#ifndef DESKTOP_VERSION 2596#ifndef DESKTOP_VERSION
2520#ifndef KORG_NODCOP 2597#ifndef KORG_NODCOP
2521 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2598 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2522#endif 2599#endif
2523#endif 2600#endif
2524 2601
2525 mMainWindow->showMaximized(); 2602 mMainWindow->showMaximized();
2526 mMainWindow-> raise(); 2603 mMainWindow-> raise();
2527 2604
2528 mViewManager->setSelected( "", false); 2605 mViewManager->setSelected( "", false);
2529 mViewManager->refreshView( "" ); 2606 mViewManager->refreshView( "" );
2530 mViewManager->setSelected( foundUid, true ); 2607 mViewManager->setSelected( foundUid, true );
2531 mViewManager->refreshView( foundUid ); 2608 mViewManager->refreshView( foundUid );
2532 2609
2533 if ( !mMultipleViewsAtOnce ) 2610 if ( !mMultipleViewsAtOnce )
2534 { 2611 {
2535 setDetailsVisible( true ); 2612 setDetailsVisible( true );
2536 mActionDetails->setChecked(true); 2613 mActionDetails->setChecked(true);
2537 } 2614 }
2538 } 2615 }
2539} 2616}
2540 2617
2541void KABCore::whatsnew() 2618void KABCore::whatsnew()
2542{ 2619{
2543 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2620 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2544} 2621}
2545void KABCore::synchowto() 2622void KABCore::synchowto()
2546{ 2623{
2547 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2624 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2548} 2625}
2549void KABCore::kdesynchowto() 2626void KABCore::kdesynchowto()
2550{ 2627{
2551 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 2628 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
2552} 2629}
2553void KABCore::multisynchowto() 2630void KABCore::multisynchowto()
2554{ 2631{
2555 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 2632 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
2556} 2633}
2557void KABCore::faq() 2634void KABCore::faq()
2558{ 2635{
2559 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2636 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2560} 2637}
2561 2638
2562#include <libkcal/syncdefines.h> 2639#include <libkcal/syncdefines.h>
2563 2640
2564KABC::Addressee KABCore::getLastSyncAddressee() 2641KABC::Addressee KABCore::getLastSyncAddressee()
2565{ 2642{
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 85ffbdb..0d5891e 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -25,491 +25,494 @@
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32#include <qtimer.h> 32#include <qtimer.h>
33 33
34#include <qwidget.h> 34#include <qwidget.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <ksyncmanager.h> 36#include <ksyncmanager.h>
37#ifndef DESKTOP_VERSION 37#ifndef DESKTOP_VERSION
38#include <qcopchannel_qws.h> 38#include <qcopchannel_qws.h>
39#endif 39#endif
40 40
41namespace KABC { 41namespace KABC {
42class AddressBook; 42class AddressBook;
43} 43}
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46class KAboutData; 46class KAboutData;
47class KConfig; 47class KConfig;
48 48
49class KAddressBookService; 49class KAddressBookService;
50class LDAPSearchDialog; 50class LDAPSearchDialog;
51#else //KAB_EMBEDDED 51#else //KAB_EMBEDDED
52class KAddressBookMain; 52class KAddressBookMain;
53//US class QAction; 53//US class QAction;
54#endif //KAB_EMBEDDED 54#endif //KAB_EMBEDDED
55class KCMultiDialog; 55class KCMultiDialog;
56class KXMLGUIClient; 56class KXMLGUIClient;
57class ExtensionManager; 57class ExtensionManager;
58class XXPortManager; 58class XXPortManager;
59class JumpButtonBar; 59class JumpButtonBar;
60class IncSearchWidget; 60class IncSearchWidget;
61class KDGanttMinimizeSplitter; 61class KDGanttMinimizeSplitter;
62class KAction; 62class KAction;
63class KActionCollection; 63class KActionCollection;
64class KToggleAction; 64class KToggleAction;
65class KSyncProfile; 65class KSyncProfile;
66 66
67class QAction; 67class QAction;
68class QMenuBar; 68class QMenuBar;
69class QSplitter; 69class QSplitter;
70class ViewContainer; 70class ViewContainer;
71class ViewManager; 71class ViewManager;
72class AddresseeEditorDialog; 72class AddresseeEditorDialog;
73class Ir; 73class Ir;
74 74
75class KABCore : public QWidget, public KSyncInterface 75class KABCore : public QWidget, public KSyncInterface
76{ 76{
77 Q_OBJECT 77 Q_OBJECT
78 78
79 public: 79 public:
80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
81 81
82 82
83 ~KABCore(); 83 ~KABCore();
84 84
85 85
86#ifdef KAB_EMBEDDED 86#ifdef KAB_EMBEDDED
87 //US added functionality 87 //US added functionality
88 QPopupMenu* getViewMenu() {return viewMenu;} 88 QPopupMenu* getViewMenu() {return viewMenu;}
89 QPopupMenu* getFilterMenu() {return filterMenu;} 89 QPopupMenu* getFilterMenu() {return filterMenu;}
90 QPopupMenu* getSettingsMenu() {return settingsMenu;} 90 QPopupMenu* getSettingsMenu() {return settingsMenu;}
91 void addActionsManually(); 91 void addActionsManually();
92#endif //KAB_EMBEDDED 92#endif //KAB_EMBEDDED
93 /** 93 /**
94 Restores the global settings. 94 Restores the global settings.
95 */ 95 */
96 void restoreSettings(); 96 void restoreSettings();
97 97
98 98
99 99
100 /** 100 /**
101 Returns a pointer to the StdAddressBook of the application. 101 Returns a pointer to the StdAddressBook of the application.
102 */ 102 */
103 KABC::AddressBook *addressBook() const; 103 KABC::AddressBook *addressBook() const;
104 104
105 /** 105 /**
106 Returns a pointer to the KConfig object of the application. 106 Returns a pointer to the KConfig object of the application.
107 */ 107 */
108 static KConfig *config(); 108 static KConfig *config();
109 109
110 /** 110 /**
111 Returns a pointer to the global KActionCollection object. So 111 Returns a pointer to the global KActionCollection object. So
112 other classes can register their actions easily. 112 other classes can register their actions easily.
113 */ 113 */
114 KActionCollection *actionCollection() const; 114 KActionCollection *actionCollection() const;
115 115
116 /** 116 /**
117 Returns the current search field of the Incremental Search Widget. 117 Returns the current search field of the Incremental Search Widget.
118 */ 118 */
119 KABC::Field *currentSearchField() const; 119 KABC::Field *currentSearchField() const;
120 120
121 /** 121 /**
122 Returns the uid list of the currently selected contacts. 122 Returns the uid list of the currently selected contacts.
123 */ 123 */
124 QStringList selectedUIDs() const; 124 QStringList selectedUIDs() const;
125 125
126 /** 126 /**
127 Displays the ResourceSelectDialog and returns the selected 127 Displays the ResourceSelectDialog and returns the selected
128 resource or a null pointer if no resource was selected by 128 resource or a null pointer if no resource was selected by
129 the user. 129 the user.
130 */ 130 */
131 KABC::Resource *requestResource( QWidget *parent ); 131 KABC::Resource *requestResource( QWidget *parent );
132 132
133#ifndef KAB_EMBEDDED 133#ifndef KAB_EMBEDDED
134 static KAboutData *createAboutData(); 134 static KAboutData *createAboutData();
135#endif //KAB_EMBEDDED 135#endif //KAB_EMBEDDED
136 136
137#ifdef KAB_EMBEDDED 137#ifdef KAB_EMBEDDED
138 inline QPopupMenu* getImportMenu() { return ImportMenu;} 138 inline QPopupMenu* getImportMenu() { return ImportMenu;}
139 inline QPopupMenu* getExportMenu() { return ExportMenu;} 139 inline QPopupMenu* getExportMenu() { return ExportMenu;}
140#endif //KAB_EMBEDDED 140#endif //KAB_EMBEDDED
141 141
142 public slots: 142 public slots:
143#ifdef KAB_EMBEDDED 143#ifdef KAB_EMBEDDED
144 void createAboutData(); 144 void createAboutData();
145#endif //KAB_EMBEDDED 145#endif //KAB_EMBEDDED
146 void setDetailsToggle(); 146 void setDetailsToggle();
147 147
148 void showLicence(); 148 void showLicence();
149 void faq(); 149 void faq();
150 void whatsnew() ; 150 void whatsnew() ;
151 void synchowto() ; 151 void synchowto() ;
152 void multisynchowto() ; 152 void multisynchowto() ;
153 void kdesynchowto() ; 153 void kdesynchowto() ;
154 void writeToPhone(); 154 void writeToPhone();
155 155
156 /** 156 /**
157 Is called whenever a contact is selected in the view. 157 Is called whenever a contact is selected in the view.
158 */ 158 */
159 void setContactSelected( const QString &uid ); 159 void setContactSelected( const QString &uid );
160 160
161 /** 161 /**
162 Opens the preferred mail composer with all selected contacts as 162 Opens the preferred mail composer with all selected contacts as
163 arguments. 163 arguments.
164 */ 164 */
165 void sendMail(); 165 void sendMail();
166 166
167 /** 167 /**
168 Opens the preferred mail composer with the given contacts as 168 Opens the preferred mail composer with the given contacts as
169 arguments. 169 arguments.
170 */ 170 */
171 void sendMail( const QString& email ); 171 void sendMail( const QString& email );
172 172
173 173
174 void mailVCard(); 174 void mailVCard();
175 void mailVCard(const QStringList& uids); 175 void mailVCard(const QStringList& uids);
176 176
177 /** 177 /**
178 Beams the "WhoAmI contact. 178 Beams the "WhoAmI contact.
179 */ 179 */
180 void beamMySelf(); 180 void beamMySelf();
181 181
182 void beamVCard(); 182 void beamVCard();
183 void export2phone(); 183 void export2phone();
184 void beamVCard(const QStringList& uids); 184 void beamVCard(const QStringList& uids);
185 void beamDone( Ir *ir ); 185 void beamDone( Ir *ir );
186 186
187 187
188 /** 188 /**
189 Starts the preferred web browser with the given URL as argument. 189 Starts the preferred web browser with the given URL as argument.
190 */ 190 */
191 void browse( const QString& url ); 191 void browse( const QString& url );
192 192
193 /** 193 /**
194 Select all contacts in the view. 194 Select all contacts in the view.
195 */ 195 */
196 void selectAllContacts(); 196 void selectAllContacts();
197 197
198 /** 198 /**
199 Deletes all selected contacts from the address book. 199 Deletes all selected contacts from the address book.
200 */ 200 */
201 void deleteContacts(); 201 void deleteContacts();
202 202
203 /** 203 /**
204 Deletes given contacts from the address book. 204 Deletes given contacts from the address book.
205 205
206 @param uids The uids of the contacts, which shall be deleted. 206 @param uids The uids of the contacts, which shall be deleted.
207 */ 207 */
208 void deleteContacts( const QStringList &uids ); 208 void deleteContacts( const QStringList &uids );
209 209
210 /** 210 /**
211 Copys the selected contacts into clipboard for later pasting. 211 Copys the selected contacts into clipboard for later pasting.
212 */ 212 */
213 void copyContacts(); 213 void copyContacts();
214 214
215 /** 215 /**
216 Cuts the selected contacts and stores them for later pasting. 216 Cuts the selected contacts and stores them for later pasting.
217 */ 217 */
218 void cutContacts(); 218 void cutContacts();
219 219
220 /** 220 /**
221 Paste contacts from clipboard into the address book. 221 Paste contacts from clipboard into the address book.
222 */ 222 */
223 void pasteContacts(); 223 void pasteContacts();
224 224
225 /** 225 /**
226 Paste given contacts into the address book. 226 Paste given contacts into the address book.
227 227
228 @param list The list of addressee, which shall be pasted. 228 @param list The list of addressee, which shall be pasted.
229 */ 229 */
230 void pasteContacts( KABC::Addressee::List &list ); 230 void pasteContacts( KABC::Addressee::List &list );
231 231
232 /** 232 /**
233 Sets the whoAmI contact, that is used by many other programs to 233 Sets the whoAmI contact, that is used by many other programs to
234 get personal information about the current user. 234 get personal information about the current user.
235 */ 235 */
236 void setWhoAmI(); 236 void setWhoAmI();
237 237
238 /** 238 /**
239 Displays the category dialog and applies the result to all 239 Displays the category dialog and applies the result to all
240 selected contacts. 240 selected contacts.
241 */ 241 */
242 void setCategories(); 242 void setCategories();
243 void manageCategories(); 243 void manageCategories();
244 void editCategories(); 244 void editCategories();
245 245
246 /** 246 /**
247 Sets the field list of the Incremental Search Widget. 247 Sets the field list of the Incremental Search Widget.
248 */ 248 */
249 void setSearchFields( const KABC::Field::List &fields ); 249 void setSearchFields( const KABC::Field::List &fields );
250 250
251 /** 251 /**
252 Search with the current search field for a contact, that matches 252 Search with the current search field for a contact, that matches
253 the given text, and selects it in the view. 253 the given text, and selects it in the view.
254 */ 254 */
255 void incrementalSearch( const QString& text ); 255 void incrementalSearch( const QString& text );
256 256
257 /** 257 /**
258 Marks the address book as modified. 258 Marks the address book as modified.
259 */ 259 */
260 void setModified(); 260 void setModified();
261 /** 261 /**
262 Marks the address book as modified without refreshing the view. 262 Marks the address book as modified without refreshing the view.
263 */ 263 */
264 void setModifiedWOrefresh(); 264 void setModifiedWOrefresh();
265 265
266 /** 266 /**
267 Marks the address book as modified concerning the argument. 267 Marks the address book as modified concerning the argument.
268 */ 268 */
269 void setModified( bool modified ); 269 void setModified( bool modified );
270 270
271 /** 271 /**
272 Returns whether the address book is modified. 272 Returns whether the address book is modified.
273 */ 273 */
274 bool modified() const; 274 bool modified() const;
275 275
276 /** 276 /**
277 Called whenever an contact is modified in the contact editor 277 Called whenever an contact is modified in the contact editor
278 dialog or the quick edit. 278 dialog or the quick edit.
279 */ 279 */
280 void contactModified( const KABC::Addressee &addr ); 280 void contactModified( const KABC::Addressee &addr );
281 void addrModified( const KABC::Addressee &addr, bool updateDetails = true );
281 282
282 /** 283 /**
283 DCOP METHODS. 284 DCOP METHODS.
284 */ 285 */
285 void addEmail( QString addr ); 286 void addEmail( QString addr );
286 void importVCard( const KURL& url, bool showPreview ); 287 void importVCard( const KURL& url, bool showPreview );
287 void importVCard( const QString& vCard, bool showPreview ); 288 void importVCard( const QString& vCard, bool showPreview );
288 void newContact(); 289 void newContact();
289 QString getNameByPhone( const QString& phone ); 290 QString getNameByPhone( const QString& phone );
290 /** 291 /**
291 END DCOP METHODS 292 END DCOP METHODS
292 */ 293 */
293 294
294 /** 295 /**
295 Saves the contents of the AddressBook back to disk. 296 Saves the contents of the AddressBook back to disk.
296 */ 297 */
297 void save(); 298 void save();
298 299
299 /** 300 /**
300 Undos the last command using the undo stack. 301 Undos the last command using the undo stack.
301 */ 302 */
302 void undo(); 303 void undo();
303 304
304 /** 305 /**
305 Redos the last command that was undone, using the redo stack. 306 Redos the last command that was undone, using the redo stack.
306 */ 307 */
307 void redo(); 308 void redo();
308 309
309 /** 310 /**
310 Shows the edit dialog for the given uid. If the uid is QString::null, 311 Shows the edit dialog for the given uid. If the uid is QString::null,
311 the method will try to find a selected addressee in the view. 312 the method will try to find a selected addressee in the view.
312 */ 313 */
313 void editContact( const QString &uid /*US = QString::null*/ ); 314 void editContact( const QString &uid /*US = QString::null*/ );
314//US added a second method without defaultparameter 315//US added a second method without defaultparameter
315 void editContact2(); 316 void editContact2();
316 317
317 /** 318 /**
318 Shows or edits the detail view for the given uid. If the uid is QString::null, 319 Shows or edits the detail view for the given uid. If the uid is QString::null,
319 the method will try to find a selected addressee in the view. 320 the method will try to find a selected addressee in the view.
320 */ 321 */
321 void executeContact( const QString &uid /*US = QString::null*/ ); 322 void executeContact( const QString &uid /*US = QString::null*/ );
322 323
323 /** 324 /**
324 Launches the configuration dialog. 325 Launches the configuration dialog.
325 */ 326 */
326 void openConfigDialog(); 327 void openConfigDialog();
327 328
328 /** 329 /**
329 Launches the ldap search dialog. 330 Launches the ldap search dialog.
330 */ 331 */
331 void openLDAPDialog(); 332 void openLDAPDialog();
332 333
333 /** 334 /**
334 Creates a KAddressBookPrinter, which will display the print 335 Creates a KAddressBookPrinter, which will display the print
335 dialog and do the printing. 336 dialog and do the printing.
336 */ 337 */
337 void print(); 338 void print();
338 339
339 /** 340 /**
340 Registers a new GUI client, so plugins can register its actions. 341 Registers a new GUI client, so plugins can register its actions.
341 */ 342 */
342 void addGUIClient( KXMLGUIClient *client ); 343 void addGUIClient( KXMLGUIClient *client );
343 344
344 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 345 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
345 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 346 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
346 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 347 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
347 348
348 349
349 signals: 350 signals:
350 void contactSelected( const QString &name ); 351 void contactSelected( const QString &name );
351 void contactSelected( const QPixmap &pixmap ); 352 void contactSelected( const QPixmap &pixmap );
352 public slots: 353 public slots:
353 void recieve(QString cmsg ); 354 void recieve(QString cmsg );
354 void getFile( bool success ); 355 void getFile( bool success );
355 void syncFileRequest(); 356 void syncFileRequest();
356 void setDetailsVisible( bool visible ); 357 void setDetailsVisible( bool visible );
357 void setDetailsToState(); 358 void setDetailsToState();
358 359
359 void saveSettings(); 360 void saveSettings();
360 361
361 private slots: 362 private slots:
362 void updateToolBar(); 363 void updateToolBar();
363 void updateMainWindow(); 364 void updateMainWindow();
364 void receive( const QCString& cmsg, const QByteArray& data ); 365 void receive( const QCString& cmsg, const QByteArray& data );
365 void toggleBeamReceive( ); 366 void toggleBeamReceive( );
366 void disableBR(bool); 367 void disableBR(bool);
367 void setJumpButtonBarVisible( bool visible ); 368 void setJumpButtonBarVisible( bool visible );
368 void setCaptionBack(); 369 void setCaptionBack();
369 void importFromOL(); 370 void importFromOL();
370 void extensionModified( const KABC::Addressee::List &list ); 371 void extensionModified( const KABC::Addressee::List &list );
371 void extensionChanged( int id ); 372 void extensionChanged( int id );
372 void clipboardDataChanged(); 373 void clipboardDataChanged();
373 void updateActionMenu(); 374 void updateActionMenu();
374 void configureKeyBindings(); 375 void configureKeyBindings();
375 void removeVoice(); 376 void removeVoice();
377 void setFormattedName();
376#ifdef KAB_EMBEDDED 378#ifdef KAB_EMBEDDED
377 void configureResources(); 379 void configureResources();
378#endif //KAB_EMBEDDED 380#endif //KAB_EMBEDDED
379 381
380 void slotEditorDestroyed( const QString &uid ); 382 void slotEditorDestroyed( const QString &uid );
381 void configurationChanged(); 383 void configurationChanged();
382 void addressBookChanged(); 384 void addressBookChanged();
383 385
384 private: 386 private:
385 void resizeEvent(QResizeEvent* e ); 387 void resizeEvent(QResizeEvent* e );
386 bool mBRdisabled; 388 bool mBRdisabled;
387#ifndef DESKTOP_VERSION 389#ifndef DESKTOP_VERSION
388 QCopChannel* infrared; 390 QCopChannel* infrared;
389#endif 391#endif
390 QTimer *mMessageTimer; 392 QTimer *mMessageTimer;
391 void initGUI(); 393 void initGUI();
392 void initActions(); 394 void initActions();
393 QString getPhoneFile(); 395 QString getPhoneFile();
394 396
395 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 397 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
396 const char *name = 0 ); 398 const char *name = 0 );
397 399
398 KXMLGUIClient *mGUIClient; 400 KXMLGUIClient *mGUIClient;
399 401
400 KABC::AddressBook *mAddressBook; 402 KABC::AddressBook *mAddressBook;
401 403
402 ViewManager *mViewManager; 404 ViewManager *mViewManager;
403 // QSplitter *mDetailsSplitter; 405 // QSplitter *mDetailsSplitter;
404 KDGanttMinimizeSplitter *mExtensionBarSplitter; 406 KDGanttMinimizeSplitter *mExtensionBarSplitter;
405 ViewContainer *mDetails; 407 ViewContainer *mDetails;
406 KDGanttMinimizeSplitter* mMiniSplitter; 408 KDGanttMinimizeSplitter* mMiniSplitter;
407 XXPortManager *mXXPortManager; 409 XXPortManager *mXXPortManager;
408 JumpButtonBar *mJumpButtonBar; 410 JumpButtonBar *mJumpButtonBar;
409 IncSearchWidget *mIncSearchWidget; 411 IncSearchWidget *mIncSearchWidget;
410 ExtensionManager *mExtensionManager; 412 ExtensionManager *mExtensionManager;
411 413
412 KCMultiDialog *mConfigureDialog; 414 KCMultiDialog *mConfigureDialog;
413 415
414#ifndef KAB_EMBEDDED 416#ifndef KAB_EMBEDDED
415 LDAPSearchDialog *mLdapSearchDialog; 417 LDAPSearchDialog *mLdapSearchDialog;
416#endif //KAB_EMBEDDED 418#endif //KAB_EMBEDDED
417 // QDict<AddresseeEditorDialog> mEditorDict; 419 // QDict<AddresseeEditorDialog> mEditorDict;
418 AddresseeEditorDialog *mEditorDialog; 420 AddresseeEditorDialog *mEditorDialog;
419 bool mReadWrite; 421 bool mReadWrite;
420 bool mModified; 422 bool mModified;
421 bool mIsPart; 423 bool mIsPart;
422 bool mMultipleViewsAtOnce; 424 bool mMultipleViewsAtOnce;
423 425
424 426
425 //US file menu 427 //US file menu
426 KAction *mActionMail; 428 KAction *mActionMail;
427 KAction *mActionBeam; 429 KAction *mActionBeam;
428 KToggleAction *mActionBR; 430 KToggleAction *mActionBR;
429 KAction *mActionExport2phone; 431 KAction *mActionExport2phone;
430 KAction* mActionPrint; 432 KAction* mActionPrint;
431 KAction* mActionNewContact; 433 KAction* mActionNewContact;
432 KAction *mActionSave; 434 KAction *mActionSave;
433 KAction *mActionEditAddressee; 435 KAction *mActionEditAddressee;
434 KAction *mActionMailVCard; 436 KAction *mActionMailVCard;
435 KAction *mActionBeamVCard; 437 KAction *mActionBeamVCard;
436 438
437 KAction *mActionQuit; 439 KAction *mActionQuit;
438 440
439 //US edit menu 441 //US edit menu
440 KAction *mActionCopy; 442 KAction *mActionCopy;
441 KAction *mActionCut; 443 KAction *mActionCut;
442 KAction *mActionPaste; 444 KAction *mActionPaste;
443 KAction *mActionSelectAll; 445 KAction *mActionSelectAll;
444 KAction *mActionUndo; 446 KAction *mActionUndo;
445 KAction *mActionRedo; 447 KAction *mActionRedo;
446 KAction *mActionDelete; 448 KAction *mActionDelete;
447 449
448 //US settings menu 450 //US settings menu
449 KAction *mActionConfigResources; 451 KAction *mActionConfigResources;
450 KAction *mActionConfigKAddressbook; 452 KAction *mActionConfigKAddressbook;
451 KAction *mActionConfigShortcuts; 453 KAction *mActionConfigShortcuts;
452 KAction *mActionConfigureToolbars; 454 KAction *mActionConfigureToolbars;
453 KAction *mActionKeyBindings; 455 KAction *mActionKeyBindings;
454 KToggleAction *mActionJumpBar; 456 KToggleAction *mActionJumpBar;
455 KToggleAction *mActionDetails; 457 KToggleAction *mActionDetails;
456 KAction *mActionWhoAmI; 458 KAction *mActionWhoAmI;
457 KAction *mActionCategories; 459 KAction *mActionCategories;
458 KAction *mActionEditCategories; 460 KAction *mActionEditCategories;
459 KAction *mActionManageCategories; 461 KAction *mActionManageCategories;
460 KAction *mActionAboutKAddressbook; 462 KAction *mActionAboutKAddressbook;
461 KAction *mActionLicence; 463 KAction *mActionLicence;
462 KAction *mActionFaq; 464 KAction *mActionFaq;
463 KAction *mActionWN; 465 KAction *mActionWN;
464 KAction *mActionSyncHowto; 466 KAction *mActionSyncHowto;
465 KAction *mActionKdeSyncHowto; 467 KAction *mActionKdeSyncHowto;
466 KAction *mActionMultiSyncHowto; 468 KAction *mActionMultiSyncHowto;
467 469
468 KAction *mActionDeleteView; 470 KAction *mActionDeleteView;
469 471
470 QPopupMenu *viewMenu; 472 QPopupMenu *viewMenu;
471 QPopupMenu *filterMenu; 473 QPopupMenu *filterMenu;
472 QPopupMenu *settingsMenu; 474 QPopupMenu *settingsMenu;
473 QPopupMenu *changeMenu; 475 QPopupMenu *changeMenu;
474 QPopupMenu *beamMenu; 476 QPopupMenu *beamMenu;
475//US QAction *mActionSave; 477//US QAction *mActionSave;
476 QPopupMenu *ImportMenu; 478 QPopupMenu *ImportMenu;
477 QPopupMenu *ExportMenu; 479 QPopupMenu *ExportMenu;
478 //LR additional methods 480 //LR additional methods
479 KAction *mActionRemoveVoice; 481 KAction *mActionRemoveVoice;
482 KAction *mActionSetFormattedName;
480 KAction * mActionImportOL; 483 KAction * mActionImportOL;
481 484
482#ifndef KAB_EMBEDDED 485#ifndef KAB_EMBEDDED
483 KAddressBookService *mAddressBookService; 486 KAddressBookService *mAddressBookService;
484#endif //KAB_EMBEDDED 487#endif //KAB_EMBEDDED
485 488
486 class KABCorePrivate; 489 class KABCorePrivate;
487 KABCorePrivate *d; 490 KABCorePrivate *d;
488 //US bool mBlockSaveFlag; 491 //US bool mBlockSaveFlag;
489 492
490#ifdef KAB_EMBEDDED 493#ifdef KAB_EMBEDDED
491 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 494 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
492#endif //KAB_EMBEDDED 495#endif //KAB_EMBEDDED
493 496
494 //this are the overwritten callbackmethods from the syncinterface 497 //this are the overwritten callbackmethods from the syncinterface
495 virtual bool sync(KSyncManager* manager, QString filename, int mode); 498 virtual bool sync(KSyncManager* manager, QString filename, int mode);
496 virtual bool syncExternal(KSyncManager* manager, QString resource); 499 virtual bool syncExternal(KSyncManager* manager, QString resource);
497 virtual void removeSyncInfo( QString syncProfile); 500 virtual void removeSyncInfo( QString syncProfile);
498 bool syncPhone(); 501 bool syncPhone();
499 void message( QString m ); 502 void message( QString m );
500 503
501 // LR ******************************* 504 // LR *******************************
502 // sync stuff! 505 // sync stuff!
503 QString sentSyncFile(); 506 QString sentSyncFile();
504 QPopupMenu *syncMenu; 507 QPopupMenu *syncMenu;
505 KSyncManager* syncManager; 508 KSyncManager* syncManager;
506 int mGlobalSyncMode; 509 int mGlobalSyncMode;
507 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 510 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
508 KABC::Addressee getLastSyncAddressee(); 511 KABC::Addressee getLastSyncAddressee();
509 QDateTime mLastAddressbookSync; 512 QDateTime mLastAddressbookSync;
510 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 513 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
511 // ********************* 514 // *********************
512 515
513}; 516};
514 517
515#endif 518#endif
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index db123da..a2095d4 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -1,155 +1,155 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24//US#ifdef KAB_EMBEDDED 24//US#ifdef KAB_EMBEDDED
25//#include <qstring.h> 25//#include <qstring.h>
26//#endif //KAB_EMBEDDED 26//#endif //KAB_EMBEDDED
27 27
28#include <qtextstream.h> 28#include <qtextstream.h>
29#include <qfile.h> 29#include <qfile.h>
30#include <qregexp.h> 30#include <qregexp.h>
31#include <stdlib.h> 31#include <stdlib.h>
32#include <libkdepim/kpimglobalprefs.h> 32#include <libkdepim/kpimglobalprefs.h>
33 33
34#include <kconfig.h> 34#include <kconfig.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kstaticdeleter.h> 36#include <kstaticdeleter.h>
37//US#include <kdebug.h> // defines kdDebug() 37//US#include <kdebug.h> // defines kdDebug()
38 38
39#include "kabprefs.h" 39#include "kabprefs.h"
40 40
41#ifdef DESKTOP_VERSION 41#ifdef DESKTOP_VERSION
42#include <qapplication.h> 42#include <qapplication.h>
43#endif 43#endif
44 44
45KABPrefs *KABPrefs::sInstance = 0; 45KABPrefs *KABPrefs::sInstance = 0;
46static KStaticDeleter<KABPrefs> staticDeleterAB; 46static KStaticDeleter<KABPrefs> staticDeleterAB;
47 47
48KABPrefs::KABPrefs() 48KABPrefs::KABPrefs()
49 : KPimPrefs("kaddressbookrc") 49 : KPimPrefs("kaddressbookrc")
50{ 50{
51 mDetailsFont = QFont("helvetica",12); 51 mDetailsFont = QFont("helvetica",12);
52 KPrefs::setCurrentGroup( "Views" ); 52 KPrefs::setCurrentGroup( "Views" );
53 addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); 53 addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
54 54
55 KPrefs::setCurrentGroup( "General" ); 55 KPrefs::setCurrentGroup( "General" );
56 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); 56 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
57 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); 57 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
58 58
59#ifdef KAB_EMBEDDED 59#ifdef KAB_EMBEDDED
60 addItemBool("AskForQuit",&mAskForQuit,true); 60 addItemBool("AskForQuit",&mAskForQuit,true);
61 addItemBool("ToolBarHor",&mToolBarHor, true ); 61 addItemBool("ToolBarHor",&mToolBarHor, true );
62 addItemBool("ToolBarUp",&mToolBarUp, false ); 62 addItemBool("ToolBarUp",&mToolBarUp, false );
63 addItemBool("SearchWithReturn",&mSearchWithReturn, true ); 63 addItemBool("SearchWithReturn",&mSearchWithReturn, false );
64 addItemFont("DetailsFont",&mDetailsFont); 64 addItemFont("DetailsFont",&mDetailsFont);
65 65
66 66
67#endif //KAB_EMBEDDED 67#endif //KAB_EMBEDDED
68 68
69 KPrefs::setCurrentGroup( "MainWindow" ); 69 KPrefs::setCurrentGroup( "MainWindow" );
70 bool m_visible = false; 70 bool m_visible = false;
71#ifdef DESKTOP_VERSION 71#ifdef DESKTOP_VERSION
72 m_visible = true; 72 m_visible = true;
73#endif 73#endif
74 addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); 74 addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible );
75 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); 75 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
76 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); 76 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
77 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); 77 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
78 addItemIntList( "DetailsSplitter", &mDetailsSplitter ); 78 addItemIntList( "DetailsSplitter", &mDetailsSplitter );
79 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); 79 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true );
80 80
81 81
82 KPrefs::setCurrentGroup( "Extensions_General" ); 82 KPrefs::setCurrentGroup( "Extensions_General" );
83 QStringList defaultExtensions; 83 QStringList defaultExtensions;
84 defaultExtensions << "merge"; 84 defaultExtensions << "merge";
85 defaultExtensions << "distribution_list_editor"; 85 defaultExtensions << "distribution_list_editor";
86 addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); 86 addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
87 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); 87 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
88 88
89 KPrefs::setCurrentGroup( "Views" ); 89 KPrefs::setCurrentGroup( "Views" );
90 QString defaultView = i18n( "Default Table View" ); 90 QString defaultView = i18n( "Default Table View" );
91 addItemString( "CurrentView", &mCurrentView, defaultView ); 91 addItemString( "CurrentView", &mCurrentView, defaultView );
92 addItemStringList( "ViewNames", &mViewNames, defaultView ); 92 addItemStringList( "ViewNames", &mViewNames, defaultView );
93 93
94 KPrefs::setCurrentGroup( "Filters" ); 94 KPrefs::setCurrentGroup( "Filters" );
95 addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); 95 addItemInt( "CurrentFilter", &mCurrentFilter, 0 );
96 96
97} 97}
98 98
99KABPrefs::~KABPrefs() 99KABPrefs::~KABPrefs()
100{ 100{
101 //qDebug("KABPrefs::~KABPrefs() "); 101 //qDebug("KABPrefs::~KABPrefs() ");
102 if (sInstance == this) 102 if (sInstance == this)
103 sInstance = staticDeleterAB.setObject(0); 103 sInstance = staticDeleterAB.setObject(0);
104} 104}
105 105
106KABPrefs *KABPrefs::instance() 106KABPrefs *KABPrefs::instance()
107{ 107{
108 if ( !sInstance ) { 108 if ( !sInstance ) {
109#ifdef KAB_EMBEDDED 109#ifdef KAB_EMBEDDED
110 sInstance = staticDeleterAB.setObject( new KABPrefs() ); 110 sInstance = staticDeleterAB.setObject( new KABPrefs() );
111#else //KAB_EMBEDDED 111#else //KAB_EMBEDDED
112 //US the following line has changed ???. Why 112 //US the following line has changed ???. Why
113 staticDeleterAB.setObject( sInstance, new KABPrefs() ); 113 staticDeleterAB.setObject( sInstance, new KABPrefs() );
114#endif //KAB_EMBEDDED 114#endif //KAB_EMBEDDED
115 sInstance->readConfig(); 115 sInstance->readConfig();
116 } 116 }
117 117
118 return sInstance; 118 return sInstance;
119} 119}
120 120
121void KABPrefs::setCategoryDefaults() 121void KABPrefs::setCategoryDefaults()
122{ 122{
123 mCustomCategories.clear(); 123 mCustomCategories.clear();
124 124
125 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) 125 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
126 << i18n( "Customer" ) << i18n( "Friend" ); 126 << i18n( "Customer" ) << i18n( "Friend" );
127} 127}
128 128
129 // US introduce a nonconst way to return the config object. 129 // US introduce a nonconst way to return the config object.
130KConfig* KABPrefs::getConfig() 130KConfig* KABPrefs::getConfig()
131{ 131{
132 return config(); 132 return config();
133} 133}
134void KABPrefs::usrReadConfig() 134void KABPrefs::usrReadConfig()
135{ 135{
136 KPimPrefs::usrReadConfig(); 136 KPimPrefs::usrReadConfig();
137} 137}
138 138
139 139
140/*US 140/*US
141void KABPrefs::usrSetDefaults() 141void KABPrefs::usrSetDefaults()
142{ 142{
143 KPimPrefs::usrSetDefaults(); 143 KPimPrefs::usrSetDefaults();
144} 144}
145 145
146void KABPrefs::usrReadConfig() 146void KABPrefs::usrReadConfig()
147{ 147{
148 KPimPrefs::usrReadConfig(); 148 KPimPrefs::usrReadConfig();
149} 149}
150 150
151void KABPrefs::usrWriteConfig() 151void KABPrefs::usrWriteConfig()
152{ 152{
153 KPimPrefs::usrWriteConfig(); 153 KPimPrefs::usrWriteConfig();
154} 154}
155*/ 155*/
diff --git a/kaddressbook/kcmconfigs/addresseewidget.cpp b/kaddressbook/kcmconfigs/addresseewidget.cpp
index eb5bdd9..168d39e 100644
--- a/kaddressbook/kcmconfigs/addresseewidget.cpp
+++ b/kaddressbook/kcmconfigs/addresseewidget.cpp
@@ -1,243 +1,238 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qgroupbox.h> 24#include <qgroupbox.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlistbox.h> 27#include <qlistbox.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qapplication.h> 29#include <qapplication.h>
30 30
31#include <kbuttonbox.h> 31#include <kbuttonbox.h>
32#include <kcombobox.h> 32#include <kcombobox.h>
33#include <kconfig.h> 33#include <kconfig.h>
34#include <kdialog.h> 34#include <kdialog.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kglobal.h> 36#include <kglobal.h>
37#include <klineedit.h> 37#include <klineedit.h>
38#include <kstandarddirs.h> 38#include <kstandarddirs.h>
39 39
40#include "addresseewidget.h" 40#include "addresseewidget.h"
41 41
42NamePartWidget::NamePartWidget( const QString &title, QWidget *parent, 42NamePartWidget::NamePartWidget( const QString &title, QWidget *parent,
43 const char *name ) 43 const char *name )
44 : QWidget( parent, name ) 44 : QWidget( parent, name )
45{ 45{
46 if (KGlobal::getOrientation() == KGlobal::Portrait) 46 if (KGlobal::getOrientation() == KGlobal::Portrait)
47 { 47 {
48 QGridLayout* layout = new QGridLayout( this, 1, 1, KDialog::marginHintSmall(), 48 QGridLayout* layout = new QGridLayout( this, 1, 1, KDialog::marginHintSmall(),
49 KDialog::spacingHintSmall() ); 49 KDialog::spacingHintSmall() );
50 50
51 QLabel *label = new QLabel( i18n( title ), this ); 51 QLabel *label = new QLabel( i18n( title ), this );
52 layout->addWidget( label, 0, 1 ); 52 layout->addWidget( label, 0, 1 );
53 53
54 mBox = new QListBox( this ); 54 mBox = new QListBox( this );
55 mBox->setMaximumSize(70, 70); 55 mBox->setMaximumSize(70, 70);
56 layout->addMultiCellWidget( mBox, 0, 1, 0, 0 ); 56 layout->addMultiCellWidget( mBox, 0, 1, 0, 0 );
57 57
58 KButtonBox *bbox = new KButtonBox( this, Qt::Vertical ); 58 KButtonBox *bbox = new KButtonBox( this, Qt::Vertical );
59 mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); 59 mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) );
60 mRemoveButton = bbox->addButton( i18n( "Rem" ), this, SLOT( remove() ) ); 60 mRemoveButton = bbox->addButton( i18n( "Rem" ), this, SLOT( remove() ) );
61 bbox->layout(); 61 bbox->layout();
62 layout->addMultiCellWidget( bbox, 0, 1, 2,2); 62 layout->addMultiCellWidget( bbox, 0, 1, 2,2);
63 63
64 mEdit = new KLineEdit( this ); 64 mEdit = new KLineEdit( this );
65 layout->addWidget( mEdit, 1, 1 ); 65 layout->addWidget( mEdit, 1, 1 );
66 //mEdit->setMinimumWidth(50); 66 //mEdit->setMinimumWidth(50);
67 67
68// layout->addWidget( group ); 68// layout->addWidget( group );
69 69
70 } 70 }
71 else 71 else
72 { 72 {
73 QHBoxLayout *layout = new QHBoxLayout( this ); 73 QHBoxLayout *layout = new QHBoxLayout( this );
74 74
75 QGroupBox *group = new QGroupBox( 0, Qt::Vertical, title, this ); 75 QGroupBox *group = new QGroupBox( 0, Qt::Vertical, title, this );
76 QGridLayout *groupLayout = new QGridLayout( group->layout(), 2, 2, 76 QGridLayout *groupLayout = new QGridLayout( group->layout(), 2, 2,
77 KDialog::spacingHint() ); 77 KDialog::spacingHint() );
78 78
79 mBox = new QListBox( group ); 79 mBox = new QListBox( group );
80 80
81 groupLayout->addWidget( mBox, 0, 0 ); 81 groupLayout->addWidget( mBox, 0, 0 );
82 82
83 KButtonBox *bbox = new KButtonBox( group, Qt::Vertical ); 83 KButtonBox *bbox = new KButtonBox( group, Qt::Vertical );
84 mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); 84 mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) );
85 mRemoveButton = bbox->addButton( i18n( "Remove" ), this, SLOT( remove() ) ); 85 mRemoveButton = bbox->addButton( i18n( "Remove" ), this, SLOT( remove() ) );
86 bbox->layout(); 86 bbox->layout();
87 groupLayout->addWidget( bbox, 0, 1 ); 87 groupLayout->addWidget( bbox, 0, 1 );
88 88
89 mEdit = new KLineEdit( group ); 89 mEdit = new KLineEdit( group );
90 groupLayout->addMultiCellWidget( mEdit, 1, 1, 0, 1 ); 90 groupLayout->addMultiCellWidget( mEdit, 1, 1, 0, 1 );
91 91
92 layout->addWidget( group ); 92 layout->addWidget( group );
93 93
94 } 94 }
95 95
96 mAddButton->setEnabled( false ); 96 mAddButton->setEnabled( false );
97 mRemoveButton->setEnabled( false ); 97 mRemoveButton->setEnabled( false );
98 98
99 99
100 connect( mBox, SIGNAL( selectionChanged( QListBoxItem* ) ), 100 connect( mBox, SIGNAL( selectionChanged( QListBoxItem* ) ),
101 SLOT( selectionChanged( QListBoxItem* ) ) ); 101 SLOT( selectionChanged( QListBoxItem* ) ) );
102 connect( mEdit, SIGNAL( textChanged( const QString& ) ), 102 connect( mEdit, SIGNAL( textChanged( const QString& ) ),
103 SLOT( textChanged( const QString& ) ) ); 103 SLOT( textChanged( const QString& ) ) );
104 connect( mEdit, SIGNAL( returnPressed() ), SLOT( add() ) ); 104 connect( mEdit, SIGNAL( returnPressed() ), SLOT( add() ) );
105 105
106} 106}
107 107
108NamePartWidget::~NamePartWidget() 108NamePartWidget::~NamePartWidget()
109{ 109{
110} 110}
111 111
112void NamePartWidget::setNameParts( const QStringList &list ) 112void NamePartWidget::setNameParts( const QStringList &list )
113{ 113{
114 mBox->clear(); 114 mBox->clear();
115 mBox->insertStringList( list ); 115 mBox->insertStringList( list );
116} 116}
117 117
118QStringList NamePartWidget::nameParts() const 118QStringList NamePartWidget::nameParts() const
119{ 119{
120 QStringList parts; 120 QStringList parts;
121 for ( uint i = 0; i < mBox->count(); ++i ) 121 for ( uint i = 0; i < mBox->count(); ++i )
122 parts.append( mBox->text( i ) ); 122 parts.append( mBox->text( i ) );
123 123
124 return parts; 124 return parts;
125} 125}
126 126
127void NamePartWidget::add() 127void NamePartWidget::add()
128{ 128{
129 if ( !mEdit->text().isEmpty() ) { 129 if ( !mEdit->text().isEmpty() ) {
130 mBox->insertItem( mEdit->text() ); 130 mBox->insertItem( mEdit->text() );
131 emit modified(); 131 emit modified();
132 } 132 }
133 133
134 mEdit->setText( "" ); 134 mEdit->setText( "" );
135} 135}
136 136
137void NamePartWidget::remove() 137void NamePartWidget::remove()
138{ 138{
139 mBox->removeItem( mBox->currentItem() ); 139 mBox->removeItem( mBox->currentItem() );
140 if ( mBox->count() == 0 ) 140 if ( mBox->count() == 0 )
141 selectionChanged( 0 ); 141 selectionChanged( 0 );
142 142
143 emit modified(); 143 emit modified();
144} 144}
145 145
146void NamePartWidget::selectionChanged( QListBoxItem *item ) 146void NamePartWidget::selectionChanged( QListBoxItem *item )
147{ 147{
148 mRemoveButton->setEnabled( item != 0 ); 148 mRemoveButton->setEnabled( item != 0 );
149} 149}
150 150
151void NamePartWidget::textChanged( const QString& text ) 151void NamePartWidget::textChanged( const QString& text )
152{ 152{
153 mAddButton->setEnabled( !text.isEmpty() ); 153 mAddButton->setEnabled( !text.isEmpty() );
154} 154}
155 155
156 156
157AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name ) 157AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name )
158 : QWidget( parent, name ) 158 : QWidget( parent, name )
159{ 159{
160 QGridLayout *layout; 160 QGridLayout *layout;
161 161
162 mPrefix = new NamePartWidget( i18n( "Prefixes" ), this ); 162 mPrefix = new NamePartWidget( i18n( "Prefixes" ), this );
163 mInclusion = new NamePartWidget( i18n( "Inclusions" ), this ); 163 mInclusion = new NamePartWidget( i18n( "Inclusions" ), this );
164 mSuffix = new NamePartWidget( i18n( "Suffixes" ), this ); 164 mSuffix = new NamePartWidget( i18n( "Suffixes" ), this );
165 QString dfn; 165 QString dfn;
166 if (QApplication::desktop()->width() > 320 ) 166 if (QApplication::desktop()->width() > 320 )
167 dfn = i18n( "Default formatted name:" ); 167 dfn = i18n( "Default formatted name:" );
168 else 168 else
169 dfn = i18n( "Def. formatted name:" ); 169 dfn = i18n( "Def. formatted name:" );
170 170
171 QLabel *label = new QLabel( dfn, this ); 171 QLabel *label = new QLabel( dfn, this );
172 172
173 mFormattedNameCombo = new KComboBox( this ); 173 mFormattedNameCombo = new KComboBox( this );
174 mFormattedNameCombo->insertItem( i18n( "Empty" ) ); 174 mFormattedNameCombo->insertItem( i18n( "Empty" ) );
175 mFormattedNameCombo->insertItem( i18n( "Simple Name" ) ); 175 mFormattedNameCombo->insertItem( i18n( "Simple Name" ) );
176 mFormattedNameCombo->insertItem( i18n( "Full Name" ) ); 176 mFormattedNameCombo->insertItem( i18n( "Full Name" ) );
177 mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) ); 177 mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) );
178 178
179 if (KGlobal::getOrientation() == KGlobal::Portrait) 179 if (KGlobal::getOrientation() == KGlobal::Portrait)
180 { 180 {
181 layout = new QGridLayout( this, 4, 2, KDialog::marginHintSmall(), 181 layout = new QGridLayout( this, 4, 2, KDialog::marginHintSmall(),
182 KDialog::spacingHintSmall() ); 182 KDialog::spacingHintSmall() );
183 183
184 layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 ); 184 layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 );
185 layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 ); 185 layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 );
186 layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 ); 186 layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 );
187 layout->addWidget( label, 3, 0 ); 187 layout->addWidget( label, 3, 0 );
188 layout->addWidget( mFormattedNameCombo, 3, 1 ); 188 layout->addWidget( mFormattedNameCombo, 3, 1 );
189 189
190 } 190 }
191 else 191 else
192 { 192 {
193 layout = new QGridLayout( this, 2, 3, KDialog::marginHint(), 193 layout = new QGridLayout( this, 2, 3, KDialog::marginHint(),
194 KDialog::spacingHint() ); 194 KDialog::spacingHint() );
195 195
196 layout->addWidget( mPrefix, 0, 0 ); 196 layout->addWidget( mPrefix, 0, 0 );
197 layout->addWidget( mInclusion, 0, 1 ); 197 layout->addWidget( mInclusion, 0, 1 );
198 layout->addWidget( mSuffix, 0, 2 ); 198 layout->addWidget( mSuffix, 0, 2 );
199 layout->addWidget( label, 1, 0 ); 199 layout->addWidget( label, 1, 0 );
200 layout->addMultiCellWidget( mFormattedNameCombo, 1, 1, 1, 2 ); 200 layout->addMultiCellWidget( mFormattedNameCombo, 1, 1, 1, 2 );
201 } 201 }
202 202
203 connect( mPrefix, SIGNAL( modified() ), SIGNAL( modified() ) ); 203 connect( mPrefix, SIGNAL( modified() ), SIGNAL( modified() ) );
204 connect( mInclusion, SIGNAL( modified() ), SIGNAL( modified() ) ); 204 connect( mInclusion, SIGNAL( modified() ), SIGNAL( modified() ) );
205 connect( mSuffix, SIGNAL( modified() ), SIGNAL( modified() ) ); 205 connect( mSuffix, SIGNAL( modified() ), SIGNAL( modified() ) );
206 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SIGNAL( modified() ) ); 206 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SIGNAL( modified() ) );
207} 207}
208 208
209AddresseeWidget::~AddresseeWidget() 209AddresseeWidget::~AddresseeWidget()
210{ 210{
211} 211}
212 212
213void AddresseeWidget::restoreSettings() 213void AddresseeWidget::restoreSettings()
214{ 214{
215 KConfig config( locateLocal("config", "kabcrc") ); 215 KConfig config( locateLocal("config", "kabcrc") );
216 config.setGroup( "General" ); 216 config.setGroup( "General" );
217 217
218 mPrefix->setNameParts( config.readListEntry( "Prefixes" ) ); 218 mPrefix->setNameParts( config.readListEntry( "Prefixes" ) );
219 mInclusion->setNameParts( config.readListEntry( "Inclusions" ) ); 219 mInclusion->setNameParts( config.readListEntry( "Inclusions" ) );
220 mSuffix->setNameParts( config.readListEntry( "Suffixes" ) ); 220 mSuffix->setNameParts( config.readListEntry( "Suffixes" ) );
221 221 mFormattedNameCombo->setCurrentItem( config.readNumEntry( "FormattedNameType", 1 ) );
222 KConfig cfg( locateLocal("config","kaddressbookrc") );
223 cfg.setGroup( "General" );
224 mFormattedNameCombo->setCurrentItem( cfg.readNumEntry( "FormattedNameType", 1 ) );
225} 222}
226 223
227void AddresseeWidget::saveSettings() 224void AddresseeWidget::saveSettings()
228{ 225{
226 qDebug("AddresseeWidget::saveSettings() ");
229 KConfig config( locateLocal("config","kabcrc") ); 227 KConfig config( locateLocal("config","kabcrc") );
230 config.setGroup( "General" ); 228 config.setGroup( "General" );
231 229
232 config.writeEntry( "Prefixes", mPrefix->nameParts() ); 230 config.writeEntry( "Prefixes", mPrefix->nameParts() );
233 config.writeEntry( "Inclusions", mInclusion->nameParts() ); 231 config.writeEntry( "Inclusions", mInclusion->nameParts() );
234 config.writeEntry( "Suffixes", mSuffix->nameParts() ); 232 config.writeEntry( "Suffixes", mSuffix->nameParts() );
235 233 config.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() );
236 KConfig cfg( locateLocal("config","kaddressbookrc") );
237 cfg.setGroup( "General" );
238 cfg.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() );
239} 234}
240 235
241#ifndef KAB_EMBEDDED 236#ifndef KAB_EMBEDDED
242#include "addresseewidget.moc" 237#include "addresseewidget.moc"
243#endif //KAB_EMBEDDED 238#endif //KAB_EMBEDDED
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp
index 8213c2b..f5dba0f 100644
--- a/kaddressbook/nameeditdialog.cpp
+++ b/kaddressbook/nameeditdialog.cpp
@@ -1,293 +1,295 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qlistbox.h> 26#include <qlistbox.h>
27#include <qlistview.h> 27#include <qlistview.h>
28#include <qtooltip.h> 28#include <qtooltip.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qcheckbox.h> 30#include <qcheckbox.h>
31#include <qstring.h> 31#include <qstring.h>
32 32
33#ifndef KAB_EMBEDDED 33#ifndef KAB_EMBEDDED
34#include <kaccelmanager.h> 34#include <kaccelmanager.h>
35#else //KAB_EMBEDDED 35#else //KAB_EMBEDDED
36#include <kstandarddirs.h> 36#include <kstandarddirs.h>
37#endif //KAB_EMBEDDED 37#endif //KAB_EMBEDDED
38 38
39#include <kapplication.h> 39#include <kapplication.h>
40#include <kbuttonbox.h> 40#include <kbuttonbox.h>
41#include <kconfig.h> 41#include <kconfig.h>
42#include <klineedit.h> 42#include <klineedit.h>
43#include <klistview.h> 43#include <klistview.h>
44#include <kcombobox.h> 44#include <kcombobox.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kglobal.h> 46#include <kglobal.h>
47#include <kdebug.h> 47#include <kdebug.h>
48#include <kiconloader.h> 48#include <kiconloader.h>
49#include <kmessagebox.h> 49#include <kmessagebox.h>
50 50
51#include "nameeditdialog.h" 51#include "nameeditdialog.h"
52 52
53NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type, 53NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type,
54 QWidget *parent, const char *name ) 54 QWidget *parent, const char *name )
55 : KDialogBase( Plain, i18n( "Edit Contact Name" ), Help | Ok | Cancel, 55 : KDialogBase( Plain, i18n( "Edit Contact Name" ), Help | Ok | Cancel,
56 Ok, parent, name, true ) 56 Ok, parent, name, true )
57{ 57{
58 58
59 QWidget *page = plainPage(); 59 QWidget *page = plainPage();
60 QGridLayout *layout = new QGridLayout( page, 5, 3 ); 60 QGridLayout *layout = new QGridLayout( page, 5, 3 );
61 layout->setSpacing( spacingHint() ); 61 layout->setSpacing( spacingHint() );
62 layout->addColSpacing( 2, 100 ); 62 layout->addColSpacing( 2, 100 );
63 QLabel *label; 63 QLabel *label;
64 64
65 label = new QLabel( i18n( "Honorific prefixes:" ), page ); 65 label = new QLabel( i18n( "Honorific prefixes:" ), page );
66 layout->addWidget( label, 0, 0 ); 66 layout->addWidget( label, 0, 0 );
67 mPrefixCombo = new KComboBox( page ); 67 mPrefixCombo = new KComboBox( page );
68 mPrefixCombo->setDuplicatesEnabled( false ); 68 mPrefixCombo->setDuplicatesEnabled( false );
69 mPrefixCombo->setEditable( true ); 69 mPrefixCombo->setEditable( true );
70 label->setBuddy( mPrefixCombo ); 70 label->setBuddy( mPrefixCombo );
71 layout->addMultiCellWidget( mPrefixCombo, 0, 0, 1, 2 ); 71 layout->addMultiCellWidget( mPrefixCombo, 0, 0, 1, 2 );
72 72
73 label = new QLabel( i18n( "Given name:" ), page ); 73 label = new QLabel( i18n( "Given name:" ), page );
74 layout->addWidget( label, 1, 0 ); 74 layout->addWidget( label, 1, 0 );
75 mGivenNameEdit = new KLineEdit( page ); 75 mGivenNameEdit = new KLineEdit( page );
76 label->setBuddy( mGivenNameEdit ); 76 label->setBuddy( mGivenNameEdit );
77 layout->addMultiCellWidget( mGivenNameEdit, 1, 1, 1, 2 ); 77 layout->addMultiCellWidget( mGivenNameEdit, 1, 1, 1, 2 );
78 78
79 label = new QLabel( i18n( "Additional names:" ), page ); 79 label = new QLabel( i18n( "Additional names:" ), page );
80 layout->addWidget( label, 2, 0 ); 80 layout->addWidget( label, 2, 0 );
81 mAdditionalNameEdit = new KLineEdit( page ); 81 mAdditionalNameEdit = new KLineEdit( page );
82 label->setBuddy( mAdditionalNameEdit ); 82 label->setBuddy( mAdditionalNameEdit );
83 layout->addMultiCellWidget( mAdditionalNameEdit, 2, 2, 1, 2 ); 83 layout->addMultiCellWidget( mAdditionalNameEdit, 2, 2, 1, 2 );
84 84
85 label = new QLabel( i18n( "Family names:" ), page ); 85 label = new QLabel( i18n( "Family names:" ), page );
86 layout->addWidget( label, 3, 0 ); 86 layout->addWidget( label, 3, 0 );
87 mFamilyNameEdit = new KLineEdit( page ); 87 mFamilyNameEdit = new KLineEdit( page );
88 label->setBuddy( mFamilyNameEdit ); 88 label->setBuddy( mFamilyNameEdit );
89 layout->addMultiCellWidget( mFamilyNameEdit, 3, 3, 1, 2 ); 89 layout->addMultiCellWidget( mFamilyNameEdit, 3, 3, 1, 2 );
90 90
91 label = new QLabel( i18n( "Honorific suffixes:" ), page ); 91 label = new QLabel( i18n( "Honorific suffixes:" ), page );
92 layout->addWidget( label, 4, 0 ); 92 layout->addWidget( label, 4, 0 );
93 mSuffixCombo = new KComboBox( page ); 93 mSuffixCombo = new KComboBox( page );
94 mSuffixCombo->setDuplicatesEnabled( false ); 94 mSuffixCombo->setDuplicatesEnabled( false );
95 mSuffixCombo->setEditable( true ); 95 mSuffixCombo->setEditable( true );
96 label->setBuddy( mSuffixCombo ); 96 label->setBuddy( mSuffixCombo );
97 layout->addMultiCellWidget( mSuffixCombo, 4, 4, 1, 2 ); 97 layout->addMultiCellWidget( mSuffixCombo, 4, 4, 1, 2 );
98 98
99 mFormattedNameCombo = new KComboBox( page ); 99 mFormattedNameCombo = new KComboBox( page );
100 mFormattedNameCombo->setMaximumWidth(100); 100 mFormattedNameCombo->setMaximumWidth(100);
101 101
102 layout->addMultiCellWidget( mFormattedNameCombo, 5, 5, 0, 0 ); 102 layout->addMultiCellWidget( mFormattedNameCombo, 5, 5, 0, 0 );
103 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( typeChanged( int ) ) ); 103 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( typeChanged( int ) ) );
104 104
105 mFormattedNameEdit = new KLineEdit( page ); 105 mFormattedNameEdit = new KLineEdit( page );
106 mFormattedNameEdit->setEnabled( type == CustomName ); 106 mFormattedNameEdit->setEnabled( type == CustomName );
107 layout->addMultiCellWidget( mFormattedNameEdit, 5, 5, 1, 2 ); 107 layout->addMultiCellWidget( mFormattedNameEdit, 5, 5, 1, 2 );
108 108
109 mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page ); 109 mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page );
110 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) ); 110 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) );
111 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) ); 111 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) );
112 layout->addMultiCellWidget( mParseBox, 6, 6, 0, 2 ); 112 layout->addMultiCellWidget( mParseBox, 6, 6, 0, 2 );
113 113
114 // Fill in the values 114 // Fill in the values
115 mFamilyNameEdit->setText( addr.familyName() ); 115 mFamilyNameEdit->setText( addr.familyName() );
116 mGivenNameEdit->setText( addr.givenName() ); 116 mGivenNameEdit->setText( addr.givenName() );
117 mAdditionalNameEdit->setText( addr.additionalName() ); 117 mAdditionalNameEdit->setText( addr.additionalName() );
118 mFormattedNameEdit->setText( addr.formattedName() ); 118 mFormattedNameEdit->setText( addr.formattedName() );
119 119
120 // Prefix and suffix combos 120 // Prefix and suffix combos
121//US KConfig config( "kabcrc" ); 121//US KConfig config( "kabcrc" );
122 KConfig config( locateLocal("config", "kabcrc") ); 122 KConfig config( locateLocal("config", "kabcrc") );
123 config.setGroup( "General" ); 123 config.setGroup( "General" );
124 124
125 QStringList sTitle; 125 QStringList sTitle;
126 sTitle += i18n( "Dr." ); 126 sTitle += i18n( "Dr." );
127 sTitle += i18n( "Miss" ); 127 sTitle += i18n( "Miss" );
128 sTitle += i18n( "Mr." ); 128 sTitle += i18n( "Mr." );
129 sTitle += i18n( "Mrs." ); 129 sTitle += i18n( "Mrs." );
130 sTitle += i18n( "Ms." ); 130 sTitle += i18n( "Ms." );
131 sTitle += i18n( "Prof." ); 131 sTitle += i18n( "Prof." );
132 sTitle += config.readListEntry( "Prefixes" ); 132 sTitle += config.readListEntry( "Prefixes" );
133 sTitle.sort(); 133 sTitle.sort();
134 134
135 QStringList sSuffix; 135 QStringList sSuffix;
136 sSuffix += i18n( "I" ); 136 sSuffix += i18n( "I" );
137 sSuffix += i18n( "II" ); 137 sSuffix += i18n( "II" );
138 sSuffix += i18n( "III" ); 138 sSuffix += i18n( "III" );
139 sSuffix += i18n( "Jr." ); 139 sSuffix += i18n( "Jr." );
140 sSuffix += i18n( "Sr." ); 140 sSuffix += i18n( "Sr." );
141 sSuffix += config.readListEntry( "Suffixes" ); 141 sSuffix += config.readListEntry( "Suffixes" );
142 sSuffix.sort(); 142 sSuffix.sort();
143 143
144 mPrefixCombo->insertStringList( sTitle ); 144 mPrefixCombo->insertStringList( sTitle );
145 mSuffixCombo->insertStringList( sSuffix ); 145 mSuffixCombo->insertStringList( sSuffix );
146 146
147#ifndef KAB_EMBEDDED 147#ifndef KAB_EMBEDDED
148 mPrefixCombo->setCurrentText( addr.prefix() ); 148 mPrefixCombo->setCurrentText( addr.prefix() );
149 mSuffixCombo->setCurrentText( addr.suffix() ); 149 mSuffixCombo->setCurrentText( addr.suffix() );
150#else //KAB_EMBEDDED 150#else //KAB_EMBEDDED
151 mPrefixCombo->setEditText( addr.prefix() ); 151 mPrefixCombo->setEditText( addr.prefix() );
152 mSuffixCombo->setEditText( addr.suffix() ); 152 mSuffixCombo->setEditText( addr.suffix() );
153#endif //KAB_EMBEDDED 153#endif //KAB_EMBEDDED
154 154
155 AddresseeConfig::instance()->setUid( addr.uid() ); 155 AddresseeConfig::instance()->setUid( addr.uid() );
156 mParseBox->setChecked( AddresseeConfig::instance()->automaticNameParsing() ); 156 mParseBox->setChecked( AddresseeConfig::instance()->automaticNameParsing() );
157 157
158#ifndef KAB_EMBEDDED 158#ifndef KAB_EMBEDDED
159 KAcceleratorManager::manage( this ); 159 KAcceleratorManager::manage( this );
160#endif //KAB_EMBEDDED 160#endif //KAB_EMBEDDED
161 161
162 connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 162 connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
163 connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 163 connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
164 connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 164 connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
165 connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 165 connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
166 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 166 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
167 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 167 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
168 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 168 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
169 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 169 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
170 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 170 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
171 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 171 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
172 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) ); 172 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) );
173 connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 173 connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
174 174
175 updateTypeCombo(); 175 updateTypeCombo();
176 mFormattedNameCombo->setCurrentItem( type ); 176 mFormattedNameCombo->setCurrentItem( type );
177 177
178 178
179 mChanged = false; 179 mChanged = false;
180} 180}
181 181
182NameEditDialog::~NameEditDialog() 182NameEditDialog::~NameEditDialog()
183{ 183{
184} 184}
185 185
186QString NameEditDialog::familyName() const 186QString NameEditDialog::familyName() const
187{ 187{
188 return mFamilyNameEdit->text(); 188 return mFamilyNameEdit->text();
189} 189}
190 190
191QString NameEditDialog::givenName() const 191QString NameEditDialog::givenName() const
192{ 192{
193 return mGivenNameEdit->text(); 193 return mGivenNameEdit->text();
194} 194}
195 195
196QString NameEditDialog::prefix() const 196QString NameEditDialog::prefix() const
197{ 197{
198 return mPrefixCombo->currentText(); 198 return mPrefixCombo->currentText();
199} 199}
200 200
201QString NameEditDialog::suffix() const 201QString NameEditDialog::suffix() const
202{ 202{
203 return mSuffixCombo->currentText(); 203 return mSuffixCombo->currentText();
204} 204}
205 205
206QString NameEditDialog::additionalName() const 206QString NameEditDialog::additionalName() const
207{ 207{
208 return mAdditionalNameEdit->text(); 208 return mAdditionalNameEdit->text();
209} 209}
210 210
211QString NameEditDialog::customFormattedName() const 211QString NameEditDialog::customFormattedName() const
212{ 212{
213 return mFormattedNameEdit->text(); 213 return mFormattedNameEdit->text();
214} 214}
215 215
216int NameEditDialog::formattedNameType() const 216int NameEditDialog::formattedNameType() const
217{ 217{
218 return mFormattedNameCombo->currentItem(); 218 return mFormattedNameCombo->currentItem();
219} 219}
220 220
221bool NameEditDialog::changed() const 221bool NameEditDialog::changed() const
222{ 222{
223 return mChanged; 223 return mChanged;
224} 224}
225 225
226QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type ) 226QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type )
227{ 227{
228 QString retval;
228 switch ( type ) { 229 switch ( type ) {
229 case SimpleName: 230 case SimpleName:
230 return addr.givenName() + " " + addr.familyName(); 231 retval = addr.givenName() + " " + addr.familyName();
231 break; 232 break;
232 case FullName: 233 case FullName:
233 return addr.prefix() + " " + addr.givenName() + " " + 234 retval =addr.prefix() + " " + addr.givenName() + " " +
234 addr.additionalName() + " " + addr.familyName() + " " + 235 addr.additionalName() + " " + addr.familyName() + " " +
235 addr.suffix(); 236 addr.suffix();
236 break; 237 break;
237 case ReverseName: 238 case ReverseName:
238 return addr.familyName() + ", " + addr.givenName(); 239 retval = addr.familyName() + ", " + addr.givenName();
239 break; 240 break;
240 default: 241 default:
241 return ""; 242 return "";
242 break; 243 break;
243 } 244 }
245 return retval.stripWhiteSpace ();
244} 246}
245 247
246void NameEditDialog::parseBoxChanged( bool value ) 248void NameEditDialog::parseBoxChanged( bool value )
247{ 249{
248 //AddresseeConfig::instance()->setUid( addr.uid() ); 250 //AddresseeConfig::instance()->setUid( addr.uid() );
249 AddresseeConfig::instance()->setAutomaticNameParsing( value ); 251 AddresseeConfig::instance()->setAutomaticNameParsing( value );
250} 252}
251 253
252void NameEditDialog::typeChanged( int pos ) 254void NameEditDialog::typeChanged( int pos )
253{ 255{
254 mFormattedNameEdit->setEnabled( pos == 0 ); 256 mFormattedNameEdit->setEnabled( pos == 0 );
255} 257}
256 258
257void NameEditDialog::modified() 259void NameEditDialog::modified()
258{ 260{
259 mChanged = true; 261 mChanged = true;
260} 262}
261 263
262void NameEditDialog::updateTypeCombo() 264void NameEditDialog::updateTypeCombo()
263{ 265{
264 KABC::Addressee addr; 266 KABC::Addressee addr;
265 addr.setPrefix( mPrefixCombo->currentText() ); 267 addr.setPrefix( mPrefixCombo->currentText() );
266 addr.setGivenName( mGivenNameEdit->text() ); 268 addr.setGivenName( mGivenNameEdit->text() );
267 addr.setAdditionalName( mAdditionalNameEdit->text() ); 269 addr.setAdditionalName( mAdditionalNameEdit->text() );
268 addr.setFamilyName( mFamilyNameEdit->text() ); 270 addr.setFamilyName( mFamilyNameEdit->text() );
269 addr.setSuffix( mSuffixCombo->currentText() ); 271 addr.setSuffix( mSuffixCombo->currentText() );
270 272
271 int pos = mFormattedNameCombo->currentItem(); 273 int pos = mFormattedNameCombo->currentItem();
272 274
273 mFormattedNameCombo->clear(); 275 mFormattedNameCombo->clear();
274 mFormattedNameCombo->insertItem( i18n( "Custom" ) ); 276 mFormattedNameCombo->insertItem( i18n( "Custom" ) );
275 mFormattedNameCombo->insertItem( formattedName( addr, SimpleName ) ); 277 mFormattedNameCombo->insertItem( formattedName( addr, SimpleName ) );
276 mFormattedNameCombo->insertItem( formattedName( addr, FullName ) ); 278 mFormattedNameCombo->insertItem( formattedName( addr, FullName ) );
277 mFormattedNameCombo->insertItem( formattedName( addr, ReverseName ) ); 279 mFormattedNameCombo->insertItem( formattedName( addr, ReverseName ) );
278 280
279 mFormattedNameCombo->setCurrentItem( pos ); 281 mFormattedNameCombo->setCurrentItem( pos );
280} 282}
281 283
282void NameEditDialog::slotHelp() 284void NameEditDialog::slotHelp()
283{ 285{
284#ifndef KAB_EMBEDDED 286#ifndef KAB_EMBEDDED
285 kapp->invokeHelp( "managing-contacts-automatic-nameparsing" ); 287 kapp->invokeHelp( "managing-contacts-automatic-nameparsing" );
286#else //KAB_EMBEDDED 288#else //KAB_EMBEDDED
287qDebug("NameEditDialog::slotHelp Help is not supported yet"); 289qDebug("NameEditDialog::slotHelp Help is not supported yet");
288#endif //KAB_EMBEDDED 290#endif //KAB_EMBEDDED
289} 291}
290 292
291#ifndef KAB_EMBEDDED 293#ifndef KAB_EMBEDDED
292#include "nameeditdialog.moc" 294#include "nameeditdialog.moc"
293#endif //KAB_EMBEDDED 295#endif //KAB_EMBEDDED