summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index a6d722d..68d3d2d 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -916,193 +916,194 @@ void KABCore::undo()
916 916
917 // Refresh the view 917 // Refresh the view
918 mViewManager->refreshView(); 918 mViewManager->refreshView();
919} 919}
920 920
921void KABCore::redo() 921void KABCore::redo()
922{ 922{
923 RedoStack::instance()->redo(); 923 RedoStack::instance()->redo();
924 924
925 // Refresh the view 925 // Refresh the view
926 mViewManager->refreshView(); 926 mViewManager->refreshView();
927} 927}
928 928
929void KABCore::setJumpButtonBarVisible( bool visible ) 929void KABCore::setJumpButtonBarVisible( bool visible )
930{ 930{
931 if ( visible ) 931 if ( visible )
932 mJumpButtonBar->show(); 932 mJumpButtonBar->show();
933 else 933 else
934 mJumpButtonBar->hide(); 934 mJumpButtonBar->hide();
935} 935}
936void KABCore::setDetailsToState() 936void KABCore::setDetailsToState()
937{ 937{
938 setDetailsVisible( mActionDetails->isChecked() ); 938 setDetailsVisible( mActionDetails->isChecked() );
939} 939}
940 940
941void KABCore::setDetailsVisible( bool visible ) 941void KABCore::setDetailsVisible( bool visible )
942{ 942{
943 if ( visible ) 943 if ( visible )
944 mDetails->show(); 944 mDetails->show();
945 else 945 else
946 mDetails->hide(); 946 mDetails->hide();
947} 947}
948 948
949void KABCore::extensionModified( const KABC::Addressee::List &list ) 949void KABCore::extensionModified( const KABC::Addressee::List &list )
950{ 950{
951 951
952 if ( list.count() != 0 ) { 952 if ( list.count() != 0 ) {
953 KABC::Addressee::List::ConstIterator it; 953 KABC::Addressee::List::ConstIterator it;
954 for ( it = list.begin(); it != list.end(); ++it ) 954 for ( it = list.begin(); it != list.end(); ++it )
955 mAddressBook->insertAddressee( *it ); 955 mAddressBook->insertAddressee( *it );
956 if ( list.count() > 1 ) 956 if ( list.count() > 1 )
957 setModified(); 957 setModified();
958 else 958 else
959 setModifiedWOrefresh(); 959 setModifiedWOrefresh();
960 } 960 }
961 if ( list.count() == 0 ) 961 if ( list.count() == 0 )
962 mViewManager->refreshView(); 962 mViewManager->refreshView();
963 else 963 else
964 mViewManager->refreshView( list[ 0 ].uid() ); 964 mViewManager->refreshView( list[ 0 ].uid() );
965 965
966 966
967 967
968} 968}
969 969
970QString KABCore::getNameByPhone( const QString &phone ) 970QString KABCore::getNameByPhone( const QString &phone )
971{ 971{
972#ifndef KAB_EMBEDDED 972#ifndef KAB_EMBEDDED
973 QRegExp r( "[/*/-/ ]" ); 973 QRegExp r( "[/*/-/ ]" );
974 QString localPhone( phone ); 974 QString localPhone( phone );
975 975
976 bool found = false; 976 bool found = false;
977 QString ownerName = ""; 977 QString ownerName = "";
978 KABC::AddressBook::Iterator iter; 978 KABC::AddressBook::Iterator iter;
979 KABC::PhoneNumber::List::Iterator phoneIter; 979 KABC::PhoneNumber::List::Iterator phoneIter;
980 KABC::PhoneNumber::List phoneList; 980 KABC::PhoneNumber::List phoneList;
981 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 981 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
982 phoneList = (*iter).phoneNumbers(); 982 phoneList = (*iter).phoneNumbers();
983 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 983 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
984 ++phoneIter) { 984 ++phoneIter) {
985 // Get rid of separator chars so just the numbers are compared. 985 // Get rid of separator chars so just the numbers are compared.
986 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 986 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
987 ownerName = (*iter).formattedName(); 987 ownerName = (*iter).formattedName();
988 found = true; 988 found = true;
989 } 989 }
990 } 990 }
991 } 991 }
992 992
993 return ownerName; 993 return ownerName;
994#else //KAB_EMBEDDED 994#else //KAB_EMBEDDED
995 qDebug("KABCore::getNameByPhone finsih method"); 995 qDebug("KABCore::getNameByPhone finsih method");
996 return ""; 996 return "";
997#endif //KAB_EMBEDDED 997#endif //KAB_EMBEDDED
998 998
999} 999}
1000 1000
1001void KABCore::openConfigDialog() 1001void KABCore::openConfigDialog()
1002{ 1002{
1003 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1003 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1004 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1004 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1005 ConfigureDialog->addModule(kabcfg ); 1005 ConfigureDialog->addModule(kabcfg );
1006 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1006 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1007 this, SLOT( configurationChanged() ) ); 1007 this, SLOT( configurationChanged() ) );
1008 connect( ConfigureDialog, SIGNAL( okClicked() ), 1008 connect( ConfigureDialog, SIGNAL( okClicked() ),
1009 this, SLOT( configurationChanged() ) ); 1009 this, SLOT( configurationChanged() ) );
1010 saveSettings(); 1010 saveSettings();
1011 ConfigureDialog->showMaximized(); 1011 ConfigureDialog->showMaximized();
1012 ConfigureDialog->exec(); 1012 if ( ConfigureDialog->exec() )
1013 KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") );
1013 delete ConfigureDialog; 1014 delete ConfigureDialog;
1014} 1015}
1015 1016
1016void KABCore::openLDAPDialog() 1017void KABCore::openLDAPDialog()
1017{ 1018{
1018#ifndef KAB_EMBEDDED 1019#ifndef KAB_EMBEDDED
1019 if ( !mLdapSearchDialog ) { 1020 if ( !mLdapSearchDialog ) {
1020 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1021 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1021 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1022 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1022 SLOT( refreshView() ) ); 1023 SLOT( refreshView() ) );
1023 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1024 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1024 SLOT( setModified() ) ); 1025 SLOT( setModified() ) );
1025 } else 1026 } else
1026 mLdapSearchDialog->restoreSettings(); 1027 mLdapSearchDialog->restoreSettings();
1027 1028
1028 if ( mLdapSearchDialog->isOK() ) 1029 if ( mLdapSearchDialog->isOK() )
1029 mLdapSearchDialog->exec(); 1030 mLdapSearchDialog->exec();
1030#else //KAB_EMBEDDED 1031#else //KAB_EMBEDDED
1031 qDebug("KABCore::openLDAPDialog() finsih method"); 1032 qDebug("KABCore::openLDAPDialog() finsih method");
1032#endif //KAB_EMBEDDED 1033#endif //KAB_EMBEDDED
1033} 1034}
1034 1035
1035void KABCore::print() 1036void KABCore::print()
1036{ 1037{
1037#ifndef KAB_EMBEDDED 1038#ifndef KAB_EMBEDDED
1038 KPrinter printer; 1039 KPrinter printer;
1039 if ( !printer.setup( this ) ) 1040 if ( !printer.setup( this ) )
1040 return; 1041 return;
1041 1042
1042 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1043 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1043 mViewManager->selectedUids(), this ); 1044 mViewManager->selectedUids(), this );
1044 1045
1045 wizard.exec(); 1046 wizard.exec();
1046#else //KAB_EMBEDDED 1047#else //KAB_EMBEDDED
1047 qDebug("KABCore::print() finsih method"); 1048 qDebug("KABCore::print() finsih method");
1048#endif //KAB_EMBEDDED 1049#endif //KAB_EMBEDDED
1049 1050
1050} 1051}
1051 1052
1052 1053
1053void KABCore::addGUIClient( KXMLGUIClient *client ) 1054void KABCore::addGUIClient( KXMLGUIClient *client )
1054{ 1055{
1055 if ( mGUIClient ) 1056 if ( mGUIClient )
1056 mGUIClient->insertChildClient( client ); 1057 mGUIClient->insertChildClient( client );
1057 else 1058 else
1058 KMessageBox::error( this, "no KXMLGUICLient"); 1059 KMessageBox::error( this, "no KXMLGUICLient");
1059} 1060}
1060 1061
1061 1062
1062void KABCore::configurationChanged() 1063void KABCore::configurationChanged()
1063{ 1064{
1064 mExtensionManager->reconfigure(); 1065 mExtensionManager->reconfigure();
1065} 1066}
1066 1067
1067void KABCore::addressBookChanged() 1068void KABCore::addressBookChanged()
1068{ 1069{
1069#ifndef KAB_EMBEDDED 1070#ifndef KAB_EMBEDDED
1070 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1071 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1071 while ( it.current() ) { 1072 while ( it.current() ) {
1072 if ( it.current()->dirty() ) { 1073 if ( it.current()->dirty() ) {
1073 QString text = i18n( "Data has been changed externally. Unsaved " 1074 QString text = i18n( "Data has been changed externally. Unsaved "
1074 "changes will be lost." ); 1075 "changes will be lost." );
1075 KMessageBox::information( this, text ); 1076 KMessageBox::information( this, text );
1076 } 1077 }
1077 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1078 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1078 ++it; 1079 ++it;
1079 } 1080 }
1080 1081
1081 mViewManager->refreshView(); 1082 mViewManager->refreshView();
1082#else //KAB_EMBEDDED 1083#else //KAB_EMBEDDED
1083 qDebug("KABCore::addressBookChanged() finsih method"); 1084 qDebug("KABCore::addressBookChanged() finsih method");
1084#endif //KAB_EMBEDDED 1085#endif //KAB_EMBEDDED
1085} 1086}
1086 1087
1087AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1088AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1088 const char *name ) 1089 const char *name )
1089{ 1090{
1090 AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent, 1091 AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent,
1091 name ? name : "editorDialog" ); 1092 name ? name : "editorDialog" );
1092 1093
1093//US 1094//US
1094 dialog->setMaximumSize( 640, 480 ); 1095 dialog->setMaximumSize( 640, 480 );
1095 dialog->showMaximized(); 1096 dialog->showMaximized();
1096 1097
1097 connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1098 connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1098 SLOT( contactModified( const KABC::Addressee& ) ) ); 1099 SLOT( contactModified( const KABC::Addressee& ) ) );
1099 connect( dialog, SIGNAL( editorDestroyed( const QString& ) ), 1100 connect( dialog, SIGNAL( editorDestroyed( const QString& ) ),
1100 SLOT( slotEditorDestroyed( const QString& ) ) ); 1101 SLOT( slotEditorDestroyed( const QString& ) ) );
1101 1102
1102 return dialog; 1103 return dialog;
1103} 1104}
1104 1105
1105void KABCore::slotEditorDestroyed( const QString &uid ) 1106void KABCore::slotEditorDestroyed( const QString &uid )
1106{ 1107{
1107 mEditorDict.remove( uid ); 1108 mEditorDict.remove( uid );
1108} 1109}
@@ -1268,200 +1269,201 @@ void KABCore::initActions()
1268//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1269//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1269 1270
1270#ifndef KAB_EMBEDDED 1271#ifndef KAB_EMBEDDED
1271 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1272 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1272 SLOT( clipboardDataChanged() ) ); 1273 SLOT( clipboardDataChanged() ) );
1273#endif //KAB_EMBEDDED 1274#endif //KAB_EMBEDDED
1274 1275
1275 // file menu 1276 // file menu
1276 if ( mIsPart ) { 1277 if ( mIsPart ) {
1277 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1278 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1278 SLOT( sendMail() ), actionCollection(), 1279 SLOT( sendMail() ), actionCollection(),
1279 "kaddressbook_mail" ); 1280 "kaddressbook_mail" );
1280 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1281 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1281 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1282 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1282 1283
1283 } else { 1284 } else {
1284 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1285 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1285 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1286 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1286 } 1287 }
1287 1288
1288 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1289 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1289 SLOT( save() ), actionCollection(), "file_sync" ); 1290 SLOT( save() ), actionCollection(), "file_sync" );
1290 1291
1291 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1292 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1292 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1293 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1293 1294
1294 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1295 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1295 this, SLOT( mailVCard() ), 1296 this, SLOT( mailVCard() ),
1296 actionCollection(), "file_mail_vcard"); 1297 actionCollection(), "file_mail_vcard");
1297 1298
1298 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1299 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1299 this, SLOT( editContact2() ), 1300 this, SLOT( editContact2() ),
1300 actionCollection(), "file_properties" ); 1301 actionCollection(), "file_properties" );
1301 1302
1302#ifdef KAB_EMBEDDED 1303#ifdef KAB_EMBEDDED
1303 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1304 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1304 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1305 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1305 mMainWindow, SLOT( exit() ), 1306 mMainWindow, SLOT( exit() ),
1306 actionCollection(), "quit" ); 1307 actionCollection(), "quit" );
1307#endif //KAB_EMBEDDED 1308#endif //KAB_EMBEDDED
1308 1309
1309 // edit menu 1310 // edit menu
1310 if ( mIsPart ) { 1311 if ( mIsPart ) {
1311 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1312 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1312 SLOT( copyContacts() ), actionCollection(), 1313 SLOT( copyContacts() ), actionCollection(),
1313 "kaddressbook_copy" ); 1314 "kaddressbook_copy" );
1314 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1315 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1315 SLOT( cutContacts() ), actionCollection(), 1316 SLOT( cutContacts() ), actionCollection(),
1316 "kaddressbook_cut" ); 1317 "kaddressbook_cut" );
1317 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1318 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1318 SLOT( pasteContacts() ), actionCollection(), 1319 SLOT( pasteContacts() ), actionCollection(),
1319 "kaddressbook_paste" ); 1320 "kaddressbook_paste" );
1320 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1321 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1321 SLOT( selectAllContacts() ), actionCollection(), 1322 SLOT( selectAllContacts() ), actionCollection(),
1322 "kaddressbook_select_all" ); 1323 "kaddressbook_select_all" );
1323 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1324 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1324 SLOT( undo() ), actionCollection(), 1325 SLOT( undo() ), actionCollection(),
1325 "kaddressbook_undo" ); 1326 "kaddressbook_undo" );
1326 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1327 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1327 this, SLOT( redo() ), actionCollection(), 1328 this, SLOT( redo() ), actionCollection(),
1328 "kaddressbook_redo" ); 1329 "kaddressbook_redo" );
1329 } else { 1330 } else {
1330 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1331 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1331 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1332 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1332 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1333 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1333 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1334 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1334 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1335 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1335 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1336 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1336 } 1337 }
1337 1338
1338 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1339 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1339 Key_Delete, this, SLOT( deleteContacts() ), 1340 Key_Delete, this, SLOT( deleteContacts() ),
1340 actionCollection(), "edit_delete" ); 1341 actionCollection(), "edit_delete" );
1341 1342
1342 mActionUndo->setEnabled( false ); 1343 mActionUndo->setEnabled( false );
1343 mActionRedo->setEnabled( false ); 1344 mActionRedo->setEnabled( false );
1344 1345
1345 // settings menu 1346 // settings menu
1346#ifdef KAB_EMBEDDED 1347#ifdef KAB_EMBEDDED
1347//US special menuentry to configure the addressbook resources. On KDE 1348//US special menuentry to configure the addressbook resources. On KDE
1348// you do that through the control center !!! 1349// you do that through the control center !!!
1349 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1350 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1350 SLOT( configureResources() ), actionCollection(), 1351 SLOT( configureResources() ), actionCollection(),
1351 "kaddressbook_configure_resources" ); 1352 "kaddressbook_configure_resources" );
1352#endif //KAB_EMBEDDED 1353#endif //KAB_EMBEDDED
1353 1354
1354 if ( mIsPart ) { 1355 if ( mIsPart ) {
1355 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1356 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1356 SLOT( openConfigDialog() ), actionCollection(), 1357 SLOT( openConfigDialog() ), actionCollection(),
1357 "kaddressbook_configure" ); 1358 "kaddressbook_configure" );
1358 1359
1359 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1360 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1360 this, SLOT( configureKeyBindings() ), actionCollection(), 1361 this, SLOT( configureKeyBindings() ), actionCollection(),
1361 "kaddressbook_configure_shortcuts" ); 1362 "kaddressbook_configure_shortcuts" );
1362#ifdef KAB_EMBEDDED 1363#ifdef KAB_EMBEDDED
1363 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1364 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1365 mActionConfigureToolbars->setEnabled( false );
1364#endif //KAB_EMBEDDED 1366#endif //KAB_EMBEDDED
1365 1367
1366 } else { 1368 } else {
1367 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1369 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1368 1370
1369 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1371 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1370 } 1372 }
1371 1373
1372 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1374 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1373 actionCollection(), "options_show_jump_bar" ); 1375 actionCollection(), "options_show_jump_bar" );
1374 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1376 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1375 1377
1376 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, 1378 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0,
1377 actionCollection(), "options_show_details" ); 1379 actionCollection(), "options_show_details" );
1378 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1380 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1379 1381
1380 // misc 1382 // misc
1381 // only enable LDAP lookup if we can handle the protocol 1383 // only enable LDAP lookup if we can handle the protocol
1382#ifndef KAB_EMBEDDED 1384#ifndef KAB_EMBEDDED
1383 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1385 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1384 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1386 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1385 this, SLOT( openLDAPDialog() ), actionCollection(), 1387 this, SLOT( openLDAPDialog() ), actionCollection(),
1386 "ldap_lookup" ); 1388 "ldap_lookup" );
1387 } 1389 }
1388#else //KAB_EMBEDDED 1390#else //KAB_EMBEDDED
1389 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1391 //qDebug("KABCore::initActions() LDAP has to be implemented");
1390#endif //KAB_EMBEDDED 1392#endif //KAB_EMBEDDED
1391 1393
1392 1394
1393 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1395 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1394 SLOT( setWhoAmI() ), actionCollection(), 1396 SLOT( setWhoAmI() ), actionCollection(),
1395 "set_personal" ); 1397 "set_personal" );
1396 1398
1397 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1399 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1398 SLOT( setCategories() ), actionCollection(), 1400 SLOT( setCategories() ), actionCollection(),
1399 "edit_set_categories" ); 1401 "edit_set_categories" );
1400 1402
1401#ifdef KAB_EMBEDDED 1403#ifdef KAB_EMBEDDED
1402 1404
1403 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1405 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1404 this, SLOT( createAboutData() ), actionCollection(), 1406 this, SLOT( createAboutData() ), actionCollection(),
1405 "kaddressbook_about_data" ); 1407 "kaddressbook_about_data" );
1406#endif //KAB_EMBEDDED 1408#endif //KAB_EMBEDDED
1407 1409
1408 clipboardDataChanged(); 1410 clipboardDataChanged();
1409 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1411 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1410 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1412 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1411} 1413}
1412 1414
1413//US we need this function, to plug all actions into the correct menues. 1415//US we need this function, to plug all actions into the correct menues.
1414// KDE uses a XML format to plug the actions, but we work her without this overhead. 1416// KDE uses a XML format to plug the actions, but we work her without this overhead.
1415void KABCore::addActionsManually() 1417void KABCore::addActionsManually()
1416{ 1418{
1417//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1419//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1418 1420
1419#ifdef KAB_EMBEDDED 1421#ifdef KAB_EMBEDDED
1420 QPopupMenu *fileMenu = new QPopupMenu( this ); 1422 QPopupMenu *fileMenu = new QPopupMenu( this );
1421 QPopupMenu *editMenu = new QPopupMenu( this ); 1423 QPopupMenu *editMenu = new QPopupMenu( this );
1422 QPopupMenu *helpMenu = new QPopupMenu( this ); 1424 QPopupMenu *helpMenu = new QPopupMenu( this );
1423 1425
1424 KToolBar* tb = mMainWindow->toolBar(); 1426 KToolBar* tb = mMainWindow->toolBar();
1425 1427
1426#ifdef DESKTOP_VERSION 1428#ifdef DESKTOP_VERSION
1427 QMenuBar* mb = mMainWindow->menuBar(); 1429 QMenuBar* mb = mMainWindow->menuBar();
1428 1430
1429 //US setup menubar. 1431 //US setup menubar.
1430 //Disable the following block if you do not want to have a menubar. 1432 //Disable the following block if you do not want to have a menubar.
1431 mb->insertItem( "&File", fileMenu ); 1433 mb->insertItem( "&File", fileMenu );
1432 mb->insertItem( "&Edit", editMenu ); 1434 mb->insertItem( "&Edit", editMenu );
1433 mb->insertItem( "&View", viewMenu ); 1435 mb->insertItem( "&View", viewMenu );
1434 mb->insertItem( "&Settings", settingsMenu ); 1436 mb->insertItem( "&Settings", settingsMenu );
1435 mb->insertItem( "&Help", helpMenu ); 1437 mb->insertItem( "&Help", helpMenu );
1436 mIncSearchWidget = new IncSearchWidget( tb ); 1438 mIncSearchWidget = new IncSearchWidget( tb );
1437 // tb->insertWidget(-1, 0, mIncSearchWidget); 1439 // tb->insertWidget(-1, 0, mIncSearchWidget);
1438 1440
1439#else 1441#else
1440 //US setup toolbar 1442 //US setup toolbar
1441 QMenuBar *menuBarTB = new QMenuBar( tb ); 1443 QMenuBar *menuBarTB = new QMenuBar( tb );
1442 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1444 QPopupMenu *popupBarTB = new QPopupMenu( this );
1443 menuBarTB->insertItem( "ME", popupBarTB); 1445 menuBarTB->insertItem( "ME", popupBarTB);
1444 tb->insertWidget(-1, 0, menuBarTB); 1446 tb->insertWidget(-1, 0, menuBarTB);
1445 mIncSearchWidget = new IncSearchWidget( tb ); 1447 mIncSearchWidget = new IncSearchWidget( tb );
1446 1448
1447 tb->enableMoving(false); 1449 tb->enableMoving(false);
1448 popupBarTB->insertItem( "&File", fileMenu ); 1450 popupBarTB->insertItem( "&File", fileMenu );
1449 popupBarTB->insertItem( "&Edit", editMenu ); 1451 popupBarTB->insertItem( "&Edit", editMenu );
1450 popupBarTB->insertItem( "&View", viewMenu ); 1452 popupBarTB->insertItem( "&View", viewMenu );
1451 popupBarTB->insertItem( "&Settings", settingsMenu ); 1453 popupBarTB->insertItem( "&Settings", settingsMenu );
1452 mViewManager->getFilterAction()->plug ( popupBarTB); 1454 mViewManager->getFilterAction()->plug ( popupBarTB);
1453 popupBarTB->insertItem( "&Help", helpMenu ); 1455 popupBarTB->insertItem( "&Help", helpMenu );
1454 if (QApplication::desktop()->width() > 320 ) { 1456 if (QApplication::desktop()->width() > 320 ) {
1455 // mViewManager->getFilterAction()->plug ( tb); 1457 // mViewManager->getFilterAction()->plug ( tb);
1456 } 1458 }
1457#endif 1459#endif
1458 // mActionQuit->plug ( mMainWindow->toolBar()); 1460 // mActionQuit->plug ( mMainWindow->toolBar());
1459 1461
1460 1462
1461 1463
1462 //US Now connect the actions with the menue entries. 1464 //US Now connect the actions with the menue entries.
1463 mActionPrint->plug( fileMenu ); 1465 mActionPrint->plug( fileMenu );
1464 mActionMail->plug( fileMenu ); 1466 mActionMail->plug( fileMenu );
1465 fileMenu->insertSeparator(); 1467 fileMenu->insertSeparator();
1466 1468
1467 mActionNewContact->plug( fileMenu ); 1469 mActionNewContact->plug( fileMenu );
@@ -1503,104 +1505,105 @@ void KABCore::addActionsManually()
1503 mActionConfigureToolbars->plug( settingsMenu ); 1505 mActionConfigureToolbars->plug( settingsMenu );
1504 1506
1505 } else { 1507 } else {
1506 mActionKeyBindings->plug( settingsMenu ); 1508 mActionKeyBindings->plug( settingsMenu );
1507 } 1509 }
1508 1510
1509 settingsMenu->insertSeparator(); 1511 settingsMenu->insertSeparator();
1510 1512
1511 mActionJumpBar->plug( settingsMenu ); 1513 mActionJumpBar->plug( settingsMenu );
1512 mActionDetails->plug( settingsMenu ); 1514 mActionDetails->plug( settingsMenu );
1513 settingsMenu->insertSeparator(); 1515 settingsMenu->insertSeparator();
1514 1516
1515 mActionWhoAmI->plug( settingsMenu ); 1517 mActionWhoAmI->plug( settingsMenu );
1516 mActionCategories->plug( settingsMenu ); 1518 mActionCategories->plug( settingsMenu );
1517 1519
1518 mActionAboutKAddressbook->plug( helpMenu ); 1520 mActionAboutKAddressbook->plug( helpMenu );
1519 1521
1520 1522
1521 if (QApplication::desktop()->width() > 320 ) { 1523 if (QApplication::desktop()->width() > 320 ) {
1522 1524
1523 mActionEditAddressee->plug( tb ); 1525 mActionEditAddressee->plug( tb );
1524 mActionSave->plug( tb ); 1526 mActionSave->plug( tb );
1525 mViewManager->getFilterAction()->plug ( tb); 1527 mViewManager->getFilterAction()->plug ( tb);
1526 if (QApplication::desktop()->width() > 480 ) { 1528 if (QApplication::desktop()->width() > 480 ) {
1527 mActionUndo->plug( tb ); 1529 mActionUndo->plug( tb );
1528 mActionDelete->plug( tb ); 1530 mActionDelete->plug( tb );
1529 mActionRedo->plug( tb ); 1531 mActionRedo->plug( tb );
1530 } 1532 }
1531 } 1533 }
1532 //mActionQuit->plug ( tb ); 1534 //mActionQuit->plug ( tb );
1533 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1535 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1534 1536
1535 //US link the searchwidget first to this. 1537 //US link the searchwidget first to this.
1536 // The real linkage to the toolbar happens later. 1538 // The real linkage to the toolbar happens later.
1537//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1539//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1538//US tb->insertItem( mIncSearchWidget ); 1540//US tb->insertItem( mIncSearchWidget );
1539/*US 1541/*US
1540 mIncSearchWidget = new IncSearchWidget( tb ); 1542 mIncSearchWidget = new IncSearchWidget( tb );
1541 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1543 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1542 SLOT( incrementalSearch( const QString& ) ) ); 1544 SLOT( incrementalSearch( const QString& ) ) );
1543 1545
1544 mJumpButtonBar = new JumpButtonBar( this, this ); 1546 mJumpButtonBar = new JumpButtonBar( this, this );
1545 1547
1546//US topLayout->addWidget( mJumpButtonBar ); 1548//US topLayout->addWidget( mJumpButtonBar );
1547 this->layout()->add( mJumpButtonBar ); 1549 this->layout()->add( mJumpButtonBar );
1548*/ 1550*/
1549 1551
1550#endif //KAB_EMBEDDED 1552#endif //KAB_EMBEDDED
1551} 1553}
1552 1554
1553 1555
1554 1556
1555void KABCore::clipboardDataChanged() 1557void KABCore::clipboardDataChanged()
1556{ 1558{
1557 1559
1558 if ( mReadWrite ) 1560 if ( mReadWrite )
1559 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 1561 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1560 1562
1561} 1563}
1562 1564
1563void KABCore::updateActionMenu() 1565void KABCore::updateActionMenu()
1564{ 1566{
1565 UndoStack *undo = UndoStack::instance(); 1567 UndoStack *undo = UndoStack::instance();
1566 RedoStack *redo = RedoStack::instance(); 1568 RedoStack *redo = RedoStack::instance();
1567 1569
1568 if ( undo->isEmpty() ) 1570 if ( undo->isEmpty() )
1569 mActionUndo->setText( i18n( "Undo" ) ); 1571 mActionUndo->setText( i18n( "Undo" ) );
1570 else 1572 else
1571 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 1573 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
1572 1574
1573 mActionUndo->setEnabled( !undo->isEmpty() ); 1575 mActionUndo->setEnabled( !undo->isEmpty() );
1574 1576
1575 if ( !redo->top() ) 1577 if ( !redo->top() )
1576 mActionRedo->setText( i18n( "Redo" ) ); 1578 mActionRedo->setText( i18n( "Redo" ) );
1577 else 1579 else
1578 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 1580 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
1579 1581
1580 mActionRedo->setEnabled( !redo->isEmpty() ); 1582 mActionRedo->setEnabled( !redo->isEmpty() );
1581} 1583}
1582 1584
1583void KABCore::configureKeyBindings() 1585void KABCore::configureKeyBindings()
1584{ 1586{
1585#ifndef KAB_EMBEDDED 1587#ifndef KAB_EMBEDDED
1586 KKeyDialog::configure( actionCollection(), true ); 1588 KKeyDialog::configure( actionCollection(), true );
1587#else //KAB_EMBEDDED 1589#else //KAB_EMBEDDED
1588 qDebug("KABCore::configureKeyBindings() not implemented"); 1590 qDebug("KABCore::configureKeyBindings() not implemented");
1589#endif //KAB_EMBEDDED 1591#endif //KAB_EMBEDDED
1590} 1592}
1591 1593
1592#ifdef KAB_EMBEDDED 1594#ifdef KAB_EMBEDDED
1593void KABCore::configureResources() 1595void KABCore::configureResources()
1594{ 1596{
1595 KRES::KCMKResources dlg( this, "" , 0 ); 1597 KRES::KCMKResources dlg( this, "" , 0 );
1596 1598
1597 if ( !dlg.exec() ) 1599 if ( !dlg.exec() )
1598 return; 1600 return;
1601 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
1599} 1602}
1600#endif //KAB_EMBEDDED 1603#endif //KAB_EMBEDDED
1601 1604
1602 1605
1603 1606
1604#ifndef KAB_EMBEDDED 1607#ifndef KAB_EMBEDDED
1605#include "kabcore.moc" 1608#include "kabcore.moc"
1606#endif //KAB_EMBEDDED 1609#endif //KAB_EMBEDDED