264 } |
264 } |
265 |
265 |
266 CleanupStack::PushL( buf ); |
266 CleanupStack::PushL( buf ); |
267 HBufC* contentType = NULL; |
267 HBufC* contentType = NULL; |
268 TPtrC p( NULL, 0 ); |
268 TPtrC p( NULL, 0 ); |
269 contentType = RecognizeLC( *iFileName, *buf ); |
269 contentType = RecognizeLC( *iFileName ); |
270 aEmbeddedLinkContent.HandleResolveComplete( *contentType, p, buf ); |
270 aEmbeddedLinkContent.HandleResolveComplete( *contentType, p, buf ); |
271 CleanupStack::PopAndDestroy( 2, buf ); // contentType, buf |
271 CleanupStack::PopAndDestroy( 2, buf ); // contentType, buf |
272 return ETrue; |
272 return ETrue; |
273 } |
273 } |
274 |
274 |
440 |
440 |
441 // ----------------------------------------------------------------------------- |
441 // ----------------------------------------------------------------------------- |
442 // CWidgetUiObserver::RecognizeL |
442 // CWidgetUiObserver::RecognizeL |
443 // ----------------------------------------------------------------------------- |
443 // ----------------------------------------------------------------------------- |
444 // |
444 // |
445 HBufC* CWidgetUiObserver::RecognizeLC( const TDesC& aFileName, const TDesC8& aData ) |
445 HBufC* CWidgetUiObserver::RecognizeLC( const TDesC& aFileName ) |
446 { |
446 { |
447 TDataRecognitionResult dataType; |
447 TDataRecognitionResult dataType; |
448 RApaLsSession apaSession; |
448 RApaLsSession apaSession; |
449 TInt ret; |
449 TInt ret; |
|
450 |
|
451 RFile file; |
|
452 User::LeaveIfError( file.Open(CCoeEnv::Static()->FsSession(), aFileName, EFileRead|EFileShareAny) ); |
|
453 CleanupClosePushL( file ); |
450 |
454 |
451 CleanupClosePushL(apaSession); |
455 CleanupClosePushL(apaSession); |
452 User::LeaveIfError( apaSession.Connect() ); |
456 User::LeaveIfError( apaSession.Connect() ); |
453 |
457 |
454 // Ask the application architecture to find the file type |
458 // Ask the application architecture to find the file type |
455 ret = apaSession.RecognizeData( aFileName, aData, dataType ); |
459 ret = apaSession.RecognizeData( file, dataType ); |
456 apaSession.Close(); |
460 apaSession.Close(); |
|
461 |
457 CleanupStack::PopAndDestroy(1, &apaSession); |
462 CleanupStack::PopAndDestroy(1, &apaSession); |
|
463 CleanupStack::PopAndDestroy( &file ); |
458 |
464 |
459 TPtrC8 mimeTypePtr = dataType.iDataType.Des8(); |
465 TPtrC8 mimeTypePtr = dataType.iDataType.Des8(); |
460 TInt len = mimeTypePtr.Length() + 1; |
466 TInt len = mimeTypePtr.Length() + 1; |
461 HBufC* contentTypeString = HBufC::NewLC( len );; |
467 HBufC* contentTypeString = HBufC::NewLC( len );; |
462 |
468 |