summaryrefslogtreecommitdiff
path: root/core/pim
authoreilers <eilers>2003-02-28 10:25:31 (UTC)
committer eilers <eilers>2003-02-28 10:25:31 (UTC)
commit81cbb2d97b4f0cd7eef56536d791434856d7ae8d (patch) (unidiff)
tree644f7c1dc38c07b67b9337a4138ca80741d0c9ca /core/pim
parent18c19111466e43e91678c5a1fa50f2f561ca3257 (diff)
downloadopie-81cbb2d97b4f0cd7eef56536d791434856d7ae8d.zip
opie-81cbb2d97b4f0cd7eef56536d791434856d7ae8d.tar.gz
opie-81cbb2d97b4f0cd7eef56536d791434856d7ae8d.tar.bz2
Beaming personal vcard on keypress is implented now !
Diffstat (limited to 'core/pim') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp26
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()
539} 539}
540 540
541static const char * beamfile = "/tmp/obex/contact.vcf"; 541static const char * beamfile = "/tmp/obex/contact.vcf";
542 542
543void AddressbookWindow::slotBeam() 543void AddressbookWindow::slotBeam()
544{ 544{
545 QString filename; 545 QString beamFilename;
546 OContact c; 546 OContact c;
547 if ( actionPersonal->isOn() ) { 547 if ( actionPersonal->isOn() ) {
548 filename = addressbookPersonalVCardName(); 548 beamFilename = addressbookPersonalVCardName();
549 if (!QFile::exists(filename)) 549 if ( !QFile::exists( beamFilename ) )
550 return; // can't beam a non-existent file 550 return; // can't beam a non-existent file
551 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 551 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
552 filename ); 552 beamFilename );
553 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 553 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
554 OContactAccess::List allList = access->allRecords(); 554 OContactAccess::List allList = access->allRecords();
555 OContactAccess::List::Iterator it = allList.begin(); // Just take first 555 OContactAccess::List::Iterator it = allList.begin(); // Just take first
556 c = *it; 556 c = *it;
557 557
558 delete access; 558 delete access;
@@ -564,24 +564,26 @@ void AddressbookWindow::slotBeam()
564 beamfile ); 564 beamfile );
565 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 565 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
566 access->add( c ); 566 access->add( c );
567 access->save(); 567 access->save();
568 delete access; 568 delete access;
569 569
570 filename = beamfile; 570 beamFilename = beamfile;
571 } 571 }
572 572
573 qWarning("Beaming: %s", beamFilename.latin1() );
573 574
574 Ir *ir = new Ir( this ); 575 Ir *ir = new Ir( this );
575 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 576 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
576 QString description = c.fullName(); 577 QString description = c.fullName();
577 ir->send( filename, description, "text/x-vCard" ); 578 ir->send( beamFilename, description, "text/x-vCard" );
578} 579}
579 580
580void AddressbookWindow::beamDone( Ir *ir ) 581void AddressbookWindow::beamDone( Ir *ir )
581{ 582{
583
582 delete ir; 584 delete ir;
583 unlink( beamfile ); 585 unlink( beamfile );
584} 586}
585 587
586 588
587static void parseName( const QString& name, QString *first, QString *middle, 589static void parseName( const QString& name, QString *first, QString *middle,
@@ -636,15 +638,21 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
636 cnt.setFileAs(); 638 cnt.setFileAs();
637 639
638 m_abView -> addEntry( cnt ); 640 m_abView -> addEntry( cnt );
639 641
640 // :SXm_abView()->init( cnt ); 642 // :SXm_abView()->init( cnt );
641 editEntry( EditEntry ); 643 editEntry( EditEntry );
642 644 } else if ( msg == "beamBusinessCard()" ) {
643 645 QString beamFilename = addressbookPersonalVCardName();
644 646 if ( !QFile::exists( beamFilename ) )
647 return; // can't beam a non-existent file
648
649 Ir *ir = new Ir( this );
650 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
651 QString description = "mycard.vcf";
652 ir->send( beamFilename, description, "text/x-vCard" );
645 } 653 }
646#if 0 654#if 0
647 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { 655 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) {
648 QDataStream stream(data,IO_ReadOnly); 656 QDataStream stream(data,IO_ReadOnly);
649 QCString ch,m; 657 QCString ch,m;
650 QStringList types; 658 QStringList types;