diff -r 0ed94ceaa377 -r cb62a4f66ebe widgets/widgetapp/src/WidgetUiObserver.cpp --- a/widgets/widgetapp/src/WidgetUiObserver.cpp Thu Dec 17 09:20:16 2009 +0200 +++ b/widgets/widgetapp/src/WidgetUiObserver.cpp Thu Jan 07 13:31:38 2010 +0200 @@ -266,7 +266,7 @@ CleanupStack::PushL( buf ); HBufC* contentType = NULL; TPtrC p( NULL, 0 ); - contentType = RecognizeLC( *iFileName, *buf ); + contentType = RecognizeLC( *iFileName ); aEmbeddedLinkContent.HandleResolveComplete( *contentType, p, buf ); CleanupStack::PopAndDestroy( 2, buf ); // contentType, buf return ETrue; @@ -442,19 +442,25 @@ // CWidgetUiObserver::RecognizeL // ----------------------------------------------------------------------------- // -HBufC* CWidgetUiObserver::RecognizeLC( const TDesC& aFileName, const TDesC8& aData ) +HBufC* CWidgetUiObserver::RecognizeLC( const TDesC& aFileName ) { TDataRecognitionResult dataType; RApaLsSession apaSession; TInt ret; + + RFile file; + User::LeaveIfError( file.Open(CCoeEnv::Static()->FsSession(), aFileName, EFileRead|EFileShareAny) ); + CleanupClosePushL( file ); CleanupClosePushL(apaSession); User::LeaveIfError( apaSession.Connect() ); // Ask the application architecture to find the file type - ret = apaSession.RecognizeData( aFileName, aData, dataType ); + ret = apaSession.RecognizeData( file, dataType ); apaSession.Close(); + CleanupStack::PopAndDestroy(1, &apaSession); + CleanupStack::PopAndDestroy( &file ); TPtrC8 mimeTypePtr = dataType.iDataType.Des8(); TInt len = mimeTypePtr.Length() + 1;