browserui/browser/BrowserAppSrc/BrowserBmOTABinSender.cpp
changeset 10 57d5b8e231c4
parent 0 84ad3b177aa3
equal deleted inserted replaced
0:84ad3b177aa3 10:57d5b8e231c4
   290 #ifndef _BOOKMARK_SENT_ASCII
   290 #ifndef _BOOKMARK_SENT_ASCII
   291     // CHARACTERISTIC-LIST termination
   291     // CHARACTERISTIC-LIST termination
   292     body->Des().Append( lend );
   292     body->Des().Append( lend );
   293 #endif  // _BOOKMARK_SENT_ASCII
   293 #endif  // _BOOKMARK_SENT_ASCII
   294 
   294 
   295 	if ( capa.iFlags & TSendingCapabilities::ESupportsAttachments )
   295 	// The issue is because of the deletion of the temp file .
   296 	  	{
   296 	// As we are sending address only , we can just create a buffer & send it in message
   297 	    // connect to file session
   297 	// body.
   298 	    RFs fsSession;
   298 
   299 	    User::LeaveIfError( fsSession.Connect() );
   299 	if ( capa.iFlags & (TSendingCapabilities::ESupportsBodyText || TSendingCapabilities::ESupportsAttachments))
   300 	    CleanupClosePushL<RFs>( fsSession );
       
   301 	    CFileMan* fman = CFileMan::NewL( fsSession );
       
   302 	    CleanupStack::PushL( fman );
       
   303 	    // try to avoid inserting any 'leave' code 
       
   304 	    // between WriteMessageBodyIntoFile()
       
   305 	    // and CreateAndSendMessageL, or
       
   306 	    // you have to take care of deleting 
       
   307 	    // temporary file
       
   308 	    error = WriteMessageBodyIntoFileL( fsSession, *body );
       
   309 	        
       
   310 	    if( error == KErrNone )
       
   311 	        {
       
   312 	        // send attachment
       
   313 	        // this function has to be trapped
       
   314 	        // because I have to be sure that the 
       
   315 	        // temproray file is removed!
       
   316 	        msgData->AppendAttachmentL( KAttachmentFilename );            
       
   317 	        TRAP( error, iSendUi->CreateAndSendMessageL( service, 
       
   318 	                                                     msgData ) );
       
   319 	        }
       
   320 	    // delete temporary file
       
   321 	    fman->Delete( KAttachmentFilename );
       
   322 	    // close file session        
       
   323 	    fsSession.Close();
       
   324 
       
   325 	    CleanupStack::PopAndDestroy( 2 ); // fsSession, fman
       
   326 	  	}
       
   327 	else if ( capa.iFlags & TSendingCapabilities::ESupportsBodyText )
       
   328 		{
   300 		{
   329 		CRichText* text = 
   301 		CRichText* text = 
   330 		        CRichText::NewL(CEikonEnv::Static()->SystemParaFormatLayerL(),
   302 		        CRichText::NewL(CEikonEnv::Static()->SystemParaFormatLayerL(),
   331 		                        CEikonEnv::Static()->SystemCharFormatLayerL());
   303 		                        CEikonEnv::Static()->SystemCharFormatLayerL());
   332 		CleanupStack::PushL(text);
   304 		CleanupStack::PushL(text);