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
@@ -964,97 +964,98 @@ void KABCore::extensionModified( const KABC::Addressee::List &list )
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
@@ -1316,104 +1317,105 @@ void KABCore::initActions()
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
@@ -1551,56 +1553,57 @@ void KABCore::addActionsManually()
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