-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 | |||
@@ -2447,129 +2447,141 @@ void KABCore::setFormattedName() | |||
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()) |