author | zautrix <zautrix> | 2004-08-06 08:39:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-06 08:39:55 (UTC) |
commit | 15edf84bf2bdd1cb00cbdc37d0402b9587c40f21 (patch) (unidiff) | |
tree | f4da393d531292ff6702aed0936f2405bdf20555 /kaddressbook | |
parent | 3bf62eb85312197352b7c836239d6d239e9a70cf (diff) | |
download | kdepimpi-15edf84bf2bdd1cb00cbdc37d0402b9587c40f21.zip kdepimpi-15edf84bf2bdd1cb00cbdc37d0402b9587c40f21.tar.gz kdepimpi-15edf84bf2bdd1cb00cbdc37d0402b9587c40f21.tar.bz2 |
Fixed some beaming problems
-rw-r--r-- | kaddressbook/kabcore.cpp | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d891b07..25891a0 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -450,10 +450,10 @@ void KABCore::setContactSelected( const QString &uid ) | |||
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 ); |
@@ -585,6 +585,10 @@ void KABCore::beamMySelf() | |||
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 | ||
@@ -629,6 +633,8 @@ void KABCore::beamVCard(const QStringList& uids) | |||
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 ); |
@@ -636,9 +642,13 @@ void KABCore::beamVCard(const QStringList& uids) | |||
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; |
@@ -663,19 +673,26 @@ void KABCore::beamVCard(const QStringList& uids) | |||
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 | ||
@@ -1490,12 +1507,19 @@ void KABCore::initActions() | |||
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" ); |
1497 | } | ||
1498 | 1517 | ||
1518 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | ||
1519 | SLOT( beamMySelf() ), actionCollection(), | ||
1520 | "kaddressbook_beam_myself" ); | ||
1521 | } | ||
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() ), |
@@ -1597,12 +1621,7 @@ void KABCore::initActions() | |||
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, |
@@ -1693,7 +1712,10 @@ void KABCore::addActionsManually() | |||
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_ |
@@ -1734,7 +1756,6 @@ void KABCore::addActionsManually() | |||
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 ); |