summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-08-06 08:39:55 (UTC)
committer zautrix <zautrix>2004-08-06 08:39:55 (UTC)
commit15edf84bf2bdd1cb00cbdc37d0402b9587c40f21 (patch) (side-by-side diff)
treef4da393d531292ff6702aed0936f2405bdf20555
parent3bf62eb85312197352b7c836239d6d239e9a70cf (diff)
downloadkdepimpi-15edf84bf2bdd1cb00cbdc37d0402b9587c40f21.zip
kdepimpi-15edf84bf2bdd1cb00cbdc37d0402b9587c40f21.tar.gz
kdepimpi-15edf84bf2bdd1cb00cbdc37d0402b9587c40f21.tar.bz2
Fixed some beaming problems
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp47
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
@@ -449,12 +449,12 @@ void KABCore::setContactSelected( const QString &uid )
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 );
@@ -584,8 +584,12 @@ void KABCore::beamMySelf()
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()
@@ -628,18 +632,24 @@ void KABCore::beamVCard(const QStringList& uids)
}
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;
@@ -662,21 +672,28 @@ void KABCore::beamVCard(const QStringList& uids)
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 )
@@ -1489,14 +1506,21 @@ void KABCore::initActions()
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" );
@@ -1596,14 +1620,9 @@ void KABCore::initActions()
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(),
@@ -1692,9 +1711,12 @@ void KABCore::addActionsManually()
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 );
@@ -1733,9 +1755,8 @@ void KABCore::addActionsManually()
mActionDetails->plug( settingsMenu );
settingsMenu->insertSeparator();
mActionWhoAmI->plug( settingsMenu );
- if ( Ir::supported() ) mActionBeam->plug( settingsMenu );
mActionCategories->plug( settingsMenu );
mActionAboutKAddressbook->plug( helpMenu );