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