-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 @@ -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 ); |