widgets/widgetapp/src/WidgetUiObserver.cpp
changeset 37 cb62a4f66ebe
parent 36 0ed94ceaa377
child 58 220a17280356
child 65 5bfc169077b2
--- 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;