summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index db19dd5..27aca2d 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2420,192 +2420,193 @@ void KABCore::setFormattedName()
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
2454void KABCore::clipboardDataChanged() 2454void 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
2462void KABCore::updateActionMenu() 2462void 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
2482void KABCore::configureKeyBindings() 2482void 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
2492void KABCore::configureResources() 2492void 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 */
2506void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2506void 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; 2511 bool ok = false;
2512 int wid = uid.toInt( &ok ); 2512 int wid = uid.toInt( &ok );
2513 if ( ok ) { 2513 if ( ok ) {
2514 if ( wid != QApplication::desktop()->width() ) { 2514 if ( wid != QApplication::desktop()->width() ) {
2515 qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); 2515 qDebug("KA/Pi: Request from different desktop geometry. Resizing ...");
2516 message( i18n("Resizing, please wait...") );
2516 raise(); 2517 raise();
2517 qApp->processEvents(); 2518 qApp->processEvents();
2518 } 2519 }
2519 2520
2520 } else { 2521 } else {
2521 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); 2522 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid ");
2522 } 2523 }
2523 2524
2524 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2525 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2525 uint i=0; 2526 uint i=0;
2526 for (i=0; i < list.count(); i++) 2527 for (i=0; i < list.count(); i++)
2527 { 2528 {
2528 nameList.append(list[i].realName()); 2529 nameList.append(list[i].realName());
2529 emailList.append(list[i].preferredEmail()); 2530 emailList.append(list[i].preferredEmail());
2530 uidList.append(list[i].uid()); 2531 uidList.append(list[i].uid());
2531 } 2532 }
2532 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); 2533 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1());
2533 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2534 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2534 2535
2535} 2536}
2536 2537
2537/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2538/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2538 * to put them into the calendar. 2539 * to put them into the calendar.
2539 */ 2540 */
2540void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2541void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2541{ 2542{
2542 // qDebug("KABCore::requestForBirthdayList"); 2543 // qDebug("KABCore::requestForBirthdayList");
2543 QStringList birthdayList; 2544 QStringList birthdayList;
2544 QStringList anniversaryList; 2545 QStringList anniversaryList;
2545 QStringList realNameList; 2546 QStringList realNameList;
2546 QStringList preferredEmailList; 2547 QStringList preferredEmailList;
2547 QStringList assembledNameList; 2548 QStringList assembledNameList;
2548 QStringList uidList; 2549 QStringList uidList;
2549 2550
2550 KABC::AddressBook::Iterator it; 2551 KABC::AddressBook::Iterator it;
2551 2552
2552 int count = 0; 2553 int count = 0;
2553 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2554 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2554 ++count; 2555 ++count;
2555 } 2556 }
2556 QProgressBar bar(count,0 ); 2557 QProgressBar bar(count,0 );
2557 int w = 300; 2558 int w = 300;
2558 if ( QApplication::desktop()->width() < 320 ) 2559 if ( QApplication::desktop()->width() < 320 )
2559 w = 220; 2560 w = 220;
2560 int h = bar.sizeHint().height() ; 2561 int h = bar.sizeHint().height() ;
2561 int dw = QApplication::desktop()->width(); 2562 int dw = QApplication::desktop()->width();
2562 int dh = QApplication::desktop()->height(); 2563 int dh = QApplication::desktop()->height();
2563 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2564 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2564 bar.show(); 2565 bar.show();
2565 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2566 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2566 qApp->processEvents(); 2567 qApp->processEvents();
2567 2568
2568 QDate bday; 2569 QDate bday;
2569 QString anni; 2570 QString anni;
2570 QString formattedbday; 2571 QString formattedbday;
2571 2572
2572 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2573 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2573 { 2574 {
2574 if ( ! bar.isVisible() ) 2575 if ( ! bar.isVisible() )
2575 return; 2576 return;
2576 bar.setProgress( count++ ); 2577 bar.setProgress( count++ );
2577 qApp->processEvents(); 2578 qApp->processEvents();
2578 bday = (*it).birthday().date(); 2579 bday = (*it).birthday().date();
2579 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2580 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2580 2581
2581 if ( bday.isValid() || !anni.isEmpty()) 2582 if ( bday.isValid() || !anni.isEmpty())
2582 { 2583 {
2583 if (bday.isValid()) 2584 if (bday.isValid())
2584 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2585 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2585 else 2586 else
2586 formattedbday = "NOTVALID"; 2587 formattedbday = "NOTVALID";
2587 if (anni.isEmpty()) 2588 if (anni.isEmpty())
2588 anni = "INVALID"; 2589 anni = "INVALID";
2589 2590
2590 birthdayList.append(formattedbday); 2591 birthdayList.append(formattedbday);
2591 anniversaryList.append(anni); //should be ISODate 2592 anniversaryList.append(anni); //should be ISODate
2592 realNameList.append((*it).realName()); 2593 realNameList.append((*it).realName());
2593 preferredEmailList.append((*it).preferredEmail()); 2594 preferredEmailList.append((*it).preferredEmail());
2594 assembledNameList.append((*it).assembledName()); 2595 assembledNameList.append((*it).assembledName());
2595 uidList.append((*it).uid()); 2596 uidList.append((*it).uid());
2596 2597
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() ); 2598 //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() );
2598 } 2599 }
2599 } 2600 }
2600 2601
2601 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2602 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2602 2603
2603} 2604}
2604 2605
2605/* this method will be called through the QCop interface from other apps to show details of a contact. 2606/* this method will be called through the QCop interface from other apps to show details of a contact.
2606 */ 2607 */
2607void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2608void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2608{ 2609{
2609 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2610 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2610 2611
2611 QString foundUid = QString::null; 2612 QString foundUid = QString::null;