-rw-r--r-- | kaddressbook/kabcore.cpp | 26 |
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 @@ -420,161 +420,155 @@ void KABCore::setContactSelected( const QString &uid ) if ( !addr.isEmpty() ) { emit contactSelected( addr.formattedName() ); KABC::Picture pic = addr.photo(); if ( pic.isIntern() ) { //US emit contactSelected( pic.data() ); //US instead use: QPixmap px; if (pic.data().isNull() != true) { px.convertFromImage(pic.data()); } emit contactSelected( px ); } } mExtensionManager->setSelectionChanged(); // update the actions bool selected = !uid.isEmpty(); if ( mReadWrite ) { mActionCut->setEnabled( selected ); mActionPaste->setEnabled( selected ); } mActionCopy->setEnabled( selected ); mActionDelete->setEnabled( selected ); mActionEditAddressee->setEnabled( selected ); mActionMail->setEnabled( selected ); mActionMailVCard->setEnabled( selected ); //if (mActionBeam) //mActionBeam->setEnabled( selected ); if (mActionBeamVCard) mActionBeamVCard->setEnabled( selected ); mActionWhoAmI->setEnabled( selected ); mActionCategories->setEnabled( selected ); } void KABCore::sendMail() { sendMail( mViewManager->selectedEmails().join( ", " ) ); } -void KABCore::sendMail( const QString& email ) +void KABCore::sendMail( const QString& emaillist ) { - bool result = ExternalAppHandler::instance()->mailToContacts(email); + // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " + if (emaillist.contains(",") > 0) + ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); + else + ExternalAppHandler::instance()->mailToOneContact( emaillist ); } void KABCore::mailVCard() { QStringList uids = mViewManager->selectedUids(); if ( !uids.isEmpty() ) mailVCard( uids ); } void KABCore::mailVCard( const QStringList& uids ) { QStringList urls; - QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); +// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); -/*US - // Create a temp dir, so that we can put the files in it with proper names - KTempFile tempDir; - if ( tempDir.status() != 0 ) { - kdWarning() << strerror( tempDir.status() ) << endl; - return; - } - - QString dirName = tempDir.name(); - tempDir.unlink(); -*/ - QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); + QString dirName = "/tmp/" + KApplication::randomString( 8 ); QDir().mkdir( dirName, true ); for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { KABC::Addressee a = mAddressBook->findByUid( *it ); if ( a.isEmpty() ) continue; QString name = a.givenName() + "_" + a.familyName() + ".vcf"; QString fileName = dirName + "/" + name; QFile outFile(fileName); + if ( outFile.open(IO_WriteOnly) ) { // file opened successfully KABC::VCardConverter converter; QString vcard; converter.addresseeToVCard( a, vcard ); QTextStream t( &outFile ); // use a text stream t.setEncoding( QTextStream::UnicodeUTF8 ); t << vcard; outFile.close(); urls.append( fileName ); } } - bool result = ExternalAppHandler::instance()->mailAttachments(urls.join(", ")); + bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); /*US kapp->invokeMailer( QString::null, QString::null, QString::null, QString::null, // subject QString::null, // body QString::null, urls ); // attachments */ } /** Beams the "WhoAmI contact. */ void KABCore::beamMySelf() { KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); if (!a.isEmpty()) { 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() { QStringList uids = mViewManager->selectedUids(); if ( !uids.isEmpty() ) beamVCard( uids ); } void KABCore::beamVCard(const QStringList& uids) { /*US QString beamFilename; Opie::OPimContact c; if ( actionPersonal->isOn() ) { beamFilename = addressbookPersonalVCardName(); if ( !QFile::exists( beamFilename ) ) return; // can't beam a non-existent file |