-rw-r--r-- | kaddressbook/kabcore.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index b4e0b07..d5de9cb 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2395,384 +2395,385 @@ void KABCore::manageCategories( ) | |||
2395 | QStringList catIncList = (*it).categories(); | 2395 | QStringList catIncList = (*it).categories(); |
2396 | int i; | 2396 | int i; |
2397 | if ( catIncList.count() ) { | 2397 | if ( catIncList.count() ) { |
2398 | newCatList.clear(); | 2398 | newCatList.clear(); |
2399 | for( i = 0; i< catIncList.count(); ++i ) { | 2399 | for( i = 0; i< catIncList.count(); ++i ) { |
2400 | if ( catList.contains (catIncList[i])) { | 2400 | if ( catList.contains (catIncList[i])) { |
2401 | newCatList.append( catIncList[i] ); | 2401 | newCatList.append( catIncList[i] ); |
2402 | } | 2402 | } |
2403 | } | 2403 | } |
2404 | newCatList.sort(); | 2404 | newCatList.sort(); |
2405 | (*it).setCategories( newCatList ); | 2405 | (*it).setCategories( newCatList ); |
2406 | mAddressBook->insertAddressee( (*it) ); | 2406 | mAddressBook->insertAddressee( (*it) ); |
2407 | } | 2407 | } |
2408 | } | 2408 | } |
2409 | setModified( true ); | 2409 | setModified( true ); |
2410 | mViewManager->refreshView(); | 2410 | mViewManager->refreshView(); |
2411 | message( i18n("Removing categories done!")); | 2411 | message( i18n("Removing categories done!")); |
2412 | } | 2412 | } |
2413 | delete cp; | 2413 | delete cp; |
2414 | } | 2414 | } |
2415 | void KABCore::removeVoice() | 2415 | void KABCore::removeVoice() |
2416 | { | 2416 | { |
2417 | 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 ) | 2417 | 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 ) |
2418 | return; | 2418 | return; |
2419 | XXPortSelectDialog dlg( this, false, this ); | 2419 | XXPortSelectDialog dlg( this, false, this ); |
2420 | if ( !dlg.exec() ) | 2420 | if ( !dlg.exec() ) |
2421 | return; | 2421 | return; |
2422 | mAddressBook->setUntagged(); | 2422 | mAddressBook->setUntagged(); |
2423 | dlg.tagSelected(); | 2423 | dlg.tagSelected(); |
2424 | message(i18n("Removing voice..."), false ); | 2424 | message(i18n("Removing voice..."), false ); |
2425 | KABC::AddressBook::Iterator it; | 2425 | KABC::AddressBook::Iterator it; |
2426 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2426 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2427 | if ( (*it).tagged() ) { | 2427 | if ( (*it).tagged() ) { |
2428 | (*it).removeVoice(); | 2428 | (*it).removeVoice(); |
2429 | } | 2429 | } |
2430 | } | 2430 | } |
2431 | message(i18n("Refreshing view...") ); | 2431 | message(i18n("Refreshing view...") ); |
2432 | qApp->processEvents(); | 2432 | qApp->processEvents(); |
2433 | mViewManager->refreshView( "" ); | 2433 | mViewManager->refreshView( "" ); |
2434 | Addressee add; | 2434 | Addressee add; |
2435 | mDetails->setAddressee( add ); | 2435 | mDetails->setAddressee( add ); |
2436 | message(i18n("Remove voice completed!") ); | 2436 | message(i18n("Remove voice completed!") ); |
2437 | 2437 | ||
2438 | 2438 | ||
2439 | 2439 | ||
2440 | } | 2440 | } |
2441 | 2441 | ||
2442 | void KABCore::setFormattedName() | 2442 | void KABCore::setFormattedName() |
2443 | { | 2443 | { |
2444 | KABFormatPrefs setpref; | 2444 | KABFormatPrefs setpref; |
2445 | if ( !setpref.exec() ) { | 2445 | if ( !setpref.exec() ) { |
2446 | return; | 2446 | return; |
2447 | } | 2447 | } |
2448 | XXPortSelectDialog dlg( this, false, this ); | 2448 | XXPortSelectDialog dlg( this, false, this ); |
2449 | if ( !dlg.exec() ) | 2449 | if ( !dlg.exec() ) |
2450 | return; | 2450 | return; |
2451 | mAddressBook->setUntagged(); | 2451 | mAddressBook->setUntagged(); |
2452 | dlg.tagSelected(); | 2452 | dlg.tagSelected(); |
2453 | int count = 0; | 2453 | int count = 0; |
2454 | KABC::AddressBook::Iterator it; | 2454 | KABC::AddressBook::Iterator it; |
2455 | bool modified = false; | 2455 | bool modified = false; |
2456 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2456 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2457 | if ( (*it).tagged() ) { | 2457 | if ( (*it).tagged() ) { |
2458 | if ( (*it).uid().left( 2 ) == "la" ) | 2458 | if ( (*it).uid().left( 2 ) == "la" ) |
2459 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) | 2459 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) |
2460 | continue; | 2460 | continue; |
2461 | ++count; | 2461 | ++count; |
2462 | if ( count %10 == 0 ) | 2462 | if ( count %10 == 0 ) |
2463 | message(i18n("Changing contact #%1").arg( count ) ); | 2463 | message(i18n("Changing contact #%1").arg( count ) ); |
2464 | qApp->processEvents(); | 2464 | qApp->processEvents(); |
2465 | QString fName; | 2465 | QString fName; |
2466 | if ( setpref.simple->isChecked() ) | 2466 | if ( setpref.simple->isChecked() ) |
2467 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | 2467 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); |
2468 | else if ( setpref.full->isChecked() ) | 2468 | else if ( setpref.full->isChecked() ) |
2469 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); | 2469 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); |
2470 | else if ( setpref.reverse->isChecked() ) | 2470 | else if ( setpref.reverse->isChecked() ) |
2471 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); | 2471 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); |
2472 | else | 2472 | else |
2473 | fName = (*it).organization(); | 2473 | fName = (*it).organization(); |
2474 | if ( setpref.setCompany->isChecked() ) | 2474 | if ( setpref.setCompany->isChecked() ) |
2475 | if ( fName.isEmpty() || fName =="," ) | 2475 | if ( fName.isEmpty() || fName =="," ) |
2476 | fName = (*it).organization(); | 2476 | fName = (*it).organization(); |
2477 | (*it).setFormattedName( fName ); | 2477 | (*it).setFormattedName( fName ); |
2478 | (*it).setChanged( true ); | 2478 | (*it).setChanged( true ); |
2479 | modified = true; | 2479 | modified = true; |
2480 | (*it).setRevision( QDateTime::currentDateTime() ); | 2480 | (*it).setRevision( QDateTime::currentDateTime() ); |
2481 | } | 2481 | } |
2482 | } | 2482 | } |
2483 | message(i18n("Refreshing view...") ); | 2483 | message(i18n("Refreshing view...") ); |
2484 | qApp->processEvents(); | 2484 | qApp->processEvents(); |
2485 | if ( modified ) | 2485 | if ( modified ) |
2486 | setModified( true ); | 2486 | setModified( true ); |
2487 | Addressee add; | 2487 | Addressee add; |
2488 | mDetails->setAddressee( add ); | 2488 | mDetails->setAddressee( add ); |
2489 | if ( count == 0 ) | 2489 | if ( count == 0 ) |
2490 | message(i18n("No contact changed!") ); | 2490 | message(i18n("No contact changed!") ); |
2491 | else | 2491 | else |
2492 | message(i18n("%1 contacts changed!").arg( count ) ); | 2492 | message(i18n("%1 contacts changed!").arg( count ) ); |
2493 | } | 2493 | } |
2494 | 2494 | ||
2495 | void KABCore::clipboardDataChanged() | 2495 | void KABCore::clipboardDataChanged() |
2496 | { | 2496 | { |
2497 | 2497 | ||
2498 | if ( mReadWrite ) | 2498 | if ( mReadWrite ) |
2499 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2499 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2500 | 2500 | ||
2501 | } | 2501 | } |
2502 | 2502 | ||
2503 | void KABCore::updateActionMenu() | 2503 | void KABCore::updateActionMenu() |
2504 | { | 2504 | { |
2505 | UndoStack *undo = UndoStack::instance(); | 2505 | UndoStack *undo = UndoStack::instance(); |
2506 | RedoStack *redo = RedoStack::instance(); | 2506 | RedoStack *redo = RedoStack::instance(); |
2507 | 2507 | ||
2508 | if ( undo->isEmpty() ) | 2508 | if ( undo->isEmpty() ) |
2509 | mActionUndo->setText( i18n( "Undo" ) ); | 2509 | mActionUndo->setText( i18n( "Undo" ) ); |
2510 | else | 2510 | else |
2511 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2511 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2512 | 2512 | ||
2513 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2513 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2514 | 2514 | ||
2515 | if ( !redo->top() ) | 2515 | if ( !redo->top() ) |
2516 | mActionRedo->setText( i18n( "Redo" ) ); | 2516 | mActionRedo->setText( i18n( "Redo" ) ); |
2517 | else | 2517 | else |
2518 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2518 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2519 | 2519 | ||
2520 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2520 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2521 | } | 2521 | } |
2522 | 2522 | ||
2523 | void KABCore::configureKeyBindings() | 2523 | void KABCore::configureKeyBindings() |
2524 | { | 2524 | { |
2525 | #ifndef KAB_EMBEDDED | 2525 | #ifndef KAB_EMBEDDED |
2526 | KKeyDialog::configure( actionCollection(), true ); | 2526 | KKeyDialog::configure( actionCollection(), true ); |
2527 | #else //KAB_EMBEDDED | 2527 | #else //KAB_EMBEDDED |
2528 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2528 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2529 | #endif //KAB_EMBEDDED | 2529 | #endif //KAB_EMBEDDED |
2530 | } | 2530 | } |
2531 | 2531 | ||
2532 | #ifdef KAB_EMBEDDED | 2532 | #ifdef KAB_EMBEDDED |
2533 | void KABCore::configureResources() | 2533 | void KABCore::configureResources() |
2534 | { | 2534 | { |
2535 | KRES::KCMKResources dlg( this, "" , 0 ); | 2535 | KRES::KCMKResources dlg( this, "" , 0 ); |
2536 | 2536 | ||
2537 | if ( !dlg.exec() ) | 2537 | if ( !dlg.exec() ) |
2538 | return; | 2538 | return; |
2539 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2539 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2540 | } | 2540 | } |
2541 | #endif //KAB_EMBEDDED | 2541 | #endif //KAB_EMBEDDED |
2542 | 2542 | ||
2543 | 2543 | ||
2544 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2544 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2545 | * for the attendees list of an event. | 2545 | * for the attendees list of an event. |
2546 | */ | 2546 | */ |
2547 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2547 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2548 | { | 2548 | { |
2549 | qDebug("KABCore::requestForNameEmailUidList "); | 2549 | qDebug("KABCore::requestForNameEmailUidList "); |
2550 | bool ok = false; | 2550 | bool ok = false; |
2551 | mEmailSourceChannel = sourceChannel; | 2551 | mEmailSourceChannel = sourceChannel; |
2552 | mEmailSourceUID = uid; | 2552 | mEmailSourceUID = uid; |
2553 | QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); | 2553 | QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); |
2554 | //callContactdialog(); | 2554 | //callContactdialog(); |
2555 | #if 0 | 2555 | #if 0 |
2556 | int wid = uid.toInt( &ok ); | 2556 | int wid = uid.toInt( &ok ); |
2557 | qDebug("UID %s ", uid.latin1()); | 2557 | qDebug("UID %s ", uid.latin1()); |
2558 | if ( ok ) { | 2558 | if ( ok ) { |
2559 | if ( wid != QApplication::desktop()->width() ) { | 2559 | if ( wid != QApplication::desktop()->width() ) { |
2560 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); | 2560 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); |
2561 | message( i18n("Resizing, please wait...") ); | 2561 | message( i18n("Resizing, please wait...") ); |
2562 | mMainWindow->showMinimized(); | 2562 | mMainWindow->showMinimized(); |
2563 | /* | 2563 | /* |
2564 | { | 2564 | { |
2565 | QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); | 2565 | QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); |
2566 | } | 2566 | } |
2567 | */ | 2567 | */ |
2568 | QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); | 2568 | QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); |
2569 | return; | 2569 | return; |
2570 | } | 2570 | } |
2571 | 2571 | ||
2572 | } else { | 2572 | } else { |
2573 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); | 2573 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); |
2574 | } | 2574 | } |
2575 | callContactdialog(); | 2575 | callContactdialog(); |
2576 | //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); | 2576 | //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); |
2577 | #endif | 2577 | #endif |
2578 | } | 2578 | } |
2579 | void KABCore::resizeAndCallContactdialog() | 2579 | void KABCore::resizeAndCallContactdialog() |
2580 | { | 2580 | { |
2581 | updateMainWindow(); | 2581 | updateMainWindow(); |
2582 | QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); | 2582 | QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); |
2583 | } | 2583 | } |
2584 | 2584 | ||
2585 | void KABCore::doRingSync() | 2585 | void KABCore::doRingSync() |
2586 | { | 2586 | { |
2587 | topLevelWidget()->raise(); | ||
2587 | syncManager->multiSync( false ); | 2588 | syncManager->multiSync( false ); |
2588 | } | 2589 | } |
2589 | void KABCore::callContactdialog() | 2590 | void KABCore::callContactdialog() |
2590 | { | 2591 | { |
2591 | static bool running = false; | 2592 | static bool running = false; |
2592 | if (running) return; | 2593 | if (running) return; |
2593 | running = true; | 2594 | running = true; |
2594 | QStringList nameList; | 2595 | QStringList nameList; |
2595 | QStringList emailList; | 2596 | QStringList emailList; |
2596 | QStringList uidList; | 2597 | QStringList uidList; |
2597 | qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); | 2598 | qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); |
2598 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2599 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2599 | uint i=0; | 2600 | uint i=0; |
2600 | for (i=0; i < list.count(); i++) | 2601 | for (i=0; i < list.count(); i++) |
2601 | { | 2602 | { |
2602 | nameList.append(list[i].realName()); | 2603 | nameList.append(list[i].realName()); |
2603 | emailList.append(list[i].preferredEmail()); | 2604 | emailList.append(list[i].preferredEmail()); |
2604 | uidList.append(list[i].uid()); | 2605 | uidList.append(list[i].uid()); |
2605 | } | 2606 | } |
2606 | QString uid = mEmailSourceUID; | 2607 | QString uid = mEmailSourceUID; |
2607 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); | 2608 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); |
2608 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); | 2609 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); |
2609 | running = false; | 2610 | running = false; |
2610 | } | 2611 | } |
2611 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2612 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2612 | * to put them into the calendar. | 2613 | * to put them into the calendar. |
2613 | */ | 2614 | */ |
2614 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2615 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2615 | { | 2616 | { |
2616 | // qDebug("KABCore::requestForBirthdayList"); | 2617 | // qDebug("KABCore::requestForBirthdayList"); |
2617 | QStringList birthdayList; | 2618 | QStringList birthdayList; |
2618 | QStringList anniversaryList; | 2619 | QStringList anniversaryList; |
2619 | QStringList realNameList; | 2620 | QStringList realNameList; |
2620 | QStringList preferredEmailList; | 2621 | QStringList preferredEmailList; |
2621 | QStringList assembledNameList; | 2622 | QStringList assembledNameList; |
2622 | QStringList uidList; | 2623 | QStringList uidList; |
2623 | 2624 | ||
2624 | KABC::AddressBook::Iterator it; | 2625 | KABC::AddressBook::Iterator it; |
2625 | 2626 | ||
2626 | int count = 0; | 2627 | int count = 0; |
2627 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2628 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2628 | ++count; | 2629 | ++count; |
2629 | } | 2630 | } |
2630 | QProgressBar bar(count,0 ); | 2631 | QProgressBar bar(count,0 ); |
2631 | int w = 300; | 2632 | int w = 300; |
2632 | if ( QApplication::desktop()->width() < 320 ) | 2633 | if ( QApplication::desktop()->width() < 320 ) |
2633 | w = 220; | 2634 | w = 220; |
2634 | int h = bar.sizeHint().height() ; | 2635 | int h = bar.sizeHint().height() ; |
2635 | int dw = QApplication::desktop()->width(); | 2636 | int dw = QApplication::desktop()->width(); |
2636 | int dh = QApplication::desktop()->height(); | 2637 | int dh = QApplication::desktop()->height(); |
2637 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2638 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2638 | bar.show(); | 2639 | bar.show(); |
2639 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2640 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2640 | qApp->processEvents(); | 2641 | qApp->processEvents(); |
2641 | 2642 | ||
2642 | QDate bday; | 2643 | QDate bday; |
2643 | QString anni; | 2644 | QString anni; |
2644 | QString formattedbday; | 2645 | QString formattedbday; |
2645 | 2646 | ||
2646 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2647 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2647 | { | 2648 | { |
2648 | if ( ! bar.isVisible() ) | 2649 | if ( ! bar.isVisible() ) |
2649 | return; | 2650 | return; |
2650 | bar.setProgress( count++ ); | 2651 | bar.setProgress( count++ ); |
2651 | qApp->processEvents(); | 2652 | qApp->processEvents(); |
2652 | bday = (*it).birthday().date(); | 2653 | bday = (*it).birthday().date(); |
2653 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2654 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2654 | 2655 | ||
2655 | if ( bday.isValid() || !anni.isEmpty()) | 2656 | if ( bday.isValid() || !anni.isEmpty()) |
2656 | { | 2657 | { |
2657 | if (bday.isValid()) | 2658 | if (bday.isValid()) |
2658 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2659 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2659 | else | 2660 | else |
2660 | formattedbday = "NOTVALID"; | 2661 | formattedbday = "NOTVALID"; |
2661 | if (anni.isEmpty()) | 2662 | if (anni.isEmpty()) |
2662 | anni = "INVALID"; | 2663 | anni = "INVALID"; |
2663 | 2664 | ||
2664 | birthdayList.append(formattedbday); | 2665 | birthdayList.append(formattedbday); |
2665 | anniversaryList.append(anni); //should be ISODate | 2666 | anniversaryList.append(anni); //should be ISODate |
2666 | realNameList.append((*it).realName()); | 2667 | realNameList.append((*it).realName()); |
2667 | preferredEmailList.append((*it).preferredEmail()); | 2668 | preferredEmailList.append((*it).preferredEmail()); |
2668 | assembledNameList.append((*it).assembledName()); | 2669 | assembledNameList.append((*it).assembledName()); |
2669 | uidList.append((*it).uid()); | 2670 | uidList.append((*it).uid()); |
2670 | 2671 | ||
2671 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); | 2672 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); |
2672 | } | 2673 | } |
2673 | } | 2674 | } |
2674 | 2675 | ||
2675 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2676 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2676 | 2677 | ||
2677 | } | 2678 | } |
2678 | 2679 | ||
2679 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2680 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2680 | */ | 2681 | */ |
2681 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2682 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2682 | { | 2683 | { |
2683 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2684 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2684 | 2685 | ||
2685 | QString foundUid = QString::null; | 2686 | QString foundUid = QString::null; |
2686 | if ( ! uid.isEmpty() ) { | 2687 | if ( ! uid.isEmpty() ) { |
2687 | Addressee adrr = mAddressBook->findByUid( uid ); | 2688 | Addressee adrr = mAddressBook->findByUid( uid ); |
2688 | if ( !adrr.isEmpty() ) { | 2689 | if ( !adrr.isEmpty() ) { |
2689 | foundUid = uid; | 2690 | foundUid = uid; |
2690 | } | 2691 | } |
2691 | if ( email == "sendbacklist" ) { | 2692 | if ( email == "sendbacklist" ) { |
2692 | //qDebug("ssssssssssssssssssssssend "); | 2693 | //qDebug("ssssssssssssssssssssssend "); |
2693 | QStringList nameList; | 2694 | QStringList nameList; |
2694 | QStringList emailList; | 2695 | QStringList emailList; |
2695 | QStringList uidList; | 2696 | QStringList uidList; |
2696 | nameList.append(adrr.realName()); | 2697 | nameList.append(adrr.realName()); |
2697 | emailList = adrr.emails(); | 2698 | emailList = adrr.emails(); |
2698 | uidList.append( adrr.preferredEmail()); | 2699 | uidList.append( adrr.preferredEmail()); |
2699 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2700 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2700 | return; | 2701 | return; |
2701 | } | 2702 | } |
2702 | 2703 | ||
2703 | } | 2704 | } |
2704 | 2705 | ||
2705 | if ( email == "sendbacklist" ) | 2706 | if ( email == "sendbacklist" ) |
2706 | return; | 2707 | return; |
2707 | if (foundUid.isEmpty()) | 2708 | if (foundUid.isEmpty()) |
2708 | { | 2709 | { |
2709 | //find the uid of the person first | 2710 | //find the uid of the person first |
2710 | Addressee::List namelist; | 2711 | Addressee::List namelist; |
2711 | Addressee::List emaillist; | 2712 | Addressee::List emaillist; |
2712 | 2713 | ||
2713 | if (!name.isEmpty()) | 2714 | if (!name.isEmpty()) |
2714 | namelist = mAddressBook->findByName( name ); | 2715 | namelist = mAddressBook->findByName( name ); |
2715 | 2716 | ||
2716 | if (!email.isEmpty()) | 2717 | if (!email.isEmpty()) |
2717 | emaillist = mAddressBook->findByEmail( email ); | 2718 | emaillist = mAddressBook->findByEmail( email ); |
2718 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2719 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2719 | //check if we have a match in Namelist and Emaillist | 2720 | //check if we have a match in Namelist and Emaillist |
2720 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2721 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2721 | foundUid = emaillist[0].uid(); | 2722 | foundUid = emaillist[0].uid(); |
2722 | } | 2723 | } |
2723 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2724 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2724 | foundUid = namelist[0].uid(); | 2725 | foundUid = namelist[0].uid(); |
2725 | else | 2726 | else |
2726 | { | 2727 | { |
2727 | for (int i = 0; i < namelist.count(); i++) | 2728 | for (int i = 0; i < namelist.count(); i++) |
2728 | { | 2729 | { |
2729 | for (int j = 0; j < emaillist.count(); j++) | 2730 | for (int j = 0; j < emaillist.count(); j++) |
2730 | { | 2731 | { |
2731 | if (namelist[i] == emaillist[j]) | 2732 | if (namelist[i] == emaillist[j]) |
2732 | { | 2733 | { |
2733 | foundUid = namelist[i].uid(); | 2734 | foundUid = namelist[i].uid(); |
2734 | } | 2735 | } |
2735 | } | 2736 | } |
2736 | } | 2737 | } |
2737 | } | 2738 | } |
2738 | } | 2739 | } |
2739 | else | 2740 | else |
2740 | { | 2741 | { |
2741 | foundUid = uid; | 2742 | foundUid = uid; |
2742 | } | 2743 | } |
2743 | 2744 | ||
2744 | if (!foundUid.isEmpty()) | 2745 | if (!foundUid.isEmpty()) |
2745 | { | 2746 | { |
2746 | 2747 | ||
2747 | // raise Ka/Pi if it is in the background | 2748 | // raise Ka/Pi if it is in the background |
2748 | #ifndef DESKTOP_VERSION | 2749 | #ifndef DESKTOP_VERSION |
2749 | #ifndef KORG_NODCOP | 2750 | #ifndef KORG_NODCOP |
2750 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2751 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2751 | #endif | 2752 | #endif |
2752 | #endif | 2753 | #endif |
2753 | 2754 | ||
2754 | mMainWindow->showMaximized(); | 2755 | mMainWindow->showMaximized(); |
2755 | mMainWindow-> raise(); | 2756 | mMainWindow-> raise(); |
2756 | 2757 | ||
2757 | mViewManager->setSelected( "", false); | 2758 | mViewManager->setSelected( "", false); |
2758 | mViewManager->refreshView( "" ); | 2759 | mViewManager->refreshView( "" ); |
2759 | mViewManager->setSelected( foundUid, true ); | 2760 | mViewManager->setSelected( foundUid, true ); |
2760 | mViewManager->refreshView( foundUid ); | 2761 | mViewManager->refreshView( foundUid ); |
2761 | 2762 | ||
2762 | if ( !mMultipleViewsAtOnce ) | 2763 | if ( !mMultipleViewsAtOnce ) |
2763 | { | 2764 | { |
2764 | setDetailsVisible( true ); | 2765 | setDetailsVisible( true ); |
2765 | mActionDetails->setChecked(true); | 2766 | mActionDetails->setChecked(true); |
2766 | } | 2767 | } |
2767 | } | 2768 | } |
2768 | } | 2769 | } |
2769 | void KABCore::storagehowto() | 2770 | void KABCore::storagehowto() |
2770 | { | 2771 | { |
2771 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 2772 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
2772 | } | 2773 | } |
2773 | void KABCore::whatsnew() | 2774 | void KABCore::whatsnew() |
2774 | { | 2775 | { |
2775 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2776 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2776 | } | 2777 | } |
2777 | void KABCore::synchowto() | 2778 | void KABCore::synchowto() |
2778 | { | 2779 | { |