author | eilers <eilers> | 2003-02-28 10:25:31 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-02-28 10:25:31 (UTC) |
commit | 81cbb2d97b4f0cd7eef56536d791434856d7ae8d (patch) (side-by-side diff) | |
tree | 644f7c1dc38c07b67b9337a4138ca80741d0c9ca | |
parent | 18c19111466e43e91678c5a1fa50f2f561ca3257 (diff) | |
download | opie-81cbb2d97b4f0cd7eef56536d791434856d7ae8d.zip opie-81cbb2d97b4f0cd7eef56536d791434856d7ae8d.tar.gz opie-81cbb2d97b4f0cd7eef56536d791434856d7ae8d.tar.bz2 |
Beaming personal vcard on keypress is implented now !
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 0276231..8937227 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -539,20 +539,20 @@ void AddressbookWindow::writeMail() } static const char * beamfile = "/tmp/obex/contact.vcf"; void AddressbookWindow::slotBeam() { - QString filename; + QString beamFilename; OContact c; if ( actionPersonal->isOn() ) { - filename = addressbookPersonalVCardName(); - if (!QFile::exists(filename)) + beamFilename = addressbookPersonalVCardName(); + if ( !QFile::exists( beamFilename ) ) return; // can't beam a non-existent file OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, - filename ); + beamFilename ); OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); OContactAccess::List allList = access->allRecords(); OContactAccess::List::Iterator it = allList.begin(); // Just take first c = *it; delete access; @@ -564,24 +564,26 @@ void AddressbookWindow::slotBeam() beamfile ); OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); access->add( c ); access->save(); delete access; - filename = beamfile; + beamFilename = beamfile; } + qWarning("Beaming: %s", beamFilename.latin1() ); Ir *ir = new Ir( this ); connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); QString description = c.fullName(); - ir->send( filename, description, "text/x-vCard" ); + ir->send( beamFilename, description, "text/x-vCard" ); } void AddressbookWindow::beamDone( Ir *ir ) { + delete ir; unlink( beamfile ); } static void parseName( const QString& name, QString *first, QString *middle, @@ -636,15 +638,21 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) cnt.setFileAs(); m_abView -> addEntry( cnt ); // :SXm_abView()->init( cnt ); editEntry( EditEntry ); - - - + } else if ( msg == "beamBusinessCard()" ) { + QString beamFilename = addressbookPersonalVCardName(); + if ( !QFile::exists( beamFilename ) ) + return; // can't beam a non-existent file + + Ir *ir = new Ir( this ); + connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); + QString description = "mycard.vcf"; + ir->send( beamFilename, description, "text/x-vCard" ); } #if 0 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { QDataStream stream(data,IO_ReadOnly); QCString ch,m; QStringList types; |