-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 | |||
@@ -451,9 +451,9 @@ void KABCore::setContactSelected( const QString &uid ) | |||
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 ); |
@@ -586,4 +586,8 @@ void KABCore::beamMySelf() | |||
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 | } |
@@ -630,4 +634,6 @@ void KABCore::beamVCard(const QStringList& uids) | |||
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 | ||
@@ -637,7 +643,11 @@ void KABCore::beamVCard(const QStringList& uids) | |||
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); |
@@ -664,11 +674,16 @@ void KABCore::beamVCard(const QStringList& uids) | |||
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 | } |
@@ -676,5 +691,7 @@ void KABCore::beamVCard(const QStringList& uids) | |||
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 | ||
@@ -1491,10 +1508,17 @@ void KABCore::initActions() | |||
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, |
@@ -1598,10 +1622,5 @@ void KABCore::initActions() | |||
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 | ||
@@ -1694,5 +1713,8 @@ void KABCore::addActionsManually() | |||
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 ); |
@@ -1735,5 +1757,4 @@ void KABCore::addActionsManually() | |||
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 | ||