author | zautrix <zautrix> | 2004-09-15 07:09:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-15 07:09:02 (UTC) |
commit | 540bbf4ded9f06df9a56e74f48bb606fb43f05d7 (patch) (unidiff) | |
tree | 6d9e57d33eb732c990fceb794c8c88f70fd764f1 | |
parent | 29059299ec9c8705de675b8f70d11c810e4e22a7 (diff) | |
download | kdepimpi-540bbf4ded9f06df9a56e74f48bb606fb43f05d7.zip kdepimpi-540bbf4ded9f06df9a56e74f48bb606fb43f05d7.tar.gz kdepimpi-540bbf4ded9f06df9a56e74f48bb606fb43f05d7.tar.bz2 |
Fix of the emport menu
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index f0a49f8..013e243 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -778,1314 +778,1314 @@ void KABCore::pasteContacts() | |||
778 | pasteContacts( list ); | 778 | pasteContacts( list ); |
779 | } | 779 | } |
780 | 780 | ||
781 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 781 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
782 | { | 782 | { |
783 | KABC::Resource *resource = requestResource( this ); | 783 | KABC::Resource *resource = requestResource( this ); |
784 | KABC::Addressee::List::Iterator it; | 784 | KABC::Addressee::List::Iterator it; |
785 | for ( it = list.begin(); it != list.end(); ++it ) | 785 | for ( it = list.begin(); it != list.end(); ++it ) |
786 | (*it).setResource( resource ); | 786 | (*it).setResource( resource ); |
787 | 787 | ||
788 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 788 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
789 | UndoStack::instance()->push( command ); | 789 | UndoStack::instance()->push( command ); |
790 | RedoStack::instance()->clear(); | 790 | RedoStack::instance()->clear(); |
791 | 791 | ||
792 | setModified( true ); | 792 | setModified( true ); |
793 | } | 793 | } |
794 | 794 | ||
795 | void KABCore::setWhoAmI() | 795 | void KABCore::setWhoAmI() |
796 | { | 796 | { |
797 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 797 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
798 | 798 | ||
799 | if ( addrList.count() > 1 ) { | 799 | if ( addrList.count() > 1 ) { |
800 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 800 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
801 | return; | 801 | return; |
802 | } | 802 | } |
803 | 803 | ||
804 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 804 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
805 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 805 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
806 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 806 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
807 | } | 807 | } |
808 | 808 | ||
809 | void KABCore::setCategories() | 809 | void KABCore::setCategories() |
810 | { | 810 | { |
811 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 811 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
812 | if ( !dlg.exec() ) | 812 | if ( !dlg.exec() ) |
813 | return; | 813 | return; |
814 | 814 | ||
815 | bool merge = false; | 815 | bool merge = false; |
816 | QString msg = i18n( "Merge with existing categories?" ); | 816 | QString msg = i18n( "Merge with existing categories?" ); |
817 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 817 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
818 | merge = true; | 818 | merge = true; |
819 | 819 | ||
820 | QStringList categories = dlg.selectedCategories(); | 820 | QStringList categories = dlg.selectedCategories(); |
821 | 821 | ||
822 | QStringList uids = mViewManager->selectedUids(); | 822 | QStringList uids = mViewManager->selectedUids(); |
823 | QStringList::Iterator it; | 823 | QStringList::Iterator it; |
824 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 824 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
825 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 825 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
826 | if ( !addr.isEmpty() ) { | 826 | if ( !addr.isEmpty() ) { |
827 | if ( !merge ) | 827 | if ( !merge ) |
828 | addr.setCategories( categories ); | 828 | addr.setCategories( categories ); |
829 | else { | 829 | else { |
830 | QStringList addrCategories = addr.categories(); | 830 | QStringList addrCategories = addr.categories(); |
831 | QStringList::Iterator catIt; | 831 | QStringList::Iterator catIt; |
832 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 832 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
833 | if ( !addrCategories.contains( *catIt ) ) | 833 | if ( !addrCategories.contains( *catIt ) ) |
834 | addrCategories.append( *catIt ); | 834 | addrCategories.append( *catIt ); |
835 | } | 835 | } |
836 | addr.setCategories( addrCategories ); | 836 | addr.setCategories( addrCategories ); |
837 | } | 837 | } |
838 | 838 | ||
839 | mAddressBook->insertAddressee( addr ); | 839 | mAddressBook->insertAddressee( addr ); |
840 | } | 840 | } |
841 | } | 841 | } |
842 | 842 | ||
843 | if ( uids.count() > 0 ) | 843 | if ( uids.count() > 0 ) |
844 | setModified( true ); | 844 | setModified( true ); |
845 | } | 845 | } |
846 | 846 | ||
847 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 847 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
848 | { | 848 | { |
849 | mIncSearchWidget->setFields( fields ); | 849 | mIncSearchWidget->setFields( fields ); |
850 | } | 850 | } |
851 | 851 | ||
852 | void KABCore::incrementalSearch( const QString& text ) | 852 | void KABCore::incrementalSearch( const QString& text ) |
853 | { | 853 | { |
854 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 854 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); |
855 | } | 855 | } |
856 | 856 | ||
857 | void KABCore::setModified() | 857 | void KABCore::setModified() |
858 | { | 858 | { |
859 | setModified( true ); | 859 | setModified( true ); |
860 | } | 860 | } |
861 | 861 | ||
862 | void KABCore::setModifiedWOrefresh() | 862 | void KABCore::setModifiedWOrefresh() |
863 | { | 863 | { |
864 | // qDebug("KABCore::setModifiedWOrefresh() "); | 864 | // qDebug("KABCore::setModifiedWOrefresh() "); |
865 | mModified = true; | 865 | mModified = true; |
866 | mActionSave->setEnabled( mModified ); | 866 | mActionSave->setEnabled( mModified ); |
867 | #ifdef DESKTOP_VERSION | 867 | #ifdef DESKTOP_VERSION |
868 | mDetails->refreshView(); | 868 | mDetails->refreshView(); |
869 | #endif | 869 | #endif |
870 | 870 | ||
871 | } | 871 | } |
872 | void KABCore::setModified( bool modified ) | 872 | void KABCore::setModified( bool modified ) |
873 | { | 873 | { |
874 | mModified = modified; | 874 | mModified = modified; |
875 | mActionSave->setEnabled( mModified ); | 875 | mActionSave->setEnabled( mModified ); |
876 | 876 | ||
877 | if ( modified ) | 877 | if ( modified ) |
878 | mJumpButtonBar->recreateButtons(); | 878 | mJumpButtonBar->recreateButtons(); |
879 | 879 | ||
880 | mViewManager->refreshView(); | 880 | mViewManager->refreshView(); |
881 | mDetails->refreshView(); | 881 | mDetails->refreshView(); |
882 | 882 | ||
883 | } | 883 | } |
884 | 884 | ||
885 | bool KABCore::modified() const | 885 | bool KABCore::modified() const |
886 | { | 886 | { |
887 | return mModified; | 887 | return mModified; |
888 | } | 888 | } |
889 | 889 | ||
890 | void KABCore::contactModified( const KABC::Addressee &addr ) | 890 | void KABCore::contactModified( const KABC::Addressee &addr ) |
891 | { | 891 | { |
892 | 892 | ||
893 | Command *command = 0; | 893 | Command *command = 0; |
894 | QString uid; | 894 | QString uid; |
895 | 895 | ||
896 | // check if it exists already | 896 | // check if it exists already |
897 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 897 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
898 | if ( origAddr.isEmpty() ) | 898 | if ( origAddr.isEmpty() ) |
899 | command = new PwNewCommand( mAddressBook, addr ); | 899 | command = new PwNewCommand( mAddressBook, addr ); |
900 | else { | 900 | else { |
901 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 901 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
902 | uid = addr.uid(); | 902 | uid = addr.uid(); |
903 | } | 903 | } |
904 | 904 | ||
905 | UndoStack::instance()->push( command ); | 905 | UndoStack::instance()->push( command ); |
906 | RedoStack::instance()->clear(); | 906 | RedoStack::instance()->clear(); |
907 | 907 | ||
908 | setModified( true ); | 908 | setModified( true ); |
909 | } | 909 | } |
910 | 910 | ||
911 | void KABCore::newContact() | 911 | void KABCore::newContact() |
912 | { | 912 | { |
913 | 913 | ||
914 | 914 | ||
915 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 915 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
916 | 916 | ||
917 | QPtrList<KRES::Resource> kresResources; | 917 | QPtrList<KRES::Resource> kresResources; |
918 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 918 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
919 | KABC::Resource *resource; | 919 | KABC::Resource *resource; |
920 | while ( ( resource = it.current() ) != 0 ) { | 920 | while ( ( resource = it.current() ) != 0 ) { |
921 | ++it; | 921 | ++it; |
922 | if ( !resource->readOnly() ) { | 922 | if ( !resource->readOnly() ) { |
923 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 923 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
924 | if ( res ) | 924 | if ( res ) |
925 | kresResources.append( res ); | 925 | kresResources.append( res ); |
926 | } | 926 | } |
927 | } | 927 | } |
928 | 928 | ||
929 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 929 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
930 | resource = static_cast<KABC::Resource*>( res ); | 930 | resource = static_cast<KABC::Resource*>( res ); |
931 | 931 | ||
932 | if ( resource ) { | 932 | if ( resource ) { |
933 | KABC::Addressee addr; | 933 | KABC::Addressee addr; |
934 | addr.setResource( resource ); | 934 | addr.setResource( resource ); |
935 | mEditorDialog->setAddressee( addr ); | 935 | mEditorDialog->setAddressee( addr ); |
936 | KApplication::execDialog ( mEditorDialog ); | 936 | KApplication::execDialog ( mEditorDialog ); |
937 | 937 | ||
938 | } else | 938 | } else |
939 | return; | 939 | return; |
940 | 940 | ||
941 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 941 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
942 | 942 | ||
943 | 943 | ||
944 | } | 944 | } |
945 | 945 | ||
946 | void KABCore::addEmail( QString aStr ) | 946 | void KABCore::addEmail( QString aStr ) |
947 | { | 947 | { |
948 | #ifndef KAB_EMBEDDED | 948 | #ifndef KAB_EMBEDDED |
949 | QString fullName, email; | 949 | QString fullName, email; |
950 | 950 | ||
951 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 951 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
952 | 952 | ||
953 | // Try to lookup the addressee matching the email address | 953 | // Try to lookup the addressee matching the email address |
954 | bool found = false; | 954 | bool found = false; |
955 | QStringList emailList; | 955 | QStringList emailList; |
956 | KABC::AddressBook::Iterator it; | 956 | KABC::AddressBook::Iterator it; |
957 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 957 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
958 | emailList = (*it).emails(); | 958 | emailList = (*it).emails(); |
959 | if ( emailList.contains( email ) > 0 ) { | 959 | if ( emailList.contains( email ) > 0 ) { |
960 | found = true; | 960 | found = true; |
961 | (*it).setNameFromString( fullName ); | 961 | (*it).setNameFromString( fullName ); |
962 | editContact( (*it).uid() ); | 962 | editContact( (*it).uid() ); |
963 | } | 963 | } |
964 | } | 964 | } |
965 | 965 | ||
966 | if ( !found ) { | 966 | if ( !found ) { |
967 | KABC::Addressee addr; | 967 | KABC::Addressee addr; |
968 | addr.setNameFromString( fullName ); | 968 | addr.setNameFromString( fullName ); |
969 | addr.insertEmail( email, true ); | 969 | addr.insertEmail( email, true ); |
970 | 970 | ||
971 | mAddressBook->insertAddressee( addr ); | 971 | mAddressBook->insertAddressee( addr ); |
972 | mViewManager->refreshView( addr.uid() ); | 972 | mViewManager->refreshView( addr.uid() ); |
973 | editContact( addr.uid() ); | 973 | editContact( addr.uid() ); |
974 | } | 974 | } |
975 | #else //KAB_EMBEDDED | 975 | #else //KAB_EMBEDDED |
976 | qDebug("KABCore::addEmail finsih method"); | 976 | qDebug("KABCore::addEmail finsih method"); |
977 | #endif //KAB_EMBEDDED | 977 | #endif //KAB_EMBEDDED |
978 | } | 978 | } |
979 | 979 | ||
980 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 980 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
981 | { | 981 | { |
982 | mXXPortManager->importVCard( url, showPreview ); | 982 | mXXPortManager->importVCard( url, showPreview ); |
983 | } | 983 | } |
984 | void KABCore::importFromOL() | 984 | void KABCore::importFromOL() |
985 | { | 985 | { |
986 | #ifdef _WIN32_ | 986 | #ifdef _WIN32_ |
987 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 987 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
988 | idgl->exec(); | 988 | idgl->exec(); |
989 | KABC::Addressee::List list = idgl->getAddressList(); | 989 | KABC::Addressee::List list = idgl->getAddressList(); |
990 | if ( list.count() > 0 ) { | 990 | if ( list.count() > 0 ) { |
991 | KABC::Addressee::List listNew; | 991 | KABC::Addressee::List listNew; |
992 | KABC::Addressee::List listExisting; | 992 | KABC::Addressee::List listExisting; |
993 | KABC::Addressee::List::Iterator it; | 993 | KABC::Addressee::List::Iterator it; |
994 | KABC::AddressBook::Iterator iter; | 994 | KABC::AddressBook::Iterator iter; |
995 | for ( it = list.begin(); it != list.end(); ++it ) { | 995 | for ( it = list.begin(); it != list.end(); ++it ) { |
996 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 996 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
997 | listNew.append( (*it) ); | 997 | listNew.append( (*it) ); |
998 | else | 998 | else |
999 | listExisting.append( (*it) ); | 999 | listExisting.append( (*it) ); |
1000 | } | 1000 | } |
1001 | if ( listExisting.count() > 0 ) | 1001 | if ( listExisting.count() > 0 ) |
1002 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1002 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1003 | if ( listNew.count() > 0 ) { | 1003 | if ( listNew.count() > 0 ) { |
1004 | pasteWithNewUid = false; | 1004 | pasteWithNewUid = false; |
1005 | pasteContacts( listNew ); | 1005 | pasteContacts( listNew ); |
1006 | pasteWithNewUid = true; | 1006 | pasteWithNewUid = true; |
1007 | } | 1007 | } |
1008 | } | 1008 | } |
1009 | delete idgl; | 1009 | delete idgl; |
1010 | #endif | 1010 | #endif |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1013 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1014 | { | 1014 | { |
1015 | mXXPortManager->importVCard( vCard, showPreview ); | 1015 | mXXPortManager->importVCard( vCard, showPreview ); |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | //US added a second method without defaultparameter | 1018 | //US added a second method without defaultparameter |
1019 | void KABCore::editContact2() { | 1019 | void KABCore::editContact2() { |
1020 | editContact( QString::null ); | 1020 | editContact( QString::null ); |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | void KABCore::editContact( const QString &uid ) | 1023 | void KABCore::editContact( const QString &uid ) |
1024 | { | 1024 | { |
1025 | 1025 | ||
1026 | if ( mExtensionManager->isQuickEditVisible() ) | 1026 | if ( mExtensionManager->isQuickEditVisible() ) |
1027 | return; | 1027 | return; |
1028 | 1028 | ||
1029 | // First, locate the contact entry | 1029 | // First, locate the contact entry |
1030 | QString localUID = uid; | 1030 | QString localUID = uid; |
1031 | if ( localUID.isNull() ) { | 1031 | if ( localUID.isNull() ) { |
1032 | QStringList uidList = mViewManager->selectedUids(); | 1032 | QStringList uidList = mViewManager->selectedUids(); |
1033 | if ( uidList.count() > 0 ) | 1033 | if ( uidList.count() > 0 ) |
1034 | localUID = *( uidList.at( 0 ) ); | 1034 | localUID = *( uidList.at( 0 ) ); |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1037 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1038 | if ( !addr.isEmpty() ) { | 1038 | if ( !addr.isEmpty() ) { |
1039 | mEditorDialog->setAddressee( addr ); | 1039 | mEditorDialog->setAddressee( addr ); |
1040 | KApplication::execDialog ( mEditorDialog ); | 1040 | KApplication::execDialog ( mEditorDialog ); |
1041 | } | 1041 | } |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | /** | 1044 | /** |
1045 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1045 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1046 | the method will try to find a selected addressee in the view. | 1046 | the method will try to find a selected addressee in the view. |
1047 | */ | 1047 | */ |
1048 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1048 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1049 | { | 1049 | { |
1050 | if ( mMultipleViewsAtOnce ) | 1050 | if ( mMultipleViewsAtOnce ) |
1051 | { | 1051 | { |
1052 | editContact( uid ); | 1052 | editContact( uid ); |
1053 | } | 1053 | } |
1054 | else | 1054 | else |
1055 | { | 1055 | { |
1056 | setDetailsVisible( true ); | 1056 | setDetailsVisible( true ); |
1057 | mActionDetails->setChecked(true); | 1057 | mActionDetails->setChecked(true); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | void KABCore::save() | 1062 | void KABCore::save() |
1063 | { | 1063 | { |
1064 | if ( !mModified ) | 1064 | if ( !mModified ) |
1065 | return; | 1065 | return; |
1066 | QString text = i18n( "There was an error while attempting to save\n the " | 1066 | QString text = i18n( "There was an error while attempting to save\n the " |
1067 | "address book. Please check that some \nother application is " | 1067 | "address book. Please check that some \nother application is " |
1068 | "not using it. " ); | 1068 | "not using it. " ); |
1069 | statusMessage(i18n("Saving addressbook ... ")); | 1069 | statusMessage(i18n("Saving addressbook ... ")); |
1070 | #ifndef KAB_EMBEDDED | 1070 | #ifndef KAB_EMBEDDED |
1071 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1071 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1072 | if ( !b || !b->save() ) { | 1072 | if ( !b || !b->save() ) { |
1073 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1073 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1074 | } | 1074 | } |
1075 | #else //KAB_EMBEDDED | 1075 | #else //KAB_EMBEDDED |
1076 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1076 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1077 | if ( !b || !b->save() ) { | 1077 | if ( !b || !b->save() ) { |
1078 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1078 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1079 | } | 1079 | } |
1080 | #endif //KAB_EMBEDDED | 1080 | #endif //KAB_EMBEDDED |
1081 | 1081 | ||
1082 | statusMessage(i18n("Addressbook saved!")); | 1082 | statusMessage(i18n("Addressbook saved!")); |
1083 | setModified( false ); | 1083 | setModified( false ); |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | void KABCore::statusMessage(QString mess , int time ) | 1086 | void KABCore::statusMessage(QString mess , int time ) |
1087 | { | 1087 | { |
1088 | //topLevelWidget()->setCaption( mess ); | 1088 | //topLevelWidget()->setCaption( mess ); |
1089 | // pending setting timer to revome message | 1089 | // pending setting timer to revome message |
1090 | } | 1090 | } |
1091 | void KABCore::undo() | 1091 | void KABCore::undo() |
1092 | { | 1092 | { |
1093 | UndoStack::instance()->undo(); | 1093 | UndoStack::instance()->undo(); |
1094 | 1094 | ||
1095 | // Refresh the view | 1095 | // Refresh the view |
1096 | mViewManager->refreshView(); | 1096 | mViewManager->refreshView(); |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | void KABCore::redo() | 1099 | void KABCore::redo() |
1100 | { | 1100 | { |
1101 | RedoStack::instance()->redo(); | 1101 | RedoStack::instance()->redo(); |
1102 | 1102 | ||
1103 | // Refresh the view | 1103 | // Refresh the view |
1104 | mViewManager->refreshView(); | 1104 | mViewManager->refreshView(); |
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1107 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1108 | { | 1108 | { |
1109 | if (mMultipleViewsAtOnce) | 1109 | if (mMultipleViewsAtOnce) |
1110 | { | 1110 | { |
1111 | if ( visible ) | 1111 | if ( visible ) |
1112 | mJumpButtonBar->show(); | 1112 | mJumpButtonBar->show(); |
1113 | else | 1113 | else |
1114 | mJumpButtonBar->hide(); | 1114 | mJumpButtonBar->hide(); |
1115 | } | 1115 | } |
1116 | else | 1116 | else |
1117 | { | 1117 | { |
1118 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1118 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1119 | if (mViewManager->isVisible()) | 1119 | if (mViewManager->isVisible()) |
1120 | { | 1120 | { |
1121 | if ( visible ) | 1121 | if ( visible ) |
1122 | mJumpButtonBar->show(); | 1122 | mJumpButtonBar->show(); |
1123 | else | 1123 | else |
1124 | mJumpButtonBar->hide(); | 1124 | mJumpButtonBar->hide(); |
1125 | } | 1125 | } |
1126 | else | 1126 | else |
1127 | { | 1127 | { |
1128 | mJumpButtonBar->hide(); | 1128 | mJumpButtonBar->hide(); |
1129 | } | 1129 | } |
1130 | } | 1130 | } |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | 1133 | ||
1134 | void KABCore::setDetailsToState() | 1134 | void KABCore::setDetailsToState() |
1135 | { | 1135 | { |
1136 | setDetailsVisible( mActionDetails->isChecked() ); | 1136 | setDetailsVisible( mActionDetails->isChecked() ); |
1137 | } | 1137 | } |
1138 | 1138 | ||
1139 | 1139 | ||
1140 | 1140 | ||
1141 | void KABCore::setDetailsVisible( bool visible ) | 1141 | void KABCore::setDetailsVisible( bool visible ) |
1142 | { | 1142 | { |
1143 | if (visible && mDetails->isHidden()) | 1143 | if (visible && mDetails->isHidden()) |
1144 | { | 1144 | { |
1145 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1145 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1146 | if ( addrList.count() > 0 ) | 1146 | if ( addrList.count() > 0 ) |
1147 | mDetails->setAddressee( addrList[ 0 ] ); | 1147 | mDetails->setAddressee( addrList[ 0 ] ); |
1148 | } | 1148 | } |
1149 | 1149 | ||
1150 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1150 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1151 | // the listview and the detailview. We do that by changing the splitbar size. | 1151 | // the listview and the detailview. We do that by changing the splitbar size. |
1152 | if (mMultipleViewsAtOnce) | 1152 | if (mMultipleViewsAtOnce) |
1153 | { | 1153 | { |
1154 | if ( visible ) | 1154 | if ( visible ) |
1155 | mDetails->show(); | 1155 | mDetails->show(); |
1156 | else | 1156 | else |
1157 | mDetails->hide(); | 1157 | mDetails->hide(); |
1158 | } | 1158 | } |
1159 | else | 1159 | else |
1160 | { | 1160 | { |
1161 | if ( visible ) { | 1161 | if ( visible ) { |
1162 | mViewManager->hide(); | 1162 | mViewManager->hide(); |
1163 | mDetails->show(); | 1163 | mDetails->show(); |
1164 | } | 1164 | } |
1165 | else { | 1165 | else { |
1166 | mViewManager->show(); | 1166 | mViewManager->show(); |
1167 | mDetails->hide(); | 1167 | mDetails->hide(); |
1168 | } | 1168 | } |
1169 | setJumpButtonBarVisible( !visible ); | 1169 | setJumpButtonBarVisible( !visible ); |
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | void KABCore::extensionChanged( int id ) | 1174 | void KABCore::extensionChanged( int id ) |
1175 | { | 1175 | { |
1176 | //change the details view only for non desktop systems | 1176 | //change the details view only for non desktop systems |
1177 | #ifndef DESKTOP_VERSION | 1177 | #ifndef DESKTOP_VERSION |
1178 | 1178 | ||
1179 | if (id == 0) | 1179 | if (id == 0) |
1180 | { | 1180 | { |
1181 | //the user disabled the extension. | 1181 | //the user disabled the extension. |
1182 | 1182 | ||
1183 | if (mMultipleViewsAtOnce) | 1183 | if (mMultipleViewsAtOnce) |
1184 | { // enable detailsview again | 1184 | { // enable detailsview again |
1185 | setDetailsVisible( true ); | 1185 | setDetailsVisible( true ); |
1186 | mActionDetails->setChecked( true ); | 1186 | mActionDetails->setChecked( true ); |
1187 | } | 1187 | } |
1188 | else | 1188 | else |
1189 | { //go back to the listview | 1189 | { //go back to the listview |
1190 | setDetailsVisible( false ); | 1190 | setDetailsVisible( false ); |
1191 | mActionDetails->setChecked( false ); | 1191 | mActionDetails->setChecked( false ); |
1192 | mActionDetails->setEnabled(true); | 1192 | mActionDetails->setEnabled(true); |
1193 | } | 1193 | } |
1194 | 1194 | ||
1195 | } | 1195 | } |
1196 | else | 1196 | else |
1197 | { | 1197 | { |
1198 | //the user enabled the extension. | 1198 | //the user enabled the extension. |
1199 | setDetailsVisible( false ); | 1199 | setDetailsVisible( false ); |
1200 | mActionDetails->setChecked( false ); | 1200 | mActionDetails->setChecked( false ); |
1201 | 1201 | ||
1202 | if (!mMultipleViewsAtOnce) | 1202 | if (!mMultipleViewsAtOnce) |
1203 | { | 1203 | { |
1204 | mActionDetails->setEnabled(false); | 1204 | mActionDetails->setEnabled(false); |
1205 | } | 1205 | } |
1206 | 1206 | ||
1207 | mExtensionManager->setSelectionChanged(); | 1207 | mExtensionManager->setSelectionChanged(); |
1208 | 1208 | ||
1209 | } | 1209 | } |
1210 | 1210 | ||
1211 | #endif// DESKTOP_VERSION | 1211 | #endif// DESKTOP_VERSION |
1212 | 1212 | ||
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | 1215 | ||
1216 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1216 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1217 | { | 1217 | { |
1218 | 1218 | ||
1219 | if ( list.count() != 0 ) { | 1219 | if ( list.count() != 0 ) { |
1220 | KABC::Addressee::List::ConstIterator it; | 1220 | KABC::Addressee::List::ConstIterator it; |
1221 | for ( it = list.begin(); it != list.end(); ++it ) | 1221 | for ( it = list.begin(); it != list.end(); ++it ) |
1222 | mAddressBook->insertAddressee( *it ); | 1222 | mAddressBook->insertAddressee( *it ); |
1223 | if ( list.count() > 1 ) | 1223 | if ( list.count() > 1 ) |
1224 | setModified(); | 1224 | setModified(); |
1225 | else | 1225 | else |
1226 | setModifiedWOrefresh(); | 1226 | setModifiedWOrefresh(); |
1227 | } | 1227 | } |
1228 | if ( list.count() == 0 ) | 1228 | if ( list.count() == 0 ) |
1229 | mViewManager->refreshView(); | 1229 | mViewManager->refreshView(); |
1230 | else | 1230 | else |
1231 | mViewManager->refreshView( list[ 0 ].uid() ); | 1231 | mViewManager->refreshView( list[ 0 ].uid() ); |
1232 | 1232 | ||
1233 | 1233 | ||
1234 | 1234 | ||
1235 | } | 1235 | } |
1236 | 1236 | ||
1237 | QString KABCore::getNameByPhone( const QString &phone ) | 1237 | QString KABCore::getNameByPhone( const QString &phone ) |
1238 | { | 1238 | { |
1239 | #ifndef KAB_EMBEDDED | 1239 | #ifndef KAB_EMBEDDED |
1240 | QRegExp r( "[/*/-/ ]" ); | 1240 | QRegExp r( "[/*/-/ ]" ); |
1241 | QString localPhone( phone ); | 1241 | QString localPhone( phone ); |
1242 | 1242 | ||
1243 | bool found = false; | 1243 | bool found = false; |
1244 | QString ownerName = ""; | 1244 | QString ownerName = ""; |
1245 | KABC::AddressBook::Iterator iter; | 1245 | KABC::AddressBook::Iterator iter; |
1246 | KABC::PhoneNumber::List::Iterator phoneIter; | 1246 | KABC::PhoneNumber::List::Iterator phoneIter; |
1247 | KABC::PhoneNumber::List phoneList; | 1247 | KABC::PhoneNumber::List phoneList; |
1248 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1248 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1249 | phoneList = (*iter).phoneNumbers(); | 1249 | phoneList = (*iter).phoneNumbers(); |
1250 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1250 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1251 | ++phoneIter) { | 1251 | ++phoneIter) { |
1252 | // Get rid of separator chars so just the numbers are compared. | 1252 | // Get rid of separator chars so just the numbers are compared. |
1253 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1253 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1254 | ownerName = (*iter).formattedName(); | 1254 | ownerName = (*iter).formattedName(); |
1255 | found = true; | 1255 | found = true; |
1256 | } | 1256 | } |
1257 | } | 1257 | } |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | return ownerName; | 1260 | return ownerName; |
1261 | #else //KAB_EMBEDDED | 1261 | #else //KAB_EMBEDDED |
1262 | qDebug("KABCore::getNameByPhone finsih method"); | 1262 | qDebug("KABCore::getNameByPhone finsih method"); |
1263 | return ""; | 1263 | return ""; |
1264 | #endif //KAB_EMBEDDED | 1264 | #endif //KAB_EMBEDDED |
1265 | 1265 | ||
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | void KABCore::openConfigDialog() | 1268 | void KABCore::openConfigDialog() |
1269 | { | 1269 | { |
1270 | KABPrefs* kab_prefs = KABPrefs::instance(); | 1270 | KABPrefs* kab_prefs = KABPrefs::instance(); |
1271 | KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); | 1271 | KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); |
1272 | 1272 | ||
1273 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1273 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1274 | KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1274 | KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1275 | ConfigureDialog->addModule(kabcfg ); | 1275 | ConfigureDialog->addModule(kabcfg ); |
1276 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1276 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1277 | ConfigureDialog->addModule(kdelibcfg ); | 1277 | ConfigureDialog->addModule(kdelibcfg ); |
1278 | 1278 | ||
1279 | 1279 | ||
1280 | 1280 | ||
1281 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1281 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1282 | this, SLOT( configurationChanged() ) ); | 1282 | this, SLOT( configurationChanged() ) ); |
1283 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1283 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1284 | this, SLOT( configurationChanged() ) ); | 1284 | this, SLOT( configurationChanged() ) ); |
1285 | saveSettings(); | 1285 | saveSettings(); |
1286 | #ifndef DESKTOP_VERSION | 1286 | #ifndef DESKTOP_VERSION |
1287 | ConfigureDialog->showMaximized(); | 1287 | ConfigureDialog->showMaximized(); |
1288 | #endif | 1288 | #endif |
1289 | if ( ConfigureDialog->exec() ) | 1289 | if ( ConfigureDialog->exec() ) |
1290 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1290 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1291 | delete ConfigureDialog; | 1291 | delete ConfigureDialog; |
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | void KABCore::openLDAPDialog() | 1294 | void KABCore::openLDAPDialog() |
1295 | { | 1295 | { |
1296 | #ifndef KAB_EMBEDDED | 1296 | #ifndef KAB_EMBEDDED |
1297 | if ( !mLdapSearchDialog ) { | 1297 | if ( !mLdapSearchDialog ) { |
1298 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1298 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1299 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1299 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1300 | SLOT( refreshView() ) ); | 1300 | SLOT( refreshView() ) ); |
1301 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1301 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1302 | SLOT( setModified() ) ); | 1302 | SLOT( setModified() ) ); |
1303 | } else | 1303 | } else |
1304 | mLdapSearchDialog->restoreSettings(); | 1304 | mLdapSearchDialog->restoreSettings(); |
1305 | 1305 | ||
1306 | if ( mLdapSearchDialog->isOK() ) | 1306 | if ( mLdapSearchDialog->isOK() ) |
1307 | mLdapSearchDialog->exec(); | 1307 | mLdapSearchDialog->exec(); |
1308 | #else //KAB_EMBEDDED | 1308 | #else //KAB_EMBEDDED |
1309 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1309 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1310 | #endif //KAB_EMBEDDED | 1310 | #endif //KAB_EMBEDDED |
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | void KABCore::print() | 1313 | void KABCore::print() |
1314 | { | 1314 | { |
1315 | #ifndef KAB_EMBEDDED | 1315 | #ifndef KAB_EMBEDDED |
1316 | KPrinter printer; | 1316 | KPrinter printer; |
1317 | if ( !printer.setup( this ) ) | 1317 | if ( !printer.setup( this ) ) |
1318 | return; | 1318 | return; |
1319 | 1319 | ||
1320 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1320 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1321 | mViewManager->selectedUids(), this ); | 1321 | mViewManager->selectedUids(), this ); |
1322 | 1322 | ||
1323 | wizard.exec(); | 1323 | wizard.exec(); |
1324 | #else //KAB_EMBEDDED | 1324 | #else //KAB_EMBEDDED |
1325 | qDebug("KABCore::print() finsih method"); | 1325 | qDebug("KABCore::print() finsih method"); |
1326 | #endif //KAB_EMBEDDED | 1326 | #endif //KAB_EMBEDDED |
1327 | 1327 | ||
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | 1330 | ||
1331 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1331 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1332 | { | 1332 | { |
1333 | if ( mGUIClient ) | 1333 | if ( mGUIClient ) |
1334 | mGUIClient->insertChildClient( client ); | 1334 | mGUIClient->insertChildClient( client ); |
1335 | else | 1335 | else |
1336 | KMessageBox::error( this, "no KXMLGUICLient"); | 1336 | KMessageBox::error( this, "no KXMLGUICLient"); |
1337 | } | 1337 | } |
1338 | 1338 | ||
1339 | 1339 | ||
1340 | void KABCore::configurationChanged() | 1340 | void KABCore::configurationChanged() |
1341 | { | 1341 | { |
1342 | mExtensionManager->reconfigure(); | 1342 | mExtensionManager->reconfigure(); |
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | void KABCore::addressBookChanged() | 1345 | void KABCore::addressBookChanged() |
1346 | { | 1346 | { |
1347 | /*US | 1347 | /*US |
1348 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1348 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1349 | while ( it.current() ) { | 1349 | while ( it.current() ) { |
1350 | if ( it.current()->dirty() ) { | 1350 | if ( it.current()->dirty() ) { |
1351 | QString text = i18n( "Data has been changed externally. Unsaved " | 1351 | QString text = i18n( "Data has been changed externally. Unsaved " |
1352 | "changes will be lost." ); | 1352 | "changes will be lost." ); |
1353 | KMessageBox::information( this, text ); | 1353 | KMessageBox::information( this, text ); |
1354 | } | 1354 | } |
1355 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1355 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1356 | ++it; | 1356 | ++it; |
1357 | } | 1357 | } |
1358 | */ | 1358 | */ |
1359 | if (mEditorDialog) | 1359 | if (mEditorDialog) |
1360 | { | 1360 | { |
1361 | if (mEditorDialog->dirty()) | 1361 | if (mEditorDialog->dirty()) |
1362 | { | 1362 | { |
1363 | QString text = i18n( "Data has been changed externally. Unsaved " | 1363 | QString text = i18n( "Data has been changed externally. Unsaved " |
1364 | "changes will be lost." ); | 1364 | "changes will be lost." ); |
1365 | KMessageBox::information( this, text ); | 1365 | KMessageBox::information( this, text ); |
1366 | } | 1366 | } |
1367 | QString currentuid = mEditorDialog->addressee().uid(); | 1367 | QString currentuid = mEditorDialog->addressee().uid(); |
1368 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1368 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1369 | } | 1369 | } |
1370 | mViewManager->refreshView(); | 1370 | mViewManager->refreshView(); |
1371 | // mDetails->refreshView(); | 1371 | // mDetails->refreshView(); |
1372 | 1372 | ||
1373 | 1373 | ||
1374 | } | 1374 | } |
1375 | 1375 | ||
1376 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1376 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1377 | const char *name ) | 1377 | const char *name ) |
1378 | { | 1378 | { |
1379 | 1379 | ||
1380 | if ( mEditorDialog == 0 ) { | 1380 | if ( mEditorDialog == 0 ) { |
1381 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1381 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1382 | name ? name : "editorDialog" ); | 1382 | name ? name : "editorDialog" ); |
1383 | 1383 | ||
1384 | 1384 | ||
1385 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1385 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1386 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1386 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1387 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1387 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1388 | // SLOT( slotEditorDestroyed( const QString& ) ) ; | 1388 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | return mEditorDialog; | 1391 | return mEditorDialog; |
1392 | } | 1392 | } |
1393 | 1393 | ||
1394 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1394 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1395 | { | 1395 | { |
1396 | //mEditorDict.remove( uid ); | 1396 | //mEditorDict.remove( uid ); |
1397 | } | 1397 | } |
1398 | 1398 | ||
1399 | void KABCore::initGUI() | 1399 | void KABCore::initGUI() |
1400 | { | 1400 | { |
1401 | #ifndef KAB_EMBEDDED | 1401 | #ifndef KAB_EMBEDDED |
1402 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1402 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1403 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1403 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1404 | 1404 | ||
1405 | mExtensionBarSplitter = new QSplitter( this ); | 1405 | mExtensionBarSplitter = new QSplitter( this ); |
1406 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1406 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1407 | 1407 | ||
1408 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1408 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1409 | 1409 | ||
1410 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1410 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1411 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1411 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1412 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1412 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1413 | SLOT( incrementalSearch( const QString& ) ) ); | 1413 | SLOT( incrementalSearch( const QString& ) ) ); |
1414 | 1414 | ||
1415 | mViewManager = new ViewManager( this, viewSpace ); | 1415 | mViewManager = new ViewManager( this, viewSpace ); |
1416 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1416 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1417 | 1417 | ||
1418 | mDetails = new ViewContainer( mDetailsSplitter ); | 1418 | mDetails = new ViewContainer( mDetailsSplitter ); |
1419 | 1419 | ||
1420 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1420 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1421 | 1421 | ||
1422 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1422 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1423 | 1423 | ||
1424 | topLayout->addWidget( mExtensionBarSplitter ); | 1424 | topLayout->addWidget( mExtensionBarSplitter ); |
1425 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1425 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1426 | topLayout->addWidget( mJumpButtonBar ); | 1426 | topLayout->addWidget( mJumpButtonBar ); |
1427 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1427 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1428 | 1428 | ||
1429 | mXXPortManager = new XXPortManager( this, this ); | 1429 | mXXPortManager = new XXPortManager( this, this ); |
1430 | 1430 | ||
1431 | #else //KAB_EMBEDDED | 1431 | #else //KAB_EMBEDDED |
1432 | //US initialize viewMenu before settingup viewmanager. | 1432 | //US initialize viewMenu before settingup viewmanager. |
1433 | // Viewmanager needs this menu to plugin submenues. | 1433 | // Viewmanager needs this menu to plugin submenues. |
1434 | viewMenu = new QPopupMenu( this ); | 1434 | viewMenu = new QPopupMenu( this ); |
1435 | settingsMenu = new QPopupMenu( this ); | 1435 | settingsMenu = new QPopupMenu( this ); |
1436 | //filterMenu = new QPopupMenu( this ); | 1436 | //filterMenu = new QPopupMenu( this ); |
1437 | ImportMenu = new QPopupMenu( this ); | 1437 | ImportMenu = new QPopupMenu( this ); |
1438 | ExportMenu = new QPopupMenu( this ); | 1438 | ExportMenu = new QPopupMenu( this ); |
1439 | 1439 | ||
1440 | changeMenu= new QPopupMenu( this ); | 1440 | changeMenu= new QPopupMenu( this ); |
1441 | 1441 | ||
1442 | //US since we have no splitter for the embedded system, setup | 1442 | //US since we have no splitter for the embedded system, setup |
1443 | // a layout with two frames. One left and one right. | 1443 | // a layout with two frames. One left and one right. |
1444 | 1444 | ||
1445 | QBoxLayout *topLayout; | 1445 | QBoxLayout *topLayout; |
1446 | 1446 | ||
1447 | // = new QHBoxLayout( this ); | 1447 | // = new QHBoxLayout( this ); |
1448 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1448 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1449 | 1449 | ||
1450 | // QWidget *mainBox = new QWidget( this ); | 1450 | // QWidget *mainBox = new QWidget( this ); |
1451 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1451 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1452 | 1452 | ||
1453 | #ifdef DESKTOP_VERSION | 1453 | #ifdef DESKTOP_VERSION |
1454 | topLayout = new QHBoxLayout( this ); | 1454 | topLayout = new QHBoxLayout( this ); |
1455 | 1455 | ||
1456 | 1456 | ||
1457 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1457 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1458 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1458 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1459 | 1459 | ||
1460 | topLayout->addWidget(mMiniSplitter ); | 1460 | topLayout->addWidget(mMiniSplitter ); |
1461 | 1461 | ||
1462 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1462 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1463 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1463 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1464 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1464 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1465 | mDetails = new ViewContainer( mMiniSplitter ); | 1465 | mDetails = new ViewContainer( mMiniSplitter ); |
1466 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1466 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1467 | #else | 1467 | #else |
1468 | if ( QApplication::desktop()->width() > 480 ) { | 1468 | if ( QApplication::desktop()->width() > 480 ) { |
1469 | topLayout = new QHBoxLayout( this ); | 1469 | topLayout = new QHBoxLayout( this ); |
1470 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1470 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1471 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1471 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1472 | } else { | 1472 | } else { |
1473 | 1473 | ||
1474 | topLayout = new QHBoxLayout( this ); | 1474 | topLayout = new QHBoxLayout( this ); |
1475 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1475 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1476 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1476 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1477 | } | 1477 | } |
1478 | 1478 | ||
1479 | topLayout->addWidget(mMiniSplitter ); | 1479 | topLayout->addWidget(mMiniSplitter ); |
1480 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1480 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1481 | mDetails = new ViewContainer( mMiniSplitter ); | 1481 | mDetails = new ViewContainer( mMiniSplitter ); |
1482 | 1482 | ||
1483 | 1483 | ||
1484 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1484 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1485 | #endif | 1485 | #endif |
1486 | //eh->hide(); | 1486 | //eh->hide(); |
1487 | // topLayout->addWidget(mExtensionManager ); | 1487 | // topLayout->addWidget(mExtensionManager ); |
1488 | 1488 | ||
1489 | 1489 | ||
1490 | /*US | 1490 | /*US |
1491 | #ifndef KAB_NOSPLITTER | 1491 | #ifndef KAB_NOSPLITTER |
1492 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1492 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1493 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1493 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1494 | topLayout->setSpacing( 10 ); | 1494 | topLayout->setSpacing( 10 ); |
1495 | 1495 | ||
1496 | mDetailsSplitter = new QSplitter( this ); | 1496 | mDetailsSplitter = new QSplitter( this ); |
1497 | 1497 | ||
1498 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1498 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1499 | 1499 | ||
1500 | mViewManager = new ViewManager( this, viewSpace ); | 1500 | mViewManager = new ViewManager( this, viewSpace ); |
1501 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1501 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1502 | 1502 | ||
1503 | mDetails = new ViewContainer( mDetailsSplitter ); | 1503 | mDetails = new ViewContainer( mDetailsSplitter ); |
1504 | 1504 | ||
1505 | topLayout->addWidget( mDetailsSplitter ); | 1505 | topLayout->addWidget( mDetailsSplitter ); |
1506 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1506 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1507 | #else //KAB_NOSPLITTER | 1507 | #else //KAB_NOSPLITTER |
1508 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1508 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1509 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1509 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1510 | topLayout->setSpacing( 10 ); | 1510 | topLayout->setSpacing( 10 ); |
1511 | 1511 | ||
1512 | // mDetailsSplitter = new QSplitter( this ); | 1512 | // mDetailsSplitter = new QSplitter( this ); |
1513 | 1513 | ||
1514 | QVBox *viewSpace = new QVBox( this ); | 1514 | QVBox *viewSpace = new QVBox( this ); |
1515 | 1515 | ||
1516 | mViewManager = new ViewManager( this, viewSpace ); | 1516 | mViewManager = new ViewManager( this, viewSpace ); |
1517 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1517 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1518 | 1518 | ||
1519 | mDetails = new ViewContainer( this ); | 1519 | mDetails = new ViewContainer( this ); |
1520 | 1520 | ||
1521 | topLayout->addWidget( viewSpace ); | 1521 | topLayout->addWidget( viewSpace ); |
1522 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1522 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1523 | topLayout->addWidget( mDetails ); | 1523 | topLayout->addWidget( mDetails ); |
1524 | #endif //KAB_NOSPLITTER | 1524 | #endif //KAB_NOSPLITTER |
1525 | */ | 1525 | */ |
1526 | 1526 | ||
1527 | 1527 | ||
1528 | #endif //KAB_EMBEDDED | 1528 | #endif //KAB_EMBEDDED |
1529 | initActions(); | 1529 | initActions(); |
1530 | 1530 | ||
1531 | #ifdef KAB_EMBEDDED | 1531 | #ifdef KAB_EMBEDDED |
1532 | addActionsManually(); | 1532 | addActionsManually(); |
1533 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1533 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1534 | mXXPortManager = new XXPortManager( this, this ); | 1534 | mXXPortManager = new XXPortManager( this, this ); |
1535 | 1535 | ||
1536 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1536 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1537 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1537 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1538 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1538 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1539 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1539 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1540 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1540 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1541 | // mIncSearchWidget->hide(); | 1541 | // mIncSearchWidget->hide(); |
1542 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1542 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1543 | SLOT( incrementalSearch( const QString& ) ) ); | 1543 | SLOT( incrementalSearch( const QString& ) ) ); |
1544 | 1544 | ||
1545 | 1545 | ||
1546 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1546 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1547 | 1547 | ||
1548 | topLayout->addWidget( mJumpButtonBar ); | 1548 | topLayout->addWidget( mJumpButtonBar ); |
1549 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1549 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1550 | 1550 | ||
1551 | // mMainWindow->getIconToolBar()->raise(); | 1551 | // mMainWindow->getIconToolBar()->raise(); |
1552 | 1552 | ||
1553 | #endif //KAB_EMBEDDED | 1553 | #endif //KAB_EMBEDDED |
1554 | 1554 | ||
1555 | } | 1555 | } |
1556 | void KABCore::initActions() | 1556 | void KABCore::initActions() |
1557 | { | 1557 | { |
1558 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1558 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1559 | 1559 | ||
1560 | #ifndef KAB_EMBEDDED | 1560 | #ifndef KAB_EMBEDDED |
1561 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1561 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1562 | SLOT( clipboardDataChanged() ) ); | 1562 | SLOT( clipboardDataChanged() ) ); |
1563 | #endif //KAB_EMBEDDED | 1563 | #endif //KAB_EMBEDDED |
1564 | 1564 | ||
1565 | // file menu | 1565 | // file menu |
1566 | if ( mIsPart ) { | 1566 | if ( mIsPart ) { |
1567 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1567 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1568 | SLOT( sendMail() ), actionCollection(), | 1568 | SLOT( sendMail() ), actionCollection(), |
1569 | "kaddressbook_mail" ); | 1569 | "kaddressbook_mail" ); |
1570 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1570 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1571 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1571 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1572 | 1572 | ||
1573 | } else { | 1573 | } else { |
1574 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1574 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1575 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1575 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1576 | } | 1576 | } |
1577 | 1577 | ||
1578 | 1578 | ||
1579 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1579 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1580 | SLOT( save() ), actionCollection(), "file_sync" ); | 1580 | SLOT( save() ), actionCollection(), "file_sync" ); |
1581 | 1581 | ||
1582 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1582 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1583 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1583 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1584 | 1584 | ||
1585 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1585 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1586 | this, SLOT( mailVCard() ), | 1586 | this, SLOT( mailVCard() ), |
1587 | actionCollection(), "file_mail_vcard"); | 1587 | actionCollection(), "file_mail_vcard"); |
1588 | 1588 | ||
1589 | mActionBeamVCard = 0; | 1589 | mActionBeamVCard = 0; |
1590 | mActionBeam = 0; | 1590 | mActionBeam = 0; |
1591 | 1591 | ||
1592 | #ifndef DESKTOP_VERSION | 1592 | #ifndef DESKTOP_VERSION |
1593 | if ( Ir::supported() ) { | 1593 | if ( Ir::supported() ) { |
1594 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1594 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1595 | SLOT( beamVCard() ), actionCollection(), | 1595 | SLOT( beamVCard() ), actionCollection(), |
1596 | "kaddressbook_beam_vcard" ); | 1596 | "kaddressbook_beam_vcard" ); |
1597 | 1597 | ||
1598 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1598 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1599 | SLOT( beamMySelf() ), actionCollection(), | 1599 | SLOT( beamMySelf() ), actionCollection(), |
1600 | "kaddressbook_beam_myself" ); | 1600 | "kaddressbook_beam_myself" ); |
1601 | } | 1601 | } |
1602 | #endif | 1602 | #endif |
1603 | 1603 | ||
1604 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1604 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1605 | this, SLOT( editContact2() ), | 1605 | this, SLOT( editContact2() ), |
1606 | actionCollection(), "file_properties" ); | 1606 | actionCollection(), "file_properties" ); |
1607 | 1607 | ||
1608 | #ifdef KAB_EMBEDDED | 1608 | #ifdef KAB_EMBEDDED |
1609 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1609 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1610 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1610 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1611 | mMainWindow, SLOT( exit() ), | 1611 | mMainWindow, SLOT( exit() ), |
1612 | actionCollection(), "quit" ); | 1612 | actionCollection(), "quit" ); |
1613 | #endif //KAB_EMBEDDED | 1613 | #endif //KAB_EMBEDDED |
1614 | 1614 | ||
1615 | // edit menu | 1615 | // edit menu |
1616 | if ( mIsPart ) { | 1616 | if ( mIsPart ) { |
1617 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1617 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1618 | SLOT( copyContacts() ), actionCollection(), | 1618 | SLOT( copyContacts() ), actionCollection(), |
1619 | "kaddressbook_copy" ); | 1619 | "kaddressbook_copy" ); |
1620 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1620 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1621 | SLOT( cutContacts() ), actionCollection(), | 1621 | SLOT( cutContacts() ), actionCollection(), |
1622 | "kaddressbook_cut" ); | 1622 | "kaddressbook_cut" ); |
1623 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1623 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1624 | SLOT( pasteContacts() ), actionCollection(), | 1624 | SLOT( pasteContacts() ), actionCollection(), |
1625 | "kaddressbook_paste" ); | 1625 | "kaddressbook_paste" ); |
1626 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1626 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1627 | SLOT( selectAllContacts() ), actionCollection(), | 1627 | SLOT( selectAllContacts() ), actionCollection(), |
1628 | "kaddressbook_select_all" ); | 1628 | "kaddressbook_select_all" ); |
1629 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1629 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1630 | SLOT( undo() ), actionCollection(), | 1630 | SLOT( undo() ), actionCollection(), |
1631 | "kaddressbook_undo" ); | 1631 | "kaddressbook_undo" ); |
1632 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1632 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1633 | this, SLOT( redo() ), actionCollection(), | 1633 | this, SLOT( redo() ), actionCollection(), |
1634 | "kaddressbook_redo" ); | 1634 | "kaddressbook_redo" ); |
1635 | } else { | 1635 | } else { |
1636 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1636 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1637 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1637 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1638 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1638 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1639 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1639 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1640 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1640 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1641 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1641 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1642 | } | 1642 | } |
1643 | 1643 | ||
1644 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1644 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1645 | Key_Delete, this, SLOT( deleteContacts() ), | 1645 | Key_Delete, this, SLOT( deleteContacts() ), |
1646 | actionCollection(), "edit_delete" ); | 1646 | actionCollection(), "edit_delete" ); |
1647 | 1647 | ||
1648 | mActionUndo->setEnabled( false ); | 1648 | mActionUndo->setEnabled( false ); |
1649 | mActionRedo->setEnabled( false ); | 1649 | mActionRedo->setEnabled( false ); |
1650 | 1650 | ||
1651 | // settings menu | 1651 | // settings menu |
1652 | #ifdef KAB_EMBEDDED | 1652 | #ifdef KAB_EMBEDDED |
1653 | //US special menuentry to configure the addressbook resources. On KDE | 1653 | //US special menuentry to configure the addressbook resources. On KDE |
1654 | // you do that through the control center !!! | 1654 | // you do that through the control center !!! |
1655 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1655 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1656 | SLOT( configureResources() ), actionCollection(), | 1656 | SLOT( configureResources() ), actionCollection(), |
1657 | "kaddressbook_configure_resources" ); | 1657 | "kaddressbook_configure_resources" ); |
1658 | #endif //KAB_EMBEDDED | 1658 | #endif //KAB_EMBEDDED |
1659 | 1659 | ||
1660 | if ( mIsPart ) { | 1660 | if ( mIsPart ) { |
1661 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1661 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1662 | SLOT( openConfigDialog() ), actionCollection(), | 1662 | SLOT( openConfigDialog() ), actionCollection(), |
1663 | "kaddressbook_configure" ); | 1663 | "kaddressbook_configure" ); |
1664 | 1664 | ||
1665 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1665 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1666 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1666 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1667 | "kaddressbook_configure_shortcuts" ); | 1667 | "kaddressbook_configure_shortcuts" ); |
1668 | #ifdef KAB_EMBEDDED | 1668 | #ifdef KAB_EMBEDDED |
1669 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1669 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1670 | mActionConfigureToolbars->setEnabled( false ); | 1670 | mActionConfigureToolbars->setEnabled( false ); |
1671 | #endif //KAB_EMBEDDED | 1671 | #endif //KAB_EMBEDDED |
1672 | 1672 | ||
1673 | } else { | 1673 | } else { |
1674 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1674 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1675 | 1675 | ||
1676 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1676 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1679 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1680 | actionCollection(), "options_show_jump_bar" ); | 1680 | actionCollection(), "options_show_jump_bar" ); |
1681 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1681 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1682 | 1682 | ||
1683 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1683 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1684 | actionCollection(), "options_show_details" ); | 1684 | actionCollection(), "options_show_details" ); |
1685 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1685 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1686 | 1686 | ||
1687 | // misc | 1687 | // misc |
1688 | // only enable LDAP lookup if we can handle the protocol | 1688 | // only enable LDAP lookup if we can handle the protocol |
1689 | #ifndef KAB_EMBEDDED | 1689 | #ifndef KAB_EMBEDDED |
1690 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1690 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1691 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1691 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1692 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1692 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1693 | "ldap_lookup" ); | 1693 | "ldap_lookup" ); |
1694 | } | 1694 | } |
1695 | #else //KAB_EMBEDDED | 1695 | #else //KAB_EMBEDDED |
1696 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1696 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1697 | #endif //KAB_EMBEDDED | 1697 | #endif //KAB_EMBEDDED |
1698 | 1698 | ||
1699 | 1699 | ||
1700 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1700 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1701 | SLOT( setWhoAmI() ), actionCollection(), | 1701 | SLOT( setWhoAmI() ), actionCollection(), |
1702 | "set_personal" ); | 1702 | "set_personal" ); |
1703 | 1703 | ||
1704 | 1704 | ||
1705 | 1705 | ||
1706 | 1706 | ||
1707 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1707 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1708 | SLOT( setCategories() ), actionCollection(), | 1708 | SLOT( setCategories() ), actionCollection(), |
1709 | "edit_set_categories" ); | 1709 | "edit_set_categories" ); |
1710 | 1710 | ||
1711 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1711 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1712 | SLOT( removeVoice() ), actionCollection(), | 1712 | SLOT( removeVoice() ), actionCollection(), |
1713 | "remove_voice" ); | 1713 | "remove_voice" ); |
1714 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, | 1714 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, |
1715 | SLOT( importFromOL() ), actionCollection(), | 1715 | SLOT( importFromOL() ), actionCollection(), |
1716 | "import_OL" ); | 1716 | "import_OL" ); |
1717 | #ifdef KAB_EMBEDDED | 1717 | #ifdef KAB_EMBEDDED |
1718 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1718 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1719 | this, SLOT( showLicence() ), actionCollection(), | 1719 | this, SLOT( showLicence() ), actionCollection(), |
1720 | "licence_about_data" ); | 1720 | "licence_about_data" ); |
1721 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1721 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
1722 | this, SLOT( faq() ), actionCollection(), | 1722 | this, SLOT( faq() ), actionCollection(), |
1723 | "faq_about_data" ); | 1723 | "faq_about_data" ); |
1724 | 1724 | ||
1725 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1725 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1726 | this, SLOT( createAboutData() ), actionCollection(), | 1726 | this, SLOT( createAboutData() ), actionCollection(), |
1727 | "kaddressbook_about_data" ); | 1727 | "kaddressbook_about_data" ); |
1728 | #endif //KAB_EMBEDDED | 1728 | #endif //KAB_EMBEDDED |
1729 | 1729 | ||
1730 | clipboardDataChanged(); | 1730 | clipboardDataChanged(); |
1731 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1731 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1732 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1732 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1733 | } | 1733 | } |
1734 | 1734 | ||
1735 | //US we need this function, to plug all actions into the correct menues. | 1735 | //US we need this function, to plug all actions into the correct menues. |
1736 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1736 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1737 | void KABCore::addActionsManually() | 1737 | void KABCore::addActionsManually() |
1738 | { | 1738 | { |
1739 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1739 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1740 | 1740 | ||
1741 | #ifdef KAB_EMBEDDED | 1741 | #ifdef KAB_EMBEDDED |
1742 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1742 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1743 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1743 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1744 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1744 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1745 | 1745 | ||
1746 | KToolBar* tb = mMainWindow->toolBar(); | 1746 | KToolBar* tb = mMainWindow->toolBar(); |
1747 | 1747 | ||
1748 | #ifdef DESKTOP_VERSION | 1748 | #ifdef DESKTOP_VERSION |
1749 | QMenuBar* mb = mMainWindow->menuBar(); | 1749 | QMenuBar* mb = mMainWindow->menuBar(); |
1750 | 1750 | ||
1751 | //US setup menubar. | 1751 | //US setup menubar. |
1752 | //Disable the following block if you do not want to have a menubar. | 1752 | //Disable the following block if you do not want to have a menubar. |
1753 | mb->insertItem( "&File", fileMenu ); | 1753 | mb->insertItem( "&File", fileMenu ); |
1754 | mb->insertItem( "&Edit", editMenu ); | 1754 | mb->insertItem( "&Edit", editMenu ); |
1755 | mb->insertItem( "&View", viewMenu ); | 1755 | mb->insertItem( "&View", viewMenu ); |
1756 | mb->insertItem( "&Settings", settingsMenu ); | 1756 | mb->insertItem( "&Settings", settingsMenu ); |
1757 | mb->insertItem( "&Change selected", changeMenu ); | 1757 | mb->insertItem( "&Change selected", changeMenu ); |
1758 | mb->insertItem( "&Help", helpMenu ); | 1758 | mb->insertItem( "&Help", helpMenu ); |
1759 | mIncSearchWidget = new IncSearchWidget( tb ); | 1759 | mIncSearchWidget = new IncSearchWidget( tb ); |
1760 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1760 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1761 | 1761 | ||
1762 | #else | 1762 | #else |
1763 | //US setup toolbar | 1763 | //US setup toolbar |
1764 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 1764 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
1765 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1765 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1766 | menuBarTB->insertItem( "ME", popupBarTB); | 1766 | menuBarTB->insertItem( "ME", popupBarTB); |
1767 | tb->insertWidget(-1, 0, menuBarTB); | 1767 | tb->insertWidget(-1, 0, menuBarTB); |
1768 | mIncSearchWidget = new IncSearchWidget( tb ); | 1768 | mIncSearchWidget = new IncSearchWidget( tb ); |
1769 | 1769 | ||
1770 | tb->enableMoving(false); | 1770 | tb->enableMoving(false); |
1771 | popupBarTB->insertItem( "&File", fileMenu ); | 1771 | popupBarTB->insertItem( "&File", fileMenu ); |
1772 | popupBarTB->insertItem( "&Edit", editMenu ); | 1772 | popupBarTB->insertItem( "&Edit", editMenu ); |
1773 | popupBarTB->insertItem( "&View", viewMenu ); | 1773 | popupBarTB->insertItem( "&View", viewMenu ); |
1774 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1774 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1775 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1775 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1776 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1776 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1777 | popupBarTB->insertItem( "&Help", helpMenu ); | 1777 | popupBarTB->insertItem( "&Help", helpMenu ); |
1778 | if (QApplication::desktop()->width() > 320 ) { | 1778 | if (QApplication::desktop()->width() > 320 ) { |
1779 | // mViewManager->getFilterAction()->plug ( tb); | 1779 | // mViewManager->getFilterAction()->plug ( tb); |
1780 | } | 1780 | } |
1781 | #endif | 1781 | #endif |
1782 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1782 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1783 | 1783 | ||
1784 | 1784 | ||
1785 | 1785 | ||
1786 | //US Now connect the actions with the menue entries. | 1786 | //US Now connect the actions with the menue entries. |
1787 | mActionPrint->plug( fileMenu ); | 1787 | mActionPrint->plug( fileMenu ); |
1788 | mActionMail->plug( fileMenu ); | 1788 | mActionMail->plug( fileMenu ); |
1789 | fileMenu->insertSeparator(); | 1789 | fileMenu->insertSeparator(); |
1790 | 1790 | ||
1791 | mActionNewContact->plug( fileMenu ); | 1791 | mActionNewContact->plug( fileMenu ); |
1792 | mActionNewContact->plug( tb ); | 1792 | mActionNewContact->plug( tb ); |
1793 | 1793 | ||
1794 | mActionEditAddressee->plug( fileMenu ); | 1794 | mActionEditAddressee->plug( fileMenu ); |
1795 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 1795 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
1796 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 1796 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
1797 | mActionEditAddressee->plug( tb ); | 1797 | mActionEditAddressee->plug( tb ); |
1798 | 1798 | ||
1799 | fileMenu->insertSeparator(); | 1799 | fileMenu->insertSeparator(); |
1800 | mActionSave->plug( fileMenu ); | 1800 | mActionSave->plug( fileMenu ); |
1801 | fileMenu->insertItem( "&Import", ImportMenu ); | 1801 | fileMenu->insertItem( "&Import", ImportMenu ); |
1802 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1802 | fileMenu->insertItem( "&Export", ExportMenu ); |
1803 | fileMenu->insertSeparator(); | 1803 | fileMenu->insertSeparator(); |
1804 | mActionMailVCard->plug( fileMenu ); | 1804 | mActionMailVCard->plug( fileMenu ); |
1805 | #ifndef DESKTOP_VERSION | 1805 | #ifndef DESKTOP_VERSION |
1806 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1806 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1807 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 1807 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
1808 | #endif | 1808 | #endif |
1809 | fileMenu->insertSeparator(); | 1809 | fileMenu->insertSeparator(); |
1810 | mActionQuit->plug( fileMenu ); | 1810 | mActionQuit->plug( fileMenu ); |
1811 | #ifdef _WIN32_ | 1811 | #ifdef _WIN32_ |
1812 | mActionImportOL->plug( ImportMenu ); | 1812 | mActionImportOL->plug( ImportMenu ); |
1813 | #endif | 1813 | #endif |
1814 | // edit menu | 1814 | // edit menu |
1815 | mActionUndo->plug( editMenu ); | 1815 | mActionUndo->plug( editMenu ); |
1816 | mActionRedo->plug( editMenu ); | 1816 | mActionRedo->plug( editMenu ); |
1817 | editMenu->insertSeparator(); | 1817 | editMenu->insertSeparator(); |
1818 | mActionCut->plug( editMenu ); | 1818 | mActionCut->plug( editMenu ); |
1819 | mActionCopy->plug( editMenu ); | 1819 | mActionCopy->plug( editMenu ); |
1820 | mActionPaste->plug( editMenu ); | 1820 | mActionPaste->plug( editMenu ); |
1821 | mActionDelete->plug( editMenu ); | 1821 | mActionDelete->plug( editMenu ); |
1822 | editMenu->insertSeparator(); | 1822 | editMenu->insertSeparator(); |
1823 | mActionSelectAll->plug( editMenu ); | 1823 | mActionSelectAll->plug( editMenu ); |
1824 | 1824 | ||
1825 | mActionRemoveVoice->plug( changeMenu ); | 1825 | mActionRemoveVoice->plug( changeMenu ); |
1826 | // settings menu | 1826 | // settings menu |
1827 | //US special menuentry to configure the addressbook resources. On KDE | 1827 | //US special menuentry to configure the addressbook resources. On KDE |
1828 | // you do that through the control center !!! | 1828 | // you do that through the control center !!! |
1829 | mActionConfigResources->plug( settingsMenu ); | 1829 | mActionConfigResources->plug( settingsMenu ); |
1830 | settingsMenu->insertSeparator(); | 1830 | settingsMenu->insertSeparator(); |
1831 | 1831 | ||
1832 | mActionConfigKAddressbook->plug( settingsMenu ); | 1832 | mActionConfigKAddressbook->plug( settingsMenu ); |
1833 | 1833 | ||
1834 | if ( mIsPart ) { | 1834 | if ( mIsPart ) { |
1835 | mActionConfigShortcuts->plug( settingsMenu ); | 1835 | mActionConfigShortcuts->plug( settingsMenu ); |
1836 | mActionConfigureToolbars->plug( settingsMenu ); | 1836 | mActionConfigureToolbars->plug( settingsMenu ); |
1837 | 1837 | ||
1838 | } else { | 1838 | } else { |
1839 | mActionKeyBindings->plug( settingsMenu ); | 1839 | mActionKeyBindings->plug( settingsMenu ); |
1840 | } | 1840 | } |
1841 | 1841 | ||
1842 | settingsMenu->insertSeparator(); | 1842 | settingsMenu->insertSeparator(); |
1843 | 1843 | ||
1844 | mActionJumpBar->plug( settingsMenu ); | 1844 | mActionJumpBar->plug( settingsMenu ); |
1845 | mActionDetails->plug( settingsMenu ); | 1845 | mActionDetails->plug( settingsMenu ); |
1846 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 1846 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
1847 | mActionDetails->plug( tb ); | 1847 | mActionDetails->plug( tb ); |
1848 | settingsMenu->insertSeparator(); | 1848 | settingsMenu->insertSeparator(); |
1849 | 1849 | ||
1850 | mActionWhoAmI->plug( settingsMenu ); | 1850 | mActionWhoAmI->plug( settingsMenu ); |
1851 | mActionCategories->plug( settingsMenu ); | 1851 | mActionCategories->plug( settingsMenu ); |
1852 | 1852 | ||
1853 | mActionLicence->plug( helpMenu ); | 1853 | mActionLicence->plug( helpMenu ); |
1854 | mActionFaq->plug( helpMenu ); | 1854 | mActionFaq->plug( helpMenu ); |
1855 | mActionAboutKAddressbook->plug( helpMenu ); | 1855 | mActionAboutKAddressbook->plug( helpMenu ); |
1856 | 1856 | ||
1857 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 1857 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
1858 | 1858 | ||
1859 | mActionSave->plug( tb ); | 1859 | mActionSave->plug( tb ); |
1860 | mViewManager->getFilterAction()->plug ( tb); | 1860 | mViewManager->getFilterAction()->plug ( tb); |
1861 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 1861 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
1862 | mActionUndo->plug( tb ); | 1862 | mActionUndo->plug( tb ); |
1863 | mActionDelete->plug( tb ); | 1863 | mActionDelete->plug( tb ); |
1864 | mActionRedo->plug( tb ); | 1864 | mActionRedo->plug( tb ); |
1865 | } | 1865 | } |
1866 | } | 1866 | } |
1867 | //mActionQuit->plug ( tb ); | 1867 | //mActionQuit->plug ( tb ); |
1868 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1868 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1869 | 1869 | ||
1870 | //US link the searchwidget first to this. | 1870 | //US link the searchwidget first to this. |
1871 | // The real linkage to the toolbar happens later. | 1871 | // The real linkage to the toolbar happens later. |
1872 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1872 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1873 | //US tb->insertItem( mIncSearchWidget ); | 1873 | //US tb->insertItem( mIncSearchWidget ); |
1874 | /*US | 1874 | /*US |
1875 | mIncSearchWidget = new IncSearchWidget( tb ); | 1875 | mIncSearchWidget = new IncSearchWidget( tb ); |
1876 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1876 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1877 | SLOT( incrementalSearch( const QString& ) ) ); | 1877 | SLOT( incrementalSearch( const QString& ) ) ); |
1878 | 1878 | ||
1879 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1879 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1880 | 1880 | ||
1881 | //US topLayout->addWidget( mJumpButtonBar ); | 1881 | //US topLayout->addWidget( mJumpButtonBar ); |
1882 | this->layout()->add( mJumpButtonBar ); | 1882 | this->layout()->add( mJumpButtonBar ); |
1883 | */ | 1883 | */ |
1884 | 1884 | ||
1885 | #endif //KAB_EMBEDDED | 1885 | #endif //KAB_EMBEDDED |
1886 | } | 1886 | } |
1887 | void KABCore::showLicence() | 1887 | void KABCore::showLicence() |
1888 | { | 1888 | { |
1889 | KApplication::showLicence(); | 1889 | KApplication::showLicence(); |
1890 | } | 1890 | } |
1891 | void KABCore::removeVoice() | 1891 | void KABCore::removeVoice() |
1892 | { | 1892 | { |
1893 | 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 ) | 1893 | 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 ) |
1894 | return; | 1894 | return; |
1895 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 1895 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
1896 | KABC::Addressee::List::Iterator it; | 1896 | KABC::Addressee::List::Iterator it; |
1897 | for ( it = list.begin(); it != list.end(); ++it ) { | 1897 | for ( it = list.begin(); it != list.end(); ++it ) { |
1898 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | 1898 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); |
1899 | PhoneNumber::List::Iterator phoneIt; | 1899 | PhoneNumber::List::Iterator phoneIt; |
1900 | bool found = false; | 1900 | bool found = false; |
1901 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 1901 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
1902 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 1902 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
1903 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 1903 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
1904 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 1904 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
1905 | (*it).insertPhoneNumber( (*phoneIt) ); | 1905 | (*it).insertPhoneNumber( (*phoneIt) ); |
1906 | found = true; | 1906 | found = true; |
1907 | } | 1907 | } |
1908 | } | 1908 | } |
1909 | 1909 | ||
1910 | } | 1910 | } |
1911 | if ( found ) | 1911 | if ( found ) |
1912 | contactModified((*it) ); | 1912 | contactModified((*it) ); |
1913 | } | 1913 | } |
1914 | } | 1914 | } |
1915 | 1915 | ||
1916 | 1916 | ||
1917 | 1917 | ||
1918 | void KABCore::clipboardDataChanged() | 1918 | void KABCore::clipboardDataChanged() |
1919 | { | 1919 | { |
1920 | 1920 | ||
1921 | if ( mReadWrite ) | 1921 | if ( mReadWrite ) |
1922 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1922 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1923 | 1923 | ||
1924 | } | 1924 | } |
1925 | 1925 | ||
1926 | void KABCore::updateActionMenu() | 1926 | void KABCore::updateActionMenu() |
1927 | { | 1927 | { |
1928 | UndoStack *undo = UndoStack::instance(); | 1928 | UndoStack *undo = UndoStack::instance(); |
1929 | RedoStack *redo = RedoStack::instance(); | 1929 | RedoStack *redo = RedoStack::instance(); |
1930 | 1930 | ||
1931 | if ( undo->isEmpty() ) | 1931 | if ( undo->isEmpty() ) |
1932 | mActionUndo->setText( i18n( "Undo" ) ); | 1932 | mActionUndo->setText( i18n( "Undo" ) ); |
1933 | else | 1933 | else |
1934 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 1934 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1935 | 1935 | ||
1936 | mActionUndo->setEnabled( !undo->isEmpty() ); | 1936 | mActionUndo->setEnabled( !undo->isEmpty() ); |
1937 | 1937 | ||
1938 | if ( !redo->top() ) | 1938 | if ( !redo->top() ) |
1939 | mActionRedo->setText( i18n( "Redo" ) ); | 1939 | mActionRedo->setText( i18n( "Redo" ) ); |
1940 | else | 1940 | else |
1941 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 1941 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
1942 | 1942 | ||
1943 | mActionRedo->setEnabled( !redo->isEmpty() ); | 1943 | mActionRedo->setEnabled( !redo->isEmpty() ); |
1944 | } | 1944 | } |
1945 | 1945 | ||
1946 | void KABCore::configureKeyBindings() | 1946 | void KABCore::configureKeyBindings() |
1947 | { | 1947 | { |
1948 | #ifndef KAB_EMBEDDED | 1948 | #ifndef KAB_EMBEDDED |
1949 | KKeyDialog::configure( actionCollection(), true ); | 1949 | KKeyDialog::configure( actionCollection(), true ); |
1950 | #else //KAB_EMBEDDED | 1950 | #else //KAB_EMBEDDED |
1951 | qDebug("KABCore::configureKeyBindings() not implemented"); | 1951 | qDebug("KABCore::configureKeyBindings() not implemented"); |
1952 | #endif //KAB_EMBEDDED | 1952 | #endif //KAB_EMBEDDED |
1953 | } | 1953 | } |
1954 | 1954 | ||
1955 | #ifdef KAB_EMBEDDED | 1955 | #ifdef KAB_EMBEDDED |
1956 | void KABCore::configureResources() | 1956 | void KABCore::configureResources() |
1957 | { | 1957 | { |
1958 | KRES::KCMKResources dlg( this, "" , 0 ); | 1958 | KRES::KCMKResources dlg( this, "" , 0 ); |
1959 | 1959 | ||
1960 | if ( !dlg.exec() ) | 1960 | if ( !dlg.exec() ) |
1961 | return; | 1961 | return; |
1962 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 1962 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
1963 | } | 1963 | } |
1964 | #endif //KAB_EMBEDDED | 1964 | #endif //KAB_EMBEDDED |
1965 | 1965 | ||
1966 | 1966 | ||
1967 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 1967 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
1968 | * for the attendees list of an event. | 1968 | * for the attendees list of an event. |
1969 | */ | 1969 | */ |
1970 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 1970 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
1971 | { | 1971 | { |
1972 | QStringList nameList; | 1972 | QStringList nameList; |
1973 | QStringList emailList; | 1973 | QStringList emailList; |
1974 | QStringList uidList; | 1974 | QStringList uidList; |
1975 | 1975 | ||
1976 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 1976 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
1977 | uint i=0; | 1977 | uint i=0; |
1978 | for (i=0; i < list.count(); i++) | 1978 | for (i=0; i < list.count(); i++) |
1979 | { | 1979 | { |
1980 | nameList.append(list[i].realName()); | 1980 | nameList.append(list[i].realName()); |
1981 | emailList.append(list[i].preferredEmail()); | 1981 | emailList.append(list[i].preferredEmail()); |
1982 | uidList.append(list[i].uid()); | 1982 | uidList.append(list[i].uid()); |
1983 | } | 1983 | } |
1984 | 1984 | ||
1985 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 1985 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
1986 | 1986 | ||
1987 | } | 1987 | } |
1988 | 1988 | ||
1989 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 1989 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
1990 | */ | 1990 | */ |
1991 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 1991 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
1992 | { | 1992 | { |
1993 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 1993 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
1994 | 1994 | ||
1995 | QString foundUid = QString::null; | 1995 | QString foundUid = QString::null; |
1996 | if ( ! uid.isEmpty() ) { | 1996 | if ( ! uid.isEmpty() ) { |
1997 | Addressee adrr = mAddressBook->findByUid( uid ); | 1997 | Addressee adrr = mAddressBook->findByUid( uid ); |
1998 | if ( !adrr.isEmpty() ) { | 1998 | if ( !adrr.isEmpty() ) { |
1999 | foundUid = uid; | 1999 | foundUid = uid; |
2000 | } | 2000 | } |
2001 | if ( email == "sendbacklist" ) { | 2001 | if ( email == "sendbacklist" ) { |
2002 | //qDebug("ssssssssssssssssssssssend "); | 2002 | //qDebug("ssssssssssssssssssssssend "); |
2003 | QStringList nameList; | 2003 | QStringList nameList; |
2004 | QStringList emailList; | 2004 | QStringList emailList; |
2005 | QStringList uidList; | 2005 | QStringList uidList; |
2006 | nameList.append(adrr.realName()); | 2006 | nameList.append(adrr.realName()); |
2007 | emailList = adrr.emails(); | 2007 | emailList = adrr.emails(); |
2008 | uidList.append( adrr.preferredEmail()); | 2008 | uidList.append( adrr.preferredEmail()); |
2009 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2009 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2010 | return; | 2010 | return; |
2011 | } | 2011 | } |
2012 | 2012 | ||
2013 | } | 2013 | } |
2014 | 2014 | ||
2015 | if ( email == "sendbacklist" ) | 2015 | if ( email == "sendbacklist" ) |
2016 | return; | 2016 | return; |
2017 | if (foundUid.isEmpty()) | 2017 | if (foundUid.isEmpty()) |
2018 | { | 2018 | { |
2019 | //find the uid of the person first | 2019 | //find the uid of the person first |
2020 | Addressee::List namelist; | 2020 | Addressee::List namelist; |
2021 | Addressee::List emaillist; | 2021 | Addressee::List emaillist; |
2022 | 2022 | ||
2023 | if (!name.isEmpty()) | 2023 | if (!name.isEmpty()) |
2024 | namelist = mAddressBook->findByName( name ); | 2024 | namelist = mAddressBook->findByName( name ); |
2025 | 2025 | ||
2026 | if (!email.isEmpty()) | 2026 | if (!email.isEmpty()) |
2027 | emaillist = mAddressBook->findByEmail( email ); | 2027 | emaillist = mAddressBook->findByEmail( email ); |
2028 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2028 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2029 | //check if we have a match in Namelist and Emaillist | 2029 | //check if we have a match in Namelist and Emaillist |
2030 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2030 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2031 | foundUid = emaillist[0].uid(); | 2031 | foundUid = emaillist[0].uid(); |
2032 | } | 2032 | } |
2033 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2033 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2034 | foundUid = namelist[0].uid(); | 2034 | foundUid = namelist[0].uid(); |
2035 | else | 2035 | else |
2036 | { | 2036 | { |
2037 | for (int i = 0; i < namelist.count(); i++) | 2037 | for (int i = 0; i < namelist.count(); i++) |
2038 | { | 2038 | { |
2039 | for (int j = 0; j < emaillist.count(); j++) | 2039 | for (int j = 0; j < emaillist.count(); j++) |
2040 | { | 2040 | { |
2041 | if (namelist[i] == emaillist[j]) | 2041 | if (namelist[i] == emaillist[j]) |
2042 | { | 2042 | { |
2043 | foundUid = namelist[i].uid(); | 2043 | foundUid = namelist[i].uid(); |
2044 | } | 2044 | } |
2045 | } | 2045 | } |
2046 | } | 2046 | } |
2047 | } | 2047 | } |
2048 | } | 2048 | } |
2049 | else | 2049 | else |
2050 | { | 2050 | { |
2051 | foundUid = uid; | 2051 | foundUid = uid; |
2052 | } | 2052 | } |
2053 | 2053 | ||
2054 | if (!foundUid.isEmpty()) | 2054 | if (!foundUid.isEmpty()) |
2055 | { | 2055 | { |
2056 | 2056 | ||
2057 | // raise Ka/Pi if it is in the background | 2057 | // raise Ka/Pi if it is in the background |
2058 | #ifndef DESKTOP_VERSION | 2058 | #ifndef DESKTOP_VERSION |
2059 | #ifndef KORG_NODCOP | 2059 | #ifndef KORG_NODCOP |
2060 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2060 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2061 | #endif | 2061 | #endif |
2062 | #endif | 2062 | #endif |
2063 | 2063 | ||
2064 | mMainWindow->showMaximized(); | 2064 | mMainWindow->showMaximized(); |
2065 | mMainWindow-> raise(); | 2065 | mMainWindow-> raise(); |
2066 | 2066 | ||
2067 | mViewManager->setSelected( "", false); | 2067 | mViewManager->setSelected( "", false); |
2068 | mViewManager->refreshView( "" ); | 2068 | mViewManager->refreshView( "" ); |
2069 | mViewManager->setSelected( foundUid, true ); | 2069 | mViewManager->setSelected( foundUid, true ); |
2070 | mViewManager->refreshView( foundUid ); | 2070 | mViewManager->refreshView( foundUid ); |
2071 | 2071 | ||
2072 | if ( !mMultipleViewsAtOnce ) | 2072 | if ( !mMultipleViewsAtOnce ) |
2073 | { | 2073 | { |
2074 | setDetailsVisible( true ); | 2074 | setDetailsVisible( true ); |
2075 | mActionDetails->setChecked(true); | 2075 | mActionDetails->setChecked(true); |
2076 | } | 2076 | } |
2077 | } | 2077 | } |
2078 | } | 2078 | } |
2079 | 2079 | ||
2080 | 2080 | ||
2081 | void KABCore::faq() | 2081 | void KABCore::faq() |
2082 | { | 2082 | { |
2083 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2083 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2084 | } | 2084 | } |
2085 | 2085 | ||
2086 | 2086 | ||
2087 | 2087 | ||
2088 | 2088 | ||
2089 | #ifndef KAB_EMBEDDED | 2089 | #ifndef KAB_EMBEDDED |
2090 | #include "kabcore.moc" | 2090 | #include "kabcore.moc" |
2091 | #endif //KAB_EMBEDDED | 2091 | #endif //KAB_EMBEDDED |