summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index d6f0cee..6610288 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -462,15 +462,19 @@ void KABCore::setContactSelected( const QString &uid )
462 462
463void KABCore::sendMail() 463void KABCore::sendMail()
464{ 464{
465 sendMail( mViewManager->selectedEmails().join( ", " ) ); 465 sendMail( mViewManager->selectedEmails().join( ", " ) );
466} 466}
467 467
468void KABCore::sendMail( const QString& email ) 468void KABCore::sendMail( const QString& emaillist )
469{ 469{
470 bool result = ExternalAppHandler::instance()->mailToContacts(email); 470 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
471 if (emaillist.contains(",") > 0)
472 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
473 else
474 ExternalAppHandler::instance()->mailToOneContact( emaillist );
471} 475}
472 476
473 477
474 478
475void KABCore::mailVCard() 479void KABCore::mailVCard()
476{ 480{
@@ -480,26 +484,15 @@ void KABCore::mailVCard()
480} 484}
481 485
482void KABCore::mailVCard( const QStringList& uids ) 486void KABCore::mailVCard( const QStringList& uids )
483{ 487{
484 QStringList urls; 488 QStringList urls;
485 489
486 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 490// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
487 491
488/*US 492 QString dirName = "/tmp/" + KApplication::randomString( 8 );
489 // Create a temp dir, so that we can put the files in it with proper names
490 KTempFile tempDir;
491 if ( tempDir.status() != 0 ) {
492 kdWarning() << strerror( tempDir.status() ) << endl;
493 return;
494 }
495
496 QString dirName = tempDir.name();
497 tempDir.unlink();
498*/
499 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
500 493
501 494
502 495
503 QDir().mkdir( dirName, true ); 496 QDir().mkdir( dirName, true );
504 497
505 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 498 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
@@ -510,12 +503,13 @@ void KABCore::mailVCard( const QStringList& uids )
510 503
511 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 504 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
512 505
513 QString fileName = dirName + "/" + name; 506 QString fileName = dirName + "/" + name;
514 507
515 QFile outFile(fileName); 508 QFile outFile(fileName);
509
516 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 510 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
517 KABC::VCardConverter converter; 511 KABC::VCardConverter converter;
518 QString vcard; 512 QString vcard;
519 513
520 converter.addresseeToVCard( a, vcard ); 514 converter.addresseeToVCard( a, vcard );
521 515
@@ -526,13 +520,13 @@ void KABCore::mailVCard( const QStringList& uids )
526 outFile.close(); 520 outFile.close();
527 521
528 urls.append( fileName ); 522 urls.append( fileName );
529 } 523 }
530 } 524 }
531 525
532 bool result = ExternalAppHandler::instance()->mailAttachments(urls.join(", ")); 526 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
533 527
534 528
535/*US 529/*US
536 kapp->invokeMailer( QString::null, QString::null, QString::null, 530 kapp->invokeMailer( QString::null, QString::null, QString::null,
537 QString::null, // subject 531 QString::null, // subject
538 QString::null, // body 532 QString::null, // body