-rw-r--r-- | kaddressbook/kabcore.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 09d8523..db19dd5 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2319,385 +2319,397 @@ void KABCore::showLicence() | |||
2319 | void KABCore::manageCategories( ) | 2319 | void KABCore::manageCategories( ) |
2320 | { | 2320 | { |
2321 | KABCatPrefs* cp = new KABCatPrefs(); | 2321 | KABCatPrefs* cp = new KABCatPrefs(); |
2322 | cp->show(); | 2322 | cp->show(); |
2323 | int w =cp->sizeHint().width() ; | 2323 | int w =cp->sizeHint().width() ; |
2324 | int h = cp->sizeHint().height() ; | 2324 | int h = cp->sizeHint().height() ; |
2325 | int dw = QApplication::desktop()->width(); | 2325 | int dw = QApplication::desktop()->width(); |
2326 | int dh = QApplication::desktop()->height(); | 2326 | int dh = QApplication::desktop()->height(); |
2327 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2327 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2328 | if ( !cp->exec() ) { | 2328 | if ( !cp->exec() ) { |
2329 | delete cp; | 2329 | delete cp; |
2330 | return; | 2330 | return; |
2331 | } | 2331 | } |
2332 | int count = 0; | 2332 | int count = 0; |
2333 | int cc = 0; | 2333 | int cc = 0; |
2334 | message( i18n("Please wait, processing categories...")); | 2334 | message( i18n("Please wait, processing categories...")); |
2335 | if ( cp->addCat() ) { | 2335 | if ( cp->addCat() ) { |
2336 | KABC::AddressBook::Iterator it; | 2336 | KABC::AddressBook::Iterator it; |
2337 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2337 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2338 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2338 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2339 | ++cc; | 2339 | ++cc; |
2340 | if ( cc %10 == 0) | 2340 | if ( cc %10 == 0) |
2341 | message(i18n("Processing contact #%1").arg(cc)); | 2341 | message(i18n("Processing contact #%1").arg(cc)); |
2342 | QStringList catIncList = (*it).categories(); | 2342 | QStringList catIncList = (*it).categories(); |
2343 | int i; | 2343 | int i; |
2344 | for( i = 0; i< catIncList.count(); ++i ) { | 2344 | for( i = 0; i< catIncList.count(); ++i ) { |
2345 | if ( !catList.contains (catIncList[i])) { | 2345 | if ( !catList.contains (catIncList[i])) { |
2346 | catList.append( catIncList[i] ); | 2346 | catList.append( catIncList[i] ); |
2347 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2347 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2348 | ++count; | 2348 | ++count; |
2349 | } | 2349 | } |
2350 | } | 2350 | } |
2351 | } | 2351 | } |
2352 | catList.sort(); | 2352 | catList.sort(); |
2353 | KABPrefs::instance()->mCustomCategories = catList; | 2353 | KABPrefs::instance()->mCustomCategories = catList; |
2354 | KABPrefs::instance()->writeConfig(); | 2354 | KABPrefs::instance()->writeConfig(); |
2355 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2355 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2356 | } else { | 2356 | } else { |
2357 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2357 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2358 | QStringList catIncList; | 2358 | QStringList catIncList; |
2359 | QStringList newCatList; | 2359 | QStringList newCatList; |
2360 | KABC::AddressBook::Iterator it; | 2360 | KABC::AddressBook::Iterator it; |
2361 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2361 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2362 | ++cc; | 2362 | ++cc; |
2363 | if ( cc %10 == 0) | 2363 | if ( cc %10 == 0) |
2364 | message(i18n("Processing contact #%1").arg(cc)); | 2364 | message(i18n("Processing contact #%1").arg(cc)); |
2365 | QStringList catIncList = (*it).categories(); | 2365 | QStringList catIncList = (*it).categories(); |
2366 | int i; | 2366 | int i; |
2367 | if ( catIncList.count() ) { | 2367 | if ( catIncList.count() ) { |
2368 | newCatList.clear(); | 2368 | newCatList.clear(); |
2369 | for( i = 0; i< catIncList.count(); ++i ) { | 2369 | for( i = 0; i< catIncList.count(); ++i ) { |
2370 | if ( catList.contains (catIncList[i])) { | 2370 | if ( catList.contains (catIncList[i])) { |
2371 | newCatList.append( catIncList[i] ); | 2371 | newCatList.append( catIncList[i] ); |
2372 | } | 2372 | } |
2373 | } | 2373 | } |
2374 | newCatList.sort(); | 2374 | newCatList.sort(); |
2375 | (*it).setCategories( newCatList ); | 2375 | (*it).setCategories( newCatList ); |
2376 | mAddressBook->insertAddressee( (*it) ); | 2376 | mAddressBook->insertAddressee( (*it) ); |
2377 | } | 2377 | } |
2378 | } | 2378 | } |
2379 | setModified( true ); | 2379 | setModified( true ); |
2380 | mViewManager->refreshView(); | 2380 | mViewManager->refreshView(); |
2381 | message( i18n("Removing categories done!")); | 2381 | message( i18n("Removing categories done!")); |
2382 | } | 2382 | } |
2383 | delete cp; | 2383 | delete cp; |
2384 | } | 2384 | } |
2385 | void KABCore::removeVoice() | 2385 | void KABCore::removeVoice() |
2386 | { | 2386 | { |
2387 | 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 ) | 2387 | 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 ) |
2388 | return; | 2388 | return; |
2389 | XXPortSelectDialog dlg( this, false, this ); | 2389 | XXPortSelectDialog dlg( this, false, this ); |
2390 | if ( !dlg.exec() ) | 2390 | if ( !dlg.exec() ) |
2391 | return; | 2391 | return; |
2392 | mAddressBook->setUntagged(); | 2392 | mAddressBook->setUntagged(); |
2393 | dlg.tagSelected(); | 2393 | dlg.tagSelected(); |
2394 | message(i18n("Removing voice..."), false ); | 2394 | message(i18n("Removing voice..."), false ); |
2395 | KABC::AddressBook::Iterator it; | 2395 | KABC::AddressBook::Iterator it; |
2396 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2396 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2397 | if ( (*it).tagged() ) { | 2397 | if ( (*it).tagged() ) { |
2398 | (*it).removeVoice(); | 2398 | (*it).removeVoice(); |
2399 | } | 2399 | } |
2400 | } | 2400 | } |
2401 | message(i18n("Refreshing view...") ); | 2401 | message(i18n("Refreshing view...") ); |
2402 | qApp->processEvents(); | 2402 | qApp->processEvents(); |
2403 | mViewManager->refreshView( "" ); | 2403 | mViewManager->refreshView( "" ); |
2404 | Addressee add; | 2404 | Addressee add; |
2405 | mDetails->setAddressee( add ); | 2405 | mDetails->setAddressee( add ); |
2406 | message(i18n("Remove voice completed!") ); | 2406 | message(i18n("Remove voice completed!") ); |
2407 | 2407 | ||
2408 | 2408 | ||
2409 | 2409 | ||
2410 | } | 2410 | } |
2411 | 2411 | ||
2412 | void KABCore::setFormattedName() | 2412 | void KABCore::setFormattedName() |
2413 | { | 2413 | { |
2414 | KABFormatPrefs setpref; | 2414 | KABFormatPrefs setpref; |
2415 | if ( !setpref.exec() ) { | 2415 | if ( !setpref.exec() ) { |
2416 | return; | 2416 | return; |
2417 | } | 2417 | } |
2418 | XXPortSelectDialog dlg( this, false, this ); | 2418 | XXPortSelectDialog dlg( this, false, this ); |
2419 | if ( !dlg.exec() ) | 2419 | if ( !dlg.exec() ) |
2420 | return; | 2420 | return; |
2421 | mAddressBook->setUntagged(); | 2421 | mAddressBook->setUntagged(); |
2422 | dlg.tagSelected(); | 2422 | dlg.tagSelected(); |
2423 | int count = 0; | 2423 | int count = 0; |
2424 | KABC::AddressBook::Iterator it; | 2424 | KABC::AddressBook::Iterator it; |
2425 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2425 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2426 | if ( (*it).tagged() ) { | 2426 | if ( (*it).tagged() ) { |
2427 | ++count; | 2427 | ++count; |
2428 | if ( count %10 == 0 ) | 2428 | if ( count %10 == 0 ) |
2429 | message(i18n("Changing contact #%1").arg( count ) ); | 2429 | message(i18n("Changing contact #%1").arg( count ) ); |
2430 | qApp->processEvents(); | 2430 | qApp->processEvents(); |
2431 | QString fName; | 2431 | QString fName; |
2432 | if ( setpref.simple->isChecked() ) | 2432 | if ( setpref.simple->isChecked() ) |
2433 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | 2433 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); |
2434 | else if ( setpref.full->isChecked() ) | 2434 | else if ( setpref.full->isChecked() ) |
2435 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); | 2435 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); |
2436 | else if ( setpref.reverse->isChecked() ) | 2436 | else if ( setpref.reverse->isChecked() ) |
2437 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); | 2437 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); |
2438 | else | 2438 | else |
2439 | fName = (*it).organization(); | 2439 | fName = (*it).organization(); |
2440 | if ( setpref.setCompany->isChecked() ) | 2440 | if ( setpref.setCompany->isChecked() ) |
2441 | if ( fName.isEmpty() || fName =="," ) | 2441 | if ( fName.isEmpty() || fName =="," ) |
2442 | fName = (*it).organization(); | 2442 | fName = (*it).organization(); |
2443 | (*it).setFormattedName( fName ); | 2443 | (*it).setFormattedName( fName ); |
2444 | } | 2444 | } |
2445 | } | 2445 | } |
2446 | message(i18n("Refreshing view...") ); | 2446 | message(i18n("Refreshing view...") ); |
2447 | qApp->processEvents(); | 2447 | qApp->processEvents(); |
2448 | mViewManager->refreshView( "" ); | 2448 | mViewManager->refreshView( "" ); |
2449 | Addressee add; | 2449 | Addressee add; |
2450 | mDetails->setAddressee( add ); | 2450 | mDetails->setAddressee( add ); |
2451 | message(i18n("Setting formatted name completed!") ); | 2451 | message(i18n("Setting formatted name completed!") ); |
2452 | } | 2452 | } |
2453 | 2453 | ||
2454 | void KABCore::clipboardDataChanged() | 2454 | void KABCore::clipboardDataChanged() |
2455 | { | 2455 | { |
2456 | 2456 | ||
2457 | if ( mReadWrite ) | 2457 | if ( mReadWrite ) |
2458 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2458 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2459 | 2459 | ||
2460 | } | 2460 | } |
2461 | 2461 | ||
2462 | void KABCore::updateActionMenu() | 2462 | void KABCore::updateActionMenu() |
2463 | { | 2463 | { |
2464 | UndoStack *undo = UndoStack::instance(); | 2464 | UndoStack *undo = UndoStack::instance(); |
2465 | RedoStack *redo = RedoStack::instance(); | 2465 | RedoStack *redo = RedoStack::instance(); |
2466 | 2466 | ||
2467 | if ( undo->isEmpty() ) | 2467 | if ( undo->isEmpty() ) |
2468 | mActionUndo->setText( i18n( "Undo" ) ); | 2468 | mActionUndo->setText( i18n( "Undo" ) ); |
2469 | else | 2469 | else |
2470 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2470 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2471 | 2471 | ||
2472 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2472 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2473 | 2473 | ||
2474 | if ( !redo->top() ) | 2474 | if ( !redo->top() ) |
2475 | mActionRedo->setText( i18n( "Redo" ) ); | 2475 | mActionRedo->setText( i18n( "Redo" ) ); |
2476 | else | 2476 | else |
2477 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2477 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2478 | 2478 | ||
2479 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2479 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2480 | } | 2480 | } |
2481 | 2481 | ||
2482 | void KABCore::configureKeyBindings() | 2482 | void KABCore::configureKeyBindings() |
2483 | { | 2483 | { |
2484 | #ifndef KAB_EMBEDDED | 2484 | #ifndef KAB_EMBEDDED |
2485 | KKeyDialog::configure( actionCollection(), true ); | 2485 | KKeyDialog::configure( actionCollection(), true ); |
2486 | #else //KAB_EMBEDDED | 2486 | #else //KAB_EMBEDDED |
2487 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2487 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2488 | #endif //KAB_EMBEDDED | 2488 | #endif //KAB_EMBEDDED |
2489 | } | 2489 | } |
2490 | 2490 | ||
2491 | #ifdef KAB_EMBEDDED | 2491 | #ifdef KAB_EMBEDDED |
2492 | void KABCore::configureResources() | 2492 | void KABCore::configureResources() |
2493 | { | 2493 | { |
2494 | KRES::KCMKResources dlg( this, "" , 0 ); | 2494 | KRES::KCMKResources dlg( this, "" , 0 ); |
2495 | 2495 | ||
2496 | if ( !dlg.exec() ) | 2496 | if ( !dlg.exec() ) |
2497 | return; | 2497 | return; |
2498 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2498 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2499 | } | 2499 | } |
2500 | #endif //KAB_EMBEDDED | 2500 | #endif //KAB_EMBEDDED |
2501 | 2501 | ||
2502 | 2502 | ||
2503 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2503 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2504 | * for the attendees list of an event. | 2504 | * for the attendees list of an event. |
2505 | */ | 2505 | */ |
2506 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2506 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2507 | { | 2507 | { |
2508 | QStringList nameList; | 2508 | QStringList nameList; |
2509 | QStringList emailList; | 2509 | QStringList emailList; |
2510 | QStringList uidList; | 2510 | QStringList uidList; |
2511 | bool ok = false; | ||
2512 | int wid = uid.toInt( &ok ); | ||
2513 | if ( ok ) { | ||
2514 | if ( wid != QApplication::desktop()->width() ) { | ||
2515 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); | ||
2516 | raise(); | ||
2517 | qApp->processEvents(); | ||
2518 | } | ||
2511 | 2519 | ||
2520 | } else { | ||
2521 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); | ||
2522 | } | ||
2523 | |||
2512 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2524 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2513 | uint i=0; | 2525 | uint i=0; |
2514 | for (i=0; i < list.count(); i++) | 2526 | for (i=0; i < list.count(); i++) |
2515 | { | 2527 | { |
2516 | nameList.append(list[i].realName()); | 2528 | nameList.append(list[i].realName()); |
2517 | emailList.append(list[i].preferredEmail()); | 2529 | emailList.append(list[i].preferredEmail()); |
2518 | uidList.append(list[i].uid()); | 2530 | uidList.append(list[i].uid()); |
2519 | } | 2531 | } |
2520 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); | 2532 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); |
2521 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2533 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2522 | 2534 | ||
2523 | } | 2535 | } |
2524 | 2536 | ||
2525 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2537 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2526 | * to put them into the calendar. | 2538 | * to put them into the calendar. |
2527 | */ | 2539 | */ |
2528 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2540 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2529 | { | 2541 | { |
2530 | // qDebug("KABCore::requestForBirthdayList"); | 2542 | // qDebug("KABCore::requestForBirthdayList"); |
2531 | QStringList birthdayList; | 2543 | QStringList birthdayList; |
2532 | QStringList anniversaryList; | 2544 | QStringList anniversaryList; |
2533 | QStringList realNameList; | 2545 | QStringList realNameList; |
2534 | QStringList preferredEmailList; | 2546 | QStringList preferredEmailList; |
2535 | QStringList assembledNameList; | 2547 | QStringList assembledNameList; |
2536 | QStringList uidList; | 2548 | QStringList uidList; |
2537 | 2549 | ||
2538 | KABC::AddressBook::Iterator it; | 2550 | KABC::AddressBook::Iterator it; |
2539 | 2551 | ||
2540 | int count = 0; | 2552 | int count = 0; |
2541 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2553 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2542 | ++count; | 2554 | ++count; |
2543 | } | 2555 | } |
2544 | QProgressBar bar(count,0 ); | 2556 | QProgressBar bar(count,0 ); |
2545 | int w = 300; | 2557 | int w = 300; |
2546 | if ( QApplication::desktop()->width() < 320 ) | 2558 | if ( QApplication::desktop()->width() < 320 ) |
2547 | w = 220; | 2559 | w = 220; |
2548 | int h = bar.sizeHint().height() ; | 2560 | int h = bar.sizeHint().height() ; |
2549 | int dw = QApplication::desktop()->width(); | 2561 | int dw = QApplication::desktop()->width(); |
2550 | int dh = QApplication::desktop()->height(); | 2562 | int dh = QApplication::desktop()->height(); |
2551 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2563 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2552 | bar.show(); | 2564 | bar.show(); |
2553 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2565 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2554 | qApp->processEvents(); | 2566 | qApp->processEvents(); |
2555 | 2567 | ||
2556 | QDate bday; | 2568 | QDate bday; |
2557 | QString anni; | 2569 | QString anni; |
2558 | QString formattedbday; | 2570 | QString formattedbday; |
2559 | 2571 | ||
2560 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2572 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2561 | { | 2573 | { |
2562 | if ( ! bar.isVisible() ) | 2574 | if ( ! bar.isVisible() ) |
2563 | return; | 2575 | return; |
2564 | bar.setProgress( count++ ); | 2576 | bar.setProgress( count++ ); |
2565 | qApp->processEvents(); | 2577 | qApp->processEvents(); |
2566 | bday = (*it).birthday().date(); | 2578 | bday = (*it).birthday().date(); |
2567 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2579 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2568 | 2580 | ||
2569 | if ( bday.isValid() || !anni.isEmpty()) | 2581 | if ( bday.isValid() || !anni.isEmpty()) |
2570 | { | 2582 | { |
2571 | if (bday.isValid()) | 2583 | if (bday.isValid()) |
2572 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2584 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2573 | else | 2585 | else |
2574 | formattedbday = "NOTVALID"; | 2586 | formattedbday = "NOTVALID"; |
2575 | if (anni.isEmpty()) | 2587 | if (anni.isEmpty()) |
2576 | anni = "INVALID"; | 2588 | anni = "INVALID"; |
2577 | 2589 | ||
2578 | birthdayList.append(formattedbday); | 2590 | birthdayList.append(formattedbday); |
2579 | anniversaryList.append(anni); //should be ISODate | 2591 | anniversaryList.append(anni); //should be ISODate |
2580 | realNameList.append((*it).realName()); | 2592 | realNameList.append((*it).realName()); |
2581 | preferredEmailList.append((*it).preferredEmail()); | 2593 | preferredEmailList.append((*it).preferredEmail()); |
2582 | assembledNameList.append((*it).assembledName()); | 2594 | assembledNameList.append((*it).assembledName()); |
2583 | uidList.append((*it).uid()); | 2595 | uidList.append((*it).uid()); |
2584 | 2596 | ||
2585 | //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() ); | 2597 | //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() ); |
2586 | } | 2598 | } |
2587 | } | 2599 | } |
2588 | 2600 | ||
2589 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2601 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2590 | 2602 | ||
2591 | } | 2603 | } |
2592 | 2604 | ||
2593 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2605 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2594 | */ | 2606 | */ |
2595 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2607 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2596 | { | 2608 | { |
2597 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2609 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2598 | 2610 | ||
2599 | QString foundUid = QString::null; | 2611 | QString foundUid = QString::null; |
2600 | if ( ! uid.isEmpty() ) { | 2612 | if ( ! uid.isEmpty() ) { |
2601 | Addressee adrr = mAddressBook->findByUid( uid ); | 2613 | Addressee adrr = mAddressBook->findByUid( uid ); |
2602 | if ( !adrr.isEmpty() ) { | 2614 | if ( !adrr.isEmpty() ) { |
2603 | foundUid = uid; | 2615 | foundUid = uid; |
2604 | } | 2616 | } |
2605 | if ( email == "sendbacklist" ) { | 2617 | if ( email == "sendbacklist" ) { |
2606 | //qDebug("ssssssssssssssssssssssend "); | 2618 | //qDebug("ssssssssssssssssssssssend "); |
2607 | QStringList nameList; | 2619 | QStringList nameList; |
2608 | QStringList emailList; | 2620 | QStringList emailList; |
2609 | QStringList uidList; | 2621 | QStringList uidList; |
2610 | nameList.append(adrr.realName()); | 2622 | nameList.append(adrr.realName()); |
2611 | emailList = adrr.emails(); | 2623 | emailList = adrr.emails(); |
2612 | uidList.append( adrr.preferredEmail()); | 2624 | uidList.append( adrr.preferredEmail()); |
2613 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2625 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2614 | return; | 2626 | return; |
2615 | } | 2627 | } |
2616 | 2628 | ||
2617 | } | 2629 | } |
2618 | 2630 | ||
2619 | if ( email == "sendbacklist" ) | 2631 | if ( email == "sendbacklist" ) |
2620 | return; | 2632 | return; |
2621 | if (foundUid.isEmpty()) | 2633 | if (foundUid.isEmpty()) |
2622 | { | 2634 | { |
2623 | //find the uid of the person first | 2635 | //find the uid of the person first |
2624 | Addressee::List namelist; | 2636 | Addressee::List namelist; |
2625 | Addressee::List emaillist; | 2637 | Addressee::List emaillist; |
2626 | 2638 | ||
2627 | if (!name.isEmpty()) | 2639 | if (!name.isEmpty()) |
2628 | namelist = mAddressBook->findByName( name ); | 2640 | namelist = mAddressBook->findByName( name ); |
2629 | 2641 | ||
2630 | if (!email.isEmpty()) | 2642 | if (!email.isEmpty()) |
2631 | emaillist = mAddressBook->findByEmail( email ); | 2643 | emaillist = mAddressBook->findByEmail( email ); |
2632 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2644 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2633 | //check if we have a match in Namelist and Emaillist | 2645 | //check if we have a match in Namelist and Emaillist |
2634 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2646 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2635 | foundUid = emaillist[0].uid(); | 2647 | foundUid = emaillist[0].uid(); |
2636 | } | 2648 | } |
2637 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2649 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2638 | foundUid = namelist[0].uid(); | 2650 | foundUid = namelist[0].uid(); |
2639 | else | 2651 | else |
2640 | { | 2652 | { |
2641 | for (int i = 0; i < namelist.count(); i++) | 2653 | for (int i = 0; i < namelist.count(); i++) |
2642 | { | 2654 | { |
2643 | for (int j = 0; j < emaillist.count(); j++) | 2655 | for (int j = 0; j < emaillist.count(); j++) |
2644 | { | 2656 | { |
2645 | if (namelist[i] == emaillist[j]) | 2657 | if (namelist[i] == emaillist[j]) |
2646 | { | 2658 | { |
2647 | foundUid = namelist[i].uid(); | 2659 | foundUid = namelist[i].uid(); |
2648 | } | 2660 | } |
2649 | } | 2661 | } |
2650 | } | 2662 | } |
2651 | } | 2663 | } |
2652 | } | 2664 | } |
2653 | else | 2665 | else |
2654 | { | 2666 | { |
2655 | foundUid = uid; | 2667 | foundUid = uid; |
2656 | } | 2668 | } |
2657 | 2669 | ||
2658 | if (!foundUid.isEmpty()) | 2670 | if (!foundUid.isEmpty()) |
2659 | { | 2671 | { |
2660 | 2672 | ||
2661 | // raise Ka/Pi if it is in the background | 2673 | // raise Ka/Pi if it is in the background |
2662 | #ifndef DESKTOP_VERSION | 2674 | #ifndef DESKTOP_VERSION |
2663 | #ifndef KORG_NODCOP | 2675 | #ifndef KORG_NODCOP |
2664 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2676 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2665 | #endif | 2677 | #endif |
2666 | #endif | 2678 | #endif |
2667 | 2679 | ||
2668 | mMainWindow->showMaximized(); | 2680 | mMainWindow->showMaximized(); |
2669 | mMainWindow-> raise(); | 2681 | mMainWindow-> raise(); |
2670 | 2682 | ||
2671 | mViewManager->setSelected( "", false); | 2683 | mViewManager->setSelected( "", false); |
2672 | mViewManager->refreshView( "" ); | 2684 | mViewManager->refreshView( "" ); |
2673 | mViewManager->setSelected( foundUid, true ); | 2685 | mViewManager->setSelected( foundUid, true ); |
2674 | mViewManager->refreshView( foundUid ); | 2686 | mViewManager->refreshView( foundUid ); |
2675 | 2687 | ||
2676 | if ( !mMultipleViewsAtOnce ) | 2688 | if ( !mMultipleViewsAtOnce ) |
2677 | { | 2689 | { |
2678 | setDetailsVisible( true ); | 2690 | setDetailsVisible( true ); |
2679 | mActionDetails->setChecked(true); | 2691 | mActionDetails->setChecked(true); |
2680 | } | 2692 | } |
2681 | } | 2693 | } |
2682 | } | 2694 | } |
2683 | 2695 | ||
2684 | void KABCore::whatsnew() | 2696 | void KABCore::whatsnew() |
2685 | { | 2697 | { |
2686 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2698 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2687 | } | 2699 | } |
2688 | void KABCore::synchowto() | 2700 | void KABCore::synchowto() |
2689 | { | 2701 | { |
2690 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 2702 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
2691 | } | 2703 | } |
2692 | void KABCore::kdesynchowto() | 2704 | void KABCore::kdesynchowto() |
2693 | { | 2705 | { |
2694 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 2706 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
2695 | } | 2707 | } |
2696 | void KABCore::multisynchowto() | 2708 | void KABCore::multisynchowto() |
2697 | { | 2709 | { |
2698 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 2710 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
2699 | } | 2711 | } |
2700 | void KABCore::faq() | 2712 | void KABCore::faq() |
2701 | { | 2713 | { |
2702 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2714 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2703 | } | 2715 | } |