author | zautrix <zautrix> | 2005-03-17 10:00:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-17 10:00:03 (UTC) |
commit | a1ae8a0c130aef01923b9a00c95919e0a9fea9d7 (patch) (unidiff) | |
tree | 09988c640bb71db2677dff6155cae0a6f027d194 /kaddressbook | |
parent | e0a510893ffcddb8d58f785832622d030900b2f9 (diff) | |
download | kdepimpi-a1ae8a0c130aef01923b9a00c95919e0a9fea9d7.zip kdepimpi-a1ae8a0c130aef01923b9a00c95919e0a9fea9d7.tar.gz kdepimpi-a1ae8a0c130aef01923b9a00c95919e0a9fea9d7.tar.bz2 |
small kapi fixes
-rw-r--r-- | kaddressbook/kabcore.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 3f7a7da..e8f6132 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1254,384 +1254,389 @@ void KABCore::newContact() | |||
1254 | 1254 | ||
1255 | void KABCore::addEmail( QString aStr ) | 1255 | void KABCore::addEmail( QString aStr ) |
1256 | { | 1256 | { |
1257 | #ifndef KAB_EMBEDDED | 1257 | #ifndef KAB_EMBEDDED |
1258 | QString fullName, email; | 1258 | QString fullName, email; |
1259 | 1259 | ||
1260 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1260 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1261 | 1261 | ||
1262 | // Try to lookup the addressee matching the email address | 1262 | // Try to lookup the addressee matching the email address |
1263 | bool found = false; | 1263 | bool found = false; |
1264 | QStringList emailList; | 1264 | QStringList emailList; |
1265 | KABC::AddressBook::Iterator it; | 1265 | KABC::AddressBook::Iterator it; |
1266 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1266 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1267 | emailList = (*it).emails(); | 1267 | emailList = (*it).emails(); |
1268 | if ( emailList.contains( email ) > 0 ) { | 1268 | if ( emailList.contains( email ) > 0 ) { |
1269 | found = true; | 1269 | found = true; |
1270 | (*it).setNameFromString( fullName ); | 1270 | (*it).setNameFromString( fullName ); |
1271 | editContact( (*it).uid() ); | 1271 | editContact( (*it).uid() ); |
1272 | } | 1272 | } |
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | if ( !found ) { | 1275 | if ( !found ) { |
1276 | KABC::Addressee addr; | 1276 | KABC::Addressee addr; |
1277 | addr.setNameFromString( fullName ); | 1277 | addr.setNameFromString( fullName ); |
1278 | addr.insertEmail( email, true ); | 1278 | addr.insertEmail( email, true ); |
1279 | 1279 | ||
1280 | mAddressBook->insertAddressee( addr ); | 1280 | mAddressBook->insertAddressee( addr ); |
1281 | mViewManager->refreshView( addr.uid() ); | 1281 | mViewManager->refreshView( addr.uid() ); |
1282 | editContact( addr.uid() ); | 1282 | editContact( addr.uid() ); |
1283 | } | 1283 | } |
1284 | #else //KAB_EMBEDDED | 1284 | #else //KAB_EMBEDDED |
1285 | qDebug("KABCore::addEmail finsih method"); | 1285 | qDebug("KABCore::addEmail finsih method"); |
1286 | #endif //KAB_EMBEDDED | 1286 | #endif //KAB_EMBEDDED |
1287 | } | 1287 | } |
1288 | 1288 | ||
1289 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1289 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1290 | { | 1290 | { |
1291 | mXXPortManager->importVCard( url, showPreview ); | 1291 | mXXPortManager->importVCard( url, showPreview ); |
1292 | } | 1292 | } |
1293 | void KABCore::importFromOL() | 1293 | void KABCore::importFromOL() |
1294 | { | 1294 | { |
1295 | #ifdef _OL_IMPORT_ | 1295 | #ifdef _OL_IMPORT_ |
1296 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 1296 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1297 | idgl->exec(); | 1297 | idgl->exec(); |
1298 | KABC::Addressee::List list = idgl->getAddressList(); | 1298 | KABC::Addressee::List list = idgl->getAddressList(); |
1299 | if ( list.count() > 0 ) { | 1299 | if ( list.count() > 0 ) { |
1300 | KABC::Addressee::List listNew; | 1300 | KABC::Addressee::List listNew; |
1301 | KABC::Addressee::List listExisting; | 1301 | KABC::Addressee::List listExisting; |
1302 | KABC::Addressee::List::Iterator it; | 1302 | KABC::Addressee::List::Iterator it; |
1303 | KABC::AddressBook::Iterator iter; | 1303 | KABC::AddressBook::Iterator iter; |
1304 | for ( it = list.begin(); it != list.end(); ++it ) { | 1304 | for ( it = list.begin(); it != list.end(); ++it ) { |
1305 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1305 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1306 | listNew.append( (*it) ); | 1306 | listNew.append( (*it) ); |
1307 | else | 1307 | else |
1308 | listExisting.append( (*it) ); | 1308 | listExisting.append( (*it) ); |
1309 | } | 1309 | } |
1310 | if ( listExisting.count() > 0 ) | 1310 | if ( listExisting.count() > 0 ) |
1311 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1311 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1312 | if ( listNew.count() > 0 ) { | 1312 | if ( listNew.count() > 0 ) { |
1313 | pasteWithNewUid = false; | 1313 | pasteWithNewUid = false; |
1314 | pasteContacts( listNew ); | 1314 | pasteContacts( listNew ); |
1315 | pasteWithNewUid = true; | 1315 | pasteWithNewUid = true; |
1316 | } | 1316 | } |
1317 | } | 1317 | } |
1318 | delete idgl; | 1318 | delete idgl; |
1319 | #endif | 1319 | #endif |
1320 | } | 1320 | } |
1321 | 1321 | ||
1322 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1322 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1323 | { | 1323 | { |
1324 | mXXPortManager->importVCard( vCard, showPreview ); | 1324 | mXXPortManager->importVCard( vCard, showPreview ); |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | //US added a second method without defaultparameter | 1327 | //US added a second method without defaultparameter |
1328 | void KABCore::editContact2() { | 1328 | void KABCore::editContact2() { |
1329 | editContact( QString::null ); | 1329 | editContact( QString::null ); |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | void KABCore::editContact( const QString &uid ) | 1332 | void KABCore::editContact( const QString &uid ) |
1333 | { | 1333 | { |
1334 | 1334 | ||
1335 | if ( mExtensionManager->isQuickEditVisible() ) | 1335 | if ( mExtensionManager->isQuickEditVisible() ) |
1336 | return; | 1336 | return; |
1337 | 1337 | ||
1338 | // First, locate the contact entry | 1338 | // First, locate the contact entry |
1339 | QString localUID = uid; | 1339 | QString localUID = uid; |
1340 | if ( localUID.isNull() ) { | 1340 | if ( localUID.isNull() ) { |
1341 | QStringList uidList = mViewManager->selectedUids(); | 1341 | QStringList uidList = mViewManager->selectedUids(); |
1342 | if ( uidList.count() > 0 ) | 1342 | if ( uidList.count() > 0 ) |
1343 | localUID = *( uidList.at( 0 ) ); | 1343 | localUID = *( uidList.at( 0 ) ); |
1344 | } | 1344 | } |
1345 | 1345 | ||
1346 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1346 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1347 | if ( !addr.isEmpty() ) { | 1347 | if ( !addr.isEmpty() ) { |
1348 | mEditorDialog->setAddressee( addr ); | 1348 | mEditorDialog->setAddressee( addr ); |
1349 | KApplication::execDialog ( mEditorDialog ); | 1349 | KApplication::execDialog ( mEditorDialog ); |
1350 | } | 1350 | } |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | /** | 1353 | /** |
1354 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1354 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1355 | the method will try to find a selected addressee in the view. | 1355 | the method will try to find a selected addressee in the view. |
1356 | */ | 1356 | */ |
1357 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1357 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1358 | { | 1358 | { |
1359 | if ( mMultipleViewsAtOnce ) | 1359 | if ( mMultipleViewsAtOnce ) |
1360 | { | 1360 | { |
1361 | editContact( uid ); | 1361 | editContact( uid ); |
1362 | } | 1362 | } |
1363 | else | 1363 | else |
1364 | { | 1364 | { |
1365 | setDetailsVisible( true ); | 1365 | setDetailsVisible( true ); |
1366 | mActionDetails->setChecked(true); | 1366 | mActionDetails->setChecked(true); |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | } | 1369 | } |
1370 | 1370 | ||
1371 | void KABCore::save() | 1371 | void KABCore::save() |
1372 | { | 1372 | { |
1373 | if (syncManager->blockSave()) | 1373 | if (syncManager->blockSave()) |
1374 | return; | 1374 | return; |
1375 | if ( !mModified ) | 1375 | if ( !mModified ) |
1376 | return; | 1376 | return; |
1377 | 1377 | ||
1378 | syncManager->setBlockSave(true); | 1378 | syncManager->setBlockSave(true); |
1379 | QString text = i18n( "There was an error while attempting to save\n the " | 1379 | QString text = i18n( "There was an error while attempting to save\n the " |
1380 | "address book. Please check that some \nother application is " | 1380 | "address book. Please check that some \nother application is " |
1381 | "not using it. " ); | 1381 | "not using it. " ); |
1382 | message(i18n("Saving ... please wait! "), false); | 1382 | message(i18n("Saving ... please wait! "), false); |
1383 | //qApp->processEvents(); | 1383 | //qApp->processEvents(); |
1384 | #ifndef KAB_EMBEDDED | 1384 | #ifndef KAB_EMBEDDED |
1385 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1385 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1386 | if ( !b || !b->save() ) { | 1386 | if ( !b || !b->save() ) { |
1387 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1387 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1388 | } | 1388 | } |
1389 | #else //KAB_EMBEDDED | 1389 | #else //KAB_EMBEDDED |
1390 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1390 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1391 | if ( !b || !b->save() ) { | 1391 | if ( !b || !b->save() ) { |
1392 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1392 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1393 | } | 1393 | } |
1394 | #endif //KAB_EMBEDDED | 1394 | #endif //KAB_EMBEDDED |
1395 | 1395 | ||
1396 | message(i18n("Addressbook saved!")); | 1396 | message(i18n("Addressbook saved!")); |
1397 | setModified( false ); | 1397 | setModified( false ); |
1398 | syncManager->setBlockSave(false); | 1398 | syncManager->setBlockSave(false); |
1399 | } | 1399 | } |
1400 | 1400 | ||
1401 | 1401 | ||
1402 | void KABCore::undo() | 1402 | void KABCore::undo() |
1403 | { | 1403 | { |
1404 | UndoStack::instance()->undo(); | 1404 | UndoStack::instance()->undo(); |
1405 | 1405 | ||
1406 | // Refresh the view | 1406 | // Refresh the view |
1407 | mViewManager->refreshView(); | 1407 | mViewManager->refreshView(); |
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | void KABCore::redo() | 1410 | void KABCore::redo() |
1411 | { | 1411 | { |
1412 | RedoStack::instance()->redo(); | 1412 | RedoStack::instance()->redo(); |
1413 | 1413 | ||
1414 | // Refresh the view | 1414 | // Refresh the view |
1415 | mViewManager->refreshView(); | 1415 | mViewManager->refreshView(); |
1416 | } | 1416 | } |
1417 | void KABCore::setJumpButtonBar( bool visible ) | 1417 | void KABCore::setJumpButtonBar( bool visible ) |
1418 | { | 1418 | { |
1419 | setJumpButtonBarVisible(visible ); | 1419 | setJumpButtonBarVisible(visible ); |
1420 | saveSettings(); | 1420 | saveSettings(); |
1421 | } | 1421 | } |
1422 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1422 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1423 | { | 1423 | { |
1424 | if (mMultipleViewsAtOnce) | 1424 | if (mMultipleViewsAtOnce) |
1425 | { | 1425 | { |
1426 | if ( visible ) | 1426 | if ( visible ) |
1427 | mJumpButtonBar->show(); | 1427 | mJumpButtonBar->show(); |
1428 | else | 1428 | else |
1429 | mJumpButtonBar->hide(); | 1429 | mJumpButtonBar->hide(); |
1430 | } | 1430 | } |
1431 | else | 1431 | else |
1432 | { | 1432 | { |
1433 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1433 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1434 | if (mViewManager->isVisible()) | 1434 | if (mViewManager->isVisible()) |
1435 | { | 1435 | { |
1436 | if ( visible ) | 1436 | if ( visible ) |
1437 | mJumpButtonBar->show(); | 1437 | mJumpButtonBar->show(); |
1438 | else | 1438 | else |
1439 | mJumpButtonBar->hide(); | 1439 | mJumpButtonBar->hide(); |
1440 | } | 1440 | } |
1441 | else | 1441 | else |
1442 | { | 1442 | { |
1443 | mJumpButtonBar->hide(); | 1443 | mJumpButtonBar->hide(); |
1444 | } | 1444 | } |
1445 | } | 1445 | } |
1446 | if ( visible ) { | ||
1447 | if ( mIncSearchWidget->currentItem() == 0 ) { | ||
1448 | message( i18n("Change search field enable jump bar") ); | ||
1449 | } | ||
1450 | } | ||
1446 | } | 1451 | } |
1447 | 1452 | ||
1448 | 1453 | ||
1449 | void KABCore::setDetailsToState() | 1454 | void KABCore::setDetailsToState() |
1450 | { | 1455 | { |
1451 | setDetailsVisible( mActionDetails->isChecked() ); | 1456 | setDetailsVisible( mActionDetails->isChecked() ); |
1452 | } | 1457 | } |
1453 | void KABCore::setDetailsToggle() | 1458 | void KABCore::setDetailsToggle() |
1454 | { | 1459 | { |
1455 | mActionDetails->setChecked( !mActionDetails->isChecked() ); | 1460 | mActionDetails->setChecked( !mActionDetails->isChecked() ); |
1456 | setDetailsToState(); | 1461 | setDetailsToState(); |
1457 | } | 1462 | } |
1458 | 1463 | ||
1459 | 1464 | ||
1460 | 1465 | ||
1461 | void KABCore::setDetailsVisible( bool visible ) | 1466 | void KABCore::setDetailsVisible( bool visible ) |
1462 | { | 1467 | { |
1463 | if (visible && mDetails->isHidden()) | 1468 | if (visible && mDetails->isHidden()) |
1464 | { | 1469 | { |
1465 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1470 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1466 | if ( addrList.count() > 0 ) | 1471 | if ( addrList.count() > 0 ) |
1467 | mDetails->setAddressee( addrList[ 0 ] ); | 1472 | mDetails->setAddressee( addrList[ 0 ] ); |
1468 | } | 1473 | } |
1469 | 1474 | ||
1470 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1475 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1471 | // the listview and the detailview. We do that by changing the splitbar size. | 1476 | // the listview and the detailview. We do that by changing the splitbar size. |
1472 | if (mMultipleViewsAtOnce) | 1477 | if (mMultipleViewsAtOnce) |
1473 | { | 1478 | { |
1474 | if ( visible ) | 1479 | if ( visible ) |
1475 | mDetails->show(); | 1480 | mDetails->show(); |
1476 | else | 1481 | else |
1477 | mDetails->hide(); | 1482 | mDetails->hide(); |
1478 | } | 1483 | } |
1479 | else | 1484 | else |
1480 | { | 1485 | { |
1481 | if ( visible ) { | 1486 | if ( visible ) { |
1482 | mViewManager->hide(); | 1487 | mViewManager->hide(); |
1483 | mDetails->show(); | 1488 | mDetails->show(); |
1484 | mIncSearchWidget->setFocus(); | 1489 | mIncSearchWidget->setFocus(); |
1485 | } | 1490 | } |
1486 | else { | 1491 | else { |
1487 | mViewManager->show(); | 1492 | mViewManager->show(); |
1488 | mDetails->hide(); | 1493 | mDetails->hide(); |
1489 | mViewManager->setFocusAV(); | 1494 | mViewManager->setFocusAV(); |
1490 | } | 1495 | } |
1491 | setJumpButtonBarVisible( !visible ); | 1496 | setJumpButtonBarVisible( !visible ); |
1492 | } | 1497 | } |
1493 | 1498 | ||
1494 | } | 1499 | } |
1495 | 1500 | ||
1496 | void KABCore::extensionChanged( int id ) | 1501 | void KABCore::extensionChanged( int id ) |
1497 | { | 1502 | { |
1498 | //change the details view only for non desktop systems | 1503 | //change the details view only for non desktop systems |
1499 | #ifndef DESKTOP_VERSION | 1504 | #ifndef DESKTOP_VERSION |
1500 | 1505 | ||
1501 | if (id == 0) | 1506 | if (id == 0) |
1502 | { | 1507 | { |
1503 | //the user disabled the extension. | 1508 | //the user disabled the extension. |
1504 | 1509 | ||
1505 | if (mMultipleViewsAtOnce) | 1510 | if (mMultipleViewsAtOnce) |
1506 | { // enable detailsview again | 1511 | { // enable detailsview again |
1507 | setDetailsVisible( true ); | 1512 | setDetailsVisible( true ); |
1508 | mActionDetails->setChecked( true ); | 1513 | mActionDetails->setChecked( true ); |
1509 | } | 1514 | } |
1510 | else | 1515 | else |
1511 | { //go back to the listview | 1516 | { //go back to the listview |
1512 | setDetailsVisible( false ); | 1517 | setDetailsVisible( false ); |
1513 | mActionDetails->setChecked( false ); | 1518 | mActionDetails->setChecked( false ); |
1514 | mActionDetails->setEnabled(true); | 1519 | mActionDetails->setEnabled(true); |
1515 | } | 1520 | } |
1516 | 1521 | ||
1517 | } | 1522 | } |
1518 | else | 1523 | else |
1519 | { | 1524 | { |
1520 | //the user enabled the extension. | 1525 | //the user enabled the extension. |
1521 | setDetailsVisible( false ); | 1526 | setDetailsVisible( false ); |
1522 | mActionDetails->setChecked( false ); | 1527 | mActionDetails->setChecked( false ); |
1523 | 1528 | ||
1524 | if (!mMultipleViewsAtOnce) | 1529 | if (!mMultipleViewsAtOnce) |
1525 | { | 1530 | { |
1526 | mActionDetails->setEnabled(false); | 1531 | mActionDetails->setEnabled(false); |
1527 | } | 1532 | } |
1528 | 1533 | ||
1529 | mExtensionManager->setSelectionChanged(); | 1534 | mExtensionManager->setSelectionChanged(); |
1530 | 1535 | ||
1531 | } | 1536 | } |
1532 | 1537 | ||
1533 | #endif// DESKTOP_VERSION | 1538 | #endif// DESKTOP_VERSION |
1534 | 1539 | ||
1535 | } | 1540 | } |
1536 | 1541 | ||
1537 | 1542 | ||
1538 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1543 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1539 | { | 1544 | { |
1540 | 1545 | ||
1541 | if ( list.count() != 0 ) { | 1546 | if ( list.count() != 0 ) { |
1542 | KABC::Addressee::List::ConstIterator it; | 1547 | KABC::Addressee::List::ConstIterator it; |
1543 | for ( it = list.begin(); it != list.end(); ++it ) | 1548 | for ( it = list.begin(); it != list.end(); ++it ) |
1544 | mAddressBook->insertAddressee( *it ); | 1549 | mAddressBook->insertAddressee( *it ); |
1545 | if ( list.count() > 1 ) | 1550 | if ( list.count() > 1 ) |
1546 | setModified(); | 1551 | setModified(); |
1547 | else | 1552 | else |
1548 | setModifiedWOrefresh(); | 1553 | setModifiedWOrefresh(); |
1549 | } | 1554 | } |
1550 | if ( list.count() == 0 ) | 1555 | if ( list.count() == 0 ) |
1551 | mViewManager->refreshView(); | 1556 | mViewManager->refreshView(); |
1552 | else | 1557 | else |
1553 | mViewManager->refreshView( list[ 0 ].uid() ); | 1558 | mViewManager->refreshView( list[ 0 ].uid() ); |
1554 | 1559 | ||
1555 | 1560 | ||
1556 | 1561 | ||
1557 | } | 1562 | } |
1558 | 1563 | ||
1559 | QString KABCore::getNameByPhone( const QString &phone ) | 1564 | QString KABCore::getNameByPhone( const QString &phone ) |
1560 | { | 1565 | { |
1561 | #ifndef KAB_EMBEDDED | 1566 | #ifndef KAB_EMBEDDED |
1562 | QRegExp r( "[/*/-/ ]" ); | 1567 | QRegExp r( "[/*/-/ ]" ); |
1563 | QString localPhone( phone ); | 1568 | QString localPhone( phone ); |
1564 | 1569 | ||
1565 | bool found = false; | 1570 | bool found = false; |
1566 | QString ownerName = ""; | 1571 | QString ownerName = ""; |
1567 | KABC::AddressBook::Iterator iter; | 1572 | KABC::AddressBook::Iterator iter; |
1568 | KABC::PhoneNumber::List::Iterator phoneIter; | 1573 | KABC::PhoneNumber::List::Iterator phoneIter; |
1569 | KABC::PhoneNumber::List phoneList; | 1574 | KABC::PhoneNumber::List phoneList; |
1570 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1575 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1571 | phoneList = (*iter).phoneNumbers(); | 1576 | phoneList = (*iter).phoneNumbers(); |
1572 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1577 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1573 | ++phoneIter) { | 1578 | ++phoneIter) { |
1574 | // Get rid of separator chars so just the numbers are compared. | 1579 | // Get rid of separator chars so just the numbers are compared. |
1575 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1580 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1576 | ownerName = (*iter).formattedName(); | 1581 | ownerName = (*iter).formattedName(); |
1577 | found = true; | 1582 | found = true; |
1578 | } | 1583 | } |
1579 | } | 1584 | } |
1580 | } | 1585 | } |
1581 | 1586 | ||
1582 | return ownerName; | 1587 | return ownerName; |
1583 | #else //KAB_EMBEDDED | 1588 | #else //KAB_EMBEDDED |
1584 | qDebug("KABCore::getNameByPhone finsih method"); | 1589 | qDebug("KABCore::getNameByPhone finsih method"); |
1585 | return ""; | 1590 | return ""; |
1586 | #endif //KAB_EMBEDDED | 1591 | #endif //KAB_EMBEDDED |
1587 | 1592 | ||
1588 | } | 1593 | } |
1589 | 1594 | ||
1590 | void KABCore::openConfigDialog() | 1595 | void KABCore::openConfigDialog() |
1591 | { | 1596 | { |
1592 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1597 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1593 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1598 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1594 | ConfigureDialog->addModule(kabcfg ); | 1599 | ConfigureDialog->addModule(kabcfg ); |
1595 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1600 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1596 | ConfigureDialog->addModule(kdelibcfg ); | 1601 | ConfigureDialog->addModule(kdelibcfg ); |
1597 | 1602 | ||
1598 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1603 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1599 | this, SLOT( configurationChanged() ) ); | 1604 | this, SLOT( configurationChanged() ) ); |
1600 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1605 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1601 | this, SLOT( configurationChanged() ) ); | 1606 | this, SLOT( configurationChanged() ) ); |
1602 | saveSettings(); | 1607 | saveSettings(); |
1603 | #ifndef DESKTOP_VERSION | 1608 | #ifndef DESKTOP_VERSION |
1604 | ConfigureDialog->showMaximized(); | 1609 | ConfigureDialog->showMaximized(); |
1605 | #endif | 1610 | #endif |
1606 | if ( ConfigureDialog->exec() ) | 1611 | if ( ConfigureDialog->exec() ) |
1607 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1612 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1608 | delete ConfigureDialog; | 1613 | delete ConfigureDialog; |
1609 | } | 1614 | } |
1610 | 1615 | ||
1611 | void KABCore::openLDAPDialog() | 1616 | void KABCore::openLDAPDialog() |
1612 | { | 1617 | { |
1613 | #ifndef KAB_EMBEDDED | 1618 | #ifndef KAB_EMBEDDED |
1614 | if ( !mLdapSearchDialog ) { | 1619 | if ( !mLdapSearchDialog ) { |
1615 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1620 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1616 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1621 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1617 | SLOT( refreshView() ) ); | 1622 | SLOT( refreshView() ) ); |
1618 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1623 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1619 | SLOT( setModified() ) ); | 1624 | SLOT( setModified() ) ); |
1620 | } else | 1625 | } else |
1621 | mLdapSearchDialog->restoreSettings(); | 1626 | mLdapSearchDialog->restoreSettings(); |
1622 | 1627 | ||
1623 | if ( mLdapSearchDialog->isOK() ) | 1628 | if ( mLdapSearchDialog->isOK() ) |
1624 | mLdapSearchDialog->exec(); | 1629 | mLdapSearchDialog->exec(); |
1625 | #else //KAB_EMBEDDED | 1630 | #else //KAB_EMBEDDED |
1626 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1631 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1627 | #endif //KAB_EMBEDDED | 1632 | #endif //KAB_EMBEDDED |
1628 | } | 1633 | } |
1629 | 1634 | ||
1630 | void KABCore::print() | 1635 | void KABCore::print() |
1631 | { | 1636 | { |
1632 | #ifndef KAB_EMBEDDED | 1637 | #ifndef KAB_EMBEDDED |
1633 | KPrinter printer; | 1638 | KPrinter printer; |
1634 | if ( !printer.setup( this ) ) | 1639 | if ( !printer.setup( this ) ) |
1635 | return; | 1640 | return; |
1636 | 1641 | ||
1637 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1642 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |