From 15edf84bf2bdd1cb00cbdc37d0402b9587c40f21 Mon Sep 17 00:00:00 2001 From: zautrix Date: Fri, 06 Aug 2004 08:39:55 +0000 Subject: Fixed some beaming problems --- diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d891b07..25891a0 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -450,11 +450,11 @@ void KABCore::setContactSelected( const QString &uid ) mActionEditAddressee->setEnabled( selected ); mActionMail->setEnabled( selected ); mActionMailVCard->setEnabled( selected ); - if (mActionBeam) - mActionBeam->setEnabled( selected ); + //if (mActionBeam) + //mActionBeam->setEnabled( selected ); - if (mActionBeam) - mActionBeamVCard->setEnabled( selected ); + if (mActionBeamVCard) + mActionBeamVCard->setEnabled( selected ); mActionWhoAmI->setEnabled( selected ); mActionCategories->setEnabled( selected ); @@ -585,6 +585,10 @@ void KABCore::beamMySelf() uids << a.uid(); beamVCard(uids); + } else { + KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); + + } } @@ -629,6 +633,8 @@ void KABCore::beamVCard(const QStringList& uids) owarn << "Beaming: " << beamFilename << oendl; */ + +#if 0 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); @@ -636,9 +642,13 @@ void KABCore::beamVCard(const QStringList& uids) QString name = "contact.vcf"; QString fileName = dirName + "/" + name; +#endif + // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory + // + QString fileName = "/tmp/kdepimbeamfile"; - QDir().mkdir( dirName, true ); + //QDir().mkdir( dirName, true ); QFile outFile(fileName); KABC::VCardConverter converter; @@ -663,19 +673,26 @@ void KABCore::beamVCard(const QStringList& uids) t << vcard; } + } else { + qDebug("Error open temp beam file "); + return; } outFile.close(); +#ifndef DESKTOP_VERSION Ir *ir = new Ir( this ); connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); ir->send( fileName, description, "text/x-vCard" ); +#endif } void KABCore::beamDone( Ir *ir ) { +#ifndef DESKTOP_VERSION delete ir; +#endif } @@ -1490,12 +1507,19 @@ void KABCore::initActions() actionCollection(), "file_mail_vcard"); mActionBeamVCard = 0; + mActionBeam = 0; + +#ifndef DESKTOP_VERSION if ( Ir::supported() ) { - mActionBeamVCard = new KAction( i18n( "Beam v&Card" ), "beam", 0, this, + mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, SLOT( beamVCard() ), actionCollection(), "kaddressbook_beam_vcard" ); + + mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, + SLOT( beamMySelf() ), actionCollection(), + "kaddressbook_beam_myself" ); } - +#endif mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, this, SLOT( editContact2() ), @@ -1597,12 +1621,7 @@ void KABCore::initActions() SLOT( setWhoAmI() ), actionCollection(), "set_personal" ); - mActionBeam = 0; - if ( Ir::supported() ) { - mActionBeam = new KAction( i18n( "&Beam Who Am I" ), "beam", 0, this, - SLOT( beamMySelf() ), actionCollection(), - "kaddressbook_beam_myself" ); - } + mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, @@ -1693,7 +1712,10 @@ void KABCore::addActionsManually() fileMenu->insertItem( "&Emport", ExportMenu ); fileMenu->insertSeparator(); mActionMailVCard->plug( fileMenu ); +#ifndef DESKTOP_VERSION if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); + if ( Ir::supported() ) mActionBeam->plug(fileMenu ); +#endif fileMenu->insertSeparator(); mActionQuit->plug( fileMenu ); #ifdef _WIN32_ @@ -1734,7 +1756,6 @@ void KABCore::addActionsManually() settingsMenu->insertSeparator(); mActionWhoAmI->plug( settingsMenu ); - if ( Ir::supported() ) mActionBeam->plug( settingsMenu ); mActionCategories->plug( settingsMenu ); mActionAboutKAddressbook->plug( helpMenu ); -- cgit v0.9.0.2