-rw-r--r-- | kaddressbook/kabcore.cpp | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d891b07..25891a0 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -389,133 +389,133 @@ void KABCore::createAboutData() | |||
389 | QMessageBox::about( this, "About KAddressbook/Pi", | 389 | QMessageBox::about( this, "About KAddressbook/Pi", |
390 | "KAddressbook/Platform-independent\n" | 390 | "KAddressbook/Platform-independent\n" |
391 | "(KA/Pi) " +version + " - " + | 391 | "(KA/Pi) " +version + " - " + |
392 | #ifdef DESKTOP_VERSION | 392 | #ifdef DESKTOP_VERSION |
393 | "Desktop Edition\n" | 393 | "Desktop Edition\n" |
394 | #else | 394 | #else |
395 | "PDA-Edition\n" | 395 | "PDA-Edition\n" |
396 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 396 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
397 | #endif | 397 | #endif |
398 | 398 | ||
399 | "(c) 2004 Ulf Schenk\n" | 399 | "(c) 2004 Ulf Schenk\n" |
400 | "(c) 1997-2003, The KDE PIM Team\n" | 400 | "(c) 1997-2003, The KDE PIM Team\n" |
401 | "Tobias Koenig Current maintainer tokoe@kde.org\n" | 401 | "Tobias Koenig Current maintainer tokoe@kde.org\n" |
402 | "Don Sanders Original author\n" | 402 | "Don Sanders Original author\n" |
403 | "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" | 403 | "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" |
404 | "Mike Pilone GUI and framework redesign mpilone@slac.com\n" | 404 | "Mike Pilone GUI and framework redesign mpilone@slac.com\n" |
405 | "Greg Stern DCOP interface\n" | 405 | "Greg Stern DCOP interface\n" |
406 | "Mark Westcot Contact pinning\n" | 406 | "Mark Westcot Contact pinning\n" |
407 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 407 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
408 | "Steffen Hansen LDAP Lookup hansen@kde.org\n" | 408 | "Steffen Hansen LDAP Lookup hansen@kde.org\n" |
409 | #ifdef _WIN32_ | 409 | #ifdef _WIN32_ |
410 | "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" | 410 | "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" |
411 | #endif | 411 | #endif |
412 | ); | 412 | ); |
413 | } | 413 | } |
414 | 414 | ||
415 | void KABCore::setContactSelected( const QString &uid ) | 415 | void KABCore::setContactSelected( const QString &uid ) |
416 | { | 416 | { |
417 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 417 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
418 | if ( !mDetails->isHidden() ) | 418 | if ( !mDetails->isHidden() ) |
419 | mDetails->setAddressee( addr ); | 419 | mDetails->setAddressee( addr ); |
420 | 420 | ||
421 | if ( !addr.isEmpty() ) { | 421 | if ( !addr.isEmpty() ) { |
422 | emit contactSelected( addr.formattedName() ); | 422 | emit contactSelected( addr.formattedName() ); |
423 | KABC::Picture pic = addr.photo(); | 423 | KABC::Picture pic = addr.photo(); |
424 | if ( pic.isIntern() ) { | 424 | if ( pic.isIntern() ) { |
425 | //US emit contactSelected( pic.data() ); | 425 | //US emit contactSelected( pic.data() ); |
426 | //US instead use: | 426 | //US instead use: |
427 | QPixmap px; | 427 | QPixmap px; |
428 | if (pic.data().isNull() != true) | 428 | if (pic.data().isNull() != true) |
429 | { | 429 | { |
430 | px.convertFromImage(pic.data()); | 430 | px.convertFromImage(pic.data()); |
431 | } | 431 | } |
432 | 432 | ||
433 | emit contactSelected( px ); | 433 | emit contactSelected( px ); |
434 | } | 434 | } |
435 | } | 435 | } |
436 | 436 | ||
437 | 437 | ||
438 | mExtensionManager->setSelectionChanged(); | 438 | mExtensionManager->setSelectionChanged(); |
439 | 439 | ||
440 | // update the actions | 440 | // update the actions |
441 | bool selected = !uid.isEmpty(); | 441 | bool selected = !uid.isEmpty(); |
442 | 442 | ||
443 | if ( mReadWrite ) { | 443 | if ( mReadWrite ) { |
444 | mActionCut->setEnabled( selected ); | 444 | mActionCut->setEnabled( selected ); |
445 | mActionPaste->setEnabled( selected ); | 445 | mActionPaste->setEnabled( selected ); |
446 | } | 446 | } |
447 | 447 | ||
448 | mActionCopy->setEnabled( selected ); | 448 | mActionCopy->setEnabled( selected ); |
449 | mActionDelete->setEnabled( selected ); | 449 | mActionDelete->setEnabled( selected ); |
450 | mActionEditAddressee->setEnabled( selected ); | 450 | mActionEditAddressee->setEnabled( selected ); |
451 | mActionMail->setEnabled( selected ); | 451 | mActionMail->setEnabled( selected ); |
452 | mActionMailVCard->setEnabled( selected ); | 452 | mActionMailVCard->setEnabled( selected ); |
453 | if (mActionBeam) | 453 | //if (mActionBeam) |
454 | mActionBeam->setEnabled( selected ); | 454 | //mActionBeam->setEnabled( selected ); |
455 | 455 | ||
456 | if (mActionBeam) | 456 | if (mActionBeamVCard) |
457 | mActionBeamVCard->setEnabled( selected ); | 457 | mActionBeamVCard->setEnabled( selected ); |
458 | 458 | ||
459 | mActionWhoAmI->setEnabled( selected ); | 459 | mActionWhoAmI->setEnabled( selected ); |
460 | mActionCategories->setEnabled( selected ); | 460 | mActionCategories->setEnabled( selected ); |
461 | } | 461 | } |
462 | 462 | ||
463 | void KABCore::sendMail() | 463 | void KABCore::sendMail() |
464 | { | 464 | { |
465 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 465 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
466 | } | 466 | } |
467 | 467 | ||
468 | void KABCore::sendMail( const QString& email ) | 468 | void KABCore::sendMail( const QString& email ) |
469 | { | 469 | { |
470 | //US original kde implementation : kapp->invokeMailer( email, "" ); | 470 | //US original kde implementation : kapp->invokeMailer( email, "" ); |
471 | 471 | ||
472 | /*US original qtopia implementation | 472 | /*US original qtopia implementation |
473 | PimContact c = abList->currentEntry(); | 473 | PimContact c = abList->currentEntry(); |
474 | QString name = c.fileAs(); | 474 | QString name = c.fileAs(); |
475 | QString email = c.defaultEmail(); | 475 | QString email = c.defaultEmail(); |
476 | #ifndef QT_NO_COP | 476 | #ifndef QT_NO_COP |
477 | QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)"); | 477 | QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)"); |
478 | e << name << email; | 478 | e << name << email; |
479 | #else | 479 | #else |
480 | */ | 480 | */ |
481 | 481 | ||
482 | 482 | ||
483 | #ifndef QT_NO_COP | 483 | #ifndef QT_NO_COP |
484 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); | 484 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); |
485 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); | 485 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); |
486 | 486 | ||
487 | QCopEnvelope e(channel, "writeMail(QString,QString)"); | 487 | QCopEnvelope e(channel, "writeMail(QString,QString)"); |
488 | //US we need no names in the To field. The emailadresses are enough | 488 | //US we need no names in the To field. The emailadresses are enough |
489 | e << "" << email; | 489 | e << "" << email; |
490 | #else | 490 | #else |
491 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); | 491 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); |
492 | #endif | 492 | #endif |
493 | } | 493 | } |
494 | 494 | ||
495 | 495 | ||
496 | 496 | ||
497 | void KABCore::mailVCard() | 497 | void KABCore::mailVCard() |
498 | { | 498 | { |
499 | QStringList uids = mViewManager->selectedUids(); | 499 | QStringList uids = mViewManager->selectedUids(); |
500 | if ( !uids.isEmpty() ) | 500 | if ( !uids.isEmpty() ) |
501 | mailVCard( uids ); | 501 | mailVCard( uids ); |
502 | } | 502 | } |
503 | 503 | ||
504 | void KABCore::mailVCard( const QStringList& uids ) | 504 | void KABCore::mailVCard( const QStringList& uids ) |
505 | { | 505 | { |
506 | QStringList urls; | 506 | QStringList urls; |
507 | 507 | ||
508 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 508 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
509 | 509 | ||
510 | /*US | 510 | /*US |
511 | // Create a temp dir, so that we can put the files in it with proper names | 511 | // Create a temp dir, so that we can put the files in it with proper names |
512 | KTempFile tempDir; | 512 | KTempFile tempDir; |
513 | if ( tempDir.status() != 0 ) { | 513 | if ( tempDir.status() != 0 ) { |
514 | kdWarning() << strerror( tempDir.status() ) << endl; | 514 | kdWarning() << strerror( tempDir.status() ) << endl; |
515 | return; | 515 | return; |
516 | } | 516 | } |
517 | 517 | ||
518 | QString dirName = tempDir.name(); | 518 | QString dirName = tempDir.name(); |
519 | tempDir.unlink(); | 519 | tempDir.unlink(); |
520 | */ | 520 | */ |
521 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | 521 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); |
@@ -524,219 +524,236 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
524 | 524 | ||
525 | QDir().mkdir( dirName, true ); | 525 | QDir().mkdir( dirName, true ); |
526 | 526 | ||
527 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 527 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
528 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 528 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
529 | 529 | ||
530 | if ( a.isEmpty() ) | 530 | if ( a.isEmpty() ) |
531 | continue; | 531 | continue; |
532 | 532 | ||
533 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 533 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
534 | 534 | ||
535 | QString fileName = dirName + "/" + name; | 535 | QString fileName = dirName + "/" + name; |
536 | 536 | ||
537 | QFile outFile(fileName); | 537 | QFile outFile(fileName); |
538 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 538 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
539 | KABC::VCardConverter converter; | 539 | KABC::VCardConverter converter; |
540 | QString vcard; | 540 | QString vcard; |
541 | 541 | ||
542 | converter.addresseeToVCard( a, vcard ); | 542 | converter.addresseeToVCard( a, vcard ); |
543 | 543 | ||
544 | QTextStream t( &outFile ); // use a text stream | 544 | QTextStream t( &outFile ); // use a text stream |
545 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 545 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
546 | t << vcard; | 546 | t << vcard; |
547 | 547 | ||
548 | outFile.close(); | 548 | outFile.close(); |
549 | 549 | ||
550 | urls.append( fileName ); | 550 | urls.append( fileName ); |
551 | } | 551 | } |
552 | } | 552 | } |
553 | /*US | 553 | /*US |
554 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 554 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
555 | QString::null, // subject | 555 | QString::null, // subject |
556 | QString::null, // body | 556 | QString::null, // body |
557 | QString::null, | 557 | QString::null, |
558 | urls ); // attachments | 558 | urls ); // attachments |
559 | */ | 559 | */ |
560 | #ifndef QT_NO_COP | 560 | #ifndef QT_NO_COP |
561 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); | 561 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); |
562 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); | 562 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); |
563 | 563 | ||
564 | QMap<QString, QString> parameterMap; | 564 | QMap<QString, QString> parameterMap; |
565 | parameterMap.insert("ATTACHMENT<n>", urls.join(", ")); | 565 | parameterMap.insert("ATTACHMENT<n>", urls.join(", ")); |
566 | 566 | ||
567 | QCopEnvelope e(channel, "writeMail(QMap(QString,QString))"); | 567 | QCopEnvelope e(channel, "writeMail(QMap(QString,QString))"); |
568 | e << parameterMap; | 568 | e << parameterMap; |
569 | #else | 569 | #else |
570 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); | 570 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); |
571 | #endif | 571 | #endif |
572 | 572 | ||
573 | 573 | ||
574 | } | 574 | } |
575 | 575 | ||
576 | /** | 576 | /** |
577 | Beams the "WhoAmI contact. | 577 | Beams the "WhoAmI contact. |
578 | */ | 578 | */ |
579 | void KABCore::beamMySelf() | 579 | void KABCore::beamMySelf() |
580 | { | 580 | { |
581 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 581 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
582 | if (!a.isEmpty()) | 582 | if (!a.isEmpty()) |
583 | { | 583 | { |
584 | QStringList uids; | 584 | QStringList uids; |
585 | uids << a.uid(); | 585 | uids << a.uid(); |
586 | 586 | ||
587 | beamVCard(uids); | 587 | beamVCard(uids); |
588 | } else { | ||
589 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | ||
590 | |||
591 | |||
588 | } | 592 | } |
589 | } | 593 | } |
590 | 594 | ||
591 | void KABCore::beamVCard() | 595 | void KABCore::beamVCard() |
592 | { | 596 | { |
593 | QStringList uids = mViewManager->selectedUids(); | 597 | QStringList uids = mViewManager->selectedUids(); |
594 | if ( !uids.isEmpty() ) | 598 | if ( !uids.isEmpty() ) |
595 | beamVCard( uids ); | 599 | beamVCard( uids ); |
596 | } | 600 | } |
597 | 601 | ||
598 | 602 | ||
599 | void KABCore::beamVCard(const QStringList& uids) | 603 | void KABCore::beamVCard(const QStringList& uids) |
600 | { | 604 | { |
601 | /*US | 605 | /*US |
602 | QString beamFilename; | 606 | QString beamFilename; |
603 | Opie::OPimContact c; | 607 | Opie::OPimContact c; |
604 | if ( actionPersonal->isOn() ) { | 608 | if ( actionPersonal->isOn() ) { |
605 | beamFilename = addressbookPersonalVCardName(); | 609 | beamFilename = addressbookPersonalVCardName(); |
606 | if ( !QFile::exists( beamFilename ) ) | 610 | if ( !QFile::exists( beamFilename ) ) |
607 | return; // can't beam a non-existent file | 611 | return; // can't beam a non-existent file |
608 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 612 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
609 | beamFilename ); | 613 | beamFilename ); |
610 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 614 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
611 | Opie::OPimContactAccess::List allList = access->allRecords(); | 615 | Opie::OPimContactAccess::List allList = access->allRecords(); |
612 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | 616 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first |
613 | c = *it; | 617 | c = *it; |
614 | 618 | ||
615 | delete access; | 619 | delete access; |
616 | } else { | 620 | } else { |
617 | unlink( beamfile ); // delete if exists | 621 | unlink( beamfile ); // delete if exists |
618 | mkdir("/tmp/obex/", 0755); | 622 | mkdir("/tmp/obex/", 0755); |
619 | c = m_abView -> currentEntry(); | 623 | c = m_abView -> currentEntry(); |
620 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 624 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
621 | beamfile ); | 625 | beamfile ); |
622 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 626 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
623 | access->add( c ); | 627 | access->add( c ); |
624 | access->save(); | 628 | access->save(); |
625 | delete access; | 629 | delete access; |
626 | 630 | ||
627 | beamFilename = beamfile; | 631 | beamFilename = beamfile; |
628 | } | 632 | } |
629 | 633 | ||
630 | owarn << "Beaming: " << beamFilename << oendl; | 634 | owarn << "Beaming: " << beamFilename << oendl; |
631 | */ | 635 | */ |
636 | |||
637 | #if 0 | ||
632 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 638 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
633 | 639 | ||
634 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | 640 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); |
635 | 641 | ||
636 | QString name = "contact.vcf"; | 642 | QString name = "contact.vcf"; |
637 | 643 | ||
638 | QString fileName = dirName + "/" + name; | 644 | QString fileName = dirName + "/" + name; |
645 | #endif | ||
646 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory | ||
647 | // | ||
648 | QString fileName = "/tmp/kdepimbeamfile"; | ||
639 | 649 | ||
640 | 650 | ||
641 | QDir().mkdir( dirName, true ); | 651 | //QDir().mkdir( dirName, true ); |
642 | 652 | ||
643 | QFile outFile(fileName); | 653 | QFile outFile(fileName); |
644 | KABC::VCardConverter converter; | 654 | KABC::VCardConverter converter; |
645 | QString description; | 655 | QString description; |
646 | 656 | ||
647 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 657 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
648 | 658 | ||
649 | QTextStream t( &outFile ); // use a text stream | 659 | QTextStream t( &outFile ); // use a text stream |
650 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 660 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
651 | 661 | ||
652 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 662 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
653 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 663 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
654 | 664 | ||
655 | if ( a.isEmpty() ) | 665 | if ( a.isEmpty() ) |
656 | continue; | 666 | continue; |
657 | 667 | ||
658 | if (description.isEmpty()) | 668 | if (description.isEmpty()) |
659 | description = a.formattedName(); | 669 | description = a.formattedName(); |
660 | 670 | ||
661 | QString vcard; | 671 | QString vcard; |
662 | converter.addresseeToVCard( a, vcard ); | 672 | converter.addresseeToVCard( a, vcard ); |
663 | t << vcard; | 673 | t << vcard; |
664 | 674 | ||
665 | } | 675 | } |
676 | } else { | ||
677 | qDebug("Error open temp beam file "); | ||
678 | return; | ||
666 | } | 679 | } |
667 | 680 | ||
668 | outFile.close(); | 681 | outFile.close(); |
669 | 682 | ||
683 | #ifndef DESKTOP_VERSION | ||
670 | Ir *ir = new Ir( this ); | 684 | Ir *ir = new Ir( this ); |
671 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 685 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
672 | ir->send( fileName, description, "text/x-vCard" ); | 686 | ir->send( fileName, description, "text/x-vCard" ); |
687 | #endif | ||
673 | 688 | ||
674 | } | 689 | } |
675 | 690 | ||
676 | void KABCore::beamDone( Ir *ir ) | 691 | void KABCore::beamDone( Ir *ir ) |
677 | { | 692 | { |
693 | #ifndef DESKTOP_VERSION | ||
678 | delete ir; | 694 | delete ir; |
695 | #endif | ||
679 | } | 696 | } |
680 | 697 | ||
681 | 698 | ||
682 | void KABCore::browse( const QString& url ) | 699 | void KABCore::browse( const QString& url ) |
683 | { | 700 | { |
684 | #ifndef KAB_EMBEDDED | 701 | #ifndef KAB_EMBEDDED |
685 | kapp->invokeBrowser( url ); | 702 | kapp->invokeBrowser( url ); |
686 | #else //KAB_EMBEDDED | 703 | #else //KAB_EMBEDDED |
687 | qDebug("KABCore::browse must be fixed"); | 704 | qDebug("KABCore::browse must be fixed"); |
688 | #endif //KAB_EMBEDDED | 705 | #endif //KAB_EMBEDDED |
689 | } | 706 | } |
690 | 707 | ||
691 | void KABCore::selectAllContacts() | 708 | void KABCore::selectAllContacts() |
692 | { | 709 | { |
693 | mViewManager->setSelected( QString::null, true ); | 710 | mViewManager->setSelected( QString::null, true ); |
694 | } | 711 | } |
695 | 712 | ||
696 | void KABCore::deleteContacts() | 713 | void KABCore::deleteContacts() |
697 | { | 714 | { |
698 | QStringList uidList = mViewManager->selectedUids(); | 715 | QStringList uidList = mViewManager->selectedUids(); |
699 | deleteContacts( uidList ); | 716 | deleteContacts( uidList ); |
700 | } | 717 | } |
701 | 718 | ||
702 | void KABCore::deleteContacts( const QStringList &uids ) | 719 | void KABCore::deleteContacts( const QStringList &uids ) |
703 | { | 720 | { |
704 | if ( uids.count() > 0 ) { | 721 | if ( uids.count() > 0 ) { |
705 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 722 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
706 | UndoStack::instance()->push( command ); | 723 | UndoStack::instance()->push( command ); |
707 | RedoStack::instance()->clear(); | 724 | RedoStack::instance()->clear(); |
708 | 725 | ||
709 | // now if we deleted anything, refresh | 726 | // now if we deleted anything, refresh |
710 | setContactSelected( QString::null ); | 727 | setContactSelected( QString::null ); |
711 | setModified( true ); | 728 | setModified( true ); |
712 | } | 729 | } |
713 | } | 730 | } |
714 | 731 | ||
715 | void KABCore::copyContacts() | 732 | void KABCore::copyContacts() |
716 | { | 733 | { |
717 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 734 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
718 | 735 | ||
719 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 736 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
720 | 737 | ||
721 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 738 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
722 | 739 | ||
723 | QClipboard *cb = QApplication::clipboard(); | 740 | QClipboard *cb = QApplication::clipboard(); |
724 | cb->setText( clipText ); | 741 | cb->setText( clipText ); |
725 | } | 742 | } |
726 | 743 | ||
727 | void KABCore::cutContacts() | 744 | void KABCore::cutContacts() |
728 | { | 745 | { |
729 | QStringList uidList = mViewManager->selectedUids(); | 746 | QStringList uidList = mViewManager->selectedUids(); |
730 | 747 | ||
731 | //US if ( uidList.size() > 0 ) { | 748 | //US if ( uidList.size() > 0 ) { |
732 | if ( uidList.count() > 0 ) { | 749 | if ( uidList.count() > 0 ) { |
733 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 750 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
734 | UndoStack::instance()->push( command ); | 751 | UndoStack::instance()->push( command ); |
735 | RedoStack::instance()->clear(); | 752 | RedoStack::instance()->clear(); |
736 | 753 | ||
737 | setModified( true ); | 754 | setModified( true ); |
738 | } | 755 | } |
739 | } | 756 | } |
740 | 757 | ||
741 | void KABCore::pasteContacts() | 758 | void KABCore::pasteContacts() |
742 | { | 759 | { |
@@ -1429,373 +1446,377 @@ void KABCore::initGUI() | |||
1429 | 1446 | ||
1430 | 1447 | ||
1431 | #endif //KAB_EMBEDDED | 1448 | #endif //KAB_EMBEDDED |
1432 | initActions(); | 1449 | initActions(); |
1433 | 1450 | ||
1434 | #ifdef KAB_EMBEDDED | 1451 | #ifdef KAB_EMBEDDED |
1435 | addActionsManually(); | 1452 | addActionsManually(); |
1436 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1453 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1437 | mXXPortManager = new XXPortManager( this, this ); | 1454 | mXXPortManager = new XXPortManager( this, this ); |
1438 | 1455 | ||
1439 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1456 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1440 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1457 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1441 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1458 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1442 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1459 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1443 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1460 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1444 | // mIncSearchWidget->hide(); | 1461 | // mIncSearchWidget->hide(); |
1445 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1462 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1446 | SLOT( incrementalSearch( const QString& ) ) ); | 1463 | SLOT( incrementalSearch( const QString& ) ) ); |
1447 | 1464 | ||
1448 | 1465 | ||
1449 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1466 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1450 | 1467 | ||
1451 | topLayout->addWidget( mJumpButtonBar ); | 1468 | topLayout->addWidget( mJumpButtonBar ); |
1452 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1469 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1453 | 1470 | ||
1454 | // mMainWindow->getIconToolBar()->raise(); | 1471 | // mMainWindow->getIconToolBar()->raise(); |
1455 | 1472 | ||
1456 | #endif //KAB_EMBEDDED | 1473 | #endif //KAB_EMBEDDED |
1457 | 1474 | ||
1458 | } | 1475 | } |
1459 | void KABCore::initActions() | 1476 | void KABCore::initActions() |
1460 | { | 1477 | { |
1461 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1478 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1462 | 1479 | ||
1463 | #ifndef KAB_EMBEDDED | 1480 | #ifndef KAB_EMBEDDED |
1464 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1481 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1465 | SLOT( clipboardDataChanged() ) ); | 1482 | SLOT( clipboardDataChanged() ) ); |
1466 | #endif //KAB_EMBEDDED | 1483 | #endif //KAB_EMBEDDED |
1467 | 1484 | ||
1468 | // file menu | 1485 | // file menu |
1469 | if ( mIsPart ) { | 1486 | if ( mIsPart ) { |
1470 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1487 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1471 | SLOT( sendMail() ), actionCollection(), | 1488 | SLOT( sendMail() ), actionCollection(), |
1472 | "kaddressbook_mail" ); | 1489 | "kaddressbook_mail" ); |
1473 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1490 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1474 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1491 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1475 | 1492 | ||
1476 | } else { | 1493 | } else { |
1477 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1494 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1478 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1495 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1479 | } | 1496 | } |
1480 | 1497 | ||
1481 | 1498 | ||
1482 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1499 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1483 | SLOT( save() ), actionCollection(), "file_sync" ); | 1500 | SLOT( save() ), actionCollection(), "file_sync" ); |
1484 | 1501 | ||
1485 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1502 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1486 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1503 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1487 | 1504 | ||
1488 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1505 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1489 | this, SLOT( mailVCard() ), | 1506 | this, SLOT( mailVCard() ), |
1490 | actionCollection(), "file_mail_vcard"); | 1507 | actionCollection(), "file_mail_vcard"); |
1491 | 1508 | ||
1492 | mActionBeamVCard = 0; | 1509 | mActionBeamVCard = 0; |
1510 | mActionBeam = 0; | ||
1511 | |||
1512 | #ifndef DESKTOP_VERSION | ||
1493 | if ( Ir::supported() ) { | 1513 | if ( Ir::supported() ) { |
1494 | mActionBeamVCard = new KAction( i18n( "Beam v&Card" ), "beam", 0, this, | 1514 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1495 | SLOT( beamVCard() ), actionCollection(), | 1515 | SLOT( beamVCard() ), actionCollection(), |
1496 | "kaddressbook_beam_vcard" ); | 1516 | "kaddressbook_beam_vcard" ); |
1517 | |||
1518 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | ||
1519 | SLOT( beamMySelf() ), actionCollection(), | ||
1520 | "kaddressbook_beam_myself" ); | ||
1497 | } | 1521 | } |
1498 | 1522 | #endif | |
1499 | 1523 | ||
1500 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1524 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1501 | this, SLOT( editContact2() ), | 1525 | this, SLOT( editContact2() ), |
1502 | actionCollection(), "file_properties" ); | 1526 | actionCollection(), "file_properties" ); |
1503 | 1527 | ||
1504 | #ifdef KAB_EMBEDDED | 1528 | #ifdef KAB_EMBEDDED |
1505 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1529 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1506 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1530 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1507 | mMainWindow, SLOT( exit() ), | 1531 | mMainWindow, SLOT( exit() ), |
1508 | actionCollection(), "quit" ); | 1532 | actionCollection(), "quit" ); |
1509 | #endif //KAB_EMBEDDED | 1533 | #endif //KAB_EMBEDDED |
1510 | 1534 | ||
1511 | // edit menu | 1535 | // edit menu |
1512 | if ( mIsPart ) { | 1536 | if ( mIsPart ) { |
1513 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1537 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1514 | SLOT( copyContacts() ), actionCollection(), | 1538 | SLOT( copyContacts() ), actionCollection(), |
1515 | "kaddressbook_copy" ); | 1539 | "kaddressbook_copy" ); |
1516 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1540 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1517 | SLOT( cutContacts() ), actionCollection(), | 1541 | SLOT( cutContacts() ), actionCollection(), |
1518 | "kaddressbook_cut" ); | 1542 | "kaddressbook_cut" ); |
1519 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1543 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1520 | SLOT( pasteContacts() ), actionCollection(), | 1544 | SLOT( pasteContacts() ), actionCollection(), |
1521 | "kaddressbook_paste" ); | 1545 | "kaddressbook_paste" ); |
1522 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1546 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1523 | SLOT( selectAllContacts() ), actionCollection(), | 1547 | SLOT( selectAllContacts() ), actionCollection(), |
1524 | "kaddressbook_select_all" ); | 1548 | "kaddressbook_select_all" ); |
1525 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1549 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1526 | SLOT( undo() ), actionCollection(), | 1550 | SLOT( undo() ), actionCollection(), |
1527 | "kaddressbook_undo" ); | 1551 | "kaddressbook_undo" ); |
1528 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1552 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1529 | this, SLOT( redo() ), actionCollection(), | 1553 | this, SLOT( redo() ), actionCollection(), |
1530 | "kaddressbook_redo" ); | 1554 | "kaddressbook_redo" ); |
1531 | } else { | 1555 | } else { |
1532 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1556 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1533 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1557 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1534 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1558 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1535 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1559 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1536 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1560 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1537 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1561 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1538 | } | 1562 | } |
1539 | 1563 | ||
1540 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1564 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1541 | Key_Delete, this, SLOT( deleteContacts() ), | 1565 | Key_Delete, this, SLOT( deleteContacts() ), |
1542 | actionCollection(), "edit_delete" ); | 1566 | actionCollection(), "edit_delete" ); |
1543 | 1567 | ||
1544 | mActionUndo->setEnabled( false ); | 1568 | mActionUndo->setEnabled( false ); |
1545 | mActionRedo->setEnabled( false ); | 1569 | mActionRedo->setEnabled( false ); |
1546 | 1570 | ||
1547 | // settings menu | 1571 | // settings menu |
1548 | #ifdef KAB_EMBEDDED | 1572 | #ifdef KAB_EMBEDDED |
1549 | //US special menuentry to configure the addressbook resources. On KDE | 1573 | //US special menuentry to configure the addressbook resources. On KDE |
1550 | // you do that through the control center !!! | 1574 | // you do that through the control center !!! |
1551 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1575 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1552 | SLOT( configureResources() ), actionCollection(), | 1576 | SLOT( configureResources() ), actionCollection(), |
1553 | "kaddressbook_configure_resources" ); | 1577 | "kaddressbook_configure_resources" ); |
1554 | #endif //KAB_EMBEDDED | 1578 | #endif //KAB_EMBEDDED |
1555 | 1579 | ||
1556 | if ( mIsPart ) { | 1580 | if ( mIsPart ) { |
1557 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1581 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1558 | SLOT( openConfigDialog() ), actionCollection(), | 1582 | SLOT( openConfigDialog() ), actionCollection(), |
1559 | "kaddressbook_configure" ); | 1583 | "kaddressbook_configure" ); |
1560 | 1584 | ||
1561 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1585 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1562 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1586 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1563 | "kaddressbook_configure_shortcuts" ); | 1587 | "kaddressbook_configure_shortcuts" ); |
1564 | #ifdef KAB_EMBEDDED | 1588 | #ifdef KAB_EMBEDDED |
1565 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1589 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1566 | mActionConfigureToolbars->setEnabled( false ); | 1590 | mActionConfigureToolbars->setEnabled( false ); |
1567 | #endif //KAB_EMBEDDED | 1591 | #endif //KAB_EMBEDDED |
1568 | 1592 | ||
1569 | } else { | 1593 | } else { |
1570 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1594 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1571 | 1595 | ||
1572 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1596 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1573 | } | 1597 | } |
1574 | 1598 | ||
1575 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1599 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1576 | actionCollection(), "options_show_jump_bar" ); | 1600 | actionCollection(), "options_show_jump_bar" ); |
1577 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1601 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1578 | 1602 | ||
1579 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, | 1603 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, |
1580 | actionCollection(), "options_show_details" ); | 1604 | actionCollection(), "options_show_details" ); |
1581 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1605 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1582 | 1606 | ||
1583 | // misc | 1607 | // misc |
1584 | // only enable LDAP lookup if we can handle the protocol | 1608 | // only enable LDAP lookup if we can handle the protocol |
1585 | #ifndef KAB_EMBEDDED | 1609 | #ifndef KAB_EMBEDDED |
1586 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1610 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1587 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1611 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1588 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1612 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1589 | "ldap_lookup" ); | 1613 | "ldap_lookup" ); |
1590 | } | 1614 | } |
1591 | #else //KAB_EMBEDDED | 1615 | #else //KAB_EMBEDDED |
1592 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1616 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1593 | #endif //KAB_EMBEDDED | 1617 | #endif //KAB_EMBEDDED |
1594 | 1618 | ||
1595 | 1619 | ||
1596 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1620 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1597 | SLOT( setWhoAmI() ), actionCollection(), | 1621 | SLOT( setWhoAmI() ), actionCollection(), |
1598 | "set_personal" ); | 1622 | "set_personal" ); |
1599 | 1623 | ||
1600 | mActionBeam = 0; | 1624 | |
1601 | if ( Ir::supported() ) { | ||
1602 | mActionBeam = new KAction( i18n( "&Beam Who Am I" ), "beam", 0, this, | ||
1603 | SLOT( beamMySelf() ), actionCollection(), | ||
1604 | "kaddressbook_beam_myself" ); | ||
1605 | } | ||
1606 | 1625 | ||
1607 | 1626 | ||
1608 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1627 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1609 | SLOT( setCategories() ), actionCollection(), | 1628 | SLOT( setCategories() ), actionCollection(), |
1610 | "edit_set_categories" ); | 1629 | "edit_set_categories" ); |
1611 | 1630 | ||
1612 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1631 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1613 | SLOT( removeVoice() ), actionCollection(), | 1632 | SLOT( removeVoice() ), actionCollection(), |
1614 | "remove_voice" ); | 1633 | "remove_voice" ); |
1615 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, | 1634 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, |
1616 | SLOT( importFromOL() ), actionCollection(), | 1635 | SLOT( importFromOL() ), actionCollection(), |
1617 | "import_OL" ); | 1636 | "import_OL" ); |
1618 | #ifdef KAB_EMBEDDED | 1637 | #ifdef KAB_EMBEDDED |
1619 | 1638 | ||
1620 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1639 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1621 | this, SLOT( createAboutData() ), actionCollection(), | 1640 | this, SLOT( createAboutData() ), actionCollection(), |
1622 | "kaddressbook_about_data" ); | 1641 | "kaddressbook_about_data" ); |
1623 | #endif //KAB_EMBEDDED | 1642 | #endif //KAB_EMBEDDED |
1624 | 1643 | ||
1625 | clipboardDataChanged(); | 1644 | clipboardDataChanged(); |
1626 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1645 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1627 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1646 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1628 | } | 1647 | } |
1629 | 1648 | ||
1630 | //US we need this function, to plug all actions into the correct menues. | 1649 | //US we need this function, to plug all actions into the correct menues. |
1631 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1650 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1632 | void KABCore::addActionsManually() | 1651 | void KABCore::addActionsManually() |
1633 | { | 1652 | { |
1634 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1653 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1635 | 1654 | ||
1636 | #ifdef KAB_EMBEDDED | 1655 | #ifdef KAB_EMBEDDED |
1637 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1656 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1638 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1657 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1639 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1658 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1640 | 1659 | ||
1641 | KToolBar* tb = mMainWindow->toolBar(); | 1660 | KToolBar* tb = mMainWindow->toolBar(); |
1642 | 1661 | ||
1643 | #ifdef DESKTOP_VERSION | 1662 | #ifdef DESKTOP_VERSION |
1644 | QMenuBar* mb = mMainWindow->menuBar(); | 1663 | QMenuBar* mb = mMainWindow->menuBar(); |
1645 | 1664 | ||
1646 | //US setup menubar. | 1665 | //US setup menubar. |
1647 | //Disable the following block if you do not want to have a menubar. | 1666 | //Disable the following block if you do not want to have a menubar. |
1648 | mb->insertItem( "&File", fileMenu ); | 1667 | mb->insertItem( "&File", fileMenu ); |
1649 | mb->insertItem( "&Edit", editMenu ); | 1668 | mb->insertItem( "&Edit", editMenu ); |
1650 | mb->insertItem( "&View", viewMenu ); | 1669 | mb->insertItem( "&View", viewMenu ); |
1651 | mb->insertItem( "&Settings", settingsMenu ); | 1670 | mb->insertItem( "&Settings", settingsMenu ); |
1652 | mb->insertItem( "&Change selected", changeMenu ); | 1671 | mb->insertItem( "&Change selected", changeMenu ); |
1653 | mb->insertItem( "&Help", helpMenu ); | 1672 | mb->insertItem( "&Help", helpMenu ); |
1654 | mIncSearchWidget = new IncSearchWidget( tb ); | 1673 | mIncSearchWidget = new IncSearchWidget( tb ); |
1655 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1674 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1656 | 1675 | ||
1657 | #else | 1676 | #else |
1658 | //US setup toolbar | 1677 | //US setup toolbar |
1659 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1678 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1660 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1679 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1661 | menuBarTB->insertItem( "ME", popupBarTB); | 1680 | menuBarTB->insertItem( "ME", popupBarTB); |
1662 | tb->insertWidget(-1, 0, menuBarTB); | 1681 | tb->insertWidget(-1, 0, menuBarTB); |
1663 | mIncSearchWidget = new IncSearchWidget( tb ); | 1682 | mIncSearchWidget = new IncSearchWidget( tb ); |
1664 | 1683 | ||
1665 | tb->enableMoving(false); | 1684 | tb->enableMoving(false); |
1666 | popupBarTB->insertItem( "&File", fileMenu ); | 1685 | popupBarTB->insertItem( "&File", fileMenu ); |
1667 | popupBarTB->insertItem( "&Edit", editMenu ); | 1686 | popupBarTB->insertItem( "&Edit", editMenu ); |
1668 | popupBarTB->insertItem( "&View", viewMenu ); | 1687 | popupBarTB->insertItem( "&View", viewMenu ); |
1669 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1688 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1670 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1689 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1671 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1690 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1672 | popupBarTB->insertItem( "&Help", helpMenu ); | 1691 | popupBarTB->insertItem( "&Help", helpMenu ); |
1673 | if (QApplication::desktop()->width() > 320 ) { | 1692 | if (QApplication::desktop()->width() > 320 ) { |
1674 | // mViewManager->getFilterAction()->plug ( tb); | 1693 | // mViewManager->getFilterAction()->plug ( tb); |
1675 | } | 1694 | } |
1676 | #endif | 1695 | #endif |
1677 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1696 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1678 | 1697 | ||
1679 | 1698 | ||
1680 | 1699 | ||
1681 | //US Now connect the actions with the menue entries. | 1700 | //US Now connect the actions with the menue entries. |
1682 | mActionPrint->plug( fileMenu ); | 1701 | mActionPrint->plug( fileMenu ); |
1683 | mActionMail->plug( fileMenu ); | 1702 | mActionMail->plug( fileMenu ); |
1684 | fileMenu->insertSeparator(); | 1703 | fileMenu->insertSeparator(); |
1685 | 1704 | ||
1686 | mActionNewContact->plug( fileMenu ); | 1705 | mActionNewContact->plug( fileMenu ); |
1687 | mActionNewContact->plug( tb ); | 1706 | mActionNewContact->plug( tb ); |
1688 | 1707 | ||
1689 | mActionEditAddressee->plug( fileMenu ); | 1708 | mActionEditAddressee->plug( fileMenu ); |
1690 | fileMenu->insertSeparator(); | 1709 | fileMenu->insertSeparator(); |
1691 | mActionSave->plug( fileMenu ); | 1710 | mActionSave->plug( fileMenu ); |
1692 | fileMenu->insertItem( "&Import", ImportMenu ); | 1711 | fileMenu->insertItem( "&Import", ImportMenu ); |
1693 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1712 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1694 | fileMenu->insertSeparator(); | 1713 | fileMenu->insertSeparator(); |
1695 | mActionMailVCard->plug( fileMenu ); | 1714 | mActionMailVCard->plug( fileMenu ); |
1715 | #ifndef DESKTOP_VERSION | ||
1696 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1716 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1717 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | ||
1718 | #endif | ||
1697 | fileMenu->insertSeparator(); | 1719 | fileMenu->insertSeparator(); |
1698 | mActionQuit->plug( fileMenu ); | 1720 | mActionQuit->plug( fileMenu ); |
1699 | #ifdef _WIN32_ | 1721 | #ifdef _WIN32_ |
1700 | mActionImportOL->plug( ImportMenu ); | 1722 | mActionImportOL->plug( ImportMenu ); |
1701 | #endif | 1723 | #endif |
1702 | // edit menu | 1724 | // edit menu |
1703 | mActionUndo->plug( editMenu ); | 1725 | mActionUndo->plug( editMenu ); |
1704 | mActionRedo->plug( editMenu ); | 1726 | mActionRedo->plug( editMenu ); |
1705 | editMenu->insertSeparator(); | 1727 | editMenu->insertSeparator(); |
1706 | mActionCut->plug( editMenu ); | 1728 | mActionCut->plug( editMenu ); |
1707 | mActionCopy->plug( editMenu ); | 1729 | mActionCopy->plug( editMenu ); |
1708 | mActionPaste->plug( editMenu ); | 1730 | mActionPaste->plug( editMenu ); |
1709 | mActionDelete->plug( editMenu ); | 1731 | mActionDelete->plug( editMenu ); |
1710 | editMenu->insertSeparator(); | 1732 | editMenu->insertSeparator(); |
1711 | mActionSelectAll->plug( editMenu ); | 1733 | mActionSelectAll->plug( editMenu ); |
1712 | 1734 | ||
1713 | mActionRemoveVoice->plug( changeMenu ); | 1735 | mActionRemoveVoice->plug( changeMenu ); |
1714 | // settings menu | 1736 | // settings menu |
1715 | //US special menuentry to configure the addressbook resources. On KDE | 1737 | //US special menuentry to configure the addressbook resources. On KDE |
1716 | // you do that through the control center !!! | 1738 | // you do that through the control center !!! |
1717 | mActionConfigResources->plug( settingsMenu ); | 1739 | mActionConfigResources->plug( settingsMenu ); |
1718 | settingsMenu->insertSeparator(); | 1740 | settingsMenu->insertSeparator(); |
1719 | 1741 | ||
1720 | mActionConfigKAddressbook->plug( settingsMenu ); | 1742 | mActionConfigKAddressbook->plug( settingsMenu ); |
1721 | 1743 | ||
1722 | if ( mIsPart ) { | 1744 | if ( mIsPart ) { |
1723 | mActionConfigShortcuts->plug( settingsMenu ); | 1745 | mActionConfigShortcuts->plug( settingsMenu ); |
1724 | mActionConfigureToolbars->plug( settingsMenu ); | 1746 | mActionConfigureToolbars->plug( settingsMenu ); |
1725 | 1747 | ||
1726 | } else { | 1748 | } else { |
1727 | mActionKeyBindings->plug( settingsMenu ); | 1749 | mActionKeyBindings->plug( settingsMenu ); |
1728 | } | 1750 | } |
1729 | 1751 | ||
1730 | settingsMenu->insertSeparator(); | 1752 | settingsMenu->insertSeparator(); |
1731 | 1753 | ||
1732 | mActionJumpBar->plug( settingsMenu ); | 1754 | mActionJumpBar->plug( settingsMenu ); |
1733 | mActionDetails->plug( settingsMenu ); | 1755 | mActionDetails->plug( settingsMenu ); |
1734 | settingsMenu->insertSeparator(); | 1756 | settingsMenu->insertSeparator(); |
1735 | 1757 | ||
1736 | mActionWhoAmI->plug( settingsMenu ); | 1758 | mActionWhoAmI->plug( settingsMenu ); |
1737 | if ( Ir::supported() ) mActionBeam->plug( settingsMenu ); | ||
1738 | mActionCategories->plug( settingsMenu ); | 1759 | mActionCategories->plug( settingsMenu ); |
1739 | 1760 | ||
1740 | mActionAboutKAddressbook->plug( helpMenu ); | 1761 | mActionAboutKAddressbook->plug( helpMenu ); |
1741 | 1762 | ||
1742 | 1763 | ||
1743 | if (QApplication::desktop()->width() > 320 ) { | 1764 | if (QApplication::desktop()->width() > 320 ) { |
1744 | 1765 | ||
1745 | mActionEditAddressee->plug( tb ); | 1766 | mActionEditAddressee->plug( tb ); |
1746 | mActionSave->plug( tb ); | 1767 | mActionSave->plug( tb ); |
1747 | mViewManager->getFilterAction()->plug ( tb); | 1768 | mViewManager->getFilterAction()->plug ( tb); |
1748 | if (QApplication::desktop()->width() > 480 ) { | 1769 | if (QApplication::desktop()->width() > 480 ) { |
1749 | mActionUndo->plug( tb ); | 1770 | mActionUndo->plug( tb ); |
1750 | mActionDelete->plug( tb ); | 1771 | mActionDelete->plug( tb ); |
1751 | mActionRedo->plug( tb ); | 1772 | mActionRedo->plug( tb ); |
1752 | } | 1773 | } |
1753 | } | 1774 | } |
1754 | //mActionQuit->plug ( tb ); | 1775 | //mActionQuit->plug ( tb ); |
1755 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1776 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1756 | 1777 | ||
1757 | //US link the searchwidget first to this. | 1778 | //US link the searchwidget first to this. |
1758 | // The real linkage to the toolbar happens later. | 1779 | // The real linkage to the toolbar happens later. |
1759 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1780 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1760 | //US tb->insertItem( mIncSearchWidget ); | 1781 | //US tb->insertItem( mIncSearchWidget ); |
1761 | /*US | 1782 | /*US |
1762 | mIncSearchWidget = new IncSearchWidget( tb ); | 1783 | mIncSearchWidget = new IncSearchWidget( tb ); |
1763 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1784 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1764 | SLOT( incrementalSearch( const QString& ) ) ); | 1785 | SLOT( incrementalSearch( const QString& ) ) ); |
1765 | 1786 | ||
1766 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1787 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1767 | 1788 | ||
1768 | //US topLayout->addWidget( mJumpButtonBar ); | 1789 | //US topLayout->addWidget( mJumpButtonBar ); |
1769 | this->layout()->add( mJumpButtonBar ); | 1790 | this->layout()->add( mJumpButtonBar ); |
1770 | */ | 1791 | */ |
1771 | 1792 | ||
1772 | #endif //KAB_EMBEDDED | 1793 | #endif //KAB_EMBEDDED |
1773 | } | 1794 | } |
1774 | void KABCore::removeVoice() | 1795 | void KABCore::removeVoice() |
1775 | { | 1796 | { |
1776 | 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 ) | 1797 | 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 ) |
1777 | return; | 1798 | return; |
1778 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 1799 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
1779 | KABC::Addressee::List::Iterator it; | 1800 | KABC::Addressee::List::Iterator it; |
1780 | for ( it = list.begin(); it != list.end(); ++it ) { | 1801 | for ( it = list.begin(); it != list.end(); ++it ) { |
1781 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | 1802 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); |
1782 | PhoneNumber::List::Iterator phoneIt; | 1803 | PhoneNumber::List::Iterator phoneIt; |
1783 | bool found = false; | 1804 | bool found = false; |
1784 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 1805 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
1785 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 1806 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
1786 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 1807 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
1787 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 1808 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
1788 | (*it).insertPhoneNumber( (*phoneIt) ); | 1809 | (*it).insertPhoneNumber( (*phoneIt) ); |
1789 | found = true; | 1810 | found = true; |
1790 | } | 1811 | } |
1791 | } | 1812 | } |
1792 | 1813 | ||
1793 | } | 1814 | } |
1794 | if ( found ) | 1815 | if ( found ) |
1795 | contactModified((*it) ); | 1816 | contactModified((*it) ); |
1796 | } | 1817 | } |
1797 | } | 1818 | } |
1798 | 1819 | ||
1799 | 1820 | ||
1800 | 1821 | ||
1801 | void KABCore::clipboardDataChanged() | 1822 | void KABCore::clipboardDataChanged() |