summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 5cd9649..6538295 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -592,97 +592,97 @@ void KABCore::beamVCard()
592} 592}
593 593
594 594
595void KABCore::beamVCard(const QStringList& uids) 595void KABCore::beamVCard(const QStringList& uids)
596{ 596{
597/*US 597/*US
598 QString beamFilename; 598 QString beamFilename;
599 Opie::OPimContact c; 599 Opie::OPimContact c;
600 if ( actionPersonal->isOn() ) { 600 if ( actionPersonal->isOn() ) {
601 beamFilename = addressbookPersonalVCardName(); 601 beamFilename = addressbookPersonalVCardName();
602 if ( !QFile::exists( beamFilename ) ) 602 if ( !QFile::exists( beamFilename ) )
603 return; // can't beam a non-existent file 603 return; // can't beam a non-existent file
604 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 604 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
605 beamFilename ); 605 beamFilename );
606 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 606 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
607 Opie::OPimContactAccess::List allList = access->allRecords(); 607 Opie::OPimContactAccess::List allList = access->allRecords();
608 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first 608 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
609 c = *it; 609 c = *it;
610 610
611 delete access; 611 delete access;
612 } else { 612 } else {
613 unlink( beamfile ); // delete if exists 613 unlink( beamfile ); // delete if exists
614 mkdir("/tmp/obex/", 0755); 614 mkdir("/tmp/obex/", 0755);
615 c = m_abView -> currentEntry(); 615 c = m_abView -> currentEntry();
616 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 616 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
617 beamfile ); 617 beamfile );
618 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 618 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
619 access->add( c ); 619 access->add( c );
620 access->save(); 620 access->save();
621 delete access; 621 delete access;
622 622
623 beamFilename = beamfile; 623 beamFilename = beamfile;
624 } 624 }
625 625
626 owarn << "Beaming: " << beamFilename << oendl; 626 owarn << "Beaming: " << beamFilename << oendl;
627*/ 627*/
628 628
629#if 0 629#if 0
630 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 630 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
631 631
632 QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 632 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
633 633
634 QString name = "contact.vcf"; 634 QString name = "contact.vcf";
635 635
636 QString fileName = dirName + "/" + name; 636 QString fileName = dirName + "/" + name;
637#endif 637#endif
638 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory 638 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory
639 // 639 //
640 QString fileName = "/tmp/kdepimbeamfile"; 640 QString fileName = "/tmp/kapibeamfile.vcf";
641 641
642 642
643 //QDir().mkdir( dirName, true ); 643 //QDir().mkdir( dirName, true );
644 644
645 QFile outFile(fileName); 645 QFile outFile(fileName);
646 KABC::VCardConverter converter; 646 KABC::VCardConverter converter;
647 QString description; 647 QString description;
648 648
649 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 649 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
650 650
651 QTextStream t( &outFile ); // use a text stream 651 QTextStream t( &outFile ); // use a text stream
652 t.setEncoding( QTextStream::UnicodeUTF8 ); 652 t.setEncoding( QTextStream::UnicodeUTF8 );
653 653
654 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 654 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
655 KABC::Addressee a = mAddressBook->findByUid( *it ); 655 KABC::Addressee a = mAddressBook->findByUid( *it );
656 656
657 if ( a.isEmpty() ) 657 if ( a.isEmpty() )
658 continue; 658 continue;
659 659
660 if (description.isEmpty()) 660 if (description.isEmpty())
661 description = a.formattedName(); 661 description = a.formattedName();
662 662
663 QString vcard; 663 QString vcard;
664 converter.addresseeToVCard( a, vcard ); 664 converter.addresseeToVCard( a, vcard );
665 t << vcard; 665 t << vcard;
666 666
667 } 667 }
668 } else { 668 } else {
669 qDebug("Error open temp beam file "); 669 qDebug("Error open temp beam file ");
670 return; 670 return;
671 } 671 }
672 672
673 outFile.close(); 673 outFile.close();
674 674
675#ifndef DESKTOP_VERSION 675#ifndef DESKTOP_VERSION
676 Ir *ir = new Ir( this ); 676 Ir *ir = new Ir( this );
677 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 677 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
678 ir->send( fileName, description, "text/x-vCard" ); 678 ir->send( fileName, description, "text/x-vCard" );
679#endif 679#endif
680 680
681} 681}
682 682
683void KABCore::beamDone( Ir *ir ) 683void KABCore::beamDone( Ir *ir )
684{ 684{
685#ifndef DESKTOP_VERSION 685#ifndef DESKTOP_VERSION
686 delete ir; 686 delete ir;
687#endif 687#endif
688} 688}