-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 @@ -445,20 +445,20 @@ void KABCore::setContactSelected( const QString &uid ) mActionPaste->setEnabled( selected ); } mActionCopy->setEnabled( selected ); mActionDelete->setEnabled( selected ); mActionEditAddressee->setEnabled( selected ); mActionMail->setEnabled( selected ); mActionMailVCard->setEnabled( selected ); - if (mActionBeam) - mActionBeam->setEnabled( selected ); + //if (mActionBeam) + //mActionBeam->setEnabled( selected ); - if (mActionBeam) + if (mActionBeamVCard) mActionBeamVCard->setEnabled( selected ); mActionWhoAmI->setEnabled( selected ); mActionCategories->setEnabled( selected ); } void KABCore::sendMail() { @@ -580,16 +580,20 @@ void KABCore::beamMySelf() { KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); if (!a.isEmpty()) { QStringList uids; 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" ) ); + + } } void KABCore::beamVCard() { QStringList uids = mViewManager->selectedUids(); if ( !uids.isEmpty() ) beamVCard( uids ); @@ -624,26 +628,32 @@ void KABCore::beamVCard(const QStringList& uids) access->save(); delete access; beamFilename = beamfile; } owarn << "Beaming: " << beamFilename << oendl; */ + +#if 0 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 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; QString description; if ( outFile.open(IO_WriteOnly) ) { // file opened successfully QTextStream t( &outFile ); // use a text stream @@ -658,29 +668,36 @@ void KABCore::beamVCard(const QStringList& uids) if (description.isEmpty()) description = a.formattedName(); QString vcard; converter.addresseeToVCard( a, vcard ); 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 } void KABCore::browse( const QString& url ) { #ifndef KAB_EMBEDDED kapp->invokeBrowser( url ); #else //KAB_EMBEDDED @@ -1485,22 +1502,29 @@ void KABCore::initActions() mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, SLOT( newContact() ), actionCollection(), "file_new_contact" ); mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, this, SLOT( mailVCard() ), 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() ), actionCollection(), "file_properties" ); #ifdef KAB_EMBEDDED // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, @@ -1592,22 +1616,17 @@ void KABCore::initActions() //qDebug("KABCore::initActions() LDAP has to be implemented"); #endif //KAB_EMBEDDED mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 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, SLOT( setCategories() ), actionCollection(), "edit_set_categories" ); mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, SLOT( removeVoice() ), actionCollection(), @@ -1688,17 +1707,20 @@ void KABCore::addActionsManually() mActionEditAddressee->plug( fileMenu ); fileMenu->insertSeparator(); mActionSave->plug( fileMenu ); fileMenu->insertItem( "&Import", ImportMenu ); 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_ mActionImportOL->plug( ImportMenu ); #endif // edit menu mActionUndo->plug( editMenu ); mActionRedo->plug( editMenu ); @@ -1729,17 +1751,16 @@ void KABCore::addActionsManually() settingsMenu->insertSeparator(); mActionJumpBar->plug( settingsMenu ); mActionDetails->plug( settingsMenu ); settingsMenu->insertSeparator(); mActionWhoAmI->plug( settingsMenu ); - if ( Ir::supported() ) mActionBeam->plug( settingsMenu ); mActionCategories->plug( settingsMenu ); mActionAboutKAddressbook->plug( helpMenu ); if (QApplication::desktop()->width() > 320 ) { mActionEditAddressee->plug( tb ); |