author | zautrix <zautrix> | 2004-11-08 23:57:27 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-11-08 23:57:27 (UTC) |
commit | 48b2ccf53b1821598c6f18aab57e6e626047c262 (patch) (unidiff) | |
tree | 10e4f0123debd92ed06f037dc9212c88a6046bc3 | |
parent | a102330ef5acb7346aa811378eaf9dbcdeabd4c4 (diff) | |
download | kdepimpi-48b2ccf53b1821598c6f18aab57e6e626047c262.zip kdepimpi-48b2ccf53b1821598c6f18aab57e6e626047c262.tar.gz kdepimpi-48b2ccf53b1821598c6f18aab57e6e626047c262.tar.bz2 |
more menu cleanup in kapi
-rw-r--r-- | kaddressbook/kabcore.cpp | 29 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 1 |
2 files changed, 19 insertions, 11 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index a6fc677..3c97ce9 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -295,963 +295,965 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
295 | //US added this field to become compatible with Opie/qtopia addressbook | 295 | //US added this field to become compatible with Opie/qtopia addressbook |
296 | // values can be "female" or "male" or "". An empty field represents undefined. | 296 | // values can be "female" or "male" or "". An empty field represents undefined. |
297 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 297 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
298 | "X-Gender", "KADDRESSBOOK" ); | 298 | "X-Gender", "KADDRESSBOOK" ); |
299 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 299 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
300 | "X-Children", "KADDRESSBOOK" ); | 300 | "X-Children", "KADDRESSBOOK" ); |
301 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 301 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
302 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 302 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
303 | #endif | 303 | #endif |
304 | initGUI(); | 304 | initGUI(); |
305 | 305 | ||
306 | mIncSearchWidget->setFocus(); | 306 | mIncSearchWidget->setFocus(); |
307 | 307 | ||
308 | 308 | ||
309 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 309 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
310 | SLOT( setContactSelected( const QString& ) ) ); | 310 | SLOT( setContactSelected( const QString& ) ) ); |
311 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 311 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
312 | SLOT( executeContact( const QString& ) ) ); | 312 | SLOT( executeContact( const QString& ) ) ); |
313 | 313 | ||
314 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 314 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
315 | SLOT( deleteContacts( ) ) ); | 315 | SLOT( deleteContacts( ) ) ); |
316 | connect( mViewManager, SIGNAL( modified() ), | 316 | connect( mViewManager, SIGNAL( modified() ), |
317 | SLOT( setModified() ) ); | 317 | SLOT( setModified() ) ); |
318 | 318 | ||
319 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 319 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
320 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 320 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
321 | 321 | ||
322 | connect( mXXPortManager, SIGNAL( modified() ), | 322 | connect( mXXPortManager, SIGNAL( modified() ), |
323 | SLOT( setModified() ) ); | 323 | SLOT( setModified() ) ); |
324 | 324 | ||
325 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 325 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
326 | SLOT( incrementalSearch( const QString& ) ) ); | 326 | SLOT( incrementalSearch( const QString& ) ) ); |
327 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 327 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
328 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 328 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
329 | 329 | ||
330 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 330 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
331 | SLOT( sendMail( const QString& ) ) ); | 331 | SLOT( sendMail( const QString& ) ) ); |
332 | 332 | ||
333 | 333 | ||
334 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 334 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
335 | 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&))); | 335 | 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&))); |
336 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 336 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
337 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 337 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
338 | 338 | ||
339 | 339 | ||
340 | #ifndef KAB_EMBEDDED | 340 | #ifndef KAB_EMBEDDED |
341 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 341 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
342 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 342 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
343 | 343 | ||
344 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 344 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
345 | SLOT( browse( const QString& ) ) ); | 345 | SLOT( browse( const QString& ) ) ); |
346 | 346 | ||
347 | 347 | ||
348 | mAddressBookService = new KAddressBookService( this ); | 348 | mAddressBookService = new KAddressBookService( this ); |
349 | 349 | ||
350 | #endif //KAB_EMBEDDED | 350 | #endif //KAB_EMBEDDED |
351 | 351 | ||
352 | mMessageTimer = new QTimer( this ); | 352 | mMessageTimer = new QTimer( this ); |
353 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 353 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
354 | mEditorDialog = 0; | 354 | mEditorDialog = 0; |
355 | createAddresseeEditorDialog( this ); | 355 | createAddresseeEditorDialog( this ); |
356 | setModified( false ); | 356 | setModified( false ); |
357 | mBRdisabled = false; | 357 | mBRdisabled = false; |
358 | #ifndef DESKTOP_VERSION | 358 | #ifndef DESKTOP_VERSION |
359 | infrared = 0; | 359 | infrared = 0; |
360 | #endif | 360 | #endif |
361 | //toggleBeamReceive( ); | 361 | //toggleBeamReceive( ); |
362 | 362 | ||
363 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 363 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
364 | QTimer::singleShot( 10000, this , SLOT ( updateToolBar())); | 364 | QTimer::singleShot( 10000, this , SLOT ( updateToolBar())); |
365 | } | 365 | } |
366 | 366 | ||
367 | void KABCore::updateToolBar() | 367 | void KABCore::updateToolBar() |
368 | { | 368 | { |
369 | mMainWindow->toolBar()->update(); | 369 | mMainWindow->toolBar()->update(); |
370 | } | 370 | } |
371 | KABCore::~KABCore() | 371 | KABCore::~KABCore() |
372 | { | 372 | { |
373 | // save(); | 373 | // save(); |
374 | //saveSettings(); | 374 | //saveSettings(); |
375 | //KABPrefs::instance()->writeConfig(); | 375 | //KABPrefs::instance()->writeConfig(); |
376 | delete AddresseeConfig::instance(); | 376 | delete AddresseeConfig::instance(); |
377 | mAddressBook = 0; | 377 | mAddressBook = 0; |
378 | KABC::StdAddressBook::close(); | 378 | KABC::StdAddressBook::close(); |
379 | 379 | ||
380 | delete syncManager; | 380 | delete syncManager; |
381 | #ifndef DESKTOP_VERSION | 381 | #ifndef DESKTOP_VERSION |
382 | if ( infrared ) | 382 | if ( infrared ) |
383 | delete infrared; | 383 | delete infrared; |
384 | #endif | 384 | #endif |
385 | } | 385 | } |
386 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 386 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
387 | { | 387 | { |
388 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 388 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
389 | if ( cmsg == "setDocument(QString)" ) { | 389 | if ( cmsg == "setDocument(QString)" ) { |
390 | QDataStream stream( data, IO_ReadOnly ); | 390 | QDataStream stream( data, IO_ReadOnly ); |
391 | QString fileName; | 391 | QString fileName; |
392 | stream >> fileName; | 392 | stream >> fileName; |
393 | recieve( fileName ); | 393 | recieve( fileName ); |
394 | return; | 394 | return; |
395 | } | 395 | } |
396 | } | 396 | } |
397 | void KABCore::toggleBeamReceive( ) | 397 | void KABCore::toggleBeamReceive( ) |
398 | { | 398 | { |
399 | if ( mBRdisabled ) | 399 | if ( mBRdisabled ) |
400 | return; | 400 | return; |
401 | #ifndef DESKTOP_VERSION | 401 | #ifndef DESKTOP_VERSION |
402 | if ( infrared ) { | 402 | if ( infrared ) { |
403 | qDebug("AB disable BeamReceive "); | 403 | qDebug("AB disable BeamReceive "); |
404 | delete infrared; | 404 | delete infrared; |
405 | infrared = 0; | 405 | infrared = 0; |
406 | mActionBR->setChecked(false); | 406 | mActionBR->setChecked(false); |
407 | return; | 407 | return; |
408 | } | 408 | } |
409 | qDebug("AB enable BeamReceive "); | 409 | qDebug("AB enable BeamReceive "); |
410 | mActionBR->setChecked(true); | 410 | mActionBR->setChecked(true); |
411 | 411 | ||
412 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 412 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
413 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 413 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
414 | #endif | 414 | #endif |
415 | } | 415 | } |
416 | 416 | ||
417 | 417 | ||
418 | void KABCore::disableBR(bool b) | 418 | void KABCore::disableBR(bool b) |
419 | { | 419 | { |
420 | #ifndef DESKTOP_VERSION | 420 | #ifndef DESKTOP_VERSION |
421 | if ( b ) { | 421 | if ( b ) { |
422 | if ( infrared ) { | 422 | if ( infrared ) { |
423 | toggleBeamReceive( ); | 423 | toggleBeamReceive( ); |
424 | } | 424 | } |
425 | mBRdisabled = true; | 425 | mBRdisabled = true; |
426 | } else { | 426 | } else { |
427 | if ( mBRdisabled ) { | 427 | if ( mBRdisabled ) { |
428 | mBRdisabled = false; | 428 | mBRdisabled = false; |
429 | //toggleBeamReceive( ); | 429 | //toggleBeamReceive( ); |
430 | } | 430 | } |
431 | } | 431 | } |
432 | #endif | 432 | #endif |
433 | 433 | ||
434 | } | 434 | } |
435 | void KABCore::recieve( QString fn ) | 435 | void KABCore::recieve( QString fn ) |
436 | { | 436 | { |
437 | //qDebug("KABCore::recieve "); | 437 | //qDebug("KABCore::recieve "); |
438 | int count = mAddressBook->importFromFile( fn, true ); | 438 | int count = mAddressBook->importFromFile( fn, true ); |
439 | if ( count ) | 439 | if ( count ) |
440 | setModified( true ); | 440 | setModified( true ); |
441 | mViewManager->refreshView(); | 441 | mViewManager->refreshView(); |
442 | message(i18n("%1 contact(s) received!").arg( count )); | 442 | message(i18n("%1 contact(s) received!").arg( count )); |
443 | topLevelWidget()->showMaximized(); | 443 | topLevelWidget()->showMaximized(); |
444 | topLevelWidget()->raise(); | 444 | topLevelWidget()->raise(); |
445 | } | 445 | } |
446 | void KABCore::restoreSettings() | 446 | void KABCore::restoreSettings() |
447 | { | 447 | { |
448 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 448 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
449 | 449 | ||
450 | bool state; | 450 | bool state; |
451 | 451 | ||
452 | if (mMultipleViewsAtOnce) | 452 | if (mMultipleViewsAtOnce) |
453 | state = KABPrefs::instance()->mDetailsPageVisible; | 453 | state = KABPrefs::instance()->mDetailsPageVisible; |
454 | else | 454 | else |
455 | state = false; | 455 | state = false; |
456 | 456 | ||
457 | mActionDetails->setChecked( state ); | 457 | mActionDetails->setChecked( state ); |
458 | setDetailsVisible( state ); | 458 | setDetailsVisible( state ); |
459 | 459 | ||
460 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 460 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
461 | 461 | ||
462 | mActionJumpBar->setChecked( state ); | 462 | mActionJumpBar->setChecked( state ); |
463 | setJumpButtonBarVisible( state ); | 463 | setJumpButtonBarVisible( state ); |
464 | /*US | 464 | /*US |
465 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 465 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
466 | if ( splitterSize.count() == 0 ) { | 466 | if ( splitterSize.count() == 0 ) { |
467 | splitterSize.append( width() / 2 ); | 467 | splitterSize.append( width() / 2 ); |
468 | splitterSize.append( width() / 2 ); | 468 | splitterSize.append( width() / 2 ); |
469 | } | 469 | } |
470 | mMiniSplitter->setSizes( splitterSize ); | 470 | mMiniSplitter->setSizes( splitterSize ); |
471 | if ( mExtensionBarSplitter ) { | 471 | if ( mExtensionBarSplitter ) { |
472 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 472 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
473 | if ( splitterSize.count() == 0 ) { | 473 | if ( splitterSize.count() == 0 ) { |
474 | splitterSize.append( width() / 2 ); | 474 | splitterSize.append( width() / 2 ); |
475 | splitterSize.append( width() / 2 ); | 475 | splitterSize.append( width() / 2 ); |
476 | } | 476 | } |
477 | mExtensionBarSplitter->setSizes( splitterSize ); | 477 | mExtensionBarSplitter->setSizes( splitterSize ); |
478 | 478 | ||
479 | } | 479 | } |
480 | */ | 480 | */ |
481 | mViewManager->restoreSettings(); | 481 | mViewManager->restoreSettings(); |
482 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 482 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
483 | mExtensionManager->restoreSettings(); | 483 | mExtensionManager->restoreSettings(); |
484 | #ifdef DESKTOP_VERSION | 484 | #ifdef DESKTOP_VERSION |
485 | int wid = width(); | 485 | int wid = width(); |
486 | if ( wid < 10 ) | 486 | if ( wid < 10 ) |
487 | wid = 400; | 487 | wid = 400; |
488 | #else | 488 | #else |
489 | int wid = QApplication::desktop()->width(); | 489 | int wid = QApplication::desktop()->width(); |
490 | if ( wid < 640 ) | 490 | if ( wid < 640 ) |
491 | wid = QApplication::desktop()->height(); | 491 | wid = QApplication::desktop()->height(); |
492 | #endif | 492 | #endif |
493 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 493 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
494 | if ( true /*splitterSize.count() == 0*/ ) { | 494 | if ( true /*splitterSize.count() == 0*/ ) { |
495 | splitterSize.append( wid / 2 ); | 495 | splitterSize.append( wid / 2 ); |
496 | splitterSize.append( wid / 2 ); | 496 | splitterSize.append( wid / 2 ); |
497 | } | 497 | } |
498 | mMiniSplitter->setSizes( splitterSize ); | 498 | mMiniSplitter->setSizes( splitterSize ); |
499 | if ( mExtensionBarSplitter ) { | 499 | if ( mExtensionBarSplitter ) { |
500 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 500 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
501 | if ( true /*splitterSize.count() == 0*/ ) { | 501 | if ( true /*splitterSize.count() == 0*/ ) { |
502 | splitterSize.append( wid / 2 ); | 502 | splitterSize.append( wid / 2 ); |
503 | splitterSize.append( wid / 2 ); | 503 | splitterSize.append( wid / 2 ); |
504 | } | 504 | } |
505 | mExtensionBarSplitter->setSizes( splitterSize ); | 505 | mExtensionBarSplitter->setSizes( splitterSize ); |
506 | 506 | ||
507 | } | 507 | } |
508 | 508 | ||
509 | 509 | ||
510 | } | 510 | } |
511 | 511 | ||
512 | void KABCore::saveSettings() | 512 | void KABCore::saveSettings() |
513 | { | 513 | { |
514 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 514 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
515 | if ( mExtensionBarSplitter ) | 515 | if ( mExtensionBarSplitter ) |
516 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 516 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
517 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 517 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
518 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 518 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
519 | #ifndef KAB_EMBEDDED | 519 | #ifndef KAB_EMBEDDED |
520 | 520 | ||
521 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 521 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
522 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 522 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
523 | #endif //KAB_EMBEDDED | 523 | #endif //KAB_EMBEDDED |
524 | mExtensionManager->saveSettings(); | 524 | mExtensionManager->saveSettings(); |
525 | mViewManager->saveSettings(); | 525 | mViewManager->saveSettings(); |
526 | 526 | ||
527 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 527 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
528 | } | 528 | } |
529 | 529 | ||
530 | KABC::AddressBook *KABCore::addressBook() const | 530 | KABC::AddressBook *KABCore::addressBook() const |
531 | { | 531 | { |
532 | return mAddressBook; | 532 | return mAddressBook; |
533 | } | 533 | } |
534 | 534 | ||
535 | KConfig *KABCore::config() | 535 | KConfig *KABCore::config() |
536 | { | 536 | { |
537 | #ifndef KAB_EMBEDDED | 537 | #ifndef KAB_EMBEDDED |
538 | return KABPrefs::instance()->config(); | 538 | return KABPrefs::instance()->config(); |
539 | #else //KAB_EMBEDDED | 539 | #else //KAB_EMBEDDED |
540 | return KABPrefs::instance()->getConfig(); | 540 | return KABPrefs::instance()->getConfig(); |
541 | #endif //KAB_EMBEDDED | 541 | #endif //KAB_EMBEDDED |
542 | } | 542 | } |
543 | 543 | ||
544 | KActionCollection *KABCore::actionCollection() const | 544 | KActionCollection *KABCore::actionCollection() const |
545 | { | 545 | { |
546 | return mGUIClient->actionCollection(); | 546 | return mGUIClient->actionCollection(); |
547 | } | 547 | } |
548 | 548 | ||
549 | KABC::Field *KABCore::currentSearchField() const | 549 | KABC::Field *KABCore::currentSearchField() const |
550 | { | 550 | { |
551 | if (mIncSearchWidget) | 551 | if (mIncSearchWidget) |
552 | return mIncSearchWidget->currentField(); | 552 | return mIncSearchWidget->currentField(); |
553 | else | 553 | else |
554 | return 0; | 554 | return 0; |
555 | } | 555 | } |
556 | 556 | ||
557 | QStringList KABCore::selectedUIDs() const | 557 | QStringList KABCore::selectedUIDs() const |
558 | { | 558 | { |
559 | return mViewManager->selectedUids(); | 559 | return mViewManager->selectedUids(); |
560 | } | 560 | } |
561 | 561 | ||
562 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 562 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
563 | { | 563 | { |
564 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 564 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
565 | 565 | ||
566 | QPtrList<KRES::Resource> kresResources; | 566 | QPtrList<KRES::Resource> kresResources; |
567 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 567 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
568 | KABC::Resource *resource; | 568 | KABC::Resource *resource; |
569 | while ( ( resource = resIt.current() ) != 0 ) { | 569 | while ( ( resource = resIt.current() ) != 0 ) { |
570 | ++resIt; | 570 | ++resIt; |
571 | if ( !resource->readOnly() ) { | 571 | if ( !resource->readOnly() ) { |
572 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 572 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
573 | if ( res ) | 573 | if ( res ) |
574 | kresResources.append( res ); | 574 | kresResources.append( res ); |
575 | } | 575 | } |
576 | } | 576 | } |
577 | 577 | ||
578 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 578 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
579 | return static_cast<KABC::Resource*>( res ); | 579 | return static_cast<KABC::Resource*>( res ); |
580 | } | 580 | } |
581 | 581 | ||
582 | #ifndef KAB_EMBEDDED | 582 | #ifndef KAB_EMBEDDED |
583 | KAboutData *KABCore::createAboutData() | 583 | KAboutData *KABCore::createAboutData() |
584 | #else //KAB_EMBEDDED | 584 | #else //KAB_EMBEDDED |
585 | void KABCore::createAboutData() | 585 | void KABCore::createAboutData() |
586 | #endif //KAB_EMBEDDED | 586 | #endif //KAB_EMBEDDED |
587 | { | 587 | { |
588 | #ifndef KAB_EMBEDDED | 588 | #ifndef KAB_EMBEDDED |
589 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 589 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
590 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 590 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
591 | KAboutData::License_GPL_V2, | 591 | KAboutData::License_GPL_V2, |
592 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 592 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
593 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 593 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
594 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 594 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
595 | about->addAuthor( "Cornelius Schumacher", | 595 | about->addAuthor( "Cornelius Schumacher", |
596 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 596 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
597 | "schumacher@kde.org" ); | 597 | "schumacher@kde.org" ); |
598 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 598 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
599 | "mpilone@slac.com" ); | 599 | "mpilone@slac.com" ); |
600 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 600 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
601 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 601 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
602 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 602 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
603 | "michel@klaralvdalens-datakonsult.se" ); | 603 | "michel@klaralvdalens-datakonsult.se" ); |
604 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 604 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
605 | "hansen@kde.org" ); | 605 | "hansen@kde.org" ); |
606 | 606 | ||
607 | return about; | 607 | return about; |
608 | #endif //KAB_EMBEDDED | 608 | #endif //KAB_EMBEDDED |
609 | 609 | ||
610 | QString version; | 610 | QString version; |
611 | #include <../version> | 611 | #include <../version> |
612 | QMessageBox::about( this, "About KAddressbook/Pi", | 612 | QMessageBox::about( this, "About KAddressbook/Pi", |
613 | "KAddressbook/Platform-independent\n" | 613 | "KAddressbook/Platform-independent\n" |
614 | "(KA/Pi) " +version + " - " + | 614 | "(KA/Pi) " +version + " - " + |
615 | #ifdef DESKTOP_VERSION | 615 | #ifdef DESKTOP_VERSION |
616 | "Desktop Edition\n" | 616 | "Desktop Edition\n" |
617 | #else | 617 | #else |
618 | "PDA-Edition\n" | 618 | "PDA-Edition\n" |
619 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 619 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
620 | #endif | 620 | #endif |
621 | 621 | ||
622 | "(c) 2004 Ulf Schenk\n" | 622 | "(c) 2004 Ulf Schenk\n" |
623 | "(c) 2004 Lutz Rogowski\n" | 623 | "(c) 2004 Lutz Rogowski\n" |
624 | "(c) 1997-2003, The KDE PIM Team\n" | 624 | "(c) 1997-2003, The KDE PIM Team\n" |
625 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" | 625 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" |
626 | "Don Sanders Original author\n" | 626 | "Don Sanders Original author\n" |
627 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" | 627 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" |
628 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" | 628 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" |
629 | "Greg Stern DCOP interface\n" | 629 | "Greg Stern DCOP interface\n" |
630 | "Mark Westcot Contact pinning\n" | 630 | "Mark Westcot Contact pinning\n" |
631 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 631 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
632 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" | 632 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" |
633 | #ifdef _WIN32_ | 633 | #ifdef _WIN32_ |
634 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 634 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
635 | #endif | 635 | #endif |
636 | ); | 636 | ); |
637 | } | 637 | } |
638 | 638 | ||
639 | void KABCore::setContactSelected( const QString &uid ) | 639 | void KABCore::setContactSelected( const QString &uid ) |
640 | { | 640 | { |
641 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 641 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
642 | if ( !mDetails->isHidden() ) | 642 | if ( !mDetails->isHidden() ) |
643 | mDetails->setAddressee( addr ); | 643 | mDetails->setAddressee( addr ); |
644 | 644 | ||
645 | if ( !addr.isEmpty() ) { | 645 | if ( !addr.isEmpty() ) { |
646 | emit contactSelected( addr.formattedName() ); | 646 | emit contactSelected( addr.formattedName() ); |
647 | KABC::Picture pic = addr.photo(); | 647 | KABC::Picture pic = addr.photo(); |
648 | if ( pic.isIntern() ) { | 648 | if ( pic.isIntern() ) { |
649 | //US emit contactSelected( pic.data() ); | 649 | //US emit contactSelected( pic.data() ); |
650 | //US instead use: | 650 | //US instead use: |
651 | QPixmap px; | 651 | QPixmap px; |
652 | if (pic.data().isNull() != true) | 652 | if (pic.data().isNull() != true) |
653 | { | 653 | { |
654 | px.convertFromImage(pic.data()); | 654 | px.convertFromImage(pic.data()); |
655 | } | 655 | } |
656 | 656 | ||
657 | emit contactSelected( px ); | 657 | emit contactSelected( px ); |
658 | } | 658 | } |
659 | } | 659 | } |
660 | 660 | ||
661 | 661 | ||
662 | mExtensionManager->setSelectionChanged(); | 662 | mExtensionManager->setSelectionChanged(); |
663 | 663 | ||
664 | // update the actions | 664 | // update the actions |
665 | bool selected = !uid.isEmpty(); | 665 | bool selected = !uid.isEmpty(); |
666 | 666 | ||
667 | if ( mReadWrite ) { | 667 | if ( mReadWrite ) { |
668 | mActionCut->setEnabled( selected ); | 668 | mActionCut->setEnabled( selected ); |
669 | mActionPaste->setEnabled( selected ); | 669 | mActionPaste->setEnabled( selected ); |
670 | } | 670 | } |
671 | 671 | ||
672 | mActionCopy->setEnabled( selected ); | 672 | mActionCopy->setEnabled( selected ); |
673 | mActionDelete->setEnabled( selected ); | 673 | mActionDelete->setEnabled( selected ); |
674 | mActionEditAddressee->setEnabled( selected ); | 674 | mActionEditAddressee->setEnabled( selected ); |
675 | mActionMail->setEnabled( selected ); | 675 | mActionMail->setEnabled( selected ); |
676 | mActionMailVCard->setEnabled( selected ); | 676 | mActionMailVCard->setEnabled( selected ); |
677 | //if (mActionBeam) | 677 | //if (mActionBeam) |
678 | //mActionBeam->setEnabled( selected ); | 678 | //mActionBeam->setEnabled( selected ); |
679 | |||
680 | if (mActionBeamVCard) | ||
681 | mActionBeamVCard->setEnabled( selected ); | ||
682 | |||
683 | mActionWhoAmI->setEnabled( selected ); | 679 | mActionWhoAmI->setEnabled( selected ); |
684 | } | 680 | } |
685 | 681 | ||
686 | void KABCore::sendMail() | 682 | void KABCore::sendMail() |
687 | { | 683 | { |
688 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 684 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
689 | } | 685 | } |
690 | 686 | ||
691 | void KABCore::sendMail( const QString& emaillist ) | 687 | void KABCore::sendMail( const QString& emaillist ) |
692 | { | 688 | { |
693 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 689 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
694 | if (emaillist.contains(",") > 0) | 690 | if (emaillist.contains(",") > 0) |
695 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 691 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
696 | else | 692 | else |
697 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 693 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
698 | } | 694 | } |
699 | 695 | ||
700 | 696 | ||
701 | 697 | ||
702 | void KABCore::mailVCard() | 698 | void KABCore::mailVCard() |
703 | { | 699 | { |
704 | QStringList uids = mViewManager->selectedUids(); | 700 | QStringList uids = mViewManager->selectedUids(); |
705 | if ( !uids.isEmpty() ) | 701 | if ( !uids.isEmpty() ) |
706 | mailVCard( uids ); | 702 | mailVCard( uids ); |
707 | } | 703 | } |
708 | 704 | ||
709 | void KABCore::mailVCard( const QStringList& uids ) | 705 | void KABCore::mailVCard( const QStringList& uids ) |
710 | { | 706 | { |
711 | QStringList urls; | 707 | QStringList urls; |
712 | 708 | ||
713 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 709 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
714 | 710 | ||
715 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 711 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
716 | 712 | ||
717 | 713 | ||
718 | 714 | ||
719 | QDir().mkdir( dirName, true ); | 715 | QDir().mkdir( dirName, true ); |
720 | 716 | ||
721 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 717 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
722 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 718 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
723 | 719 | ||
724 | if ( a.isEmpty() ) | 720 | if ( a.isEmpty() ) |
725 | continue; | 721 | continue; |
726 | 722 | ||
727 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 723 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
728 | 724 | ||
729 | QString fileName = dirName + "/" + name; | 725 | QString fileName = dirName + "/" + name; |
730 | 726 | ||
731 | QFile outFile(fileName); | 727 | QFile outFile(fileName); |
732 | 728 | ||
733 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 729 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
734 | KABC::VCardConverter converter; | 730 | KABC::VCardConverter converter; |
735 | QString vcard; | 731 | QString vcard; |
736 | 732 | ||
737 | converter.addresseeToVCard( a, vcard ); | 733 | converter.addresseeToVCard( a, vcard ); |
738 | 734 | ||
739 | QTextStream t( &outFile ); // use a text stream | 735 | QTextStream t( &outFile ); // use a text stream |
740 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 736 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
741 | t << vcard; | 737 | t << vcard; |
742 | 738 | ||
743 | outFile.close(); | 739 | outFile.close(); |
744 | 740 | ||
745 | urls.append( fileName ); | 741 | urls.append( fileName ); |
746 | } | 742 | } |
747 | } | 743 | } |
748 | 744 | ||
749 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 745 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
750 | 746 | ||
751 | 747 | ||
752 | /*US | 748 | /*US |
753 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 749 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
754 | QString::null, // subject | 750 | QString::null, // subject |
755 | QString::null, // body | 751 | QString::null, // body |
756 | QString::null, | 752 | QString::null, |
757 | urls ); // attachments | 753 | urls ); // attachments |
758 | */ | 754 | */ |
759 | 755 | ||
760 | } | 756 | } |
761 | 757 | ||
762 | /** | 758 | /** |
763 | Beams the "WhoAmI contact. | 759 | Beams the "WhoAmI contact. |
764 | */ | 760 | */ |
765 | void KABCore::beamMySelf() | 761 | void KABCore::beamMySelf() |
766 | { | 762 | { |
767 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 763 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
768 | if (!a.isEmpty()) | 764 | if (!a.isEmpty()) |
769 | { | 765 | { |
770 | QStringList uids; | 766 | QStringList uids; |
771 | uids << a.uid(); | 767 | uids << a.uid(); |
772 | 768 | ||
773 | beamVCard(uids); | 769 | beamVCard(uids); |
774 | } else { | 770 | } else { |
775 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 771 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
776 | 772 | ||
777 | 773 | ||
778 | } | 774 | } |
779 | } | 775 | } |
780 | void KABCore::updateMainWindow() | 776 | void KABCore::updateMainWindow() |
781 | { | 777 | { |
782 | 778 | ||
783 | mMainWindow->showMaximized(); | 779 | mMainWindow->showMaximized(); |
784 | mMainWindow->update(); | 780 | mMainWindow->update(); |
785 | } | 781 | } |
786 | void KABCore::resizeEvent(QResizeEvent* e ) | 782 | void KABCore::resizeEvent(QResizeEvent* e ) |
787 | { | 783 | { |
788 | if ( !mMiniSplitter ) | 784 | if ( !mMiniSplitter ) |
789 | return; | 785 | return; |
790 | if ( QApplication::desktop()->width() >= 480 ) { | 786 | if ( QApplication::desktop()->width() >= 480 ) { |
791 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 | 787 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 |
792 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | 788 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { |
793 | mMiniSplitter->setOrientation( Qt::Horizontal); | 789 | mMiniSplitter->setOrientation( Qt::Horizontal); |
794 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 790 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
795 | if ( QApplication::desktop()->width() <= 640 ) { | 791 | if ( QApplication::desktop()->width() <= 640 ) { |
796 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 792 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
797 | mViewManager->getFilterAction()->setComboWidth( 150 ); | 793 | mViewManager->getFilterAction()->setComboWidth( 150 ); |
798 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 794 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
799 | } | 795 | } |
800 | } | 796 | } |
801 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 | 797 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 |
802 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | 798 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { |
803 | mMiniSplitter->setOrientation( Qt::Vertical ); | 799 | mMiniSplitter->setOrientation( Qt::Vertical ); |
804 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 800 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
805 | if ( QApplication::desktop()->width() <= 640 ) { | 801 | if ( QApplication::desktop()->width() <= 640 ) { |
806 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 802 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
807 | mMainWindow->showMinimized(); | 803 | mMainWindow->showMinimized(); |
808 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 804 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
809 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 805 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
810 | } | 806 | } |
811 | } | 807 | } |
812 | } | 808 | } |
813 | } | 809 | } |
814 | 810 | ||
815 | } | 811 | } |
816 | void KABCore::export2phone() | 812 | void KABCore::export2phone() |
817 | { | 813 | { |
818 | 814 | ||
819 | QStringList uids; | 815 | QStringList uids; |
820 | XXPortSelectDialog dlg( this, false, this ); | 816 | XXPortSelectDialog dlg( this, false, this ); |
821 | if ( dlg.exec() ) | 817 | if ( dlg.exec() ) |
822 | uids = dlg.uids(); | 818 | uids = dlg.uids(); |
823 | else | 819 | else |
824 | return; | 820 | return; |
825 | if ( uids.isEmpty() ) | 821 | if ( uids.isEmpty() ) |
826 | return; | 822 | return; |
827 | // qDebug("count %d ", uids.count()); | 823 | // qDebug("count %d ", uids.count()); |
828 | 824 | ||
829 | KAex2phonePrefs ex2phone; | 825 | KAex2phonePrefs ex2phone; |
830 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 826 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
831 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 827 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
832 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 828 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
833 | 829 | ||
834 | if ( !ex2phone.exec() ) { | 830 | if ( !ex2phone.exec() ) { |
835 | return; | 831 | return; |
836 | } | 832 | } |
837 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 833 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
838 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 834 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
839 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 835 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
840 | 836 | ||
841 | 837 | ||
842 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 838 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
843 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 839 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
844 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 840 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
845 | 841 | ||
846 | QString fileName = getPhoneFile(); | 842 | QString fileName = getPhoneFile(); |
847 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 843 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
848 | return; | 844 | return; |
849 | 845 | ||
850 | message(i18n("Exporting to phone...")); | 846 | message(i18n("Exporting to phone...")); |
851 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 847 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
852 | 848 | ||
853 | } | 849 | } |
854 | QString KABCore::getPhoneFile() | 850 | QString KABCore::getPhoneFile() |
855 | { | 851 | { |
856 | #ifdef DESKTOP_VERSION | 852 | #ifdef DESKTOP_VERSION |
857 | return locateLocal("tmp", "phonefile.vcf"); | 853 | return locateLocal("tmp", "phonefile.vcf"); |
858 | #else | 854 | #else |
859 | return "/tmp/phonefile.vcf"; | 855 | return "/tmp/phonefile.vcf"; |
860 | #endif | 856 | #endif |
861 | 857 | ||
862 | } | 858 | } |
863 | void KABCore::writeToPhone( ) | 859 | void KABCore::writeToPhone( ) |
864 | { | 860 | { |
865 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) | 861 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) |
866 | message(i18n("Export to phone finished!")); | 862 | message(i18n("Export to phone finished!")); |
867 | else | 863 | else |
868 | qDebug(i18n("Error exporting to phone")); | 864 | qDebug(i18n("Error exporting to phone")); |
869 | } | 865 | } |
870 | void KABCore::beamVCard() | 866 | void KABCore::beamVCard() |
871 | { | 867 | { |
872 | QStringList uids = mViewManager->selectedUids(); | 868 | QStringList uids; |
873 | if ( !uids.isEmpty() ) | 869 | XXPortSelectDialog dlg( this, false, this ); |
870 | if ( dlg.exec() ) | ||
871 | uids = dlg.uids(); | ||
872 | else | ||
873 | return; | ||
874 | if ( uids.isEmpty() ) | ||
875 | return; | ||
874 | beamVCard( uids ); | 876 | beamVCard( uids ); |
875 | } | 877 | } |
876 | 878 | ||
877 | 879 | ||
878 | void KABCore::beamVCard(const QStringList& uids) | 880 | void KABCore::beamVCard(const QStringList& uids) |
879 | { | 881 | { |
880 | 882 | ||
881 | // LR: we should use the /tmp dir on the Zaurus, | 883 | // LR: we should use the /tmp dir on the Zaurus, |
882 | // because: /tmp = RAM, (HOME)/kdepim = flash memory | 884 | // because: /tmp = RAM, (HOME)/kdepim = flash memory |
883 | 885 | ||
884 | #ifdef DESKTOP_VERSION | 886 | #ifdef DESKTOP_VERSION |
885 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); | 887 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); |
886 | #else | 888 | #else |
887 | QString fileName = "/tmp/kapibeamfile.vcf"; | 889 | QString fileName = "/tmp/kapibeamfile.vcf"; |
888 | #endif | 890 | #endif |
889 | 891 | ||
890 | KABC::VCardConverter converter; | 892 | KABC::VCardConverter converter; |
891 | QString description; | 893 | QString description; |
892 | QString datastream; | 894 | QString datastream; |
893 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 895 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
894 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 896 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
895 | 897 | ||
896 | if ( a.isEmpty() ) | 898 | if ( a.isEmpty() ) |
897 | continue; | 899 | continue; |
898 | 900 | ||
899 | if (description.isEmpty()) | 901 | if (description.isEmpty()) |
900 | description = a.formattedName(); | 902 | description = a.formattedName(); |
901 | 903 | ||
902 | QString vcard; | 904 | QString vcard; |
903 | converter.addresseeToVCard( a, vcard ); | 905 | converter.addresseeToVCard( a, vcard ); |
904 | int start = 0; | 906 | int start = 0; |
905 | int next; | 907 | int next; |
906 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 908 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
907 | int semi = vcard.find(";", next); | 909 | int semi = vcard.find(";", next); |
908 | int dopp = vcard.find(":", next); | 910 | int dopp = vcard.find(":", next); |
909 | int sep; | 911 | int sep; |
910 | if ( semi < dopp && semi >= 0 ) | 912 | if ( semi < dopp && semi >= 0 ) |
911 | sep = semi ; | 913 | sep = semi ; |
912 | else | 914 | else |
913 | sep = dopp; | 915 | sep = dopp; |
914 | datastream +=vcard.mid( start, next - start); | 916 | datastream +=vcard.mid( start, next - start); |
915 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 917 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
916 | start = sep; | 918 | start = sep; |
917 | } | 919 | } |
918 | datastream += vcard.mid( start,vcard.length() ); | 920 | datastream += vcard.mid( start,vcard.length() ); |
919 | } | 921 | } |
920 | #ifndef DESKTOP_VERSION | 922 | #ifndef DESKTOP_VERSION |
921 | QFile outFile(fileName); | 923 | QFile outFile(fileName); |
922 | if ( outFile.open(IO_WriteOnly) ) { | 924 | if ( outFile.open(IO_WriteOnly) ) { |
923 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 925 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
924 | QTextStream t( &outFile ); // use a text stream | 926 | QTextStream t( &outFile ); // use a text stream |
925 | //t.setEncoding( QTextStream::UnicodeUTF8 ); | 927 | //t.setEncoding( QTextStream::UnicodeUTF8 ); |
926 | t.setEncoding( QTextStream::Latin1 ); | 928 | t.setEncoding( QTextStream::Latin1 ); |
927 | t <<datastream.latin1(); | 929 | t <<datastream.latin1(); |
928 | outFile.close(); | 930 | outFile.close(); |
929 | Ir *ir = new Ir( this ); | 931 | Ir *ir = new Ir( this ); |
930 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 932 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
931 | ir->send( fileName, description, "text/x-vCard" ); | 933 | ir->send( fileName, description, "text/x-vCard" ); |
932 | } else { | 934 | } else { |
933 | qDebug("Error open temp beam file "); | 935 | qDebug("Error open temp beam file "); |
934 | return; | 936 | return; |
935 | } | 937 | } |
936 | #endif | 938 | #endif |
937 | 939 | ||
938 | } | 940 | } |
939 | 941 | ||
940 | void KABCore::beamDone( Ir *ir ) | 942 | void KABCore::beamDone( Ir *ir ) |
941 | { | 943 | { |
942 | #ifndef DESKTOP_VERSION | 944 | #ifndef DESKTOP_VERSION |
943 | delete ir; | 945 | delete ir; |
944 | #endif | 946 | #endif |
945 | topLevelWidget()->raise(); | 947 | topLevelWidget()->raise(); |
946 | message( i18n("Beaming finished!") ); | 948 | message( i18n("Beaming finished!") ); |
947 | } | 949 | } |
948 | 950 | ||
949 | 951 | ||
950 | void KABCore::browse( const QString& url ) | 952 | void KABCore::browse( const QString& url ) |
951 | { | 953 | { |
952 | #ifndef KAB_EMBEDDED | 954 | #ifndef KAB_EMBEDDED |
953 | kapp->invokeBrowser( url ); | 955 | kapp->invokeBrowser( url ); |
954 | #else //KAB_EMBEDDED | 956 | #else //KAB_EMBEDDED |
955 | qDebug("KABCore::browse must be fixed"); | 957 | qDebug("KABCore::browse must be fixed"); |
956 | #endif //KAB_EMBEDDED | 958 | #endif //KAB_EMBEDDED |
957 | } | 959 | } |
958 | 960 | ||
959 | void KABCore::selectAllContacts() | 961 | void KABCore::selectAllContacts() |
960 | { | 962 | { |
961 | mViewManager->setSelected( QString::null, true ); | 963 | mViewManager->setSelected( QString::null, true ); |
962 | } | 964 | } |
963 | 965 | ||
964 | void KABCore::deleteContacts() | 966 | void KABCore::deleteContacts() |
965 | { | 967 | { |
966 | QStringList uidList = mViewManager->selectedUids(); | 968 | QStringList uidList = mViewManager->selectedUids(); |
967 | deleteContacts( uidList ); | 969 | deleteContacts( uidList ); |
968 | } | 970 | } |
969 | 971 | ||
970 | void KABCore::deleteContacts( const QStringList &uids ) | 972 | void KABCore::deleteContacts( const QStringList &uids ) |
971 | { | 973 | { |
972 | if ( uids.count() > 0 ) { | 974 | if ( uids.count() > 0 ) { |
973 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 975 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
974 | UndoStack::instance()->push( command ); | 976 | UndoStack::instance()->push( command ); |
975 | RedoStack::instance()->clear(); | 977 | RedoStack::instance()->clear(); |
976 | 978 | ||
977 | // now if we deleted anything, refresh | 979 | // now if we deleted anything, refresh |
978 | setContactSelected( QString::null ); | 980 | setContactSelected( QString::null ); |
979 | setModified( true ); | 981 | setModified( true ); |
980 | } | 982 | } |
981 | } | 983 | } |
982 | 984 | ||
983 | void KABCore::copyContacts() | 985 | void KABCore::copyContacts() |
984 | { | 986 | { |
985 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 987 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
986 | 988 | ||
987 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 989 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
988 | 990 | ||
989 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 991 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
990 | 992 | ||
991 | QClipboard *cb = QApplication::clipboard(); | 993 | QClipboard *cb = QApplication::clipboard(); |
992 | cb->setText( clipText ); | 994 | cb->setText( clipText ); |
993 | } | 995 | } |
994 | 996 | ||
995 | void KABCore::cutContacts() | 997 | void KABCore::cutContacts() |
996 | { | 998 | { |
997 | QStringList uidList = mViewManager->selectedUids(); | 999 | QStringList uidList = mViewManager->selectedUids(); |
998 | 1000 | ||
999 | //US if ( uidList.size() > 0 ) { | 1001 | //US if ( uidList.size() > 0 ) { |
1000 | if ( uidList.count() > 0 ) { | 1002 | if ( uidList.count() > 0 ) { |
1001 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 1003 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
1002 | UndoStack::instance()->push( command ); | 1004 | UndoStack::instance()->push( command ); |
1003 | RedoStack::instance()->clear(); | 1005 | RedoStack::instance()->clear(); |
1004 | 1006 | ||
1005 | setModified( true ); | 1007 | setModified( true ); |
1006 | } | 1008 | } |
1007 | } | 1009 | } |
1008 | 1010 | ||
1009 | void KABCore::pasteContacts() | 1011 | void KABCore::pasteContacts() |
1010 | { | 1012 | { |
1011 | QClipboard *cb = QApplication::clipboard(); | 1013 | QClipboard *cb = QApplication::clipboard(); |
1012 | 1014 | ||
1013 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 1015 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
1014 | 1016 | ||
1015 | pasteContacts( list ); | 1017 | pasteContacts( list ); |
1016 | } | 1018 | } |
1017 | 1019 | ||
1018 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 1020 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
1019 | { | 1021 | { |
1020 | KABC::Resource *resource = requestResource( this ); | 1022 | KABC::Resource *resource = requestResource( this ); |
1021 | KABC::Addressee::List::Iterator it; | 1023 | KABC::Addressee::List::Iterator it; |
1022 | for ( it = list.begin(); it != list.end(); ++it ) | 1024 | for ( it = list.begin(); it != list.end(); ++it ) |
1023 | (*it).setResource( resource ); | 1025 | (*it).setResource( resource ); |
1024 | 1026 | ||
1025 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 1027 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
1026 | UndoStack::instance()->push( command ); | 1028 | UndoStack::instance()->push( command ); |
1027 | RedoStack::instance()->clear(); | 1029 | RedoStack::instance()->clear(); |
1028 | 1030 | ||
1029 | setModified( true ); | 1031 | setModified( true ); |
1030 | } | 1032 | } |
1031 | 1033 | ||
1032 | void KABCore::setWhoAmI() | 1034 | void KABCore::setWhoAmI() |
1033 | { | 1035 | { |
1034 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1036 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1035 | 1037 | ||
1036 | if ( addrList.count() > 1 ) { | 1038 | if ( addrList.count() > 1 ) { |
1037 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 1039 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
1038 | return; | 1040 | return; |
1039 | } | 1041 | } |
1040 | 1042 | ||
1041 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 1043 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
1042 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 1044 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
1043 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 1045 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
1044 | } | 1046 | } |
1045 | void KABCore::editCategories() | 1047 | void KABCore::editCategories() |
1046 | { | 1048 | { |
1047 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); | 1049 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); |
1048 | dlg.exec(); | 1050 | dlg.exec(); |
1049 | } | 1051 | } |
1050 | void KABCore::setCategories() | 1052 | void KABCore::setCategories() |
1051 | { | 1053 | { |
1052 | 1054 | ||
1053 | QStringList uids; | 1055 | QStringList uids; |
1054 | XXPortSelectDialog dlgx( this, false, this ); | 1056 | XXPortSelectDialog dlgx( this, false, this ); |
1055 | if ( dlgx.exec() ) | 1057 | if ( dlgx.exec() ) |
1056 | uids = dlgx.uids(); | 1058 | uids = dlgx.uids(); |
1057 | else | 1059 | else |
1058 | return; | 1060 | return; |
1059 | if ( uids.isEmpty() ) | 1061 | if ( uids.isEmpty() ) |
1060 | return; | 1062 | return; |
1061 | // qDebug("count %d ", uids.count()); | 1063 | // qDebug("count %d ", uids.count()); |
1062 | 1064 | ||
1063 | 1065 | ||
1064 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 1066 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
1065 | if ( !dlg.exec() ) { | 1067 | if ( !dlg.exec() ) { |
1066 | message( i18n("Setting categories cancelled") ); | 1068 | message( i18n("Setting categories cancelled") ); |
1067 | return; | 1069 | return; |
1068 | } | 1070 | } |
1069 | bool merge = false; | 1071 | bool merge = false; |
1070 | QString msg = i18n( "Merge with existing categories?" ); | 1072 | QString msg = i18n( "Merge with existing categories?" ); |
1071 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 1073 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
1072 | merge = true; | 1074 | merge = true; |
1073 | 1075 | ||
1074 | message( i18n("Setting categories ... please wait!") ); | 1076 | message( i18n("Setting categories ... please wait!") ); |
1075 | QStringList categories = dlg.selectedCategories(); | 1077 | QStringList categories = dlg.selectedCategories(); |
1076 | 1078 | ||
1077 | //QStringList uids = mViewManager->selectedUids(); | 1079 | //QStringList uids = mViewManager->selectedUids(); |
1078 | QStringList::Iterator it; | 1080 | QStringList::Iterator it; |
1079 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 1081 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
1080 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 1082 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
1081 | if ( !addr.isEmpty() ) { | 1083 | if ( !addr.isEmpty() ) { |
1082 | if ( !merge ) | 1084 | if ( !merge ) |
1083 | addr.setCategories( categories ); | 1085 | addr.setCategories( categories ); |
1084 | else { | 1086 | else { |
1085 | QStringList addrCategories = addr.categories(); | 1087 | QStringList addrCategories = addr.categories(); |
1086 | QStringList::Iterator catIt; | 1088 | QStringList::Iterator catIt; |
1087 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 1089 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
1088 | if ( !addrCategories.contains( *catIt ) ) | 1090 | if ( !addrCategories.contains( *catIt ) ) |
1089 | addrCategories.append( *catIt ); | 1091 | addrCategories.append( *catIt ); |
1090 | } | 1092 | } |
1091 | addr.setCategories( addrCategories ); | 1093 | addr.setCategories( addrCategories ); |
1092 | } | 1094 | } |
1093 | mAddressBook->insertAddressee( addr ); | 1095 | mAddressBook->insertAddressee( addr ); |
1094 | } | 1096 | } |
1095 | } | 1097 | } |
1096 | 1098 | ||
1097 | if ( uids.count() > 0 ) | 1099 | if ( uids.count() > 0 ) |
1098 | setModified( true ); | 1100 | setModified( true ); |
1099 | message( i18n("Setting categories completed!") ); | 1101 | message( i18n("Setting categories completed!") ); |
1100 | } | 1102 | } |
1101 | 1103 | ||
1102 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1104 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
1103 | { | 1105 | { |
1104 | mIncSearchWidget->setFields( fields ); | 1106 | mIncSearchWidget->setFields( fields ); |
1105 | } | 1107 | } |
1106 | 1108 | ||
1107 | void KABCore::incrementalSearch( const QString& text ) | 1109 | void KABCore::incrementalSearch( const QString& text ) |
1108 | { | 1110 | { |
1109 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 1111 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); |
1110 | } | 1112 | } |
1111 | 1113 | ||
1112 | void KABCore::setModified() | 1114 | void KABCore::setModified() |
1113 | { | 1115 | { |
1114 | setModified( true ); | 1116 | setModified( true ); |
1115 | } | 1117 | } |
1116 | 1118 | ||
1117 | void KABCore::setModifiedWOrefresh() | 1119 | void KABCore::setModifiedWOrefresh() |
1118 | { | 1120 | { |
1119 | // qDebug("KABCore::setModifiedWOrefresh() "); | 1121 | // qDebug("KABCore::setModifiedWOrefresh() "); |
1120 | mModified = true; | 1122 | mModified = true; |
1121 | mActionSave->setEnabled( mModified ); | 1123 | mActionSave->setEnabled( mModified ); |
1122 | #ifdef DESKTOP_VERSION | 1124 | #ifdef DESKTOP_VERSION |
1123 | mDetails->refreshView(); | 1125 | mDetails->refreshView(); |
1124 | #endif | 1126 | #endif |
1125 | 1127 | ||
1126 | } | 1128 | } |
1127 | void KABCore::setModified( bool modified ) | 1129 | void KABCore::setModified( bool modified ) |
1128 | { | 1130 | { |
1129 | mModified = modified; | 1131 | mModified = modified; |
1130 | mActionSave->setEnabled( mModified ); | 1132 | mActionSave->setEnabled( mModified ); |
1131 | 1133 | ||
1132 | if ( modified ) | 1134 | if ( modified ) |
1133 | mJumpButtonBar->recreateButtons(); | 1135 | mJumpButtonBar->recreateButtons(); |
1134 | 1136 | ||
1135 | mViewManager->refreshView(); | 1137 | mViewManager->refreshView(); |
1136 | mDetails->refreshView(); | 1138 | mDetails->refreshView(); |
1137 | 1139 | ||
1138 | } | 1140 | } |
1139 | 1141 | ||
1140 | bool KABCore::modified() const | 1142 | bool KABCore::modified() const |
1141 | { | 1143 | { |
1142 | return mModified; | 1144 | return mModified; |
1143 | } | 1145 | } |
1144 | 1146 | ||
1145 | void KABCore::contactModified( const KABC::Addressee &addr ) | 1147 | void KABCore::contactModified( const KABC::Addressee &addr ) |
1146 | { | 1148 | { |
1147 | 1149 | ||
1148 | Command *command = 0; | 1150 | Command *command = 0; |
1149 | QString uid; | 1151 | QString uid; |
1150 | 1152 | ||
1151 | // check if it exists already | 1153 | // check if it exists already |
1152 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 1154 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
1153 | if ( origAddr.isEmpty() ) | 1155 | if ( origAddr.isEmpty() ) |
1154 | command = new PwNewCommand( mAddressBook, addr ); | 1156 | command = new PwNewCommand( mAddressBook, addr ); |
1155 | else { | 1157 | else { |
1156 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 1158 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
1157 | uid = addr.uid(); | 1159 | uid = addr.uid(); |
1158 | } | 1160 | } |
1159 | 1161 | ||
1160 | UndoStack::instance()->push( command ); | 1162 | UndoStack::instance()->push( command ); |
1161 | RedoStack::instance()->clear(); | 1163 | RedoStack::instance()->clear(); |
1162 | 1164 | ||
1163 | setModified( true ); | 1165 | setModified( true ); |
1164 | } | 1166 | } |
1165 | 1167 | ||
1166 | void KABCore::newContact() | 1168 | void KABCore::newContact() |
1167 | { | 1169 | { |
1168 | 1170 | ||
1169 | 1171 | ||
1170 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 1172 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
1171 | 1173 | ||
1172 | QPtrList<KRES::Resource> kresResources; | 1174 | QPtrList<KRES::Resource> kresResources; |
1173 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 1175 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
1174 | KABC::Resource *resource; | 1176 | KABC::Resource *resource; |
1175 | while ( ( resource = it.current() ) != 0 ) { | 1177 | while ( ( resource = it.current() ) != 0 ) { |
1176 | ++it; | 1178 | ++it; |
1177 | if ( !resource->readOnly() ) { | 1179 | if ( !resource->readOnly() ) { |
1178 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 1180 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
1179 | if ( res ) | 1181 | if ( res ) |
1180 | kresResources.append( res ); | 1182 | kresResources.append( res ); |
1181 | } | 1183 | } |
1182 | } | 1184 | } |
1183 | 1185 | ||
1184 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1186 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1185 | resource = static_cast<KABC::Resource*>( res ); | 1187 | resource = static_cast<KABC::Resource*>( res ); |
1186 | 1188 | ||
1187 | if ( resource ) { | 1189 | if ( resource ) { |
1188 | KABC::Addressee addr; | 1190 | KABC::Addressee addr; |
1189 | addr.setResource( resource ); | 1191 | addr.setResource( resource ); |
1190 | mEditorDialog->setAddressee( addr ); | 1192 | mEditorDialog->setAddressee( addr ); |
1191 | KApplication::execDialog ( mEditorDialog ); | 1193 | KApplication::execDialog ( mEditorDialog ); |
1192 | 1194 | ||
1193 | } else | 1195 | } else |
1194 | return; | 1196 | return; |
1195 | 1197 | ||
1196 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 1198 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
1197 | 1199 | ||
1198 | 1200 | ||
1199 | } | 1201 | } |
1200 | 1202 | ||
1201 | void KABCore::addEmail( QString aStr ) | 1203 | void KABCore::addEmail( QString aStr ) |
1202 | { | 1204 | { |
1203 | #ifndef KAB_EMBEDDED | 1205 | #ifndef KAB_EMBEDDED |
1204 | QString fullName, email; | 1206 | QString fullName, email; |
1205 | 1207 | ||
1206 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1208 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1207 | 1209 | ||
1208 | // Try to lookup the addressee matching the email address | 1210 | // Try to lookup the addressee matching the email address |
1209 | bool found = false; | 1211 | bool found = false; |
1210 | QStringList emailList; | 1212 | QStringList emailList; |
1211 | KABC::AddressBook::Iterator it; | 1213 | KABC::AddressBook::Iterator it; |
1212 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1214 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1213 | emailList = (*it).emails(); | 1215 | emailList = (*it).emails(); |
1214 | if ( emailList.contains( email ) > 0 ) { | 1216 | if ( emailList.contains( email ) > 0 ) { |
1215 | found = true; | 1217 | found = true; |
1216 | (*it).setNameFromString( fullName ); | 1218 | (*it).setNameFromString( fullName ); |
1217 | editContact( (*it).uid() ); | 1219 | editContact( (*it).uid() ); |
1218 | } | 1220 | } |
1219 | } | 1221 | } |
1220 | 1222 | ||
1221 | if ( !found ) { | 1223 | if ( !found ) { |
1222 | KABC::Addressee addr; | 1224 | KABC::Addressee addr; |
1223 | addr.setNameFromString( fullName ); | 1225 | addr.setNameFromString( fullName ); |
1224 | addr.insertEmail( email, true ); | 1226 | addr.insertEmail( email, true ); |
1225 | 1227 | ||
1226 | mAddressBook->insertAddressee( addr ); | 1228 | mAddressBook->insertAddressee( addr ); |
1227 | mViewManager->refreshView( addr.uid() ); | 1229 | mViewManager->refreshView( addr.uid() ); |
1228 | editContact( addr.uid() ); | 1230 | editContact( addr.uid() ); |
1229 | } | 1231 | } |
1230 | #else //KAB_EMBEDDED | 1232 | #else //KAB_EMBEDDED |
1231 | qDebug("KABCore::addEmail finsih method"); | 1233 | qDebug("KABCore::addEmail finsih method"); |
1232 | #endif //KAB_EMBEDDED | 1234 | #endif //KAB_EMBEDDED |
1233 | } | 1235 | } |
1234 | 1236 | ||
1235 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1237 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1236 | { | 1238 | { |
1237 | mXXPortManager->importVCard( url, showPreview ); | 1239 | mXXPortManager->importVCard( url, showPreview ); |
1238 | } | 1240 | } |
1239 | void KABCore::importFromOL() | 1241 | void KABCore::importFromOL() |
1240 | { | 1242 | { |
1241 | #ifdef _WIN32_ | 1243 | #ifdef _WIN32_ |
1242 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 1244 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1243 | idgl->exec(); | 1245 | idgl->exec(); |
1244 | KABC::Addressee::List list = idgl->getAddressList(); | 1246 | KABC::Addressee::List list = idgl->getAddressList(); |
1245 | if ( list.count() > 0 ) { | 1247 | if ( list.count() > 0 ) { |
1246 | KABC::Addressee::List listNew; | 1248 | KABC::Addressee::List listNew; |
1247 | KABC::Addressee::List listExisting; | 1249 | KABC::Addressee::List listExisting; |
1248 | KABC::Addressee::List::Iterator it; | 1250 | KABC::Addressee::List::Iterator it; |
1249 | KABC::AddressBook::Iterator iter; | 1251 | KABC::AddressBook::Iterator iter; |
1250 | for ( it = list.begin(); it != list.end(); ++it ) { | 1252 | for ( it = list.begin(); it != list.end(); ++it ) { |
1251 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1253 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1252 | listNew.append( (*it) ); | 1254 | listNew.append( (*it) ); |
1253 | else | 1255 | else |
1254 | listExisting.append( (*it) ); | 1256 | listExisting.append( (*it) ); |
1255 | } | 1257 | } |
1256 | if ( listExisting.count() > 0 ) | 1258 | if ( listExisting.count() > 0 ) |
1257 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1259 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
@@ -1315,1224 +1317,1229 @@ void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | |||
1315 | } | 1317 | } |
1316 | 1318 | ||
1317 | void KABCore::save() | 1319 | void KABCore::save() |
1318 | { | 1320 | { |
1319 | if (syncManager->blockSave()) | 1321 | if (syncManager->blockSave()) |
1320 | return; | 1322 | return; |
1321 | if ( !mModified ) | 1323 | if ( !mModified ) |
1322 | return; | 1324 | return; |
1323 | 1325 | ||
1324 | syncManager->setBlockSave(true); | 1326 | syncManager->setBlockSave(true); |
1325 | QString text = i18n( "There was an error while attempting to save\n the " | 1327 | QString text = i18n( "There was an error while attempting to save\n the " |
1326 | "address book. Please check that some \nother application is " | 1328 | "address book. Please check that some \nother application is " |
1327 | "not using it. " ); | 1329 | "not using it. " ); |
1328 | message(i18n("Saving addressbook ... ")); | 1330 | message(i18n("Saving addressbook ... ")); |
1329 | #ifndef KAB_EMBEDDED | 1331 | #ifndef KAB_EMBEDDED |
1330 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1332 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1331 | if ( !b || !b->save() ) { | 1333 | if ( !b || !b->save() ) { |
1332 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1334 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1333 | } | 1335 | } |
1334 | #else //KAB_EMBEDDED | 1336 | #else //KAB_EMBEDDED |
1335 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1337 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1336 | if ( !b || !b->save() ) { | 1338 | if ( !b || !b->save() ) { |
1337 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1339 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1338 | } | 1340 | } |
1339 | #endif //KAB_EMBEDDED | 1341 | #endif //KAB_EMBEDDED |
1340 | 1342 | ||
1341 | message(i18n("Addressbook saved!")); | 1343 | message(i18n("Addressbook saved!")); |
1342 | setModified( false ); | 1344 | setModified( false ); |
1343 | syncManager->setBlockSave(false); | 1345 | syncManager->setBlockSave(false); |
1344 | } | 1346 | } |
1345 | 1347 | ||
1346 | 1348 | ||
1347 | void KABCore::undo() | 1349 | void KABCore::undo() |
1348 | { | 1350 | { |
1349 | UndoStack::instance()->undo(); | 1351 | UndoStack::instance()->undo(); |
1350 | 1352 | ||
1351 | // Refresh the view | 1353 | // Refresh the view |
1352 | mViewManager->refreshView(); | 1354 | mViewManager->refreshView(); |
1353 | } | 1355 | } |
1354 | 1356 | ||
1355 | void KABCore::redo() | 1357 | void KABCore::redo() |
1356 | { | 1358 | { |
1357 | RedoStack::instance()->redo(); | 1359 | RedoStack::instance()->redo(); |
1358 | 1360 | ||
1359 | // Refresh the view | 1361 | // Refresh the view |
1360 | mViewManager->refreshView(); | 1362 | mViewManager->refreshView(); |
1361 | } | 1363 | } |
1362 | 1364 | ||
1363 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1365 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1364 | { | 1366 | { |
1365 | if (mMultipleViewsAtOnce) | 1367 | if (mMultipleViewsAtOnce) |
1366 | { | 1368 | { |
1367 | if ( visible ) | 1369 | if ( visible ) |
1368 | mJumpButtonBar->show(); | 1370 | mJumpButtonBar->show(); |
1369 | else | 1371 | else |
1370 | mJumpButtonBar->hide(); | 1372 | mJumpButtonBar->hide(); |
1371 | } | 1373 | } |
1372 | else | 1374 | else |
1373 | { | 1375 | { |
1374 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1376 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1375 | if (mViewManager->isVisible()) | 1377 | if (mViewManager->isVisible()) |
1376 | { | 1378 | { |
1377 | if ( visible ) | 1379 | if ( visible ) |
1378 | mJumpButtonBar->show(); | 1380 | mJumpButtonBar->show(); |
1379 | else | 1381 | else |
1380 | mJumpButtonBar->hide(); | 1382 | mJumpButtonBar->hide(); |
1381 | } | 1383 | } |
1382 | else | 1384 | else |
1383 | { | 1385 | { |
1384 | mJumpButtonBar->hide(); | 1386 | mJumpButtonBar->hide(); |
1385 | } | 1387 | } |
1386 | } | 1388 | } |
1387 | } | 1389 | } |
1388 | 1390 | ||
1389 | 1391 | ||
1390 | void KABCore::setDetailsToState() | 1392 | void KABCore::setDetailsToState() |
1391 | { | 1393 | { |
1392 | setDetailsVisible( mActionDetails->isChecked() ); | 1394 | setDetailsVisible( mActionDetails->isChecked() ); |
1393 | } | 1395 | } |
1394 | void KABCore::setDetailsToggle() | 1396 | void KABCore::setDetailsToggle() |
1395 | { | 1397 | { |
1396 | mActionDetails->setChecked( !mActionDetails->isChecked() ); | 1398 | mActionDetails->setChecked( !mActionDetails->isChecked() ); |
1397 | setDetailsToState(); | 1399 | setDetailsToState(); |
1398 | } | 1400 | } |
1399 | 1401 | ||
1400 | 1402 | ||
1401 | 1403 | ||
1402 | void KABCore::setDetailsVisible( bool visible ) | 1404 | void KABCore::setDetailsVisible( bool visible ) |
1403 | { | 1405 | { |
1404 | if (visible && mDetails->isHidden()) | 1406 | if (visible && mDetails->isHidden()) |
1405 | { | 1407 | { |
1406 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1408 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1407 | if ( addrList.count() > 0 ) | 1409 | if ( addrList.count() > 0 ) |
1408 | mDetails->setAddressee( addrList[ 0 ] ); | 1410 | mDetails->setAddressee( addrList[ 0 ] ); |
1409 | } | 1411 | } |
1410 | 1412 | ||
1411 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1413 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1412 | // the listview and the detailview. We do that by changing the splitbar size. | 1414 | // the listview and the detailview. We do that by changing the splitbar size. |
1413 | if (mMultipleViewsAtOnce) | 1415 | if (mMultipleViewsAtOnce) |
1414 | { | 1416 | { |
1415 | if ( visible ) | 1417 | if ( visible ) |
1416 | mDetails->show(); | 1418 | mDetails->show(); |
1417 | else | 1419 | else |
1418 | mDetails->hide(); | 1420 | mDetails->hide(); |
1419 | } | 1421 | } |
1420 | else | 1422 | else |
1421 | { | 1423 | { |
1422 | if ( visible ) { | 1424 | if ( visible ) { |
1423 | mViewManager->hide(); | 1425 | mViewManager->hide(); |
1424 | mDetails->show(); | 1426 | mDetails->show(); |
1425 | mIncSearchWidget->setFocus(); | 1427 | mIncSearchWidget->setFocus(); |
1426 | } | 1428 | } |
1427 | else { | 1429 | else { |
1428 | mViewManager->show(); | 1430 | mViewManager->show(); |
1429 | mDetails->hide(); | 1431 | mDetails->hide(); |
1430 | mViewManager->setFocusAV(); | 1432 | mViewManager->setFocusAV(); |
1431 | } | 1433 | } |
1432 | setJumpButtonBarVisible( !visible ); | 1434 | setJumpButtonBarVisible( !visible ); |
1433 | } | 1435 | } |
1434 | 1436 | ||
1435 | } | 1437 | } |
1436 | 1438 | ||
1437 | void KABCore::extensionChanged( int id ) | 1439 | void KABCore::extensionChanged( int id ) |
1438 | { | 1440 | { |
1439 | //change the details view only for non desktop systems | 1441 | //change the details view only for non desktop systems |
1440 | #ifndef DESKTOP_VERSION | 1442 | #ifndef DESKTOP_VERSION |
1441 | 1443 | ||
1442 | if (id == 0) | 1444 | if (id == 0) |
1443 | { | 1445 | { |
1444 | //the user disabled the extension. | 1446 | //the user disabled the extension. |
1445 | 1447 | ||
1446 | if (mMultipleViewsAtOnce) | 1448 | if (mMultipleViewsAtOnce) |
1447 | { // enable detailsview again | 1449 | { // enable detailsview again |
1448 | setDetailsVisible( true ); | 1450 | setDetailsVisible( true ); |
1449 | mActionDetails->setChecked( true ); | 1451 | mActionDetails->setChecked( true ); |
1450 | } | 1452 | } |
1451 | else | 1453 | else |
1452 | { //go back to the listview | 1454 | { //go back to the listview |
1453 | setDetailsVisible( false ); | 1455 | setDetailsVisible( false ); |
1454 | mActionDetails->setChecked( false ); | 1456 | mActionDetails->setChecked( false ); |
1455 | mActionDetails->setEnabled(true); | 1457 | mActionDetails->setEnabled(true); |
1456 | } | 1458 | } |
1457 | 1459 | ||
1458 | } | 1460 | } |
1459 | else | 1461 | else |
1460 | { | 1462 | { |
1461 | //the user enabled the extension. | 1463 | //the user enabled the extension. |
1462 | setDetailsVisible( false ); | 1464 | setDetailsVisible( false ); |
1463 | mActionDetails->setChecked( false ); | 1465 | mActionDetails->setChecked( false ); |
1464 | 1466 | ||
1465 | if (!mMultipleViewsAtOnce) | 1467 | if (!mMultipleViewsAtOnce) |
1466 | { | 1468 | { |
1467 | mActionDetails->setEnabled(false); | 1469 | mActionDetails->setEnabled(false); |
1468 | } | 1470 | } |
1469 | 1471 | ||
1470 | mExtensionManager->setSelectionChanged(); | 1472 | mExtensionManager->setSelectionChanged(); |
1471 | 1473 | ||
1472 | } | 1474 | } |
1473 | 1475 | ||
1474 | #endif// DESKTOP_VERSION | 1476 | #endif// DESKTOP_VERSION |
1475 | 1477 | ||
1476 | } | 1478 | } |
1477 | 1479 | ||
1478 | 1480 | ||
1479 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1481 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1480 | { | 1482 | { |
1481 | 1483 | ||
1482 | if ( list.count() != 0 ) { | 1484 | if ( list.count() != 0 ) { |
1483 | KABC::Addressee::List::ConstIterator it; | 1485 | KABC::Addressee::List::ConstIterator it; |
1484 | for ( it = list.begin(); it != list.end(); ++it ) | 1486 | for ( it = list.begin(); it != list.end(); ++it ) |
1485 | mAddressBook->insertAddressee( *it ); | 1487 | mAddressBook->insertAddressee( *it ); |
1486 | if ( list.count() > 1 ) | 1488 | if ( list.count() > 1 ) |
1487 | setModified(); | 1489 | setModified(); |
1488 | else | 1490 | else |
1489 | setModifiedWOrefresh(); | 1491 | setModifiedWOrefresh(); |
1490 | } | 1492 | } |
1491 | if ( list.count() == 0 ) | 1493 | if ( list.count() == 0 ) |
1492 | mViewManager->refreshView(); | 1494 | mViewManager->refreshView(); |
1493 | else | 1495 | else |
1494 | mViewManager->refreshView( list[ 0 ].uid() ); | 1496 | mViewManager->refreshView( list[ 0 ].uid() ); |
1495 | 1497 | ||
1496 | 1498 | ||
1497 | 1499 | ||
1498 | } | 1500 | } |
1499 | 1501 | ||
1500 | QString KABCore::getNameByPhone( const QString &phone ) | 1502 | QString KABCore::getNameByPhone( const QString &phone ) |
1501 | { | 1503 | { |
1502 | #ifndef KAB_EMBEDDED | 1504 | #ifndef KAB_EMBEDDED |
1503 | QRegExp r( "[/*/-/ ]" ); | 1505 | QRegExp r( "[/*/-/ ]" ); |
1504 | QString localPhone( phone ); | 1506 | QString localPhone( phone ); |
1505 | 1507 | ||
1506 | bool found = false; | 1508 | bool found = false; |
1507 | QString ownerName = ""; | 1509 | QString ownerName = ""; |
1508 | KABC::AddressBook::Iterator iter; | 1510 | KABC::AddressBook::Iterator iter; |
1509 | KABC::PhoneNumber::List::Iterator phoneIter; | 1511 | KABC::PhoneNumber::List::Iterator phoneIter; |
1510 | KABC::PhoneNumber::List phoneList; | 1512 | KABC::PhoneNumber::List phoneList; |
1511 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1513 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1512 | phoneList = (*iter).phoneNumbers(); | 1514 | phoneList = (*iter).phoneNumbers(); |
1513 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1515 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1514 | ++phoneIter) { | 1516 | ++phoneIter) { |
1515 | // Get rid of separator chars so just the numbers are compared. | 1517 | // Get rid of separator chars so just the numbers are compared. |
1516 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1518 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1517 | ownerName = (*iter).formattedName(); | 1519 | ownerName = (*iter).formattedName(); |
1518 | found = true; | 1520 | found = true; |
1519 | } | 1521 | } |
1520 | } | 1522 | } |
1521 | } | 1523 | } |
1522 | 1524 | ||
1523 | return ownerName; | 1525 | return ownerName; |
1524 | #else //KAB_EMBEDDED | 1526 | #else //KAB_EMBEDDED |
1525 | qDebug("KABCore::getNameByPhone finsih method"); | 1527 | qDebug("KABCore::getNameByPhone finsih method"); |
1526 | return ""; | 1528 | return ""; |
1527 | #endif //KAB_EMBEDDED | 1529 | #endif //KAB_EMBEDDED |
1528 | 1530 | ||
1529 | } | 1531 | } |
1530 | 1532 | ||
1531 | void KABCore::openConfigDialog() | 1533 | void KABCore::openConfigDialog() |
1532 | { | 1534 | { |
1533 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1535 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1534 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1536 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1535 | ConfigureDialog->addModule(kabcfg ); | 1537 | ConfigureDialog->addModule(kabcfg ); |
1536 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1538 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1537 | ConfigureDialog->addModule(kdelibcfg ); | 1539 | ConfigureDialog->addModule(kdelibcfg ); |
1538 | 1540 | ||
1539 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1541 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1540 | this, SLOT( configurationChanged() ) ); | 1542 | this, SLOT( configurationChanged() ) ); |
1541 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1543 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1542 | this, SLOT( configurationChanged() ) ); | 1544 | this, SLOT( configurationChanged() ) ); |
1543 | saveSettings(); | 1545 | saveSettings(); |
1544 | #ifndef DESKTOP_VERSION | 1546 | #ifndef DESKTOP_VERSION |
1545 | ConfigureDialog->showMaximized(); | 1547 | ConfigureDialog->showMaximized(); |
1546 | #endif | 1548 | #endif |
1547 | if ( ConfigureDialog->exec() ) | 1549 | if ( ConfigureDialog->exec() ) |
1548 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1550 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1549 | delete ConfigureDialog; | 1551 | delete ConfigureDialog; |
1550 | } | 1552 | } |
1551 | 1553 | ||
1552 | void KABCore::openLDAPDialog() | 1554 | void KABCore::openLDAPDialog() |
1553 | { | 1555 | { |
1554 | #ifndef KAB_EMBEDDED | 1556 | #ifndef KAB_EMBEDDED |
1555 | if ( !mLdapSearchDialog ) { | 1557 | if ( !mLdapSearchDialog ) { |
1556 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1558 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1557 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1559 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1558 | SLOT( refreshView() ) ); | 1560 | SLOT( refreshView() ) ); |
1559 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1561 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1560 | SLOT( setModified() ) ); | 1562 | SLOT( setModified() ) ); |
1561 | } else | 1563 | } else |
1562 | mLdapSearchDialog->restoreSettings(); | 1564 | mLdapSearchDialog->restoreSettings(); |
1563 | 1565 | ||
1564 | if ( mLdapSearchDialog->isOK() ) | 1566 | if ( mLdapSearchDialog->isOK() ) |
1565 | mLdapSearchDialog->exec(); | 1567 | mLdapSearchDialog->exec(); |
1566 | #else //KAB_EMBEDDED | 1568 | #else //KAB_EMBEDDED |
1567 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1569 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1568 | #endif //KAB_EMBEDDED | 1570 | #endif //KAB_EMBEDDED |
1569 | } | 1571 | } |
1570 | 1572 | ||
1571 | void KABCore::print() | 1573 | void KABCore::print() |
1572 | { | 1574 | { |
1573 | #ifndef KAB_EMBEDDED | 1575 | #ifndef KAB_EMBEDDED |
1574 | KPrinter printer; | 1576 | KPrinter printer; |
1575 | if ( !printer.setup( this ) ) | 1577 | if ( !printer.setup( this ) ) |
1576 | return; | 1578 | return; |
1577 | 1579 | ||
1578 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1580 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1579 | mViewManager->selectedUids(), this ); | 1581 | mViewManager->selectedUids(), this ); |
1580 | 1582 | ||
1581 | wizard.exec(); | 1583 | wizard.exec(); |
1582 | #else //KAB_EMBEDDED | 1584 | #else //KAB_EMBEDDED |
1583 | qDebug("KABCore::print() finsih method"); | 1585 | qDebug("KABCore::print() finsih method"); |
1584 | #endif //KAB_EMBEDDED | 1586 | #endif //KAB_EMBEDDED |
1585 | 1587 | ||
1586 | } | 1588 | } |
1587 | 1589 | ||
1588 | 1590 | ||
1589 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1591 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1590 | { | 1592 | { |
1591 | if ( mGUIClient ) | 1593 | if ( mGUIClient ) |
1592 | mGUIClient->insertChildClient( client ); | 1594 | mGUIClient->insertChildClient( client ); |
1593 | else | 1595 | else |
1594 | KMessageBox::error( this, "no KXMLGUICLient"); | 1596 | KMessageBox::error( this, "no KXMLGUICLient"); |
1595 | } | 1597 | } |
1596 | 1598 | ||
1597 | 1599 | ||
1598 | void KABCore::configurationChanged() | 1600 | void KABCore::configurationChanged() |
1599 | { | 1601 | { |
1600 | mExtensionManager->reconfigure(); | 1602 | mExtensionManager->reconfigure(); |
1601 | } | 1603 | } |
1602 | 1604 | ||
1603 | void KABCore::addressBookChanged() | 1605 | void KABCore::addressBookChanged() |
1604 | { | 1606 | { |
1605 | /*US | 1607 | /*US |
1606 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1608 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1607 | while ( it.current() ) { | 1609 | while ( it.current() ) { |
1608 | if ( it.current()->dirty() ) { | 1610 | if ( it.current()->dirty() ) { |
1609 | QString text = i18n( "Data has been changed externally. Unsaved " | 1611 | QString text = i18n( "Data has been changed externally. Unsaved " |
1610 | "changes will be lost." ); | 1612 | "changes will be lost." ); |
1611 | KMessageBox::information( this, text ); | 1613 | KMessageBox::information( this, text ); |
1612 | } | 1614 | } |
1613 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1615 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1614 | ++it; | 1616 | ++it; |
1615 | } | 1617 | } |
1616 | */ | 1618 | */ |
1617 | if (mEditorDialog) | 1619 | if (mEditorDialog) |
1618 | { | 1620 | { |
1619 | if (mEditorDialog->dirty()) | 1621 | if (mEditorDialog->dirty()) |
1620 | { | 1622 | { |
1621 | QString text = i18n( "Data has been changed externally. Unsaved " | 1623 | QString text = i18n( "Data has been changed externally. Unsaved " |
1622 | "changes will be lost." ); | 1624 | "changes will be lost." ); |
1623 | KMessageBox::information( this, text ); | 1625 | KMessageBox::information( this, text ); |
1624 | } | 1626 | } |
1625 | QString currentuid = mEditorDialog->addressee().uid(); | 1627 | QString currentuid = mEditorDialog->addressee().uid(); |
1626 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1628 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1627 | } | 1629 | } |
1628 | mViewManager->refreshView(); | 1630 | mViewManager->refreshView(); |
1629 | // mDetails->refreshView(); | 1631 | // mDetails->refreshView(); |
1630 | 1632 | ||
1631 | 1633 | ||
1632 | } | 1634 | } |
1633 | 1635 | ||
1634 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1636 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1635 | const char *name ) | 1637 | const char *name ) |
1636 | { | 1638 | { |
1637 | 1639 | ||
1638 | if ( mEditorDialog == 0 ) { | 1640 | if ( mEditorDialog == 0 ) { |
1639 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1641 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1640 | name ? name : "editorDialog" ); | 1642 | name ? name : "editorDialog" ); |
1641 | 1643 | ||
1642 | 1644 | ||
1643 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1645 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1644 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1646 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1645 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1647 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1646 | // SLOT( slotEditorDestroyed( const QString& ) ) ; | 1648 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1647 | } | 1649 | } |
1648 | 1650 | ||
1649 | return mEditorDialog; | 1651 | return mEditorDialog; |
1650 | } | 1652 | } |
1651 | 1653 | ||
1652 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1654 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1653 | { | 1655 | { |
1654 | //mEditorDict.remove( uid ); | 1656 | //mEditorDict.remove( uid ); |
1655 | } | 1657 | } |
1656 | 1658 | ||
1657 | void KABCore::initGUI() | 1659 | void KABCore::initGUI() |
1658 | { | 1660 | { |
1659 | #ifndef KAB_EMBEDDED | 1661 | #ifndef KAB_EMBEDDED |
1660 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1662 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1661 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1663 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1662 | 1664 | ||
1663 | mExtensionBarSplitter = new QSplitter( this ); | 1665 | mExtensionBarSplitter = new QSplitter( this ); |
1664 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1666 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1665 | 1667 | ||
1666 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1668 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1667 | 1669 | ||
1668 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1670 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1669 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1671 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1670 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1672 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1671 | SLOT( incrementalSearch( const QString& ) ) ); | 1673 | SLOT( incrementalSearch( const QString& ) ) ); |
1672 | 1674 | ||
1673 | mViewManager = new ViewManager( this, viewSpace ); | 1675 | mViewManager = new ViewManager( this, viewSpace ); |
1674 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1676 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1675 | 1677 | ||
1676 | mDetails = new ViewContainer( mDetailsSplitter ); | 1678 | mDetails = new ViewContainer( mDetailsSplitter ); |
1677 | 1679 | ||
1678 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1680 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1679 | 1681 | ||
1680 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1682 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1681 | 1683 | ||
1682 | topLayout->addWidget( mExtensionBarSplitter ); | 1684 | topLayout->addWidget( mExtensionBarSplitter ); |
1683 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1685 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1684 | topLayout->addWidget( mJumpButtonBar ); | 1686 | topLayout->addWidget( mJumpButtonBar ); |
1685 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1687 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1686 | 1688 | ||
1687 | mXXPortManager = new XXPortManager( this, this ); | 1689 | mXXPortManager = new XXPortManager( this, this ); |
1688 | 1690 | ||
1689 | #else //KAB_EMBEDDED | 1691 | #else //KAB_EMBEDDED |
1690 | //US initialize viewMenu before settingup viewmanager. | 1692 | //US initialize viewMenu before settingup viewmanager. |
1691 | // Viewmanager needs this menu to plugin submenues. | 1693 | // Viewmanager needs this menu to plugin submenues. |
1692 | viewMenu = new QPopupMenu( this ); | 1694 | viewMenu = new QPopupMenu( this ); |
1693 | settingsMenu = new QPopupMenu( this ); | 1695 | settingsMenu = new QPopupMenu( this ); |
1694 | //filterMenu = new QPopupMenu( this ); | 1696 | //filterMenu = new QPopupMenu( this ); |
1695 | ImportMenu = new QPopupMenu( this ); | 1697 | ImportMenu = new QPopupMenu( this ); |
1696 | ExportMenu = new QPopupMenu( this ); | 1698 | ExportMenu = new QPopupMenu( this ); |
1697 | syncMenu = new QPopupMenu( this ); | 1699 | syncMenu = new QPopupMenu( this ); |
1698 | changeMenu= new QPopupMenu( this ); | 1700 | changeMenu= new QPopupMenu( this ); |
1701 | beamMenu= new QPopupMenu( this ); | ||
1699 | 1702 | ||
1700 | //US since we have no splitter for the embedded system, setup | 1703 | //US since we have no splitter for the embedded system, setup |
1701 | // a layout with two frames. One left and one right. | 1704 | // a layout with two frames. One left and one right. |
1702 | 1705 | ||
1703 | QBoxLayout *topLayout; | 1706 | QBoxLayout *topLayout; |
1704 | 1707 | ||
1705 | // = new QHBoxLayout( this ); | 1708 | // = new QHBoxLayout( this ); |
1706 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1709 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1707 | 1710 | ||
1708 | // QWidget *mainBox = new QWidget( this ); | 1711 | // QWidget *mainBox = new QWidget( this ); |
1709 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1712 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1710 | 1713 | ||
1711 | #ifdef DESKTOP_VERSION | 1714 | #ifdef DESKTOP_VERSION |
1712 | topLayout = new QHBoxLayout( this ); | 1715 | topLayout = new QHBoxLayout( this ); |
1713 | 1716 | ||
1714 | 1717 | ||
1715 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1718 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1716 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1719 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1717 | 1720 | ||
1718 | topLayout->addWidget(mMiniSplitter ); | 1721 | topLayout->addWidget(mMiniSplitter ); |
1719 | 1722 | ||
1720 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1723 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1721 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1724 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1722 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1725 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1723 | mDetails = new ViewContainer( mMiniSplitter ); | 1726 | mDetails = new ViewContainer( mMiniSplitter ); |
1724 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1727 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1725 | #else | 1728 | #else |
1726 | if ( QApplication::desktop()->width() > 480 ) { | 1729 | if ( QApplication::desktop()->width() > 480 ) { |
1727 | topLayout = new QHBoxLayout( this ); | 1730 | topLayout = new QHBoxLayout( this ); |
1728 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1731 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1729 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1732 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1730 | } else { | 1733 | } else { |
1731 | 1734 | ||
1732 | topLayout = new QHBoxLayout( this ); | 1735 | topLayout = new QHBoxLayout( this ); |
1733 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1736 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1734 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1737 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1735 | } | 1738 | } |
1736 | 1739 | ||
1737 | topLayout->addWidget(mMiniSplitter ); | 1740 | topLayout->addWidget(mMiniSplitter ); |
1738 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1741 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1739 | mDetails = new ViewContainer( mMiniSplitter ); | 1742 | mDetails = new ViewContainer( mMiniSplitter ); |
1740 | 1743 | ||
1741 | 1744 | ||
1742 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1745 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1743 | #endif | 1746 | #endif |
1744 | //eh->hide(); | 1747 | //eh->hide(); |
1745 | // topLayout->addWidget(mExtensionManager ); | 1748 | // topLayout->addWidget(mExtensionManager ); |
1746 | 1749 | ||
1747 | 1750 | ||
1748 | /*US | 1751 | /*US |
1749 | #ifndef KAB_NOSPLITTER | 1752 | #ifndef KAB_NOSPLITTER |
1750 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1753 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1751 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1754 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1752 | topLayout->setSpacing( 10 ); | 1755 | topLayout->setSpacing( 10 ); |
1753 | 1756 | ||
1754 | mDetailsSplitter = new QSplitter( this ); | 1757 | mDetailsSplitter = new QSplitter( this ); |
1755 | 1758 | ||
1756 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1759 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1757 | 1760 | ||
1758 | mViewManager = new ViewManager( this, viewSpace ); | 1761 | mViewManager = new ViewManager( this, viewSpace ); |
1759 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1762 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1760 | 1763 | ||
1761 | mDetails = new ViewContainer( mDetailsSplitter ); | 1764 | mDetails = new ViewContainer( mDetailsSplitter ); |
1762 | 1765 | ||
1763 | topLayout->addWidget( mDetailsSplitter ); | 1766 | topLayout->addWidget( mDetailsSplitter ); |
1764 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1767 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1765 | #else //KAB_NOSPLITTER | 1768 | #else //KAB_NOSPLITTER |
1766 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1769 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1767 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1770 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1768 | topLayout->setSpacing( 10 ); | 1771 | topLayout->setSpacing( 10 ); |
1769 | 1772 | ||
1770 | // mDetailsSplitter = new QSplitter( this ); | 1773 | // mDetailsSplitter = new QSplitter( this ); |
1771 | 1774 | ||
1772 | QVBox *viewSpace = new QVBox( this ); | 1775 | QVBox *viewSpace = new QVBox( this ); |
1773 | 1776 | ||
1774 | mViewManager = new ViewManager( this, viewSpace ); | 1777 | mViewManager = new ViewManager( this, viewSpace ); |
1775 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1778 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1776 | 1779 | ||
1777 | mDetails = new ViewContainer( this ); | 1780 | mDetails = new ViewContainer( this ); |
1778 | 1781 | ||
1779 | topLayout->addWidget( viewSpace ); | 1782 | topLayout->addWidget( viewSpace ); |
1780 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1783 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1781 | topLayout->addWidget( mDetails ); | 1784 | topLayout->addWidget( mDetails ); |
1782 | #endif //KAB_NOSPLITTER | 1785 | #endif //KAB_NOSPLITTER |
1783 | */ | 1786 | */ |
1784 | 1787 | ||
1785 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1788 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1786 | syncManager->setBlockSave(false); | 1789 | syncManager->setBlockSave(false); |
1787 | 1790 | ||
1788 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1791 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1789 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1792 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1790 | syncManager->setDefaultFileName( sentSyncFile()); | 1793 | syncManager->setDefaultFileName( sentSyncFile()); |
1791 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1794 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1792 | 1795 | ||
1793 | #endif //KAB_EMBEDDED | 1796 | #endif //KAB_EMBEDDED |
1794 | initActions(); | 1797 | initActions(); |
1795 | 1798 | ||
1796 | #ifdef KAB_EMBEDDED | 1799 | #ifdef KAB_EMBEDDED |
1797 | addActionsManually(); | 1800 | addActionsManually(); |
1798 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1801 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1799 | mXXPortManager = new XXPortManager( this, this ); | 1802 | mXXPortManager = new XXPortManager( this, this ); |
1800 | 1803 | ||
1801 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1804 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1802 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1805 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1803 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1806 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1804 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1807 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1805 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1808 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1806 | // mIncSearchWidget->hide(); | 1809 | // mIncSearchWidget->hide(); |
1807 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1810 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1808 | SLOT( incrementalSearch( const QString& ) ) ); | 1811 | SLOT( incrementalSearch( const QString& ) ) ); |
1809 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 1812 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
1810 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 1813 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
1811 | 1814 | ||
1812 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1815 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1813 | 1816 | ||
1814 | topLayout->addWidget( mJumpButtonBar ); | 1817 | topLayout->addWidget( mJumpButtonBar ); |
1815 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1818 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1816 | 1819 | ||
1817 | // mMainWindow->getIconToolBar()->raise(); | 1820 | // mMainWindow->getIconToolBar()->raise(); |
1818 | 1821 | ||
1819 | #endif //KAB_EMBEDDED | 1822 | #endif //KAB_EMBEDDED |
1820 | 1823 | ||
1821 | } | 1824 | } |
1822 | void KABCore::initActions() | 1825 | void KABCore::initActions() |
1823 | { | 1826 | { |
1824 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1827 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1825 | 1828 | ||
1826 | #ifndef KAB_EMBEDDED | 1829 | #ifndef KAB_EMBEDDED |
1827 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1830 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1828 | SLOT( clipboardDataChanged() ) ); | 1831 | SLOT( clipboardDataChanged() ) ); |
1829 | #endif //KAB_EMBEDDED | 1832 | #endif //KAB_EMBEDDED |
1830 | 1833 | ||
1831 | // file menu | 1834 | // file menu |
1832 | if ( mIsPart ) { | 1835 | if ( mIsPart ) { |
1833 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1836 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1834 | SLOT( sendMail() ), actionCollection(), | 1837 | SLOT( sendMail() ), actionCollection(), |
1835 | "kaddressbook_mail" ); | 1838 | "kaddressbook_mail" ); |
1836 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1839 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1837 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1840 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1838 | 1841 | ||
1839 | } else { | 1842 | } else { |
1840 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1843 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1841 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1844 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1842 | } | 1845 | } |
1843 | 1846 | ||
1844 | 1847 | ||
1845 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1848 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1846 | SLOT( save() ), actionCollection(), "file_sync" ); | 1849 | SLOT( save() ), actionCollection(), "file_sync" ); |
1847 | 1850 | ||
1848 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1851 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1849 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1852 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1850 | 1853 | ||
1851 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1854 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1852 | this, SLOT( mailVCard() ), | 1855 | this, SLOT( mailVCard() ), |
1853 | actionCollection(), "file_mail_vcard"); | 1856 | actionCollection(), "file_mail_vcard"); |
1854 | 1857 | ||
1855 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, | 1858 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, |
1856 | SLOT( export2phone() ), actionCollection(), | 1859 | SLOT( export2phone() ), actionCollection(), |
1857 | "kaddressbook_ex2phone" ); | 1860 | "kaddressbook_ex2phone" ); |
1858 | 1861 | ||
1859 | mActionBeamVCard = 0; | 1862 | mActionBeamVCard = 0; |
1860 | mActionBeam = 0; | 1863 | mActionBeam = 0; |
1861 | 1864 | ||
1862 | #ifndef DESKTOP_VERSION | 1865 | #ifndef DESKTOP_VERSION |
1863 | if ( Ir::supported() ) { | 1866 | if ( Ir::supported() ) { |
1864 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1867 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, |
1865 | SLOT( beamVCard() ), actionCollection(), | 1868 | SLOT( beamVCard() ), actionCollection(), |
1866 | "kaddressbook_beam_vcard" ); | 1869 | "kaddressbook_beam_vcard" ); |
1867 | 1870 | ||
1868 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1871 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1869 | SLOT( beamMySelf() ), actionCollection(), | 1872 | SLOT( beamMySelf() ), actionCollection(), |
1870 | "kaddressbook_beam_myself" ); | 1873 | "kaddressbook_beam_myself" ); |
1871 | } | 1874 | } |
1872 | #endif | 1875 | #endif |
1873 | 1876 | ||
1874 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1877 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1875 | this, SLOT( editContact2() ), | 1878 | this, SLOT( editContact2() ), |
1876 | actionCollection(), "file_properties" ); | 1879 | actionCollection(), "file_properties" ); |
1877 | 1880 | ||
1878 | #ifdef KAB_EMBEDDED | 1881 | #ifdef KAB_EMBEDDED |
1879 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1882 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1880 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1883 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1881 | mMainWindow, SLOT( exit() ), | 1884 | mMainWindow, SLOT( exit() ), |
1882 | actionCollection(), "quit" ); | 1885 | actionCollection(), "quit" ); |
1883 | #endif //KAB_EMBEDDED | 1886 | #endif //KAB_EMBEDDED |
1884 | 1887 | ||
1885 | // edit menu | 1888 | // edit menu |
1886 | if ( mIsPart ) { | 1889 | if ( mIsPart ) { |
1887 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1890 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1888 | SLOT( copyContacts() ), actionCollection(), | 1891 | SLOT( copyContacts() ), actionCollection(), |
1889 | "kaddressbook_copy" ); | 1892 | "kaddressbook_copy" ); |
1890 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1893 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1891 | SLOT( cutContacts() ), actionCollection(), | 1894 | SLOT( cutContacts() ), actionCollection(), |
1892 | "kaddressbook_cut" ); | 1895 | "kaddressbook_cut" ); |
1893 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1896 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1894 | SLOT( pasteContacts() ), actionCollection(), | 1897 | SLOT( pasteContacts() ), actionCollection(), |
1895 | "kaddressbook_paste" ); | 1898 | "kaddressbook_paste" ); |
1896 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1899 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1897 | SLOT( selectAllContacts() ), actionCollection(), | 1900 | SLOT( selectAllContacts() ), actionCollection(), |
1898 | "kaddressbook_select_all" ); | 1901 | "kaddressbook_select_all" ); |
1899 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1902 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1900 | SLOT( undo() ), actionCollection(), | 1903 | SLOT( undo() ), actionCollection(), |
1901 | "kaddressbook_undo" ); | 1904 | "kaddressbook_undo" ); |
1902 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1905 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1903 | this, SLOT( redo() ), actionCollection(), | 1906 | this, SLOT( redo() ), actionCollection(), |
1904 | "kaddressbook_redo" ); | 1907 | "kaddressbook_redo" ); |
1905 | } else { | 1908 | } else { |
1906 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1909 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1907 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1910 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1908 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1911 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1909 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1912 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1910 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1913 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1911 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1914 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1912 | } | 1915 | } |
1913 | 1916 | ||
1914 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1917 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1915 | Key_Delete, this, SLOT( deleteContacts() ), | 1918 | Key_Delete, this, SLOT( deleteContacts() ), |
1916 | actionCollection(), "edit_delete" ); | 1919 | actionCollection(), "edit_delete" ); |
1917 | 1920 | ||
1918 | mActionUndo->setEnabled( false ); | 1921 | mActionUndo->setEnabled( false ); |
1919 | mActionRedo->setEnabled( false ); | 1922 | mActionRedo->setEnabled( false ); |
1920 | 1923 | ||
1921 | // settings menu | 1924 | // settings menu |
1922 | #ifdef KAB_EMBEDDED | 1925 | #ifdef KAB_EMBEDDED |
1923 | //US special menuentry to configure the addressbook resources. On KDE | 1926 | //US special menuentry to configure the addressbook resources. On KDE |
1924 | // you do that through the control center !!! | 1927 | // you do that through the control center !!! |
1925 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1928 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1926 | SLOT( configureResources() ), actionCollection(), | 1929 | SLOT( configureResources() ), actionCollection(), |
1927 | "kaddressbook_configure_resources" ); | 1930 | "kaddressbook_configure_resources" ); |
1928 | #endif //KAB_EMBEDDED | 1931 | #endif //KAB_EMBEDDED |
1929 | 1932 | ||
1930 | if ( mIsPart ) { | 1933 | if ( mIsPart ) { |
1931 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1934 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1932 | SLOT( openConfigDialog() ), actionCollection(), | 1935 | SLOT( openConfigDialog() ), actionCollection(), |
1933 | "kaddressbook_configure" ); | 1936 | "kaddressbook_configure" ); |
1934 | 1937 | ||
1935 | //US not implemented yet | 1938 | //US not implemented yet |
1936 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1939 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1937 | // this, SLOT( configureKeyBindings() ), actionCollection(), | 1940 | // this, SLOT( configureKeyBindings() ), actionCollection(), |
1938 | // "kaddressbook_configure_shortcuts" ); | 1941 | // "kaddressbook_configure_shortcuts" ); |
1939 | #ifdef KAB_EMBEDDED | 1942 | #ifdef KAB_EMBEDDED |
1940 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1943 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1941 | mActionConfigureToolbars->setEnabled( false ); | 1944 | mActionConfigureToolbars->setEnabled( false ); |
1942 | #endif //KAB_EMBEDDED | 1945 | #endif //KAB_EMBEDDED |
1943 | 1946 | ||
1944 | } else { | 1947 | } else { |
1945 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1948 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1946 | 1949 | ||
1947 | //US not implemented yet | 1950 | //US not implemented yet |
1948 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1951 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1949 | } | 1952 | } |
1950 | 1953 | ||
1951 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1954 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1952 | actionCollection(), "options_show_jump_bar" ); | 1955 | actionCollection(), "options_show_jump_bar" ); |
1953 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1956 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1954 | 1957 | ||
1955 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1958 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1956 | actionCollection(), "options_show_details" ); | 1959 | actionCollection(), "options_show_details" ); |
1957 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1960 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1958 | 1961 | ||
1959 | 1962 | ||
1960 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, | 1963 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
1961 | SLOT( toggleBeamReceive() ), actionCollection(), | 1964 | SLOT( toggleBeamReceive() ), actionCollection(), |
1962 | "kaddressbook_beam_rec" ); | 1965 | "kaddressbook_beam_rec" ); |
1963 | 1966 | ||
1964 | 1967 | ||
1965 | // misc | 1968 | // misc |
1966 | // only enable LDAP lookup if we can handle the protocol | 1969 | // only enable LDAP lookup if we can handle the protocol |
1967 | #ifndef KAB_EMBEDDED | 1970 | #ifndef KAB_EMBEDDED |
1968 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1971 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1969 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1972 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1970 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1973 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1971 | "ldap_lookup" ); | 1974 | "ldap_lookup" ); |
1972 | } | 1975 | } |
1973 | #else //KAB_EMBEDDED | 1976 | #else //KAB_EMBEDDED |
1974 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1977 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1975 | #endif //KAB_EMBEDDED | 1978 | #endif //KAB_EMBEDDED |
1976 | 1979 | ||
1977 | 1980 | ||
1978 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1981 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1979 | SLOT( setWhoAmI() ), actionCollection(), | 1982 | SLOT( setWhoAmI() ), actionCollection(), |
1980 | "set_personal" ); | 1983 | "set_personal" ); |
1981 | 1984 | ||
1982 | 1985 | ||
1983 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1986 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1984 | SLOT( setCategories() ), actionCollection(), | 1987 | SLOT( setCategories() ), actionCollection(), |
1985 | "edit_set_categories" ); | 1988 | "edit_set_categories" ); |
1986 | mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this, | 1989 | mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this, |
1987 | SLOT( editCategories() ), actionCollection(), | 1990 | SLOT( editCategories() ), actionCollection(), |
1988 | "edit__categories" ); | 1991 | "edit__categories" ); |
1989 | 1992 | ||
1990 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1993 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1991 | SLOT( removeVoice() ), actionCollection(), | 1994 | SLOT( removeVoice() ), actionCollection(), |
1992 | "remove_voice" ); | 1995 | "remove_voice" ); |
1993 | 1996 | ||
1994 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, | 1997 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, |
1995 | SLOT( manageCategories() ), actionCollection(), | 1998 | SLOT( manageCategories() ), actionCollection(), |
1996 | "remove_voice" ); | 1999 | "remove_voice" ); |
1997 | 2000 | ||
1998 | 2001 | ||
1999 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 2002 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
2000 | SLOT( importFromOL() ), actionCollection(), | 2003 | SLOT( importFromOL() ), actionCollection(), |
2001 | "import_OL" ); | 2004 | "import_OL" ); |
2002 | #ifdef KAB_EMBEDDED | 2005 | #ifdef KAB_EMBEDDED |
2003 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 2006 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
2004 | this, SLOT( showLicence() ), actionCollection(), | 2007 | this, SLOT( showLicence() ), actionCollection(), |
2005 | "licence_about_data" ); | 2008 | "licence_about_data" ); |
2006 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 2009 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
2007 | this, SLOT( faq() ), actionCollection(), | 2010 | this, SLOT( faq() ), actionCollection(), |
2008 | "faq_about_data" ); | 2011 | "faq_about_data" ); |
2009 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 2012 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
2010 | this, SLOT( whatsnew() ), actionCollection(), | 2013 | this, SLOT( whatsnew() ), actionCollection(), |
2011 | "wn" ); | 2014 | "wn" ); |
2012 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 2015 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
2013 | this, SLOT( synchowto() ), actionCollection(), | 2016 | this, SLOT( synchowto() ), actionCollection(), |
2014 | "sync" ); | 2017 | "sync" ); |
2015 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, | 2018 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, |
2016 | this, SLOT( kdesynchowto() ), actionCollection(), | 2019 | this, SLOT( kdesynchowto() ), actionCollection(), |
2017 | "kdesync" ); | 2020 | "kdesync" ); |
2018 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, | 2021 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, |
2019 | this, SLOT( multisynchowto() ), actionCollection(), | 2022 | this, SLOT( multisynchowto() ), actionCollection(), |
2020 | "multisync" ); | 2023 | "multisync" ); |
2021 | 2024 | ||
2022 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 2025 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
2023 | this, SLOT( createAboutData() ), actionCollection(), | 2026 | this, SLOT( createAboutData() ), actionCollection(), |
2024 | "kaddressbook_about_data" ); | 2027 | "kaddressbook_about_data" ); |
2025 | #endif //KAB_EMBEDDED | 2028 | #endif //KAB_EMBEDDED |
2026 | 2029 | ||
2027 | clipboardDataChanged(); | 2030 | clipboardDataChanged(); |
2028 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2031 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2029 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2032 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2030 | } | 2033 | } |
2031 | 2034 | ||
2032 | //US we need this function, to plug all actions into the correct menues. | 2035 | //US we need this function, to plug all actions into the correct menues. |
2033 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 2036 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
2034 | void KABCore::addActionsManually() | 2037 | void KABCore::addActionsManually() |
2035 | { | 2038 | { |
2036 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 2039 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
2037 | 2040 | ||
2038 | #ifdef KAB_EMBEDDED | 2041 | #ifdef KAB_EMBEDDED |
2039 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 2042 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
2040 | QPopupMenu *editMenu = new QPopupMenu( this ); | 2043 | QPopupMenu *editMenu = new QPopupMenu( this ); |
2041 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 2044 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
2042 | 2045 | ||
2043 | KToolBar* tb = mMainWindow->toolBar(); | 2046 | KToolBar* tb = mMainWindow->toolBar(); |
2044 | 2047 | ||
2045 | #ifndef DESKTOP_VERSION | 2048 | #ifndef DESKTOP_VERSION |
2046 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { | 2049 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { |
2047 | #endif | 2050 | #endif |
2048 | QMenuBar* mb = mMainWindow->menuBar(); | 2051 | QMenuBar* mb = mMainWindow->menuBar(); |
2049 | 2052 | ||
2050 | //US setup menubar. | 2053 | //US setup menubar. |
2051 | //Disable the following block if you do not want to have a menubar. | 2054 | //Disable the following block if you do not want to have a menubar. |
2052 | mb->insertItem( i18n("&File"), fileMenu ); | 2055 | mb->insertItem( i18n("&File"), fileMenu ); |
2053 | mb->insertItem( i18n("&Edit"), editMenu ); | 2056 | mb->insertItem( i18n("&Edit"), editMenu ); |
2054 | mb->insertItem( i18n("&View"), viewMenu ); | 2057 | mb->insertItem( i18n("&View"), viewMenu ); |
2055 | mb->insertItem( i18n("&Settings"), settingsMenu ); | 2058 | mb->insertItem( i18n("&Settings"), settingsMenu ); |
2056 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 2059 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
2057 | //mb->insertItem( i18n("&Change"), changeMenu ); | 2060 | //mb->insertItem( i18n("&Change"), changeMenu ); |
2058 | mb->insertItem( i18n("&Help"), helpMenu ); | 2061 | mb->insertItem( i18n("&Help"), helpMenu ); |
2059 | mIncSearchWidget = new IncSearchWidget( tb ); | 2062 | mIncSearchWidget = new IncSearchWidget( tb ); |
2060 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 2063 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
2061 | #ifndef DESKTOP_VERSION | 2064 | #ifndef DESKTOP_VERSION |
2062 | } else { | 2065 | } else { |
2063 | //US setup toolbar | 2066 | //US setup toolbar |
2064 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 2067 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
2065 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 2068 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
2066 | menuBarTB->insertItem( "ME", popupBarTB); | 2069 | menuBarTB->insertItem( "ME", popupBarTB); |
2067 | tb->insertWidget(-1, 0, menuBarTB); | 2070 | tb->insertWidget(-1, 0, menuBarTB); |
2068 | mIncSearchWidget = new IncSearchWidget( tb ); | 2071 | mIncSearchWidget = new IncSearchWidget( tb ); |
2069 | 2072 | ||
2070 | tb->enableMoving(false); | 2073 | tb->enableMoving(false); |
2071 | popupBarTB->insertItem( i18n("&File"), fileMenu ); | 2074 | popupBarTB->insertItem( i18n("&File"), fileMenu ); |
2072 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); | 2075 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); |
2073 | popupBarTB->insertItem( i18n("&View"), viewMenu ); | 2076 | popupBarTB->insertItem( i18n("&View"), viewMenu ); |
2074 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); | 2077 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); |
2075 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 2078 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
2076 | mViewManager->getFilterAction()->plug ( popupBarTB); | 2079 | mViewManager->getFilterAction()->plug ( popupBarTB); |
2077 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); | 2080 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); |
2078 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); | 2081 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); |
2079 | if (QApplication::desktop()->width() > 320 ) { | 2082 | if (QApplication::desktop()->width() > 320 ) { |
2080 | // mViewManager->getFilterAction()->plug ( tb); | 2083 | // mViewManager->getFilterAction()->plug ( tb); |
2081 | } | 2084 | } |
2082 | } | 2085 | } |
2083 | #endif | 2086 | #endif |
2084 | // mActionQuit->plug ( mMainWindow->toolBar()); | 2087 | // mActionQuit->plug ( mMainWindow->toolBar()); |
2085 | 2088 | ||
2086 | 2089 | ||
2087 | 2090 | ||
2088 | //US Now connect the actions with the menue entries. | 2091 | //US Now connect the actions with the menue entries. |
2089 | mActionPrint->plug( fileMenu ); | 2092 | mActionPrint->plug( fileMenu ); |
2090 | mActionMail->plug( fileMenu ); | 2093 | mActionMail->plug( fileMenu ); |
2091 | fileMenu->insertSeparator(); | 2094 | fileMenu->insertSeparator(); |
2092 | 2095 | ||
2093 | mActionNewContact->plug( fileMenu ); | 2096 | mActionNewContact->plug( fileMenu ); |
2094 | mActionNewContact->plug( tb ); | 2097 | mActionNewContact->plug( tb ); |
2095 | 2098 | ||
2096 | mActionEditAddressee->plug( fileMenu ); | 2099 | mActionEditAddressee->plug( fileMenu ); |
2097 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 2100 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
2098 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 2101 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
2099 | mActionEditAddressee->plug( tb ); | 2102 | mActionEditAddressee->plug( tb ); |
2100 | 2103 | ||
2101 | fileMenu->insertSeparator(); | 2104 | fileMenu->insertSeparator(); |
2102 | mActionSave->plug( fileMenu ); | 2105 | mActionSave->plug( fileMenu ); |
2103 | fileMenu->insertItem( "&Import", ImportMenu ); | 2106 | fileMenu->insertItem( "&Import", ImportMenu ); |
2104 | fileMenu->insertItem( "&Export", ExportMenu ); | 2107 | fileMenu->insertItem( "&Export", ExportMenu ); |
2105 | fileMenu->insertItem( i18n("&Change"), changeMenu ); | 2108 | fileMenu->insertItem( i18n("&Change"), changeMenu ); |
2109 | fileMenu->insertItem( i18n("&Beam"), beamMenu ); | ||
2106 | fileMenu->insertSeparator(); | 2110 | fileMenu->insertSeparator(); |
2107 | mActionMailVCard->plug( fileMenu ); | 2111 | mActionMailVCard->plug( fileMenu ); |
2108 | #ifndef DESKTOP_VERSION | 2112 | #ifndef DESKTOP_VERSION |
2109 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 2113 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); |
2110 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 2114 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); |
2115 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); | ||
2111 | #endif | 2116 | #endif |
2112 | fileMenu->insertSeparator(); | 2117 | fileMenu->insertSeparator(); |
2113 | mActionQuit->plug( fileMenu ); | 2118 | mActionQuit->plug( fileMenu ); |
2114 | #ifdef _WIN32_ | 2119 | #ifdef _WIN32_ |
2115 | mActionImportOL->plug( ImportMenu ); | 2120 | mActionImportOL->plug( ImportMenu ); |
2116 | #endif | 2121 | #endif |
2117 | // edit menu | 2122 | // edit menu |
2118 | mActionUndo->plug( editMenu ); | 2123 | mActionUndo->plug( editMenu ); |
2119 | mActionRedo->plug( editMenu ); | 2124 | mActionRedo->plug( editMenu ); |
2120 | editMenu->insertSeparator(); | 2125 | editMenu->insertSeparator(); |
2121 | mActionCut->plug( editMenu ); | 2126 | mActionCut->plug( editMenu ); |
2122 | mActionCopy->plug( editMenu ); | 2127 | mActionCopy->plug( editMenu ); |
2123 | mActionPaste->plug( editMenu ); | 2128 | mActionPaste->plug( editMenu ); |
2124 | mActionDelete->plug( editMenu ); | 2129 | mActionDelete->plug( editMenu ); |
2125 | editMenu->insertSeparator(); | 2130 | editMenu->insertSeparator(); |
2126 | mActionSelectAll->plug( editMenu ); | 2131 | mActionSelectAll->plug( editMenu ); |
2127 | 2132 | ||
2128 | mActionRemoveVoice->plug( changeMenu ); | 2133 | mActionRemoveVoice->plug( changeMenu ); |
2129 | // settings menu | 2134 | // settings menu |
2130 | //US special menuentry to configure the addressbook resources. On KDE | 2135 | //US special menuentry to configure the addressbook resources. On KDE |
2131 | // you do that through the control center !!! | 2136 | // you do that through the control center !!! |
2132 | mActionConfigResources->plug( settingsMenu ); | 2137 | mActionConfigResources->plug( settingsMenu ); |
2133 | settingsMenu->insertSeparator(); | 2138 | settingsMenu->insertSeparator(); |
2134 | 2139 | ||
2135 | mActionConfigKAddressbook->plug( settingsMenu ); | 2140 | mActionConfigKAddressbook->plug( settingsMenu ); |
2136 | 2141 | ||
2137 | if ( mIsPart ) { | 2142 | if ( mIsPart ) { |
2138 | //US not implemented yet | 2143 | //US not implemented yet |
2139 | //mActionConfigShortcuts->plug( settingsMenu ); | 2144 | //mActionConfigShortcuts->plug( settingsMenu ); |
2140 | //mActionConfigureToolbars->plug( settingsMenu ); | 2145 | //mActionConfigureToolbars->plug( settingsMenu ); |
2141 | 2146 | ||
2142 | } else { | 2147 | } else { |
2143 | //US not implemented yet | 2148 | //US not implemented yet |
2144 | //mActionKeyBindings->plug( settingsMenu ); | 2149 | //mActionKeyBindings->plug( settingsMenu ); |
2145 | } | 2150 | } |
2146 | 2151 | ||
2147 | settingsMenu->insertSeparator(); | 2152 | settingsMenu->insertSeparator(); |
2148 | 2153 | ||
2149 | mActionJumpBar->plug( settingsMenu ); | 2154 | mActionJumpBar->plug( settingsMenu ); |
2150 | mActionDetails->plug( settingsMenu ); | 2155 | mActionDetails->plug( settingsMenu ); |
2151 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2156 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2152 | mActionDetails->plug( tb ); | 2157 | mActionDetails->plug( tb ); |
2153 | settingsMenu->insertSeparator(); | 2158 | settingsMenu->insertSeparator(); |
2154 | mActionBR->plug(settingsMenu ); | 2159 | #ifndef DESKTOP_VERSION |
2160 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); | ||
2161 | #endif | ||
2155 | settingsMenu->insertSeparator(); | 2162 | settingsMenu->insertSeparator(); |
2156 | 2163 | ||
2157 | mActionWhoAmI->plug( settingsMenu ); | 2164 | mActionWhoAmI->plug( settingsMenu ); |
2158 | mActionEditCategories->plug( settingsMenu ); | 2165 | mActionEditCategories->plug( settingsMenu ); |
2159 | mActionEditCategories->plug( changeMenu ); | 2166 | mActionEditCategories->plug( changeMenu ); |
2160 | mActionCategories->plug( changeMenu ); | 2167 | mActionCategories->plug( changeMenu ); |
2161 | mActionManageCategories->plug( changeMenu ); | 2168 | mActionManageCategories->plug( changeMenu ); |
2162 | 2169 | ||
2163 | mActionCategories->plug( settingsMenu ); | 2170 | mActionCategories->plug( settingsMenu ); |
2164 | mActionManageCategories->plug( settingsMenu ); | 2171 | mActionManageCategories->plug( settingsMenu ); |
2165 | 2172 | ||
2166 | 2173 | ||
2167 | mActionWN->plug( helpMenu ); | 2174 | mActionWN->plug( helpMenu ); |
2168 | mActionSyncHowto->plug( helpMenu ); | 2175 | mActionSyncHowto->plug( helpMenu ); |
2169 | mActionKdeSyncHowto->plug( helpMenu ); | 2176 | mActionKdeSyncHowto->plug( helpMenu ); |
2170 | mActionMultiSyncHowto->plug( helpMenu ); | 2177 | mActionMultiSyncHowto->plug( helpMenu ); |
2171 | mActionFaq->plug( helpMenu ); | 2178 | mActionFaq->plug( helpMenu ); |
2172 | mActionLicence->plug( helpMenu ); | 2179 | mActionLicence->plug( helpMenu ); |
2173 | mActionAboutKAddressbook->plug( helpMenu ); | 2180 | mActionAboutKAddressbook->plug( helpMenu ); |
2174 | 2181 | ||
2175 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2182 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2176 | 2183 | ||
2177 | mActionSave->plug( tb ); | 2184 | mActionSave->plug( tb ); |
2178 | mViewManager->getFilterAction()->plug ( tb); | 2185 | mViewManager->getFilterAction()->plug ( tb); |
2179 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 2186 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
2180 | mActionUndo->plug( tb ); | 2187 | mActionUndo->plug( tb ); |
2181 | mActionDelete->plug( tb ); | 2188 | mActionDelete->plug( tb ); |
2182 | mActionRedo->plug( tb ); | 2189 | mActionRedo->plug( tb ); |
2183 | } | 2190 | } |
2184 | } else { | 2191 | } else { |
2185 | mActionSave->plug( tb ); | 2192 | mActionSave->plug( tb ); |
2186 | tb->enableMoving(false); | 2193 | tb->enableMoving(false); |
2187 | } | 2194 | } |
2188 | //mActionQuit->plug ( tb ); | 2195 | //mActionQuit->plug ( tb ); |
2189 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2196 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2190 | 2197 | ||
2191 | //US link the searchwidget first to this. | 2198 | //US link the searchwidget first to this. |
2192 | // The real linkage to the toolbar happens later. | 2199 | // The real linkage to the toolbar happens later. |
2193 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2200 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2194 | //US tb->insertItem( mIncSearchWidget ); | 2201 | //US tb->insertItem( mIncSearchWidget ); |
2195 | /*US | 2202 | /*US |
2196 | mIncSearchWidget = new IncSearchWidget( tb ); | 2203 | mIncSearchWidget = new IncSearchWidget( tb ); |
2197 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2204 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2198 | SLOT( incrementalSearch( const QString& ) ) ); | 2205 | SLOT( incrementalSearch( const QString& ) ) ); |
2199 | 2206 | ||
2200 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2207 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2201 | 2208 | ||
2202 | //US topLayout->addWidget( mJumpButtonBar ); | 2209 | //US topLayout->addWidget( mJumpButtonBar ); |
2203 | this->layout()->add( mJumpButtonBar ); | 2210 | this->layout()->add( mJumpButtonBar ); |
2204 | */ | 2211 | */ |
2205 | 2212 | ||
2206 | #endif //KAB_EMBEDDED | 2213 | #endif //KAB_EMBEDDED |
2207 | 2214 | ||
2208 | mActionExport2phone->plug( ExportMenu ); | 2215 | mActionExport2phone->plug( ExportMenu ); |
2209 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2216 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2210 | syncManager->fillSyncMenu(); | 2217 | syncManager->fillSyncMenu(); |
2211 | 2218 | ||
2212 | } | 2219 | } |
2213 | void KABCore::showLicence() | 2220 | void KABCore::showLicence() |
2214 | { | 2221 | { |
2215 | KApplication::showLicence(); | 2222 | KApplication::showLicence(); |
2216 | } | 2223 | } |
2217 | 2224 | ||
2218 | void KABCore::manageCategories( ) | 2225 | void KABCore::manageCategories( ) |
2219 | { | 2226 | { |
2220 | KABCatPrefs* cp = new KABCatPrefs(); | 2227 | KABCatPrefs* cp = new KABCatPrefs(); |
2221 | cp->show(); | 2228 | cp->show(); |
2222 | int w =cp->sizeHint().width() ; | 2229 | int w =cp->sizeHint().width() ; |
2223 | int h = cp->sizeHint().height() ; | 2230 | int h = cp->sizeHint().height() ; |
2224 | int dw = QApplication::desktop()->width(); | 2231 | int dw = QApplication::desktop()->width(); |
2225 | int dh = QApplication::desktop()->height(); | 2232 | int dh = QApplication::desktop()->height(); |
2226 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2233 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2227 | if ( !cp->exec() ) { | 2234 | if ( !cp->exec() ) { |
2228 | delete cp; | 2235 | delete cp; |
2229 | return; | 2236 | return; |
2230 | } | 2237 | } |
2231 | int count = 0; | 2238 | int count = 0; |
2232 | message( i18n("Please wait, processing categories...")); | 2239 | message( i18n("Please wait, processing categories...")); |
2233 | if ( cp->addCat() ) { | 2240 | if ( cp->addCat() ) { |
2234 | KABC::AddressBook::Iterator it; | 2241 | KABC::AddressBook::Iterator it; |
2235 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2242 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2236 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2243 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2237 | QStringList catIncList = (*it).categories(); | 2244 | QStringList catIncList = (*it).categories(); |
2238 | int i; | 2245 | int i; |
2239 | for( i = 0; i< catIncList.count(); ++i ) { | 2246 | for( i = 0; i< catIncList.count(); ++i ) { |
2240 | if ( !catList.contains (catIncList[i])) { | 2247 | if ( !catList.contains (catIncList[i])) { |
2241 | catList.append( catIncList[i] ); | 2248 | catList.append( catIncList[i] ); |
2242 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2249 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2243 | ++count; | 2250 | ++count; |
2244 | } | 2251 | } |
2245 | } | 2252 | } |
2246 | } | 2253 | } |
2247 | catList.sort(); | 2254 | catList.sort(); |
2248 | KABPrefs::instance()->mCustomCategories = catList; | 2255 | KABPrefs::instance()->mCustomCategories = catList; |
2249 | KABPrefs::instance()->writeConfig(); | 2256 | KABPrefs::instance()->writeConfig(); |
2250 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2257 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2251 | } else { | 2258 | } else { |
2252 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2259 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2253 | QStringList catIncList; | 2260 | QStringList catIncList; |
2254 | QStringList newCatList; | 2261 | QStringList newCatList; |
2255 | KABC::AddressBook::Iterator it; | 2262 | KABC::AddressBook::Iterator it; |
2256 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2263 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2257 | QStringList catIncList = (*it).categories(); | 2264 | QStringList catIncList = (*it).categories(); |
2258 | int i; | 2265 | int i; |
2259 | if ( catIncList.count() ) { | 2266 | if ( catIncList.count() ) { |
2260 | newCatList.clear(); | 2267 | newCatList.clear(); |
2261 | for( i = 0; i< catIncList.count(); ++i ) { | 2268 | for( i = 0; i< catIncList.count(); ++i ) { |
2262 | if ( catList.contains (catIncList[i])) { | 2269 | if ( catList.contains (catIncList[i])) { |
2263 | newCatList.append( catIncList[i] ); | 2270 | newCatList.append( catIncList[i] ); |
2264 | } | 2271 | } |
2265 | } | 2272 | } |
2266 | newCatList.sort(); | 2273 | newCatList.sort(); |
2267 | (*it).setCategories( newCatList ); | 2274 | (*it).setCategories( newCatList ); |
2268 | mAddressBook->insertAddressee( (*it) ); | 2275 | mAddressBook->insertAddressee( (*it) ); |
2269 | } | 2276 | } |
2270 | } | 2277 | } |
2271 | setModified( true ); | 2278 | setModified( true ); |
2272 | mViewManager->refreshView(); | 2279 | mViewManager->refreshView(); |
2273 | mDetails->refreshView(); | 2280 | mDetails->refreshView(); |
2274 | message( i18n("Removing categories done!")); | 2281 | message( i18n("Removing categories done!")); |
2275 | } | 2282 | } |
2276 | delete cp; | 2283 | delete cp; |
2277 | } | 2284 | } |
2278 | void KABCore::removeVoice() | 2285 | void KABCore::removeVoice() |
2279 | { | 2286 | { |
2280 | 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 ) | 2287 | 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 ) |
2281 | return; | 2288 | return; |
2282 | KABC::Addressee::List list; | 2289 | KABC::Addressee::List list; |
2283 | XXPortSelectDialog dlg( this, false, this ); | 2290 | XXPortSelectDialog dlg( this, false, this ); |
2284 | if ( dlg.exec() ) | 2291 | if ( dlg.exec() ) |
2285 | list = dlg.contacts(); | 2292 | list = dlg.contacts(); |
2286 | else | 2293 | else |
2287 | return; | 2294 | return; |
2288 | KABC::Addressee::List::Iterator it; | 2295 | KABC::Addressee::List::Iterator it; |
2289 | for ( it = list.begin(); it != list.end(); ++it ) { | 2296 | for ( it = list.begin(); it != list.end(); ++it ) { |
2290 | if ( (*it).removeVoice() ) | 2297 | if ( (*it).removeVoice() ) |
2291 | contactModified((*it) ); | 2298 | contactModified((*it) ); |
2292 | } | 2299 | } |
2293 | } | 2300 | } |
2294 | 2301 | ||
2295 | 2302 | ||
2296 | 2303 | ||
2297 | void KABCore::clipboardDataChanged() | 2304 | void KABCore::clipboardDataChanged() |
2298 | { | 2305 | { |
2299 | 2306 | ||
2300 | if ( mReadWrite ) | 2307 | if ( mReadWrite ) |
2301 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2308 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2302 | 2309 | ||
2303 | } | 2310 | } |
2304 | 2311 | ||
2305 | void KABCore::updateActionMenu() | 2312 | void KABCore::updateActionMenu() |
2306 | { | 2313 | { |
2307 | UndoStack *undo = UndoStack::instance(); | 2314 | UndoStack *undo = UndoStack::instance(); |
2308 | RedoStack *redo = RedoStack::instance(); | 2315 | RedoStack *redo = RedoStack::instance(); |
2309 | 2316 | ||
2310 | if ( undo->isEmpty() ) | 2317 | if ( undo->isEmpty() ) |
2311 | mActionUndo->setText( i18n( "Undo" ) ); | 2318 | mActionUndo->setText( i18n( "Undo" ) ); |
2312 | else | 2319 | else |
2313 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2320 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2314 | 2321 | ||
2315 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2322 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2316 | 2323 | ||
2317 | if ( !redo->top() ) | 2324 | if ( !redo->top() ) |
2318 | mActionRedo->setText( i18n( "Redo" ) ); | 2325 | mActionRedo->setText( i18n( "Redo" ) ); |
2319 | else | 2326 | else |
2320 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2327 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2321 | 2328 | ||
2322 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2329 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2323 | } | 2330 | } |
2324 | 2331 | ||
2325 | void KABCore::configureKeyBindings() | 2332 | void KABCore::configureKeyBindings() |
2326 | { | 2333 | { |
2327 | #ifndef KAB_EMBEDDED | 2334 | #ifndef KAB_EMBEDDED |
2328 | KKeyDialog::configure( actionCollection(), true ); | 2335 | KKeyDialog::configure( actionCollection(), true ); |
2329 | #else //KAB_EMBEDDED | 2336 | #else //KAB_EMBEDDED |
2330 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2337 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2331 | #endif //KAB_EMBEDDED | 2338 | #endif //KAB_EMBEDDED |
2332 | } | 2339 | } |
2333 | 2340 | ||
2334 | #ifdef KAB_EMBEDDED | 2341 | #ifdef KAB_EMBEDDED |
2335 | void KABCore::configureResources() | 2342 | void KABCore::configureResources() |
2336 | { | 2343 | { |
2337 | KRES::KCMKResources dlg( this, "" , 0 ); | 2344 | KRES::KCMKResources dlg( this, "" , 0 ); |
2338 | 2345 | ||
2339 | if ( !dlg.exec() ) | 2346 | if ( !dlg.exec() ) |
2340 | return; | 2347 | return; |
2341 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2348 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2342 | } | 2349 | } |
2343 | #endif //KAB_EMBEDDED | 2350 | #endif //KAB_EMBEDDED |
2344 | 2351 | ||
2345 | 2352 | ||
2346 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2353 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2347 | * for the attendees list of an event. | 2354 | * for the attendees list of an event. |
2348 | */ | 2355 | */ |
2349 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2356 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2350 | { | 2357 | { |
2351 | QStringList nameList; | 2358 | QStringList nameList; |
2352 | QStringList emailList; | 2359 | QStringList emailList; |
2353 | QStringList uidList; | 2360 | QStringList uidList; |
2354 | 2361 | ||
2355 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2362 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2356 | uint i=0; | 2363 | uint i=0; |
2357 | for (i=0; i < list.count(); i++) | 2364 | for (i=0; i < list.count(); i++) |
2358 | { | 2365 | { |
2359 | nameList.append(list[i].realName()); | 2366 | nameList.append(list[i].realName()); |
2360 | emailList.append(list[i].preferredEmail()); | 2367 | emailList.append(list[i].preferredEmail()); |
2361 | uidList.append(list[i].uid()); | 2368 | uidList.append(list[i].uid()); |
2362 | } | 2369 | } |
2363 | 2370 | ||
2364 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2371 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2365 | 2372 | ||
2366 | } | 2373 | } |
2367 | 2374 | ||
2368 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2375 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2369 | * to put them into the calendar. | 2376 | * to put them into the calendar. |
2370 | */ | 2377 | */ |
2371 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2378 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2372 | { | 2379 | { |
2373 | // qDebug("KABCore::requestForBirthdayList"); | 2380 | // qDebug("KABCore::requestForBirthdayList"); |
2374 | QStringList birthdayList; | 2381 | QStringList birthdayList; |
2375 | QStringList anniversaryList; | 2382 | QStringList anniversaryList; |
2376 | QStringList realNameList; | 2383 | QStringList realNameList; |
2377 | QStringList preferredEmailList; | 2384 | QStringList preferredEmailList; |
2378 | QStringList assembledNameList; | 2385 | QStringList assembledNameList; |
2379 | QStringList uidList; | 2386 | QStringList uidList; |
2380 | 2387 | ||
2381 | KABC::AddressBook::Iterator it; | 2388 | KABC::AddressBook::Iterator it; |
2382 | 2389 | ||
2383 | int count = 0; | 2390 | int count = 0; |
2384 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2391 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2385 | ++count; | 2392 | ++count; |
2386 | } | 2393 | } |
2387 | QProgressBar bar(count,0 ); | 2394 | QProgressBar bar(count,0 ); |
2388 | int w = 300; | 2395 | int w = 300; |
2389 | if ( QApplication::desktop()->width() < 320 ) | 2396 | if ( QApplication::desktop()->width() < 320 ) |
2390 | w = 220; | 2397 | w = 220; |
2391 | int h = bar.sizeHint().height() ; | 2398 | int h = bar.sizeHint().height() ; |
2392 | int dw = QApplication::desktop()->width(); | 2399 | int dw = QApplication::desktop()->width(); |
2393 | int dh = QApplication::desktop()->height(); | 2400 | int dh = QApplication::desktop()->height(); |
2394 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2401 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2395 | bar.show(); | 2402 | bar.show(); |
2396 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2403 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2397 | qApp->processEvents(); | 2404 | qApp->processEvents(); |
2398 | 2405 | ||
2399 | QDate bday; | 2406 | QDate bday; |
2400 | QString anni; | 2407 | QString anni; |
2401 | QString formattedbday; | 2408 | QString formattedbday; |
2402 | 2409 | ||
2403 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2410 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2404 | { | 2411 | { |
2405 | if ( ! bar.isVisible() ) | 2412 | if ( ! bar.isVisible() ) |
2406 | return; | 2413 | return; |
2407 | bar.setProgress( count++ ); | 2414 | bar.setProgress( count++ ); |
2408 | qApp->processEvents(); | 2415 | qApp->processEvents(); |
2409 | bday = (*it).birthday().date(); | 2416 | bday = (*it).birthday().date(); |
2410 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2417 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2411 | 2418 | ||
2412 | if ( bday.isValid() || !anni.isEmpty()) | 2419 | if ( bday.isValid() || !anni.isEmpty()) |
2413 | { | 2420 | { |
2414 | if (bday.isValid()) | 2421 | if (bday.isValid()) |
2415 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2422 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2416 | else | 2423 | else |
2417 | formattedbday = "NOTVALID"; | 2424 | formattedbday = "NOTVALID"; |
2418 | if (anni.isEmpty()) | 2425 | if (anni.isEmpty()) |
2419 | anni = "INVALID"; | 2426 | anni = "INVALID"; |
2420 | 2427 | ||
2421 | birthdayList.append(formattedbday); | 2428 | birthdayList.append(formattedbday); |
2422 | anniversaryList.append(anni); //should be ISODate | 2429 | anniversaryList.append(anni); //should be ISODate |
2423 | realNameList.append((*it).realName()); | 2430 | realNameList.append((*it).realName()); |
2424 | preferredEmailList.append((*it).preferredEmail()); | 2431 | preferredEmailList.append((*it).preferredEmail()); |
2425 | assembledNameList.append((*it).assembledName()); | 2432 | assembledNameList.append((*it).assembledName()); |
2426 | uidList.append((*it).uid()); | 2433 | uidList.append((*it).uid()); |
2427 | 2434 | ||
2428 | //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() ); | 2435 | //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() ); |
2429 | } | 2436 | } |
2430 | } | 2437 | } |
2431 | 2438 | ||
2432 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2439 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2433 | 2440 | ||
2434 | } | 2441 | } |
2435 | 2442 | ||
2436 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2443 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2437 | */ | 2444 | */ |
2438 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2445 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2439 | { | 2446 | { |
2440 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2447 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2441 | 2448 | ||
2442 | QString foundUid = QString::null; | 2449 | QString foundUid = QString::null; |
2443 | if ( ! uid.isEmpty() ) { | 2450 | if ( ! uid.isEmpty() ) { |
2444 | Addressee adrr = mAddressBook->findByUid( uid ); | 2451 | Addressee adrr = mAddressBook->findByUid( uid ); |
2445 | if ( !adrr.isEmpty() ) { | 2452 | if ( !adrr.isEmpty() ) { |
2446 | foundUid = uid; | 2453 | foundUid = uid; |
2447 | } | 2454 | } |
2448 | if ( email == "sendbacklist" ) { | 2455 | if ( email == "sendbacklist" ) { |
2449 | //qDebug("ssssssssssssssssssssssend "); | 2456 | //qDebug("ssssssssssssssssssssssend "); |
2450 | QStringList nameList; | 2457 | QStringList nameList; |
2451 | QStringList emailList; | 2458 | QStringList emailList; |
2452 | QStringList uidList; | 2459 | QStringList uidList; |
2453 | nameList.append(adrr.realName()); | 2460 | nameList.append(adrr.realName()); |
2454 | emailList = adrr.emails(); | 2461 | emailList = adrr.emails(); |
2455 | uidList.append( adrr.preferredEmail()); | 2462 | uidList.append( adrr.preferredEmail()); |
2456 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2463 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2457 | return; | 2464 | return; |
2458 | } | 2465 | } |
2459 | 2466 | ||
2460 | } | 2467 | } |
2461 | 2468 | ||
2462 | if ( email == "sendbacklist" ) | 2469 | if ( email == "sendbacklist" ) |
2463 | return; | 2470 | return; |
2464 | if (foundUid.isEmpty()) | 2471 | if (foundUid.isEmpty()) |
2465 | { | 2472 | { |
2466 | //find the uid of the person first | 2473 | //find the uid of the person first |
2467 | Addressee::List namelist; | 2474 | Addressee::List namelist; |
2468 | Addressee::List emaillist; | 2475 | Addressee::List emaillist; |
2469 | 2476 | ||
2470 | if (!name.isEmpty()) | 2477 | if (!name.isEmpty()) |
2471 | namelist = mAddressBook->findByName( name ); | 2478 | namelist = mAddressBook->findByName( name ); |
2472 | 2479 | ||
2473 | if (!email.isEmpty()) | 2480 | if (!email.isEmpty()) |
2474 | emaillist = mAddressBook->findByEmail( email ); | 2481 | emaillist = mAddressBook->findByEmail( email ); |
2475 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2482 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2476 | //check if we have a match in Namelist and Emaillist | 2483 | //check if we have a match in Namelist and Emaillist |
2477 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2484 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2478 | foundUid = emaillist[0].uid(); | 2485 | foundUid = emaillist[0].uid(); |
2479 | } | 2486 | } |
2480 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2487 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2481 | foundUid = namelist[0].uid(); | 2488 | foundUid = namelist[0].uid(); |
2482 | else | 2489 | else |
2483 | { | 2490 | { |
2484 | for (int i = 0; i < namelist.count(); i++) | 2491 | for (int i = 0; i < namelist.count(); i++) |
2485 | { | 2492 | { |
2486 | for (int j = 0; j < emaillist.count(); j++) | 2493 | for (int j = 0; j < emaillist.count(); j++) |
2487 | { | 2494 | { |
2488 | if (namelist[i] == emaillist[j]) | 2495 | if (namelist[i] == emaillist[j]) |
2489 | { | 2496 | { |
2490 | foundUid = namelist[i].uid(); | 2497 | foundUid = namelist[i].uid(); |
2491 | } | 2498 | } |
2492 | } | 2499 | } |
2493 | } | 2500 | } |
2494 | } | 2501 | } |
2495 | } | 2502 | } |
2496 | else | 2503 | else |
2497 | { | 2504 | { |
2498 | foundUid = uid; | 2505 | foundUid = uid; |
2499 | } | 2506 | } |
2500 | 2507 | ||
2501 | if (!foundUid.isEmpty()) | 2508 | if (!foundUid.isEmpty()) |
2502 | { | 2509 | { |
2503 | 2510 | ||
2504 | // raise Ka/Pi if it is in the background | 2511 | // raise Ka/Pi if it is in the background |
2505 | #ifndef DESKTOP_VERSION | 2512 | #ifndef DESKTOP_VERSION |
2506 | #ifndef KORG_NODCOP | 2513 | #ifndef KORG_NODCOP |
2507 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2514 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2508 | #endif | 2515 | #endif |
2509 | #endif | 2516 | #endif |
2510 | 2517 | ||
2511 | mMainWindow->showMaximized(); | 2518 | mMainWindow->showMaximized(); |
2512 | mMainWindow-> raise(); | 2519 | mMainWindow-> raise(); |
2513 | 2520 | ||
2514 | mViewManager->setSelected( "", false); | 2521 | mViewManager->setSelected( "", false); |
2515 | mViewManager->refreshView( "" ); | 2522 | mViewManager->refreshView( "" ); |
2516 | mViewManager->setSelected( foundUid, true ); | 2523 | mViewManager->setSelected( foundUid, true ); |
2517 | mViewManager->refreshView( foundUid ); | 2524 | mViewManager->refreshView( foundUid ); |
2518 | 2525 | ||
2519 | if ( !mMultipleViewsAtOnce ) | 2526 | if ( !mMultipleViewsAtOnce ) |
2520 | { | 2527 | { |
2521 | setDetailsVisible( true ); | 2528 | setDetailsVisible( true ); |
2522 | mActionDetails->setChecked(true); | 2529 | mActionDetails->setChecked(true); |
2523 | } | 2530 | } |
2524 | } | 2531 | } |
2525 | } | 2532 | } |
2526 | 2533 | ||
2527 | void KABCore::whatsnew() | 2534 | void KABCore::whatsnew() |
2528 | { | 2535 | { |
2529 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2536 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2530 | } | 2537 | } |
2531 | void KABCore::synchowto() | 2538 | void KABCore::synchowto() |
2532 | { | 2539 | { |
2533 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 2540 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
2534 | } | 2541 | } |
2535 | void KABCore::kdesynchowto() | 2542 | void KABCore::kdesynchowto() |
2536 | { | 2543 | { |
2537 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 2544 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
2538 | } | 2545 | } |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 88e83f0..c7c12ff 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -91,425 +91,426 @@ class KABCore : public QWidget, public KSyncInterface | |||
91 | void addActionsManually(); | 91 | void addActionsManually(); |
92 | #endif //KAB_EMBEDDED | 92 | #endif //KAB_EMBEDDED |
93 | /** | 93 | /** |
94 | Restores the global settings. | 94 | Restores the global settings. |
95 | */ | 95 | */ |
96 | void restoreSettings(); | 96 | void restoreSettings(); |
97 | 97 | ||
98 | /** | 98 | /** |
99 | Saves the global settings. | 99 | Saves the global settings. |
100 | */ | 100 | */ |
101 | void saveSettings(); | 101 | void saveSettings(); |
102 | 102 | ||
103 | /** | 103 | /** |
104 | Returns a pointer to the StdAddressBook of the application. | 104 | Returns a pointer to the StdAddressBook of the application. |
105 | */ | 105 | */ |
106 | KABC::AddressBook *addressBook() const; | 106 | KABC::AddressBook *addressBook() const; |
107 | 107 | ||
108 | /** | 108 | /** |
109 | Returns a pointer to the KConfig object of the application. | 109 | Returns a pointer to the KConfig object of the application. |
110 | */ | 110 | */ |
111 | static KConfig *config(); | 111 | static KConfig *config(); |
112 | 112 | ||
113 | /** | 113 | /** |
114 | Returns a pointer to the global KActionCollection object. So | 114 | Returns a pointer to the global KActionCollection object. So |
115 | other classes can register their actions easily. | 115 | other classes can register their actions easily. |
116 | */ | 116 | */ |
117 | KActionCollection *actionCollection() const; | 117 | KActionCollection *actionCollection() const; |
118 | 118 | ||
119 | /** | 119 | /** |
120 | Returns the current search field of the Incremental Search Widget. | 120 | Returns the current search field of the Incremental Search Widget. |
121 | */ | 121 | */ |
122 | KABC::Field *currentSearchField() const; | 122 | KABC::Field *currentSearchField() const; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | Returns the uid list of the currently selected contacts. | 125 | Returns the uid list of the currently selected contacts. |
126 | */ | 126 | */ |
127 | QStringList selectedUIDs() const; | 127 | QStringList selectedUIDs() const; |
128 | 128 | ||
129 | /** | 129 | /** |
130 | Displays the ResourceSelectDialog and returns the selected | 130 | Displays the ResourceSelectDialog and returns the selected |
131 | resource or a null pointer if no resource was selected by | 131 | resource or a null pointer if no resource was selected by |
132 | the user. | 132 | the user. |
133 | */ | 133 | */ |
134 | KABC::Resource *requestResource( QWidget *parent ); | 134 | KABC::Resource *requestResource( QWidget *parent ); |
135 | 135 | ||
136 | #ifndef KAB_EMBEDDED | 136 | #ifndef KAB_EMBEDDED |
137 | static KAboutData *createAboutData(); | 137 | static KAboutData *createAboutData(); |
138 | #endif //KAB_EMBEDDED | 138 | #endif //KAB_EMBEDDED |
139 | 139 | ||
140 | #ifdef KAB_EMBEDDED | 140 | #ifdef KAB_EMBEDDED |
141 | inline QPopupMenu* getImportMenu() { return ImportMenu;} | 141 | inline QPopupMenu* getImportMenu() { return ImportMenu;} |
142 | inline QPopupMenu* getExportMenu() { return ExportMenu;} | 142 | inline QPopupMenu* getExportMenu() { return ExportMenu;} |
143 | #endif //KAB_EMBEDDED | 143 | #endif //KAB_EMBEDDED |
144 | 144 | ||
145 | public slots: | 145 | public slots: |
146 | #ifdef KAB_EMBEDDED | 146 | #ifdef KAB_EMBEDDED |
147 | void createAboutData(); | 147 | void createAboutData(); |
148 | #endif //KAB_EMBEDDED | 148 | #endif //KAB_EMBEDDED |
149 | void setDetailsToggle(); | 149 | void setDetailsToggle(); |
150 | 150 | ||
151 | void showLicence(); | 151 | void showLicence(); |
152 | void faq(); | 152 | void faq(); |
153 | void whatsnew() ; | 153 | void whatsnew() ; |
154 | void synchowto() ; | 154 | void synchowto() ; |
155 | void multisynchowto() ; | 155 | void multisynchowto() ; |
156 | void kdesynchowto() ; | 156 | void kdesynchowto() ; |
157 | void writeToPhone(); | 157 | void writeToPhone(); |
158 | 158 | ||
159 | /** | 159 | /** |
160 | Is called whenever a contact is selected in the view. | 160 | Is called whenever a contact is selected in the view. |
161 | */ | 161 | */ |
162 | void setContactSelected( const QString &uid ); | 162 | void setContactSelected( const QString &uid ); |
163 | 163 | ||
164 | /** | 164 | /** |
165 | Opens the preferred mail composer with all selected contacts as | 165 | Opens the preferred mail composer with all selected contacts as |
166 | arguments. | 166 | arguments. |
167 | */ | 167 | */ |
168 | void sendMail(); | 168 | void sendMail(); |
169 | 169 | ||
170 | /** | 170 | /** |
171 | Opens the preferred mail composer with the given contacts as | 171 | Opens the preferred mail composer with the given contacts as |
172 | arguments. | 172 | arguments. |
173 | */ | 173 | */ |
174 | void sendMail( const QString& email ); | 174 | void sendMail( const QString& email ); |
175 | 175 | ||
176 | 176 | ||
177 | void mailVCard(); | 177 | void mailVCard(); |
178 | void mailVCard(const QStringList& uids); | 178 | void mailVCard(const QStringList& uids); |
179 | 179 | ||
180 | /** | 180 | /** |
181 | Beams the "WhoAmI contact. | 181 | Beams the "WhoAmI contact. |
182 | */ | 182 | */ |
183 | void beamMySelf(); | 183 | void beamMySelf(); |
184 | 184 | ||
185 | void beamVCard(); | 185 | void beamVCard(); |
186 | void export2phone(); | 186 | void export2phone(); |
187 | void beamVCard(const QStringList& uids); | 187 | void beamVCard(const QStringList& uids); |
188 | void beamDone( Ir *ir ); | 188 | void beamDone( Ir *ir ); |
189 | 189 | ||
190 | 190 | ||
191 | /** | 191 | /** |
192 | Starts the preferred web browser with the given URL as argument. | 192 | Starts the preferred web browser with the given URL as argument. |
193 | */ | 193 | */ |
194 | void browse( const QString& url ); | 194 | void browse( const QString& url ); |
195 | 195 | ||
196 | /** | 196 | /** |
197 | Select all contacts in the view. | 197 | Select all contacts in the view. |
198 | */ | 198 | */ |
199 | void selectAllContacts(); | 199 | void selectAllContacts(); |
200 | 200 | ||
201 | /** | 201 | /** |
202 | Deletes all selected contacts from the address book. | 202 | Deletes all selected contacts from the address book. |
203 | */ | 203 | */ |
204 | void deleteContacts(); | 204 | void deleteContacts(); |
205 | 205 | ||
206 | /** | 206 | /** |
207 | Deletes given contacts from the address book. | 207 | Deletes given contacts from the address book. |
208 | 208 | ||
209 | @param uids The uids of the contacts, which shall be deleted. | 209 | @param uids The uids of the contacts, which shall be deleted. |
210 | */ | 210 | */ |
211 | void deleteContacts( const QStringList &uids ); | 211 | void deleteContacts( const QStringList &uids ); |
212 | 212 | ||
213 | /** | 213 | /** |
214 | Copys the selected contacts into clipboard for later pasting. | 214 | Copys the selected contacts into clipboard for later pasting. |
215 | */ | 215 | */ |
216 | void copyContacts(); | 216 | void copyContacts(); |
217 | 217 | ||
218 | /** | 218 | /** |
219 | Cuts the selected contacts and stores them for later pasting. | 219 | Cuts the selected contacts and stores them for later pasting. |
220 | */ | 220 | */ |
221 | void cutContacts(); | 221 | void cutContacts(); |
222 | 222 | ||
223 | /** | 223 | /** |
224 | Paste contacts from clipboard into the address book. | 224 | Paste contacts from clipboard into the address book. |
225 | */ | 225 | */ |
226 | void pasteContacts(); | 226 | void pasteContacts(); |
227 | 227 | ||
228 | /** | 228 | /** |
229 | Paste given contacts into the address book. | 229 | Paste given contacts into the address book. |
230 | 230 | ||
231 | @param list The list of addressee, which shall be pasted. | 231 | @param list The list of addressee, which shall be pasted. |
232 | */ | 232 | */ |
233 | void pasteContacts( KABC::Addressee::List &list ); | 233 | void pasteContacts( KABC::Addressee::List &list ); |
234 | 234 | ||
235 | /** | 235 | /** |
236 | Sets the whoAmI contact, that is used by many other programs to | 236 | Sets the whoAmI contact, that is used by many other programs to |
237 | get personal information about the current user. | 237 | get personal information about the current user. |
238 | */ | 238 | */ |
239 | void setWhoAmI(); | 239 | void setWhoAmI(); |
240 | 240 | ||
241 | /** | 241 | /** |
242 | Displays the category dialog and applies the result to all | 242 | Displays the category dialog and applies the result to all |
243 | selected contacts. | 243 | selected contacts. |
244 | */ | 244 | */ |
245 | void setCategories(); | 245 | void setCategories(); |
246 | void manageCategories(); | 246 | void manageCategories(); |
247 | void editCategories(); | 247 | void editCategories(); |
248 | 248 | ||
249 | /** | 249 | /** |
250 | Sets the field list of the Incremental Search Widget. | 250 | Sets the field list of the Incremental Search Widget. |
251 | */ | 251 | */ |
252 | void setSearchFields( const KABC::Field::List &fields ); | 252 | void setSearchFields( const KABC::Field::List &fields ); |
253 | 253 | ||
254 | /** | 254 | /** |
255 | Search with the current search field for a contact, that matches | 255 | Search with the current search field for a contact, that matches |
256 | the given text, and selects it in the view. | 256 | the given text, and selects it in the view. |
257 | */ | 257 | */ |
258 | void incrementalSearch( const QString& text ); | 258 | void incrementalSearch( const QString& text ); |
259 | 259 | ||
260 | /** | 260 | /** |
261 | Marks the address book as modified. | 261 | Marks the address book as modified. |
262 | */ | 262 | */ |
263 | void setModified(); | 263 | void setModified(); |
264 | /** | 264 | /** |
265 | Marks the address book as modified without refreshing the view. | 265 | Marks the address book as modified without refreshing the view. |
266 | */ | 266 | */ |
267 | void setModifiedWOrefresh(); | 267 | void setModifiedWOrefresh(); |
268 | 268 | ||
269 | /** | 269 | /** |
270 | Marks the address book as modified concerning the argument. | 270 | Marks the address book as modified concerning the argument. |
271 | */ | 271 | */ |
272 | void setModified( bool modified ); | 272 | void setModified( bool modified ); |
273 | 273 | ||
274 | /** | 274 | /** |
275 | Returns whether the address book is modified. | 275 | Returns whether the address book is modified. |
276 | */ | 276 | */ |
277 | bool modified() const; | 277 | bool modified() const; |
278 | 278 | ||
279 | /** | 279 | /** |
280 | Called whenever an contact is modified in the contact editor | 280 | Called whenever an contact is modified in the contact editor |
281 | dialog or the quick edit. | 281 | dialog or the quick edit. |
282 | */ | 282 | */ |
283 | void contactModified( const KABC::Addressee &addr ); | 283 | void contactModified( const KABC::Addressee &addr ); |
284 | 284 | ||
285 | /** | 285 | /** |
286 | DCOP METHODS. | 286 | DCOP METHODS. |
287 | */ | 287 | */ |
288 | void addEmail( QString addr ); | 288 | void addEmail( QString addr ); |
289 | void importVCard( const KURL& url, bool showPreview ); | 289 | void importVCard( const KURL& url, bool showPreview ); |
290 | void importVCard( const QString& vCard, bool showPreview ); | 290 | void importVCard( const QString& vCard, bool showPreview ); |
291 | void newContact(); | 291 | void newContact(); |
292 | QString getNameByPhone( const QString& phone ); | 292 | QString getNameByPhone( const QString& phone ); |
293 | /** | 293 | /** |
294 | END DCOP METHODS | 294 | END DCOP METHODS |
295 | */ | 295 | */ |
296 | 296 | ||
297 | /** | 297 | /** |
298 | Saves the contents of the AddressBook back to disk. | 298 | Saves the contents of the AddressBook back to disk. |
299 | */ | 299 | */ |
300 | void save(); | 300 | void save(); |
301 | 301 | ||
302 | /** | 302 | /** |
303 | Undos the last command using the undo stack. | 303 | Undos the last command using the undo stack. |
304 | */ | 304 | */ |
305 | void undo(); | 305 | void undo(); |
306 | 306 | ||
307 | /** | 307 | /** |
308 | Redos the last command that was undone, using the redo stack. | 308 | Redos the last command that was undone, using the redo stack. |
309 | */ | 309 | */ |
310 | void redo(); | 310 | void redo(); |
311 | 311 | ||
312 | /** | 312 | /** |
313 | Shows the edit dialog for the given uid. If the uid is QString::null, | 313 | Shows the edit dialog for the given uid. If the uid is QString::null, |
314 | the method will try to find a selected addressee in the view. | 314 | the method will try to find a selected addressee in the view. |
315 | */ | 315 | */ |
316 | void editContact( const QString &uid /*US = QString::null*/ ); | 316 | void editContact( const QString &uid /*US = QString::null*/ ); |
317 | //US added a second method without defaultparameter | 317 | //US added a second method without defaultparameter |
318 | void editContact2(); | 318 | void editContact2(); |
319 | 319 | ||
320 | /** | 320 | /** |
321 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 321 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
322 | the method will try to find a selected addressee in the view. | 322 | the method will try to find a selected addressee in the view. |
323 | */ | 323 | */ |
324 | void executeContact( const QString &uid /*US = QString::null*/ ); | 324 | void executeContact( const QString &uid /*US = QString::null*/ ); |
325 | 325 | ||
326 | /** | 326 | /** |
327 | Launches the configuration dialog. | 327 | Launches the configuration dialog. |
328 | */ | 328 | */ |
329 | void openConfigDialog(); | 329 | void openConfigDialog(); |
330 | 330 | ||
331 | /** | 331 | /** |
332 | Launches the ldap search dialog. | 332 | Launches the ldap search dialog. |
333 | */ | 333 | */ |
334 | void openLDAPDialog(); | 334 | void openLDAPDialog(); |
335 | 335 | ||
336 | /** | 336 | /** |
337 | Creates a KAddressBookPrinter, which will display the print | 337 | Creates a KAddressBookPrinter, which will display the print |
338 | dialog and do the printing. | 338 | dialog and do the printing. |
339 | */ | 339 | */ |
340 | void print(); | 340 | void print(); |
341 | 341 | ||
342 | /** | 342 | /** |
343 | Registers a new GUI client, so plugins can register its actions. | 343 | Registers a new GUI client, so plugins can register its actions. |
344 | */ | 344 | */ |
345 | void addGUIClient( KXMLGUIClient *client ); | 345 | void addGUIClient( KXMLGUIClient *client ); |
346 | 346 | ||
347 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 347 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
348 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 348 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
349 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 349 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
350 | 350 | ||
351 | 351 | ||
352 | signals: | 352 | signals: |
353 | void contactSelected( const QString &name ); | 353 | void contactSelected( const QString &name ); |
354 | void contactSelected( const QPixmap &pixmap ); | 354 | void contactSelected( const QPixmap &pixmap ); |
355 | public slots: | 355 | public slots: |
356 | void recieve(QString cmsg ); | 356 | void recieve(QString cmsg ); |
357 | void getFile( bool success ); | 357 | void getFile( bool success ); |
358 | void syncFileRequest(); | 358 | void syncFileRequest(); |
359 | void setDetailsVisible( bool visible ); | 359 | void setDetailsVisible( bool visible ); |
360 | void setDetailsToState(); | 360 | void setDetailsToState(); |
361 | // void slotSyncMenu( int ); | 361 | // void slotSyncMenu( int ); |
362 | private slots: | 362 | private slots: |
363 | void updateToolBar(); | 363 | void updateToolBar(); |
364 | void updateMainWindow(); | 364 | void updateMainWindow(); |
365 | void receive( const QCString& cmsg, const QByteArray& data ); | 365 | void receive( const QCString& cmsg, const QByteArray& data ); |
366 | void toggleBeamReceive( ); | 366 | void toggleBeamReceive( ); |
367 | void disableBR(bool); | 367 | void disableBR(bool); |
368 | void setJumpButtonBarVisible( bool visible ); | 368 | void setJumpButtonBarVisible( bool visible ); |
369 | void setCaptionBack(); | 369 | void setCaptionBack(); |
370 | void importFromOL(); | 370 | void importFromOL(); |
371 | void extensionModified( const KABC::Addressee::List &list ); | 371 | void extensionModified( const KABC::Addressee::List &list ); |
372 | void extensionChanged( int id ); | 372 | void extensionChanged( int id ); |
373 | void clipboardDataChanged(); | 373 | void clipboardDataChanged(); |
374 | void updateActionMenu(); | 374 | void updateActionMenu(); |
375 | void configureKeyBindings(); | 375 | void configureKeyBindings(); |
376 | void removeVoice(); | 376 | void removeVoice(); |
377 | #ifdef KAB_EMBEDDED | 377 | #ifdef KAB_EMBEDDED |
378 | void configureResources(); | 378 | void configureResources(); |
379 | #endif //KAB_EMBEDDED | 379 | #endif //KAB_EMBEDDED |
380 | 380 | ||
381 | void slotEditorDestroyed( const QString &uid ); | 381 | void slotEditorDestroyed( const QString &uid ); |
382 | void configurationChanged(); | 382 | void configurationChanged(); |
383 | void addressBookChanged(); | 383 | void addressBookChanged(); |
384 | 384 | ||
385 | private: | 385 | private: |
386 | void resizeEvent(QResizeEvent* e ); | 386 | void resizeEvent(QResizeEvent* e ); |
387 | bool mBRdisabled; | 387 | bool mBRdisabled; |
388 | #ifndef DESKTOP_VERSION | 388 | #ifndef DESKTOP_VERSION |
389 | QCopChannel* infrared; | 389 | QCopChannel* infrared; |
390 | #endif | 390 | #endif |
391 | QTimer *mMessageTimer; | 391 | QTimer *mMessageTimer; |
392 | void initGUI(); | 392 | void initGUI(); |
393 | void initActions(); | 393 | void initActions(); |
394 | QString getPhoneFile(); | 394 | QString getPhoneFile(); |
395 | 395 | ||
396 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 396 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
397 | const char *name = 0 ); | 397 | const char *name = 0 ); |
398 | 398 | ||
399 | KXMLGUIClient *mGUIClient; | 399 | KXMLGUIClient *mGUIClient; |
400 | 400 | ||
401 | KABC::AddressBook *mAddressBook; | 401 | KABC::AddressBook *mAddressBook; |
402 | 402 | ||
403 | ViewManager *mViewManager; | 403 | ViewManager *mViewManager; |
404 | // QSplitter *mDetailsSplitter; | 404 | // QSplitter *mDetailsSplitter; |
405 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 405 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
406 | ViewContainer *mDetails; | 406 | ViewContainer *mDetails; |
407 | KDGanttMinimizeSplitter* mMiniSplitter; | 407 | KDGanttMinimizeSplitter* mMiniSplitter; |
408 | XXPortManager *mXXPortManager; | 408 | XXPortManager *mXXPortManager; |
409 | JumpButtonBar *mJumpButtonBar; | 409 | JumpButtonBar *mJumpButtonBar; |
410 | IncSearchWidget *mIncSearchWidget; | 410 | IncSearchWidget *mIncSearchWidget; |
411 | ExtensionManager *mExtensionManager; | 411 | ExtensionManager *mExtensionManager; |
412 | 412 | ||
413 | KCMultiDialog *mConfigureDialog; | 413 | KCMultiDialog *mConfigureDialog; |
414 | 414 | ||
415 | #ifndef KAB_EMBEDDED | 415 | #ifndef KAB_EMBEDDED |
416 | LDAPSearchDialog *mLdapSearchDialog; | 416 | LDAPSearchDialog *mLdapSearchDialog; |
417 | #endif //KAB_EMBEDDED | 417 | #endif //KAB_EMBEDDED |
418 | // QDict<AddresseeEditorDialog> mEditorDict; | 418 | // QDict<AddresseeEditorDialog> mEditorDict; |
419 | AddresseeEditorDialog *mEditorDialog; | 419 | AddresseeEditorDialog *mEditorDialog; |
420 | bool mReadWrite; | 420 | bool mReadWrite; |
421 | bool mModified; | 421 | bool mModified; |
422 | bool mIsPart; | 422 | bool mIsPart; |
423 | bool mMultipleViewsAtOnce; | 423 | bool mMultipleViewsAtOnce; |
424 | 424 | ||
425 | 425 | ||
426 | //US file menu | 426 | //US file menu |
427 | KAction *mActionMail; | 427 | KAction *mActionMail; |
428 | KAction *mActionBeam; | 428 | KAction *mActionBeam; |
429 | KToggleAction *mActionBR; | 429 | KToggleAction *mActionBR; |
430 | KAction *mActionExport2phone; | 430 | KAction *mActionExport2phone; |
431 | KAction* mActionPrint; | 431 | KAction* mActionPrint; |
432 | KAction* mActionNewContact; | 432 | KAction* mActionNewContact; |
433 | KAction *mActionSave; | 433 | KAction *mActionSave; |
434 | KAction *mActionEditAddressee; | 434 | KAction *mActionEditAddressee; |
435 | KAction *mActionMailVCard; | 435 | KAction *mActionMailVCard; |
436 | KAction *mActionBeamVCard; | 436 | KAction *mActionBeamVCard; |
437 | 437 | ||
438 | KAction *mActionQuit; | 438 | KAction *mActionQuit; |
439 | 439 | ||
440 | //US edit menu | 440 | //US edit menu |
441 | KAction *mActionCopy; | 441 | KAction *mActionCopy; |
442 | KAction *mActionCut; | 442 | KAction *mActionCut; |
443 | KAction *mActionPaste; | 443 | KAction *mActionPaste; |
444 | KAction *mActionSelectAll; | 444 | KAction *mActionSelectAll; |
445 | KAction *mActionUndo; | 445 | KAction *mActionUndo; |
446 | KAction *mActionRedo; | 446 | KAction *mActionRedo; |
447 | KAction *mActionDelete; | 447 | KAction *mActionDelete; |
448 | 448 | ||
449 | //US settings menu | 449 | //US settings menu |
450 | KAction *mActionConfigResources; | 450 | KAction *mActionConfigResources; |
451 | KAction *mActionConfigKAddressbook; | 451 | KAction *mActionConfigKAddressbook; |
452 | KAction *mActionConfigShortcuts; | 452 | KAction *mActionConfigShortcuts; |
453 | KAction *mActionConfigureToolbars; | 453 | KAction *mActionConfigureToolbars; |
454 | KAction *mActionKeyBindings; | 454 | KAction *mActionKeyBindings; |
455 | KToggleAction *mActionJumpBar; | 455 | KToggleAction *mActionJumpBar; |
456 | KToggleAction *mActionDetails; | 456 | KToggleAction *mActionDetails; |
457 | KAction *mActionWhoAmI; | 457 | KAction *mActionWhoAmI; |
458 | KAction *mActionCategories; | 458 | KAction *mActionCategories; |
459 | KAction *mActionEditCategories; | 459 | KAction *mActionEditCategories; |
460 | KAction *mActionManageCategories; | 460 | KAction *mActionManageCategories; |
461 | KAction *mActionAboutKAddressbook; | 461 | KAction *mActionAboutKAddressbook; |
462 | KAction *mActionLicence; | 462 | KAction *mActionLicence; |
463 | KAction *mActionFaq; | 463 | KAction *mActionFaq; |
464 | KAction *mActionWN; | 464 | KAction *mActionWN; |
465 | KAction *mActionSyncHowto; | 465 | KAction *mActionSyncHowto; |
466 | KAction *mActionKdeSyncHowto; | 466 | KAction *mActionKdeSyncHowto; |
467 | KAction *mActionMultiSyncHowto; | 467 | KAction *mActionMultiSyncHowto; |
468 | 468 | ||
469 | KAction *mActionDeleteView; | 469 | KAction *mActionDeleteView; |
470 | 470 | ||
471 | QPopupMenu *viewMenu; | 471 | QPopupMenu *viewMenu; |
472 | QPopupMenu *filterMenu; | 472 | QPopupMenu *filterMenu; |
473 | QPopupMenu *settingsMenu; | 473 | QPopupMenu *settingsMenu; |
474 | QPopupMenu *changeMenu; | 474 | QPopupMenu *changeMenu; |
475 | QPopupMenu *beamMenu; | ||
475 | //US QAction *mActionSave; | 476 | //US QAction *mActionSave; |
476 | QPopupMenu *ImportMenu; | 477 | QPopupMenu *ImportMenu; |
477 | QPopupMenu *ExportMenu; | 478 | QPopupMenu *ExportMenu; |
478 | //LR additional methods | 479 | //LR additional methods |
479 | KAction *mActionRemoveVoice; | 480 | KAction *mActionRemoveVoice; |
480 | KAction * mActionImportOL; | 481 | KAction * mActionImportOL; |
481 | 482 | ||
482 | #ifndef KAB_EMBEDDED | 483 | #ifndef KAB_EMBEDDED |
483 | KAddressBookService *mAddressBookService; | 484 | KAddressBookService *mAddressBookService; |
484 | #endif //KAB_EMBEDDED | 485 | #endif //KAB_EMBEDDED |
485 | 486 | ||
486 | class KABCorePrivate; | 487 | class KABCorePrivate; |
487 | KABCorePrivate *d; | 488 | KABCorePrivate *d; |
488 | //US bool mBlockSaveFlag; | 489 | //US bool mBlockSaveFlag; |
489 | 490 | ||
490 | #ifdef KAB_EMBEDDED | 491 | #ifdef KAB_EMBEDDED |
491 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 492 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
492 | #endif //KAB_EMBEDDED | 493 | #endif //KAB_EMBEDDED |
493 | 494 | ||
494 | //this are the overwritten callbackmethods from the syncinterface | 495 | //this are the overwritten callbackmethods from the syncinterface |
495 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 496 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
496 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 497 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
497 | virtual void removeSyncInfo( QString syncProfile); | 498 | virtual void removeSyncInfo( QString syncProfile); |
498 | bool syncPhone(); | 499 | bool syncPhone(); |
499 | void message( QString m ); | 500 | void message( QString m ); |
500 | 501 | ||
501 | // LR ******************************* | 502 | // LR ******************************* |
502 | // sync stuff! | 503 | // sync stuff! |
503 | QString sentSyncFile(); | 504 | QString sentSyncFile(); |
504 | QPopupMenu *syncMenu; | 505 | QPopupMenu *syncMenu; |
505 | KSyncManager* syncManager; | 506 | KSyncManager* syncManager; |
506 | int mGlobalSyncMode; | 507 | int mGlobalSyncMode; |
507 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 508 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
508 | KABC::Addressee getLastSyncAddressee(); | 509 | KABC::Addressee getLastSyncAddressee(); |
509 | QDateTime mLastAddressbookSync; | 510 | QDateTime mLastAddressbookSync; |
510 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 511 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
511 | // ********************* | 512 | // ********************* |
512 | 513 | ||
513 | }; | 514 | }; |
514 | 515 | ||
515 | #endif | 516 | #endif |