summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp32
-rw-r--r--kaddressbook/kabcore.h4
2 files changed, 35 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index a0fec91..7e3fc7c 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -761,842 +761,872 @@ void KABCore::contactModified( const KABC::Addressee &addr )
761 command = new PwEditCommand( mAddressBook, origAddr, addr ); 761 command = new PwEditCommand( mAddressBook, origAddr, addr );
762 uid = addr.uid(); 762 uid = addr.uid();
763 } 763 }
764 764
765 UndoStack::instance()->push( command ); 765 UndoStack::instance()->push( command );
766 RedoStack::instance()->clear(); 766 RedoStack::instance()->clear();
767 767
768 setModified( true ); 768 setModified( true );
769} 769}
770 770
771void KABCore::newContact() 771void KABCore::newContact()
772{ 772{
773 773
774 774
775 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 775 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
776 776
777 QPtrList<KRES::Resource> kresResources; 777 QPtrList<KRES::Resource> kresResources;
778 QPtrListIterator<KABC::Resource> it( kabcResources ); 778 QPtrListIterator<KABC::Resource> it( kabcResources );
779 KABC::Resource *resource; 779 KABC::Resource *resource;
780 while ( ( resource = it.current() ) != 0 ) { 780 while ( ( resource = it.current() ) != 0 ) {
781 ++it; 781 ++it;
782 if ( !resource->readOnly() ) { 782 if ( !resource->readOnly() ) {
783 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 783 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
784 if ( res ) 784 if ( res )
785 kresResources.append( res ); 785 kresResources.append( res );
786 } 786 }
787 } 787 }
788 788
789 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 789 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
790 resource = static_cast<KABC::Resource*>( res ); 790 resource = static_cast<KABC::Resource*>( res );
791 791
792 if ( resource ) { 792 if ( resource ) {
793 KABC::Addressee addr; 793 KABC::Addressee addr;
794 addr.setResource( resource ); 794 addr.setResource( resource );
795 mEditorDialog->setAddressee( addr ); 795 mEditorDialog->setAddressee( addr );
796 KApplication::execDialog ( mEditorDialog ); 796 KApplication::execDialog ( mEditorDialog );
797 797
798 } else 798 } else
799 return; 799 return;
800 800
801 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 801 // mEditorDict.insert( dialog->addressee().uid(), dialog );
802 802
803 803
804} 804}
805 805
806void KABCore::addEmail( QString aStr ) 806void KABCore::addEmail( QString aStr )
807{ 807{
808#ifndef KAB_EMBEDDED 808#ifndef KAB_EMBEDDED
809 QString fullName, email; 809 QString fullName, email;
810 810
811 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 811 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
812 812
813 // Try to lookup the addressee matching the email address 813 // Try to lookup the addressee matching the email address
814 bool found = false; 814 bool found = false;
815 QStringList emailList; 815 QStringList emailList;
816 KABC::AddressBook::Iterator it; 816 KABC::AddressBook::Iterator it;
817 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 817 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
818 emailList = (*it).emails(); 818 emailList = (*it).emails();
819 if ( emailList.contains( email ) > 0 ) { 819 if ( emailList.contains( email ) > 0 ) {
820 found = true; 820 found = true;
821 (*it).setNameFromString( fullName ); 821 (*it).setNameFromString( fullName );
822 editContact( (*it).uid() ); 822 editContact( (*it).uid() );
823 } 823 }
824 } 824 }
825 825
826 if ( !found ) { 826 if ( !found ) {
827 KABC::Addressee addr; 827 KABC::Addressee addr;
828 addr.setNameFromString( fullName ); 828 addr.setNameFromString( fullName );
829 addr.insertEmail( email, true ); 829 addr.insertEmail( email, true );
830 830
831 mAddressBook->insertAddressee( addr ); 831 mAddressBook->insertAddressee( addr );
832 mViewManager->refreshView( addr.uid() ); 832 mViewManager->refreshView( addr.uid() );
833 editContact( addr.uid() ); 833 editContact( addr.uid() );
834 } 834 }
835#else //KAB_EMBEDDED 835#else //KAB_EMBEDDED
836 qDebug("KABCore::addEmail finsih method"); 836 qDebug("KABCore::addEmail finsih method");
837#endif //KAB_EMBEDDED 837#endif //KAB_EMBEDDED
838} 838}
839 839
840void KABCore::importVCard( const KURL &url, bool showPreview ) 840void KABCore::importVCard( const KURL &url, bool showPreview )
841{ 841{
842 mXXPortManager->importVCard( url, showPreview ); 842 mXXPortManager->importVCard( url, showPreview );
843} 843}
844 844
845void KABCore::importVCard( const QString &vCard, bool showPreview ) 845void KABCore::importVCard( const QString &vCard, bool showPreview )
846{ 846{
847 mXXPortManager->importVCard( vCard, showPreview ); 847 mXXPortManager->importVCard( vCard, showPreview );
848} 848}
849 849
850//US added a second method without defaultparameter 850//US added a second method without defaultparameter
851void KABCore::editContact2() { 851void KABCore::editContact2() {
852 editContact( QString::null ); 852 editContact( QString::null );
853} 853}
854 854
855void KABCore::editContact( const QString &uid ) 855void KABCore::editContact( const QString &uid )
856{ 856{
857 857
858 if ( mExtensionManager->isQuickEditVisible() ) 858 if ( mExtensionManager->isQuickEditVisible() )
859 return; 859 return;
860 860
861 // First, locate the contact entry 861 // First, locate the contact entry
862 QString localUID = uid; 862 QString localUID = uid;
863 if ( localUID.isNull() ) { 863 if ( localUID.isNull() ) {
864 QStringList uidList = mViewManager->selectedUids(); 864 QStringList uidList = mViewManager->selectedUids();
865 if ( uidList.count() > 0 ) 865 if ( uidList.count() > 0 )
866 localUID = *( uidList.at( 0 ) ); 866 localUID = *( uidList.at( 0 ) );
867 } 867 }
868 868
869 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 869 KABC::Addressee addr = mAddressBook->findByUid( localUID );
870 if ( !addr.isEmpty() ) { 870 if ( !addr.isEmpty() ) {
871 mEditorDialog->setAddressee( addr ); 871 mEditorDialog->setAddressee( addr );
872 KApplication::execDialog ( mEditorDialog ); 872 KApplication::execDialog ( mEditorDialog );
873 } 873 }
874} 874}
875 875
876void KABCore::save() 876void KABCore::save()
877{ 877{
878 if ( !mModified ) 878 if ( !mModified )
879 return; 879 return;
880 QString text = i18n( "There was an error while attempting to save\n the " 880 QString text = i18n( "There was an error while attempting to save\n the "
881 "address book. Please check that some \nother application is " 881 "address book. Please check that some \nother application is "
882 "not using it. " ); 882 "not using it. " );
883 statusMessage(i18n("Saving addressbook ... ")); 883 statusMessage(i18n("Saving addressbook ... "));
884#ifndef KAB_EMBEDDED 884#ifndef KAB_EMBEDDED
885 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 885 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
886 if ( !b || !b->save() ) { 886 if ( !b || !b->save() ) {
887 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 887 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
888 } 888 }
889#else //KAB_EMBEDDED 889#else //KAB_EMBEDDED
890 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 890 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
891 if ( !b || !b->save() ) { 891 if ( !b || !b->save() ) {
892 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 892 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
893 } 893 }
894#endif //KAB_EMBEDDED 894#endif //KAB_EMBEDDED
895 895
896 statusMessage(i18n("Addressbook saved!")); 896 statusMessage(i18n("Addressbook saved!"));
897 setModified( false ); 897 setModified( false );
898} 898}
899 899
900void KABCore::statusMessage(QString mess , int time ) 900void KABCore::statusMessage(QString mess , int time )
901{ 901{
902 //topLevelWidget()->setCaption( mess ); 902 //topLevelWidget()->setCaption( mess );
903 // pending setting timer to revome message 903 // pending setting timer to revome message
904} 904}
905void KABCore::undo() 905void KABCore::undo()
906{ 906{
907 UndoStack::instance()->undo(); 907 UndoStack::instance()->undo();
908 908
909 // Refresh the view 909 // Refresh the view
910 mViewManager->refreshView(); 910 mViewManager->refreshView();
911} 911}
912 912
913void KABCore::redo() 913void KABCore::redo()
914{ 914{
915 RedoStack::instance()->redo(); 915 RedoStack::instance()->redo();
916 916
917 // Refresh the view 917 // Refresh the view
918 mViewManager->refreshView(); 918 mViewManager->refreshView();
919} 919}
920 920
921void KABCore::setJumpButtonBarVisible( bool visible ) 921void KABCore::setJumpButtonBarVisible( bool visible )
922{ 922{
923 if ( visible ) 923 if ( visible )
924 mJumpButtonBar->show(); 924 mJumpButtonBar->show();
925 else 925 else
926 mJumpButtonBar->hide(); 926 mJumpButtonBar->hide();
927} 927}
928void KABCore::setDetailsToState() 928void KABCore::setDetailsToState()
929{ 929{
930 setDetailsVisible( mActionDetails->isChecked() ); 930 setDetailsVisible( mActionDetails->isChecked() );
931} 931}
932 932
933void KABCore::setDetailsVisible( bool visible ) 933void KABCore::setDetailsVisible( bool visible )
934{ 934{
935 if ( visible ) 935 if ( visible )
936 mDetails->show(); 936 mDetails->show();
937 else 937 else
938 mDetails->hide(); 938 mDetails->hide();
939} 939}
940 940
941void KABCore::extensionModified( const KABC::Addressee::List &list ) 941void KABCore::extensionModified( const KABC::Addressee::List &list )
942{ 942{
943 943
944 if ( list.count() != 0 ) { 944 if ( list.count() != 0 ) {
945 KABC::Addressee::List::ConstIterator it; 945 KABC::Addressee::List::ConstIterator it;
946 for ( it = list.begin(); it != list.end(); ++it ) 946 for ( it = list.begin(); it != list.end(); ++it )
947 mAddressBook->insertAddressee( *it ); 947 mAddressBook->insertAddressee( *it );
948 if ( list.count() > 1 ) 948 if ( list.count() > 1 )
949 setModified(); 949 setModified();
950 else 950 else
951 setModifiedWOrefresh(); 951 setModifiedWOrefresh();
952 } 952 }
953 if ( list.count() == 0 ) 953 if ( list.count() == 0 )
954 mViewManager->refreshView(); 954 mViewManager->refreshView();
955 else 955 else
956 mViewManager->refreshView( list[ 0 ].uid() ); 956 mViewManager->refreshView( list[ 0 ].uid() );
957 957
958 958
959 959
960} 960}
961 961
962QString KABCore::getNameByPhone( const QString &phone ) 962QString KABCore::getNameByPhone( const QString &phone )
963{ 963{
964#ifndef KAB_EMBEDDED 964#ifndef KAB_EMBEDDED
965 QRegExp r( "[/*/-/ ]" ); 965 QRegExp r( "[/*/-/ ]" );
966 QString localPhone( phone ); 966 QString localPhone( phone );
967 967
968 bool found = false; 968 bool found = false;
969 QString ownerName = ""; 969 QString ownerName = "";
970 KABC::AddressBook::Iterator iter; 970 KABC::AddressBook::Iterator iter;
971 KABC::PhoneNumber::List::Iterator phoneIter; 971 KABC::PhoneNumber::List::Iterator phoneIter;
972 KABC::PhoneNumber::List phoneList; 972 KABC::PhoneNumber::List phoneList;
973 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 973 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
974 phoneList = (*iter).phoneNumbers(); 974 phoneList = (*iter).phoneNumbers();
975 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 975 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
976 ++phoneIter) { 976 ++phoneIter) {
977 // Get rid of separator chars so just the numbers are compared. 977 // Get rid of separator chars so just the numbers are compared.
978 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 978 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
979 ownerName = (*iter).formattedName(); 979 ownerName = (*iter).formattedName();
980 found = true; 980 found = true;
981 } 981 }
982 } 982 }
983 } 983 }
984 984
985 return ownerName; 985 return ownerName;
986#else //KAB_EMBEDDED 986#else //KAB_EMBEDDED
987 qDebug("KABCore::getNameByPhone finsih method"); 987 qDebug("KABCore::getNameByPhone finsih method");
988 return ""; 988 return "";
989#endif //KAB_EMBEDDED 989#endif //KAB_EMBEDDED
990 990
991} 991}
992 992
993void KABCore::openConfigDialog() 993void KABCore::openConfigDialog()
994{ 994{
995 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 995 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
996 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 996 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
997 ConfigureDialog->addModule(kabcfg ); 997 ConfigureDialog->addModule(kabcfg );
998 connect( ConfigureDialog, SIGNAL( applyClicked() ), 998 connect( ConfigureDialog, SIGNAL( applyClicked() ),
999 this, SLOT( configurationChanged() ) ); 999 this, SLOT( configurationChanged() ) );
1000 connect( ConfigureDialog, SIGNAL( okClicked() ), 1000 connect( ConfigureDialog, SIGNAL( okClicked() ),
1001 this, SLOT( configurationChanged() ) ); 1001 this, SLOT( configurationChanged() ) );
1002 saveSettings(); 1002 saveSettings();
1003 ConfigureDialog->showMaximized(); 1003 ConfigureDialog->showMaximized();
1004 if ( ConfigureDialog->exec() ) 1004 if ( ConfigureDialog->exec() )
1005 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); 1005 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") );
1006 delete ConfigureDialog; 1006 delete ConfigureDialog;
1007} 1007}
1008 1008
1009void KABCore::openLDAPDialog() 1009void KABCore::openLDAPDialog()
1010{ 1010{
1011#ifndef KAB_EMBEDDED 1011#ifndef KAB_EMBEDDED
1012 if ( !mLdapSearchDialog ) { 1012 if ( !mLdapSearchDialog ) {
1013 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1013 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1014 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1014 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1015 SLOT( refreshView() ) ); 1015 SLOT( refreshView() ) );
1016 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1016 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1017 SLOT( setModified() ) ); 1017 SLOT( setModified() ) );
1018 } else 1018 } else
1019 mLdapSearchDialog->restoreSettings(); 1019 mLdapSearchDialog->restoreSettings();
1020 1020
1021 if ( mLdapSearchDialog->isOK() ) 1021 if ( mLdapSearchDialog->isOK() )
1022 mLdapSearchDialog->exec(); 1022 mLdapSearchDialog->exec();
1023#else //KAB_EMBEDDED 1023#else //KAB_EMBEDDED
1024 qDebug("KABCore::openLDAPDialog() finsih method"); 1024 qDebug("KABCore::openLDAPDialog() finsih method");
1025#endif //KAB_EMBEDDED 1025#endif //KAB_EMBEDDED
1026} 1026}
1027 1027
1028void KABCore::print() 1028void KABCore::print()
1029{ 1029{
1030#ifndef KAB_EMBEDDED 1030#ifndef KAB_EMBEDDED
1031 KPrinter printer; 1031 KPrinter printer;
1032 if ( !printer.setup( this ) ) 1032 if ( !printer.setup( this ) )
1033 return; 1033 return;
1034 1034
1035 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1035 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1036 mViewManager->selectedUids(), this ); 1036 mViewManager->selectedUids(), this );
1037 1037
1038 wizard.exec(); 1038 wizard.exec();
1039#else //KAB_EMBEDDED 1039#else //KAB_EMBEDDED
1040 qDebug("KABCore::print() finsih method"); 1040 qDebug("KABCore::print() finsih method");
1041#endif //KAB_EMBEDDED 1041#endif //KAB_EMBEDDED
1042 1042
1043} 1043}
1044 1044
1045 1045
1046void KABCore::addGUIClient( KXMLGUIClient *client ) 1046void KABCore::addGUIClient( KXMLGUIClient *client )
1047{ 1047{
1048 if ( mGUIClient ) 1048 if ( mGUIClient )
1049 mGUIClient->insertChildClient( client ); 1049 mGUIClient->insertChildClient( client );
1050 else 1050 else
1051 KMessageBox::error( this, "no KXMLGUICLient"); 1051 KMessageBox::error( this, "no KXMLGUICLient");
1052} 1052}
1053 1053
1054 1054
1055void KABCore::configurationChanged() 1055void KABCore::configurationChanged()
1056{ 1056{
1057 mExtensionManager->reconfigure(); 1057 mExtensionManager->reconfigure();
1058} 1058}
1059 1059
1060void KABCore::addressBookChanged() 1060void KABCore::addressBookChanged()
1061{ 1061{
1062#ifndef KAB_EMBEDDED 1062#ifndef KAB_EMBEDDED
1063 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1063 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1064 while ( it.current() ) { 1064 while ( it.current() ) {
1065 if ( it.current()->dirty() ) { 1065 if ( it.current()->dirty() ) {
1066 QString text = i18n( "Data has been changed externally. Unsaved " 1066 QString text = i18n( "Data has been changed externally. Unsaved "
1067 "changes will be lost." ); 1067 "changes will be lost." );
1068 KMessageBox::information( this, text ); 1068 KMessageBox::information( this, text );
1069 } 1069 }
1070 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1070 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1071 ++it; 1071 ++it;
1072 } 1072 }
1073 1073
1074 mViewManager->refreshView(); 1074 mViewManager->refreshView();
1075#else //KAB_EMBEDDED 1075#else //KAB_EMBEDDED
1076 qDebug("KABCore::addressBookChanged() finsih method"); 1076 qDebug("KABCore::addressBookChanged() finsih method");
1077#endif //KAB_EMBEDDED 1077#endif //KAB_EMBEDDED
1078} 1078}
1079 1079
1080AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1080AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1081 const char *name ) 1081 const char *name )
1082{ 1082{
1083 1083
1084 if ( mEditorDialog == 0 ) { 1084 if ( mEditorDialog == 0 ) {
1085 mEditorDialog = new AddresseeEditorDialog( this, parent, 1085 mEditorDialog = new AddresseeEditorDialog( this, parent,
1086 name ? name : "editorDialog" ); 1086 name ? name : "editorDialog" );
1087 1087
1088 1088
1089 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1089 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1090 SLOT( contactModified( const KABC::Addressee& ) ) ); 1090 SLOT( contactModified( const KABC::Addressee& ) ) );
1091 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1091 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1092 // SLOT( slotEditorDestroyed( const QString& ) ) ); 1092 // SLOT( slotEditorDestroyed( const QString& ) ) );
1093 } 1093 }
1094 1094
1095 return mEditorDialog; 1095 return mEditorDialog;
1096} 1096}
1097 1097
1098void KABCore::slotEditorDestroyed( const QString &uid ) 1098void KABCore::slotEditorDestroyed( const QString &uid )
1099{ 1099{
1100 qDebug("KABCore::slotEditorDestroyed called. maybe a problem! "); 1100 qDebug("KABCore::slotEditorDestroyed called. maybe a problem! ");
1101 //mEditorDict.remove( uid ); 1101 //mEditorDict.remove( uid );
1102} 1102}
1103 1103
1104void KABCore::initGUI() 1104void KABCore::initGUI()
1105{ 1105{
1106#ifndef KAB_EMBEDDED 1106#ifndef KAB_EMBEDDED
1107 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1107 QHBoxLayout *topLayout = new QHBoxLayout( this );
1108 topLayout->setSpacing( KDialogBase::spacingHint() ); 1108 topLayout->setSpacing( KDialogBase::spacingHint() );
1109 1109
1110 mExtensionBarSplitter = new QSplitter( this ); 1110 mExtensionBarSplitter = new QSplitter( this );
1111 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1111 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1112 1112
1113 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1113 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1114 1114
1115 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1115 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1116 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1116 mIncSearchWidget = new IncSearchWidget( viewSpace );
1117 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1117 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1118 SLOT( incrementalSearch( const QString& ) ) ); 1118 SLOT( incrementalSearch( const QString& ) ) );
1119 1119
1120 mViewManager = new ViewManager( this, viewSpace ); 1120 mViewManager = new ViewManager( this, viewSpace );
1121 viewSpace->setStretchFactor( mViewManager, 1 ); 1121 viewSpace->setStretchFactor( mViewManager, 1 );
1122 1122
1123 mDetails = new ViewContainer( mDetailsSplitter ); 1123 mDetails = new ViewContainer( mDetailsSplitter );
1124 1124
1125 mJumpButtonBar = new JumpButtonBar( this, this ); 1125 mJumpButtonBar = new JumpButtonBar( this, this );
1126 1126
1127 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1127 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1128 1128
1129 topLayout->addWidget( mExtensionBarSplitter ); 1129 topLayout->addWidget( mExtensionBarSplitter );
1130 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1130 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1131 topLayout->addWidget( mJumpButtonBar ); 1131 topLayout->addWidget( mJumpButtonBar );
1132 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1132 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1133 1133
1134 mXXPortManager = new XXPortManager( this, this ); 1134 mXXPortManager = new XXPortManager( this, this );
1135 1135
1136#else //KAB_EMBEDDED 1136#else //KAB_EMBEDDED
1137 //US initialize viewMenu before settingup viewmanager. 1137 //US initialize viewMenu before settingup viewmanager.
1138 // Viewmanager needs this menu to plugin submenues. 1138 // Viewmanager needs this menu to plugin submenues.
1139 viewMenu = new QPopupMenu( this ); 1139 viewMenu = new QPopupMenu( this );
1140 settingsMenu = new QPopupMenu( this ); 1140 settingsMenu = new QPopupMenu( this );
1141 //filterMenu = new QPopupMenu( this ); 1141 //filterMenu = new QPopupMenu( this );
1142 ImportMenu = new QPopupMenu( this ); 1142 ImportMenu = new QPopupMenu( this );
1143 ExportMenu = new QPopupMenu( this ); 1143 ExportMenu = new QPopupMenu( this );
1144 1144
1145 changeMenu= new QPopupMenu( this );
1145 1146
1146//US since we have no splitter for the embedded system, setup 1147//US since we have no splitter for the embedded system, setup
1147// a layout with two frames. One left and one right. 1148// a layout with two frames. One left and one right.
1148 1149
1149 QBoxLayout *topLayout; 1150 QBoxLayout *topLayout;
1150 1151
1151 // = new QHBoxLayout( this ); 1152 // = new QHBoxLayout( this );
1152// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1153// QBoxLayout *topLayout = (QBoxLayout*)layout();
1153 1154
1154// QWidget *mainBox = new QWidget( this ); 1155// QWidget *mainBox = new QWidget( this );
1155// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1156// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1156 1157
1157#ifdef DESKTOP_VERSION 1158#ifdef DESKTOP_VERSION
1158 topLayout = new QHBoxLayout( this ); 1159 topLayout = new QHBoxLayout( this );
1159 1160
1160 1161
1161 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1162 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1162 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1163 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1163 1164
1164 topLayout->addWidget(mMiniSplitter ); 1165 topLayout->addWidget(mMiniSplitter );
1165 1166
1166 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1167 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1167 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1168 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1168 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1169 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1169 mDetails = new ViewContainer( mMiniSplitter ); 1170 mDetails = new ViewContainer( mMiniSplitter );
1170 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1171 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1171#else 1172#else
1172 if ( QApplication::desktop()->width() > 480 ) { 1173 if ( QApplication::desktop()->width() > 480 ) {
1173 topLayout = new QHBoxLayout( this ); 1174 topLayout = new QHBoxLayout( this );
1174 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1175 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1175 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1176 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1176 } else { 1177 } else {
1177 1178
1178 topLayout = new QHBoxLayout( this ); 1179 topLayout = new QHBoxLayout( this );
1179 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1180 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1180 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1181 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1181 } 1182 }
1182 1183
1183 topLayout->addWidget(mMiniSplitter ); 1184 topLayout->addWidget(mMiniSplitter );
1184 mViewManager = new ViewManager( this, mMiniSplitter ); 1185 mViewManager = new ViewManager( this, mMiniSplitter );
1185 mDetails = new ViewContainer( mMiniSplitter ); 1186 mDetails = new ViewContainer( mMiniSplitter );
1186 1187
1187 1188
1188 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1189 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1189#endif 1190#endif
1190 //eh->hide(); 1191 //eh->hide();
1191 // topLayout->addWidget(mExtensionManager ); 1192 // topLayout->addWidget(mExtensionManager );
1192 1193
1193 1194
1194/*US 1195/*US
1195#ifndef KAB_NOSPLITTER 1196#ifndef KAB_NOSPLITTER
1196 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1197 QHBoxLayout *topLayout = new QHBoxLayout( this );
1197//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1198//US topLayout->setSpacing( KDialogBase::spacingHint() );
1198 topLayout->setSpacing( 10 ); 1199 topLayout->setSpacing( 10 );
1199 1200
1200 mDetailsSplitter = new QSplitter( this ); 1201 mDetailsSplitter = new QSplitter( this );
1201 1202
1202 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1203 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1203 1204
1204 mViewManager = new ViewManager( this, viewSpace ); 1205 mViewManager = new ViewManager( this, viewSpace );
1205 viewSpace->setStretchFactor( mViewManager, 1 ); 1206 viewSpace->setStretchFactor( mViewManager, 1 );
1206 1207
1207 mDetails = new ViewContainer( mDetailsSplitter ); 1208 mDetails = new ViewContainer( mDetailsSplitter );
1208 1209
1209 topLayout->addWidget( mDetailsSplitter ); 1210 topLayout->addWidget( mDetailsSplitter );
1210 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1211 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1211#else //KAB_NOSPLITTER 1212#else //KAB_NOSPLITTER
1212 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1213 QHBoxLayout *topLayout = new QHBoxLayout( this );
1213//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1214//US topLayout->setSpacing( KDialogBase::spacingHint() );
1214 topLayout->setSpacing( 10 ); 1215 topLayout->setSpacing( 10 );
1215 1216
1216// mDetailsSplitter = new QSplitter( this ); 1217// mDetailsSplitter = new QSplitter( this );
1217 1218
1218 QVBox *viewSpace = new QVBox( this ); 1219 QVBox *viewSpace = new QVBox( this );
1219 1220
1220 mViewManager = new ViewManager( this, viewSpace ); 1221 mViewManager = new ViewManager( this, viewSpace );
1221 viewSpace->setStretchFactor( mViewManager, 1 ); 1222 viewSpace->setStretchFactor( mViewManager, 1 );
1222 1223
1223 mDetails = new ViewContainer( this ); 1224 mDetails = new ViewContainer( this );
1224 1225
1225 topLayout->addWidget( viewSpace ); 1226 topLayout->addWidget( viewSpace );
1226// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1227// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1227 topLayout->addWidget( mDetails ); 1228 topLayout->addWidget( mDetails );
1228#endif //KAB_NOSPLITTER 1229#endif //KAB_NOSPLITTER
1229*/ 1230*/
1230 1231
1231 1232
1232#endif //KAB_EMBEDDED 1233#endif //KAB_EMBEDDED
1233 initActions(); 1234 initActions();
1234 1235
1235#ifdef KAB_EMBEDDED 1236#ifdef KAB_EMBEDDED
1236 addActionsManually(); 1237 addActionsManually();
1237 //US make sure the export and import menues are initialized before creating the xxPortManager. 1238 //US make sure the export and import menues are initialized before creating the xxPortManager.
1238 mXXPortManager = new XXPortManager( this, this ); 1239 mXXPortManager = new XXPortManager( this, this );
1239 1240
1240 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1241 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1241 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1242 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1242 // mActionQuit->plug ( mMainWindow->toolBar()); 1243 // mActionQuit->plug ( mMainWindow->toolBar());
1243 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1244 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1244 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1245 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1245 // mIncSearchWidget->hide(); 1246 // mIncSearchWidget->hide();
1246 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1247 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1247 SLOT( incrementalSearch( const QString& ) ) ); 1248 SLOT( incrementalSearch( const QString& ) ) );
1248 1249
1249 1250
1250 mJumpButtonBar = new JumpButtonBar( this, this ); 1251 mJumpButtonBar = new JumpButtonBar( this, this );
1251 1252
1252 topLayout->addWidget( mJumpButtonBar ); 1253 topLayout->addWidget( mJumpButtonBar );
1253//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1254//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1254 1255
1255// mMainWindow->getIconToolBar()->raise(); 1256// mMainWindow->getIconToolBar()->raise();
1256 1257
1257#endif //KAB_EMBEDDED 1258#endif //KAB_EMBEDDED
1258 1259
1259} 1260}
1260void KABCore::initActions() 1261void KABCore::initActions()
1261{ 1262{
1262//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1263//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1263 1264
1264#ifndef KAB_EMBEDDED 1265#ifndef KAB_EMBEDDED
1265 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1266 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1266 SLOT( clipboardDataChanged() ) ); 1267 SLOT( clipboardDataChanged() ) );
1267#endif //KAB_EMBEDDED 1268#endif //KAB_EMBEDDED
1268 1269
1269 // file menu 1270 // file menu
1270 if ( mIsPart ) { 1271 if ( mIsPart ) {
1271 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1272 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1272 SLOT( sendMail() ), actionCollection(), 1273 SLOT( sendMail() ), actionCollection(),
1273 "kaddressbook_mail" ); 1274 "kaddressbook_mail" );
1274 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1275 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1275 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1276 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1276 1277
1277 } else { 1278 } else {
1278 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1279 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1279 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1280 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1280 } 1281 }
1281 1282
1282 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1283 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1283 SLOT( save() ), actionCollection(), "file_sync" ); 1284 SLOT( save() ), actionCollection(), "file_sync" );
1284 1285
1285 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1286 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1286 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1287 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1287 1288
1288 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1289 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1289 this, SLOT( mailVCard() ), 1290 this, SLOT( mailVCard() ),
1290 actionCollection(), "file_mail_vcard"); 1291 actionCollection(), "file_mail_vcard");
1291 1292
1292 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1293 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1293 this, SLOT( editContact2() ), 1294 this, SLOT( editContact2() ),
1294 actionCollection(), "file_properties" ); 1295 actionCollection(), "file_properties" );
1295 1296
1296#ifdef KAB_EMBEDDED 1297#ifdef KAB_EMBEDDED
1297 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1298 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1298 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1299 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1299 mMainWindow, SLOT( exit() ), 1300 mMainWindow, SLOT( exit() ),
1300 actionCollection(), "quit" ); 1301 actionCollection(), "quit" );
1301#endif //KAB_EMBEDDED 1302#endif //KAB_EMBEDDED
1302 1303
1303 // edit menu 1304 // edit menu
1304 if ( mIsPart ) { 1305 if ( mIsPart ) {
1305 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1306 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1306 SLOT( copyContacts() ), actionCollection(), 1307 SLOT( copyContacts() ), actionCollection(),
1307 "kaddressbook_copy" ); 1308 "kaddressbook_copy" );
1308 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1309 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1309 SLOT( cutContacts() ), actionCollection(), 1310 SLOT( cutContacts() ), actionCollection(),
1310 "kaddressbook_cut" ); 1311 "kaddressbook_cut" );
1311 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1312 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1312 SLOT( pasteContacts() ), actionCollection(), 1313 SLOT( pasteContacts() ), actionCollection(),
1313 "kaddressbook_paste" ); 1314 "kaddressbook_paste" );
1314 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1315 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1315 SLOT( selectAllContacts() ), actionCollection(), 1316 SLOT( selectAllContacts() ), actionCollection(),
1316 "kaddressbook_select_all" ); 1317 "kaddressbook_select_all" );
1317 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1318 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1318 SLOT( undo() ), actionCollection(), 1319 SLOT( undo() ), actionCollection(),
1319 "kaddressbook_undo" ); 1320 "kaddressbook_undo" );
1320 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1321 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1321 this, SLOT( redo() ), actionCollection(), 1322 this, SLOT( redo() ), actionCollection(),
1322 "kaddressbook_redo" ); 1323 "kaddressbook_redo" );
1323 } else { 1324 } else {
1324 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1325 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1325 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1326 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1326 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1327 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1327 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1328 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1328 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1329 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1329 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1330 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1330 } 1331 }
1331 1332
1332 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1333 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1333 Key_Delete, this, SLOT( deleteContacts() ), 1334 Key_Delete, this, SLOT( deleteContacts() ),
1334 actionCollection(), "edit_delete" ); 1335 actionCollection(), "edit_delete" );
1335 1336
1336 mActionUndo->setEnabled( false ); 1337 mActionUndo->setEnabled( false );
1337 mActionRedo->setEnabled( false ); 1338 mActionRedo->setEnabled( false );
1338 1339
1339 // settings menu 1340 // settings menu
1340#ifdef KAB_EMBEDDED 1341#ifdef KAB_EMBEDDED
1341//US special menuentry to configure the addressbook resources. On KDE 1342//US special menuentry to configure the addressbook resources. On KDE
1342// you do that through the control center !!! 1343// you do that through the control center !!!
1343 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1344 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1344 SLOT( configureResources() ), actionCollection(), 1345 SLOT( configureResources() ), actionCollection(),
1345 "kaddressbook_configure_resources" ); 1346 "kaddressbook_configure_resources" );
1346#endif //KAB_EMBEDDED 1347#endif //KAB_EMBEDDED
1347 1348
1348 if ( mIsPart ) { 1349 if ( mIsPart ) {
1349 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1350 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1350 SLOT( openConfigDialog() ), actionCollection(), 1351 SLOT( openConfigDialog() ), actionCollection(),
1351 "kaddressbook_configure" ); 1352 "kaddressbook_configure" );
1352 1353
1353 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1354 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1354 this, SLOT( configureKeyBindings() ), actionCollection(), 1355 this, SLOT( configureKeyBindings() ), actionCollection(),
1355 "kaddressbook_configure_shortcuts" ); 1356 "kaddressbook_configure_shortcuts" );
1356#ifdef KAB_EMBEDDED 1357#ifdef KAB_EMBEDDED
1357 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1358 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1358 mActionConfigureToolbars->setEnabled( false ); 1359 mActionConfigureToolbars->setEnabled( false );
1359#endif //KAB_EMBEDDED 1360#endif //KAB_EMBEDDED
1360 1361
1361 } else { 1362 } else {
1362 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1363 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1363 1364
1364 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1365 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1365 } 1366 }
1366 1367
1367 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1368 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1368 actionCollection(), "options_show_jump_bar" ); 1369 actionCollection(), "options_show_jump_bar" );
1369 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1370 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1370 1371
1371 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, 1372 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0,
1372 actionCollection(), "options_show_details" ); 1373 actionCollection(), "options_show_details" );
1373 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1374 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1374 1375
1375 // misc 1376 // misc
1376 // only enable LDAP lookup if we can handle the protocol 1377 // only enable LDAP lookup if we can handle the protocol
1377#ifndef KAB_EMBEDDED 1378#ifndef KAB_EMBEDDED
1378 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1379 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1379 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1380 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1380 this, SLOT( openLDAPDialog() ), actionCollection(), 1381 this, SLOT( openLDAPDialog() ), actionCollection(),
1381 "ldap_lookup" ); 1382 "ldap_lookup" );
1382 } 1383 }
1383#else //KAB_EMBEDDED 1384#else //KAB_EMBEDDED
1384 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1385 //qDebug("KABCore::initActions() LDAP has to be implemented");
1385#endif //KAB_EMBEDDED 1386#endif //KAB_EMBEDDED
1386 1387
1387 1388
1388 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1389 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1389 SLOT( setWhoAmI() ), actionCollection(), 1390 SLOT( setWhoAmI() ), actionCollection(),
1390 "set_personal" ); 1391 "set_personal" );
1391 1392
1392 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1393 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1393 SLOT( setCategories() ), actionCollection(), 1394 SLOT( setCategories() ), actionCollection(),
1394 "edit_set_categories" ); 1395 "edit_set_categories" );
1395 1396
1397 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1398 SLOT( removeVoice() ), actionCollection(),
1399 "remove_voice" );
1396#ifdef KAB_EMBEDDED 1400#ifdef KAB_EMBEDDED
1397 1401
1398 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1402 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1399 this, SLOT( createAboutData() ), actionCollection(), 1403 this, SLOT( createAboutData() ), actionCollection(),
1400 "kaddressbook_about_data" ); 1404 "kaddressbook_about_data" );
1401#endif //KAB_EMBEDDED 1405#endif //KAB_EMBEDDED
1402 1406
1403 clipboardDataChanged(); 1407 clipboardDataChanged();
1404 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1408 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1405 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1409 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1406} 1410}
1407 1411
1408//US we need this function, to plug all actions into the correct menues. 1412//US we need this function, to plug all actions into the correct menues.
1409// KDE uses a XML format to plug the actions, but we work her without this overhead. 1413// KDE uses a XML format to plug the actions, but we work her without this overhead.
1410void KABCore::addActionsManually() 1414void KABCore::addActionsManually()
1411{ 1415{
1412//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1416//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1413 1417
1414#ifdef KAB_EMBEDDED 1418#ifdef KAB_EMBEDDED
1415 QPopupMenu *fileMenu = new QPopupMenu( this ); 1419 QPopupMenu *fileMenu = new QPopupMenu( this );
1416 QPopupMenu *editMenu = new QPopupMenu( this ); 1420 QPopupMenu *editMenu = new QPopupMenu( this );
1417 QPopupMenu *helpMenu = new QPopupMenu( this ); 1421 QPopupMenu *helpMenu = new QPopupMenu( this );
1418 1422
1419 KToolBar* tb = mMainWindow->toolBar(); 1423 KToolBar* tb = mMainWindow->toolBar();
1420 1424
1421#ifdef DESKTOP_VERSION 1425#ifdef DESKTOP_VERSION
1422 QMenuBar* mb = mMainWindow->menuBar(); 1426 QMenuBar* mb = mMainWindow->menuBar();
1423 1427
1424 //US setup menubar. 1428 //US setup menubar.
1425 //Disable the following block if you do not want to have a menubar. 1429 //Disable the following block if you do not want to have a menubar.
1426 mb->insertItem( "&File", fileMenu ); 1430 mb->insertItem( "&File", fileMenu );
1427 mb->insertItem( "&Edit", editMenu ); 1431 mb->insertItem( "&Edit", editMenu );
1428 mb->insertItem( "&View", viewMenu ); 1432 mb->insertItem( "&View", viewMenu );
1429 mb->insertItem( "&Settings", settingsMenu ); 1433 mb->insertItem( "&Settings", settingsMenu );
1434 mb->insertItem( "&Change selected", changeMenu );
1430 mb->insertItem( "&Help", helpMenu ); 1435 mb->insertItem( "&Help", helpMenu );
1431 mIncSearchWidget = new IncSearchWidget( tb ); 1436 mIncSearchWidget = new IncSearchWidget( tb );
1432 // tb->insertWidget(-1, 0, mIncSearchWidget); 1437 // tb->insertWidget(-1, 0, mIncSearchWidget);
1433 1438
1434#else 1439#else
1435 //US setup toolbar 1440 //US setup toolbar
1436 QMenuBar *menuBarTB = new QMenuBar( tb ); 1441 QMenuBar *menuBarTB = new QMenuBar( tb );
1437 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1442 QPopupMenu *popupBarTB = new QPopupMenu( this );
1438 menuBarTB->insertItem( "ME", popupBarTB); 1443 menuBarTB->insertItem( "ME", popupBarTB);
1439 tb->insertWidget(-1, 0, menuBarTB); 1444 tb->insertWidget(-1, 0, menuBarTB);
1440 mIncSearchWidget = new IncSearchWidget( tb ); 1445 mIncSearchWidget = new IncSearchWidget( tb );
1441 1446
1442 tb->enableMoving(false); 1447 tb->enableMoving(false);
1443 popupBarTB->insertItem( "&File", fileMenu ); 1448 popupBarTB->insertItem( "&File", fileMenu );
1444 popupBarTB->insertItem( "&Edit", editMenu ); 1449 popupBarTB->insertItem( "&Edit", editMenu );
1445 popupBarTB->insertItem( "&View", viewMenu ); 1450 popupBarTB->insertItem( "&View", viewMenu );
1446 popupBarTB->insertItem( "&Settings", settingsMenu ); 1451 popupBarTB->insertItem( "&Settings", settingsMenu );
1447 mViewManager->getFilterAction()->plug ( popupBarTB); 1452 mViewManager->getFilterAction()->plug ( popupBarTB);
1453 popupBarTB->insertItem( "&Change selected", changeMenu );
1448 popupBarTB->insertItem( "&Help", helpMenu ); 1454 popupBarTB->insertItem( "&Help", helpMenu );
1449 if (QApplication::desktop()->width() > 320 ) { 1455 if (QApplication::desktop()->width() > 320 ) {
1450 // mViewManager->getFilterAction()->plug ( tb); 1456 // mViewManager->getFilterAction()->plug ( tb);
1451 } 1457 }
1452#endif 1458#endif
1453 // mActionQuit->plug ( mMainWindow->toolBar()); 1459 // mActionQuit->plug ( mMainWindow->toolBar());
1454 1460
1455 1461
1456 1462
1457 //US Now connect the actions with the menue entries. 1463 //US Now connect the actions with the menue entries.
1458 mActionPrint->plug( fileMenu ); 1464 mActionPrint->plug( fileMenu );
1459 mActionMail->plug( fileMenu ); 1465 mActionMail->plug( fileMenu );
1460 fileMenu->insertSeparator(); 1466 fileMenu->insertSeparator();
1461 1467
1462 mActionNewContact->plug( fileMenu ); 1468 mActionNewContact->plug( fileMenu );
1463 mActionNewContact->plug( tb ); 1469 mActionNewContact->plug( tb );
1464 1470
1465 mActionEditAddressee->plug( fileMenu ); 1471 mActionEditAddressee->plug( fileMenu );
1466 fileMenu->insertSeparator(); 1472 fileMenu->insertSeparator();
1467 mActionSave->plug( fileMenu ); 1473 mActionSave->plug( fileMenu );
1468 fileMenu->insertItem( "&Import", ImportMenu ); 1474 fileMenu->insertItem( "&Import", ImportMenu );
1469 fileMenu->insertItem( "&Emport", ExportMenu ); 1475 fileMenu->insertItem( "&Emport", ExportMenu );
1470 fileMenu->insertSeparator(); 1476 fileMenu->insertSeparator();
1471 mActionMailVCard->plug( fileMenu ); 1477 mActionMailVCard->plug( fileMenu );
1472 fileMenu->insertSeparator(); 1478 fileMenu->insertSeparator();
1473 mActionQuit->plug( fileMenu ); 1479 mActionQuit->plug( fileMenu );
1474 1480
1475 1481
1476 // edit menu 1482 // edit menu
1477 mActionUndo->plug( editMenu ); 1483 mActionUndo->plug( editMenu );
1478 mActionRedo->plug( editMenu ); 1484 mActionRedo->plug( editMenu );
1479 editMenu->insertSeparator(); 1485 editMenu->insertSeparator();
1480 mActionCut->plug( editMenu ); 1486 mActionCut->plug( editMenu );
1481 mActionCopy->plug( editMenu ); 1487 mActionCopy->plug( editMenu );
1482 mActionPaste->plug( editMenu ); 1488 mActionPaste->plug( editMenu );
1483 mActionDelete->plug( editMenu ); 1489 mActionDelete->plug( editMenu );
1484 editMenu->insertSeparator(); 1490 editMenu->insertSeparator();
1485 mActionSelectAll->plug( editMenu ); 1491 mActionSelectAll->plug( editMenu );
1486 1492
1487 1493 mActionRemoveVoice->plug( changeMenu );
1488 // settings menu 1494 // settings menu
1489//US special menuentry to configure the addressbook resources. On KDE 1495//US special menuentry to configure the addressbook resources. On KDE
1490// you do that through the control center !!! 1496// you do that through the control center !!!
1491 mActionConfigResources->plug( settingsMenu ); 1497 mActionConfigResources->plug( settingsMenu );
1492 settingsMenu->insertSeparator(); 1498 settingsMenu->insertSeparator();
1493 1499
1494 mActionConfigKAddressbook->plug( settingsMenu ); 1500 mActionConfigKAddressbook->plug( settingsMenu );
1495 1501
1496 if ( mIsPart ) { 1502 if ( mIsPart ) {
1497 mActionConfigShortcuts->plug( settingsMenu ); 1503 mActionConfigShortcuts->plug( settingsMenu );
1498 mActionConfigureToolbars->plug( settingsMenu ); 1504 mActionConfigureToolbars->plug( settingsMenu );
1499 1505
1500 } else { 1506 } else {
1501 mActionKeyBindings->plug( settingsMenu ); 1507 mActionKeyBindings->plug( settingsMenu );
1502 } 1508 }
1503 1509
1504 settingsMenu->insertSeparator(); 1510 settingsMenu->insertSeparator();
1505 1511
1506 mActionJumpBar->plug( settingsMenu ); 1512 mActionJumpBar->plug( settingsMenu );
1507 mActionDetails->plug( settingsMenu ); 1513 mActionDetails->plug( settingsMenu );
1508 settingsMenu->insertSeparator(); 1514 settingsMenu->insertSeparator();
1509 1515
1510 mActionWhoAmI->plug( settingsMenu ); 1516 mActionWhoAmI->plug( settingsMenu );
1511 mActionCategories->plug( settingsMenu ); 1517 mActionCategories->plug( settingsMenu );
1512 1518
1513 mActionAboutKAddressbook->plug( helpMenu ); 1519 mActionAboutKAddressbook->plug( helpMenu );
1514 1520
1515 1521
1516 if (QApplication::desktop()->width() > 320 ) { 1522 if (QApplication::desktop()->width() > 320 ) {
1517 1523
1518 mActionEditAddressee->plug( tb ); 1524 mActionEditAddressee->plug( tb );
1519 mActionSave->plug( tb ); 1525 mActionSave->plug( tb );
1520 mViewManager->getFilterAction()->plug ( tb); 1526 mViewManager->getFilterAction()->plug ( tb);
1521 if (QApplication::desktop()->width() > 480 ) { 1527 if (QApplication::desktop()->width() > 480 ) {
1522 mActionUndo->plug( tb ); 1528 mActionUndo->plug( tb );
1523 mActionDelete->plug( tb ); 1529 mActionDelete->plug( tb );
1524 mActionRedo->plug( tb ); 1530 mActionRedo->plug( tb );
1525 } 1531 }
1526 } 1532 }
1527 //mActionQuit->plug ( tb ); 1533 //mActionQuit->plug ( tb );
1528 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1534 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1529 1535
1530 //US link the searchwidget first to this. 1536 //US link the searchwidget first to this.
1531 // The real linkage to the toolbar happens later. 1537 // The real linkage to the toolbar happens later.
1532//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1538//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1533//US tb->insertItem( mIncSearchWidget ); 1539//US tb->insertItem( mIncSearchWidget );
1534/*US 1540/*US
1535 mIncSearchWidget = new IncSearchWidget( tb ); 1541 mIncSearchWidget = new IncSearchWidget( tb );
1536 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1542 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1537 SLOT( incrementalSearch( const QString& ) ) ); 1543 SLOT( incrementalSearch( const QString& ) ) );
1538 1544
1539 mJumpButtonBar = new JumpButtonBar( this, this ); 1545 mJumpButtonBar = new JumpButtonBar( this, this );
1540 1546
1541//US topLayout->addWidget( mJumpButtonBar ); 1547//US topLayout->addWidget( mJumpButtonBar );
1542 this->layout()->add( mJumpButtonBar ); 1548 this->layout()->add( mJumpButtonBar );
1543*/ 1549*/
1544 1550
1545#endif //KAB_EMBEDDED 1551#endif //KAB_EMBEDDED
1546} 1552}
1553void KABCore::removeVoice()
1554{
1555 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 )
1556 return;
1557 KABC::Addressee::List list = mViewManager->selectedAddressees();
1558 KABC::Addressee::List::Iterator it;
1559 for ( it = list.begin(); it != list.end(); ++it ) {
1560 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1561 PhoneNumber::List::Iterator phoneIt;
1562 bool found = false;
1563 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1564 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1565 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1566 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1567 (*it).insertPhoneNumber( (*phoneIt) );
1568 found = true;
1569 }
1570 }
1571
1572 }
1573 if ( found )
1574 contactModified((*it) );
1575 }
1576}
1547 1577
1548 1578
1549 1579
1550void KABCore::clipboardDataChanged() 1580void KABCore::clipboardDataChanged()
1551{ 1581{
1552 1582
1553 if ( mReadWrite ) 1583 if ( mReadWrite )
1554 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 1584 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1555 1585
1556} 1586}
1557 1587
1558void KABCore::updateActionMenu() 1588void KABCore::updateActionMenu()
1559{ 1589{
1560 UndoStack *undo = UndoStack::instance(); 1590 UndoStack *undo = UndoStack::instance();
1561 RedoStack *redo = RedoStack::instance(); 1591 RedoStack *redo = RedoStack::instance();
1562 1592
1563 if ( undo->isEmpty() ) 1593 if ( undo->isEmpty() )
1564 mActionUndo->setText( i18n( "Undo" ) ); 1594 mActionUndo->setText( i18n( "Undo" ) );
1565 else 1595 else
1566 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 1596 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
1567 1597
1568 mActionUndo->setEnabled( !undo->isEmpty() ); 1598 mActionUndo->setEnabled( !undo->isEmpty() );
1569 1599
1570 if ( !redo->top() ) 1600 if ( !redo->top() )
1571 mActionRedo->setText( i18n( "Redo" ) ); 1601 mActionRedo->setText( i18n( "Redo" ) );
1572 else 1602 else
1573 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 1603 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
1574 1604
1575 mActionRedo->setEnabled( !redo->isEmpty() ); 1605 mActionRedo->setEnabled( !redo->isEmpty() );
1576} 1606}
1577 1607
1578void KABCore::configureKeyBindings() 1608void KABCore::configureKeyBindings()
1579{ 1609{
1580#ifndef KAB_EMBEDDED 1610#ifndef KAB_EMBEDDED
1581 KKeyDialog::configure( actionCollection(), true ); 1611 KKeyDialog::configure( actionCollection(), true );
1582#else //KAB_EMBEDDED 1612#else //KAB_EMBEDDED
1583 qDebug("KABCore::configureKeyBindings() not implemented"); 1613 qDebug("KABCore::configureKeyBindings() not implemented");
1584#endif //KAB_EMBEDDED 1614#endif //KAB_EMBEDDED
1585} 1615}
1586 1616
1587#ifdef KAB_EMBEDDED 1617#ifdef KAB_EMBEDDED
1588void KABCore::configureResources() 1618void KABCore::configureResources()
1589{ 1619{
1590 KRES::KCMKResources dlg( this, "" , 0 ); 1620 KRES::KCMKResources dlg( this, "" , 0 );
1591 1621
1592 if ( !dlg.exec() ) 1622 if ( !dlg.exec() )
1593 return; 1623 return;
1594 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 1624 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
1595} 1625}
1596#endif //KAB_EMBEDDED 1626#endif //KAB_EMBEDDED
1597 1627
1598 1628
1599 1629
1600#ifndef KAB_EMBEDDED 1630#ifndef KAB_EMBEDDED
1601#include "kabcore.moc" 1631#include "kabcore.moc"
1602#endif //KAB_EMBEDDED 1632#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c823f1f..8d6041e 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,421 +1,425 @@
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#ifndef KABCORE_H 24#ifndef KABCORE_H
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 32
33#include <qwidget.h> 33#include <qwidget.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35 35
36namespace KABC { 36namespace KABC {
37class AddressBook; 37class AddressBook;
38} 38}
39 39
40#ifndef KAB_EMBEDDED 40#ifndef KAB_EMBEDDED
41class KAboutData; 41class KAboutData;
42class KConfig; 42class KConfig;
43 43
44class KAddressBookService; 44class KAddressBookService;
45class LDAPSearchDialog; 45class LDAPSearchDialog;
46#else //KAB_EMBEDDED 46#else //KAB_EMBEDDED
47class KAddressBookMain; 47class KAddressBookMain;
48//US class QAction; 48//US class QAction;
49#endif //KAB_EMBEDDED 49#endif //KAB_EMBEDDED
50class KCMultiDialog; 50class KCMultiDialog;
51class KXMLGUIClient; 51class KXMLGUIClient;
52class ExtensionManager; 52class ExtensionManager;
53class XXPortManager; 53class XXPortManager;
54class JumpButtonBar; 54class JumpButtonBar;
55class IncSearchWidget; 55class IncSearchWidget;
56class KDGanttMinimizeSplitter; 56class KDGanttMinimizeSplitter;
57class KAction; 57class KAction;
58class KActionCollection; 58class KActionCollection;
59class KToggleAction; 59class KToggleAction;
60 60
61class QAction; 61class QAction;
62class QMenuBar; 62class QMenuBar;
63class QSplitter; 63class QSplitter;
64class ViewContainer; 64class ViewContainer;
65class ViewManager; 65class ViewManager;
66class AddresseeEditorDialog; 66class AddresseeEditorDialog;
67 67
68class KABCore : public QWidget 68class KABCore : public QWidget
69{ 69{
70 Q_OBJECT 70 Q_OBJECT
71 71
72 public: 72 public:
73 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 73 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
74 74
75 75
76 ~KABCore(); 76 ~KABCore();
77 77
78 78
79#ifdef KAB_EMBEDDED 79#ifdef KAB_EMBEDDED
80 //US added functionality 80 //US added functionality
81 QPopupMenu* getViewMenu() {return viewMenu;} 81 QPopupMenu* getViewMenu() {return viewMenu;}
82 QPopupMenu* getFilterMenu() {return filterMenu;} 82 QPopupMenu* getFilterMenu() {return filterMenu;}
83 QPopupMenu* getSettingsMenu() {return settingsMenu;} 83 QPopupMenu* getSettingsMenu() {return settingsMenu;}
84 void addActionsManually(); 84 void addActionsManually();
85#endif //KAB_EMBEDDED 85#endif //KAB_EMBEDDED
86 /** 86 /**
87 Restores the global settings. 87 Restores the global settings.
88 */ 88 */
89 void restoreSettings(); 89 void restoreSettings();
90 90
91 /** 91 /**
92 Saves the global settings. 92 Saves the global settings.
93 */ 93 */
94 void saveSettings(); 94 void saveSettings();
95 95
96 /** 96 /**
97 Returns a pointer to the StdAddressBook of the application. 97 Returns a pointer to the StdAddressBook of the application.
98 */ 98 */
99 KABC::AddressBook *addressBook() const; 99 KABC::AddressBook *addressBook() const;
100 100
101 /** 101 /**
102 Returns a pointer to the KConfig object of the application. 102 Returns a pointer to the KConfig object of the application.
103 */ 103 */
104 static KConfig *config(); 104 static KConfig *config();
105 105
106 /** 106 /**
107 Returns a pointer to the global KActionCollection object. So 107 Returns a pointer to the global KActionCollection object. So
108 other classes can register their actions easily. 108 other classes can register their actions easily.
109 */ 109 */
110 KActionCollection *actionCollection() const; 110 KActionCollection *actionCollection() const;
111 111
112 /** 112 /**
113 Returns the current search field of the Incremental Search Widget. 113 Returns the current search field of the Incremental Search Widget.
114 */ 114 */
115 KABC::Field *currentSearchField() const; 115 KABC::Field *currentSearchField() const;
116 116
117 /** 117 /**
118 Returns the uid list of the currently selected contacts. 118 Returns the uid list of the currently selected contacts.
119 */ 119 */
120 QStringList selectedUIDs() const; 120 QStringList selectedUIDs() const;
121 121
122 /** 122 /**
123 Displays the ResourceSelectDialog and returns the selected 123 Displays the ResourceSelectDialog and returns the selected
124 resource or a null pointer if no resource was selected by 124 resource or a null pointer if no resource was selected by
125 the user. 125 the user.
126 */ 126 */
127 KABC::Resource *requestResource( QWidget *parent ); 127 KABC::Resource *requestResource( QWidget *parent );
128 128
129#ifndef KAB_EMBEDDED 129#ifndef KAB_EMBEDDED
130 static KAboutData *createAboutData(); 130 static KAboutData *createAboutData();
131#endif //KAB_EMBEDDED 131#endif //KAB_EMBEDDED
132 132
133#ifdef KAB_EMBEDDED 133#ifdef KAB_EMBEDDED
134 inline QPopupMenu* getImportMenu() { return ImportMenu;} 134 inline QPopupMenu* getImportMenu() { return ImportMenu;}
135 inline QPopupMenu* getExportMenu() { return ExportMenu;} 135 inline QPopupMenu* getExportMenu() { return ExportMenu;}
136#endif //KAB_EMBEDDED 136#endif //KAB_EMBEDDED
137 137
138 public slots: 138 public slots:
139#ifdef KAB_EMBEDDED 139#ifdef KAB_EMBEDDED
140 void createAboutData(); 140 void createAboutData();
141#endif //KAB_EMBEDDED 141#endif //KAB_EMBEDDED
142 142
143 void statusMessage(QString, int time = 0 ); 143 void statusMessage(QString, int time = 0 );
144 /** 144 /**
145 Is called whenever a contact is selected in the view. 145 Is called whenever a contact is selected in the view.
146 */ 146 */
147 void setContactSelected( const QString &uid ); 147 void setContactSelected( const QString &uid );
148 148
149 /** 149 /**
150 Opens the preferred mail composer with all selected contacts as 150 Opens the preferred mail composer with all selected contacts as
151 arguments. 151 arguments.
152 */ 152 */
153 void sendMail(); 153 void sendMail();
154 154
155 /** 155 /**
156 Opens the preferred mail composer with the given contacts as 156 Opens the preferred mail composer with the given contacts as
157 arguments. 157 arguments.
158 */ 158 */
159 void sendMail( const QString& email ); 159 void sendMail( const QString& email );
160 160
161 161
162 void mailVCard(); 162 void mailVCard();
163 void mailVCard(const QStringList& uids); 163 void mailVCard(const QStringList& uids);
164 164
165 /** 165 /**
166 Starts the preferred web browser with the given URL as argument. 166 Starts the preferred web browser with the given URL as argument.
167 */ 167 */
168 void browse( const QString& url ); 168 void browse( const QString& url );
169 169
170 /** 170 /**
171 Select all contacts in the view. 171 Select all contacts in the view.
172 */ 172 */
173 void selectAllContacts(); 173 void selectAllContacts();
174 174
175 /** 175 /**
176 Deletes all selected contacts from the address book. 176 Deletes all selected contacts from the address book.
177 */ 177 */
178 void deleteContacts(); 178 void deleteContacts();
179 179
180 /** 180 /**
181 Deletes given contacts from the address book. 181 Deletes given contacts from the address book.
182 182
183 @param uids The uids of the contacts, which shall be deleted. 183 @param uids The uids of the contacts, which shall be deleted.
184 */ 184 */
185 void deleteContacts( const QStringList &uids ); 185 void deleteContacts( const QStringList &uids );
186 186
187 /** 187 /**
188 Copys the selected contacts into clipboard for later pasting. 188 Copys the selected contacts into clipboard for later pasting.
189 */ 189 */
190 void copyContacts(); 190 void copyContacts();
191 191
192 /** 192 /**
193 Cuts the selected contacts and stores them for later pasting. 193 Cuts the selected contacts and stores them for later pasting.
194 */ 194 */
195 void cutContacts(); 195 void cutContacts();
196 196
197 /** 197 /**
198 Paste contacts from clipboard into the address book. 198 Paste contacts from clipboard into the address book.
199 */ 199 */
200 void pasteContacts(); 200 void pasteContacts();
201 201
202 /** 202 /**
203 Paste given contacts into the address book. 203 Paste given contacts into the address book.
204 204
205 @param list The list of addressee, which shall be pasted. 205 @param list The list of addressee, which shall be pasted.
206 */ 206 */
207 void pasteContacts( KABC::Addressee::List &list ); 207 void pasteContacts( KABC::Addressee::List &list );
208 208
209 /** 209 /**
210 Sets the whoAmI contact, that is used by many other programs to 210 Sets the whoAmI contact, that is used by many other programs to
211 get personal information about the current user. 211 get personal information about the current user.
212 */ 212 */
213 void setWhoAmI(); 213 void setWhoAmI();
214 214
215 /** 215 /**
216 Displays the category dialog and applies the result to all 216 Displays the category dialog and applies the result to all
217 selected contacts. 217 selected contacts.
218 */ 218 */
219 void setCategories(); 219 void setCategories();
220 220
221 /** 221 /**
222 Sets the field list of the Incremental Search Widget. 222 Sets the field list of the Incremental Search Widget.
223 */ 223 */
224 void setSearchFields( const KABC::Field::List &fields ); 224 void setSearchFields( const KABC::Field::List &fields );
225 225
226 /** 226 /**
227 Search with the current search field for a contact, that matches 227 Search with the current search field for a contact, that matches
228 the given text, and selects it in the view. 228 the given text, and selects it in the view.
229 */ 229 */
230 void incrementalSearch( const QString& text ); 230 void incrementalSearch( const QString& text );
231 231
232 /** 232 /**
233 Marks the address book as modified. 233 Marks the address book as modified.
234 */ 234 */
235 void setModified(); 235 void setModified();
236 /** 236 /**
237 Marks the address book as modified without refreshing the view. 237 Marks the address book as modified without refreshing the view.
238 */ 238 */
239 void setModifiedWOrefresh(); 239 void setModifiedWOrefresh();
240 240
241 /** 241 /**
242 Marks the address book as modified concerning the argument. 242 Marks the address book as modified concerning the argument.
243 */ 243 */
244 void setModified( bool modified ); 244 void setModified( bool modified );
245 245
246 /** 246 /**
247 Returns whether the address book is modified. 247 Returns whether the address book is modified.
248 */ 248 */
249 bool modified() const; 249 bool modified() const;
250 250
251 /** 251 /**
252 Called whenever an contact is modified in the contact editor 252 Called whenever an contact is modified in the contact editor
253 dialog or the quick edit. 253 dialog or the quick edit.
254 */ 254 */
255 void contactModified( const KABC::Addressee &addr ); 255 void contactModified( const KABC::Addressee &addr );
256 256
257 /** 257 /**
258 DCOP METHODS. 258 DCOP METHODS.
259 */ 259 */
260 void addEmail( QString addr ); 260 void addEmail( QString addr );
261 void importVCard( const KURL& url, bool showPreview ); 261 void importVCard( const KURL& url, bool showPreview );
262 void importVCard( const QString& vCard, bool showPreview ); 262 void importVCard( const QString& vCard, bool showPreview );
263 void newContact(); 263 void newContact();
264 QString getNameByPhone( const QString& phone ); 264 QString getNameByPhone( const QString& phone );
265 /** 265 /**
266 END DCOP METHODS 266 END DCOP METHODS
267 */ 267 */
268 268
269 /** 269 /**
270 Saves the contents of the AddressBook back to disk. 270 Saves the contents of the AddressBook back to disk.
271 */ 271 */
272 void save(); 272 void save();
273 273
274 /** 274 /**
275 Undos the last command using the undo stack. 275 Undos the last command using the undo stack.
276 */ 276 */
277 void undo(); 277 void undo();
278 278
279 /** 279 /**
280 Redos the last command that was undone, using the redo stack. 280 Redos the last command that was undone, using the redo stack.
281 */ 281 */
282 void redo(); 282 void redo();
283 283
284 /** 284 /**
285 Shows the edit dialog for the given uid. If the uid is QString::null, 285 Shows the edit dialog for the given uid. If the uid is QString::null,
286 the method will try to find a selected addressee in the view. 286 the method will try to find a selected addressee in the view.
287 */ 287 */
288 void editContact( const QString &uid /*US = QString::null*/ ); 288 void editContact( const QString &uid /*US = QString::null*/ );
289//US added a second method without defaultparameter 289//US added a second method without defaultparameter
290 void editContact2(); 290 void editContact2();
291 291
292 /** 292 /**
293 Launches the configuration dialog. 293 Launches the configuration dialog.
294 */ 294 */
295 void openConfigDialog(); 295 void openConfigDialog();
296 296
297 /** 297 /**
298 Launches the ldap search dialog. 298 Launches the ldap search dialog.
299 */ 299 */
300 void openLDAPDialog(); 300 void openLDAPDialog();
301 301
302 /** 302 /**
303 Creates a KAddressBookPrinter, which will display the print 303 Creates a KAddressBookPrinter, which will display the print
304 dialog and do the printing. 304 dialog and do the printing.
305 */ 305 */
306 void print(); 306 void print();
307 307
308 /** 308 /**
309 Registers a new GUI client, so plugins can register its actions. 309 Registers a new GUI client, so plugins can register its actions.
310 */ 310 */
311 void addGUIClient( KXMLGUIClient *client ); 311 void addGUIClient( KXMLGUIClient *client );
312 312
313 signals: 313 signals:
314 void contactSelected( const QString &name ); 314 void contactSelected( const QString &name );
315 void contactSelected( const QPixmap &pixmap ); 315 void contactSelected( const QPixmap &pixmap );
316 public slots: 316 public slots:
317 void setDetailsVisible( bool visible ); 317 void setDetailsVisible( bool visible );
318 void setDetailsToState(); 318 void setDetailsToState();
319 private slots: 319 private slots:
320 void setJumpButtonBarVisible( bool visible ); 320 void setJumpButtonBarVisible( bool visible );
321 321
322 void extensionModified( const KABC::Addressee::List &list ); 322 void extensionModified( const KABC::Addressee::List &list );
323 void clipboardDataChanged(); 323 void clipboardDataChanged();
324 void updateActionMenu(); 324 void updateActionMenu();
325 void configureKeyBindings(); 325 void configureKeyBindings();
326 void removeVoice();
326#ifdef KAB_EMBEDDED 327#ifdef KAB_EMBEDDED
327 void configureResources(); 328 void configureResources();
328#endif //KAB_EMBEDDED 329#endif //KAB_EMBEDDED
329 330
330 void slotEditorDestroyed( const QString &uid ); 331 void slotEditorDestroyed( const QString &uid );
331 void configurationChanged(); 332 void configurationChanged();
332 void addressBookChanged(); 333 void addressBookChanged();
333 334
334 private: 335 private:
335 void initGUI(); 336 void initGUI();
336 void initActions(); 337 void initActions();
337 338
338 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 339 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
339 const char *name = 0 ); 340 const char *name = 0 );
340 341
341 KXMLGUIClient *mGUIClient; 342 KXMLGUIClient *mGUIClient;
342 343
343 KABC::AddressBook *mAddressBook; 344 KABC::AddressBook *mAddressBook;
344 345
345 ViewManager *mViewManager; 346 ViewManager *mViewManager;
346 // QSplitter *mDetailsSplitter; 347 // QSplitter *mDetailsSplitter;
347 KDGanttMinimizeSplitter *mExtensionBarSplitter; 348 KDGanttMinimizeSplitter *mExtensionBarSplitter;
348 ViewContainer *mDetails; 349 ViewContainer *mDetails;
349 KDGanttMinimizeSplitter* mMiniSplitter; 350 KDGanttMinimizeSplitter* mMiniSplitter;
350 XXPortManager *mXXPortManager; 351 XXPortManager *mXXPortManager;
351 JumpButtonBar *mJumpButtonBar; 352 JumpButtonBar *mJumpButtonBar;
352 IncSearchWidget *mIncSearchWidget; 353 IncSearchWidget *mIncSearchWidget;
353 ExtensionManager *mExtensionManager; 354 ExtensionManager *mExtensionManager;
354 355
355 KCMultiDialog *mConfigureDialog; 356 KCMultiDialog *mConfigureDialog;
356 357
357#ifndef KAB_EMBEDDED 358#ifndef KAB_EMBEDDED
358 359
359 KCMultiDialog *mConfigureDialog; 360 KCMultiDialog *mConfigureDialog;
360 LDAPSearchDialog *mLdapSearchDialog; 361 LDAPSearchDialog *mLdapSearchDialog;
361#endif //KAB_EMBEDDED 362#endif //KAB_EMBEDDED
362 // QDict<AddresseeEditorDialog> mEditorDict; 363 // QDict<AddresseeEditorDialog> mEditorDict;
363 AddresseeEditorDialog *mEditorDialog; 364 AddresseeEditorDialog *mEditorDialog;
364 bool mReadWrite; 365 bool mReadWrite;
365 bool mModified; 366 bool mModified;
366 bool mIsPart; 367 bool mIsPart;
367 368
368 //US file menu 369 //US file menu
369 KAction *mActionMail; 370 KAction *mActionMail;
370 KAction* mActionPrint; 371 KAction* mActionPrint;
371 KAction* mActionNewContact; 372 KAction* mActionNewContact;
372 KAction *mActionSave; 373 KAction *mActionSave;
373 KAction *mActionEditAddressee; 374 KAction *mActionEditAddressee;
374 KAction *mActionMailVCard; 375 KAction *mActionMailVCard;
375 KAction *mActionQuit; 376 KAction *mActionQuit;
376 377
377 //US edit menu 378 //US edit menu
378 KAction *mActionCopy; 379 KAction *mActionCopy;
379 KAction *mActionCut; 380 KAction *mActionCut;
380 KAction *mActionPaste; 381 KAction *mActionPaste;
381 KAction *mActionSelectAll; 382 KAction *mActionSelectAll;
382 KAction *mActionUndo; 383 KAction *mActionUndo;
383 KAction *mActionRedo; 384 KAction *mActionRedo;
384 KAction *mActionDelete; 385 KAction *mActionDelete;
385 386
386 //US settings menu 387 //US settings menu
387 KAction *mActionConfigResources; 388 KAction *mActionConfigResources;
388 KAction *mActionConfigKAddressbook; 389 KAction *mActionConfigKAddressbook;
389 KAction *mActionConfigShortcuts; 390 KAction *mActionConfigShortcuts;
390 KAction *mActionConfigureToolbars; 391 KAction *mActionConfigureToolbars;
391 KAction *mActionKeyBindings; 392 KAction *mActionKeyBindings;
392 KToggleAction *mActionJumpBar; 393 KToggleAction *mActionJumpBar;
393 KToggleAction *mActionDetails; 394 KToggleAction *mActionDetails;
394 KAction *mActionWhoAmI; 395 KAction *mActionWhoAmI;
395 KAction *mActionCategories; 396 KAction *mActionCategories;
396 KAction *mActionAboutKAddressbook; 397 KAction *mActionAboutKAddressbook;
397 398
398 KAction *mActionDeleteView; 399 KAction *mActionDeleteView;
399 400
400 QPopupMenu *viewMenu; 401 QPopupMenu *viewMenu;
401 QPopupMenu *filterMenu; 402 QPopupMenu *filterMenu;
402 QPopupMenu *settingsMenu; 403 QPopupMenu *settingsMenu;
404 QPopupMenu *changeMenu;
403 405
404//US QAction *mActionSave; 406//US QAction *mActionSave;
405 QPopupMenu *ImportMenu; 407 QPopupMenu *ImportMenu;
406 QPopupMenu *ExportMenu; 408 QPopupMenu *ExportMenu;
409 //LR additional methods
410 KAction *mActionRemoveVoice;
407 411
408#ifndef KAB_EMBEDDED 412#ifndef KAB_EMBEDDED
409 KAddressBookService *mAddressBookService; 413 KAddressBookService *mAddressBookService;
410#endif //KAB_EMBEDDED 414#endif //KAB_EMBEDDED
411 415
412 class KABCorePrivate; 416 class KABCorePrivate;
413 KABCorePrivate *d; 417 KABCorePrivate *d;
414 418
415#ifdef KAB_EMBEDDED 419#ifdef KAB_EMBEDDED
416 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 420 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
417#endif //KAB_EMBEDDED 421#endif //KAB_EMBEDDED
418 422
419}; 423};
420 424
421#endif 425#endif