-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 3715786..046cb63 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -330,96 +330,97 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
330 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 330 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
331 | "X-IMAddress", "KADDRESSBOOK" ); | 331 | "X-IMAddress", "KADDRESSBOOK" ); |
332 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 332 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
333 | "X-Anniversary", "KADDRESSBOOK" ); | 333 | "X-Anniversary", "KADDRESSBOOK" ); |
334 | 334 | ||
335 | //US added this field to become compatible with Opie/qtopia addressbook | 335 | //US added this field to become compatible with Opie/qtopia addressbook |
336 | // values can be "female" or "male" or "". An empty field represents undefined. | 336 | // values can be "female" or "male" or "". An empty field represents undefined. |
337 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 337 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
338 | "X-Gender", "KADDRESSBOOK" ); | 338 | "X-Gender", "KADDRESSBOOK" ); |
339 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 339 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
340 | "X-Children", "KADDRESSBOOK" ); | 340 | "X-Children", "KADDRESSBOOK" ); |
341 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 341 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
342 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 342 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
343 | #endif | 343 | #endif |
344 | initGUI(); | 344 | initGUI(); |
345 | 345 | ||
346 | mIncSearchWidget->setFocus(); | 346 | mIncSearchWidget->setFocus(); |
347 | 347 | ||
348 | 348 | ||
349 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 349 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
350 | SLOT( setContactSelected( const QString& ) ) ); | 350 | SLOT( setContactSelected( const QString& ) ) ); |
351 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 351 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
352 | SLOT( executeContact( const QString& ) ) ); | 352 | SLOT( executeContact( const QString& ) ) ); |
353 | 353 | ||
354 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 354 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
355 | SLOT( deleteContacts( ) ) ); | 355 | SLOT( deleteContacts( ) ) ); |
356 | connect( mViewManager, SIGNAL( modified() ), | 356 | connect( mViewManager, SIGNAL( modified() ), |
357 | SLOT( setModified() ) ); | 357 | SLOT( setModified() ) ); |
358 | 358 | ||
359 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 359 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
360 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 360 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
361 | 361 | ||
362 | connect( mXXPortManager, SIGNAL( modified() ), | 362 | connect( mXXPortManager, SIGNAL( modified() ), |
363 | SLOT( setModified() ) ); | 363 | SLOT( setModified() ) ); |
364 | 364 | ||
365 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 365 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
366 | SLOT( incrementalSearchJump( const QString& ) ) ); | 366 | SLOT( incrementalSearchJump( const QString& ) ) ); |
367 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 367 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
368 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 368 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
369 | 369 | ||
370 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 370 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
371 | SLOT( sendMail( const QString& ) ) ); | 371 | SLOT( sendMail( const QString& ) ) ); |
372 | 372 | ||
373 | 373 | ||
374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
375 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 375 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
376 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 376 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
377 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 377 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
378 | connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync())); | ||
378 | connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); | 379 | connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); |
379 | 380 | ||
380 | 381 | ||
381 | #ifndef KAB_EMBEDDED | 382 | #ifndef KAB_EMBEDDED |
382 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 383 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
383 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 384 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
384 | 385 | ||
385 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 386 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
386 | SLOT( browse( const QString& ) ) ); | 387 | SLOT( browse( const QString& ) ) ); |
387 | 388 | ||
388 | 389 | ||
389 | mAddressBookService = new KAddressBookService( this ); | 390 | mAddressBookService = new KAddressBookService( this ); |
390 | 391 | ||
391 | #endif //KAB_EMBEDDED | 392 | #endif //KAB_EMBEDDED |
392 | 393 | ||
393 | mMessageTimer = new QTimer( this ); | 394 | mMessageTimer = new QTimer( this ); |
394 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 395 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
395 | mEditorDialog = 0; | 396 | mEditorDialog = 0; |
396 | createAddresseeEditorDialog( this ); | 397 | createAddresseeEditorDialog( this ); |
397 | setModified( false ); | 398 | setModified( false ); |
398 | mBRdisabled = false; | 399 | mBRdisabled = false; |
399 | #ifndef DESKTOP_VERSION | 400 | #ifndef DESKTOP_VERSION |
400 | infrared = 0; | 401 | infrared = 0; |
401 | #endif | 402 | #endif |
402 | //toggleBeamReceive( ); | 403 | //toggleBeamReceive( ); |
403 | mMainWindow->toolBar()->show(); | 404 | mMainWindow->toolBar()->show(); |
404 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 405 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
405 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 406 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
406 | } | 407 | } |
407 | 408 | ||
408 | void KABCore::updateToolBar() | 409 | void KABCore::updateToolBar() |
409 | { | 410 | { |
410 | static int iii = 0; | 411 | static int iii = 0; |
411 | ++iii; | 412 | ++iii; |
412 | mMainWindow->toolBar()->repaintMe(); | 413 | mMainWindow->toolBar()->repaintMe(); |
413 | if ( iii < 4 ) | 414 | if ( iii < 4 ) |
414 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); | 415 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); |
415 | } | 416 | } |
416 | KABCore::~KABCore() | 417 | KABCore::~KABCore() |
417 | { | 418 | { |
418 | // save(); | 419 | // save(); |
419 | //saveSettings(); | 420 | //saveSettings(); |
420 | //KABPrefs::instance()->writeConfig(); | 421 | //KABPrefs::instance()->writeConfig(); |
421 | delete AddresseeConfig::instance(); | 422 | delete AddresseeConfig::instance(); |
422 | mAddressBook = 0; | 423 | mAddressBook = 0; |
423 | KABC::StdAddressBook::close(); | 424 | KABC::StdAddressBook::close(); |
424 | 425 | ||
425 | delete syncManager; | 426 | delete syncManager; |
@@ -2535,96 +2536,100 @@ void KABCore::configureResources() | |||
2535 | if ( !dlg.exec() ) | 2536 | if ( !dlg.exec() ) |
2536 | return; | 2537 | return; |
2537 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2538 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2538 | } | 2539 | } |
2539 | #endif //KAB_EMBEDDED | 2540 | #endif //KAB_EMBEDDED |
2540 | 2541 | ||
2541 | 2542 | ||
2542 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2543 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2543 | * for the attendees list of an event. | 2544 | * for the attendees list of an event. |
2544 | */ | 2545 | */ |
2545 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2546 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2546 | { | 2547 | { |
2547 | qDebug("KABCore::requestForNameEmailUidList "); | 2548 | qDebug("KABCore::requestForNameEmailUidList "); |
2548 | bool ok = false; | 2549 | bool ok = false; |
2549 | mEmailSourceChannel = sourceChannel; | 2550 | mEmailSourceChannel = sourceChannel; |
2550 | mEmailSourceUID = uid; | 2551 | mEmailSourceUID = uid; |
2551 | QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); | 2552 | QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); |
2552 | //callContactdialog(); | 2553 | //callContactdialog(); |
2553 | #if 0 | 2554 | #if 0 |
2554 | int wid = uid.toInt( &ok ); | 2555 | int wid = uid.toInt( &ok ); |
2555 | qDebug("UID %s ", uid.latin1()); | 2556 | qDebug("UID %s ", uid.latin1()); |
2556 | if ( ok ) { | 2557 | if ( ok ) { |
2557 | if ( wid != QApplication::desktop()->width() ) { | 2558 | if ( wid != QApplication::desktop()->width() ) { |
2558 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); | 2559 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); |
2559 | message( i18n("Resizing, please wait...") ); | 2560 | message( i18n("Resizing, please wait...") ); |
2560 | mMainWindow->showMinimized(); | 2561 | mMainWindow->showMinimized(); |
2561 | /* | 2562 | /* |
2562 | { | 2563 | { |
2563 | QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); | 2564 | QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); |
2564 | } | 2565 | } |
2565 | */ | 2566 | */ |
2566 | QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); | 2567 | QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); |
2567 | return; | 2568 | return; |
2568 | } | 2569 | } |
2569 | 2570 | ||
2570 | } else { | 2571 | } else { |
2571 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); | 2572 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); |
2572 | } | 2573 | } |
2573 | callContactdialog(); | 2574 | callContactdialog(); |
2574 | //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); | 2575 | //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); |
2575 | #endif | 2576 | #endif |
2576 | } | 2577 | } |
2577 | void KABCore::resizeAndCallContactdialog() | 2578 | void KABCore::resizeAndCallContactdialog() |
2578 | { | 2579 | { |
2579 | updateMainWindow(); | 2580 | updateMainWindow(); |
2580 | QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); | 2581 | QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); |
2581 | } | 2582 | } |
2582 | 2583 | ||
2584 | void KABCore::doRingSync() | ||
2585 | { | ||
2586 | syncManager->multiSync( false ); | ||
2587 | } | ||
2583 | void KABCore::callContactdialog() | 2588 | void KABCore::callContactdialog() |
2584 | { | 2589 | { |
2585 | static bool running = false; | 2590 | static bool running = false; |
2586 | if (running) return; | 2591 | if (running) return; |
2587 | running = true; | 2592 | running = true; |
2588 | QStringList nameList; | 2593 | QStringList nameList; |
2589 | QStringList emailList; | 2594 | QStringList emailList; |
2590 | QStringList uidList; | 2595 | QStringList uidList; |
2591 | qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); | 2596 | qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); |
2592 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2597 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2593 | uint i=0; | 2598 | uint i=0; |
2594 | for (i=0; i < list.count(); i++) | 2599 | for (i=0; i < list.count(); i++) |
2595 | { | 2600 | { |
2596 | nameList.append(list[i].realName()); | 2601 | nameList.append(list[i].realName()); |
2597 | emailList.append(list[i].preferredEmail()); | 2602 | emailList.append(list[i].preferredEmail()); |
2598 | uidList.append(list[i].uid()); | 2603 | uidList.append(list[i].uid()); |
2599 | } | 2604 | } |
2600 | QString uid = mEmailSourceUID; | 2605 | QString uid = mEmailSourceUID; |
2601 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); | 2606 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); |
2602 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); | 2607 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); |
2603 | running = false; | 2608 | running = false; |
2604 | } | 2609 | } |
2605 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2610 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2606 | * to put them into the calendar. | 2611 | * to put them into the calendar. |
2607 | */ | 2612 | */ |
2608 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2613 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2609 | { | 2614 | { |
2610 | // qDebug("KABCore::requestForBirthdayList"); | 2615 | // qDebug("KABCore::requestForBirthdayList"); |
2611 | QStringList birthdayList; | 2616 | QStringList birthdayList; |
2612 | QStringList anniversaryList; | 2617 | QStringList anniversaryList; |
2613 | QStringList realNameList; | 2618 | QStringList realNameList; |
2614 | QStringList preferredEmailList; | 2619 | QStringList preferredEmailList; |
2615 | QStringList assembledNameList; | 2620 | QStringList assembledNameList; |
2616 | QStringList uidList; | 2621 | QStringList uidList; |
2617 | 2622 | ||
2618 | KABC::AddressBook::Iterator it; | 2623 | KABC::AddressBook::Iterator it; |
2619 | 2624 | ||
2620 | int count = 0; | 2625 | int count = 0; |
2621 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2626 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2622 | ++count; | 2627 | ++count; |
2623 | } | 2628 | } |
2624 | QProgressBar bar(count,0 ); | 2629 | QProgressBar bar(count,0 ); |
2625 | int w = 300; | 2630 | int w = 300; |
2626 | if ( QApplication::desktop()->width() < 320 ) | 2631 | if ( QApplication::desktop()->width() < 320 ) |
2627 | w = 220; | 2632 | w = 220; |
2628 | int h = bar.sizeHint().height() ; | 2633 | int h = bar.sizeHint().height() ; |
2629 | int dw = QApplication::desktop()->width(); | 2634 | int dw = QApplication::desktop()->width(); |
2630 | int dh = QApplication::desktop()->height(); | 2635 | int dh = QApplication::desktop()->height(); |