25 #include <avkon.hrh> |
25 #include <avkon.hrh> |
26 #include <aknmessagequerydialog.h> |
26 #include <aknmessagequerydialog.h> |
27 #include <ActiveApDb.h> |
27 #include <ActiveApDb.h> |
28 #include <EscapeUtils.h> |
28 #include <EscapeUtils.h> |
29 #include <Uri16.h> |
29 #include <Uri16.h> |
30 #include <brctldefs.h> |
30 #include <BrCtlDefs.h> |
31 #include "WidgetUiObserver.h" |
31 #include "WidgetUiObserver.h" |
32 #include "WidgetUiWindow.h" |
32 #include "WidgetUiWindow.h" |
33 #include "WidgetUiWindowView.h" |
33 #include "WidgetUiWindowView.h" |
34 #include "WidgetUiWindowManager.h" |
34 #include "WidgetUiWindowManager.h" |
35 #include "WidgetUiWindowContainer.h" |
35 #include "WidgetUiWindowContainer.h" |
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 ); |
269 contentType = RecognizeLC( *iFileName, *buf ); |
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 ) |
445 HBufC* CWidgetUiObserver::RecognizeLC( const TDesC& aFileName, const TDesC8& aData ) |
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 ); |
|
454 |
450 |
455 CleanupClosePushL(apaSession); |
451 CleanupClosePushL(apaSession); |
456 User::LeaveIfError( apaSession.Connect() ); |
452 User::LeaveIfError( apaSession.Connect() ); |
457 |
453 |
458 // Ask the application architecture to find the file type |
454 // Ask the application architecture to find the file type |
459 ret = apaSession.RecognizeData( file, dataType ); |
455 ret = apaSession.RecognizeData( aFileName, aData, dataType ); |
460 apaSession.Close(); |
456 apaSession.Close(); |
461 |
|
462 CleanupStack::PopAndDestroy(1, &apaSession); |
457 CleanupStack::PopAndDestroy(1, &apaSession); |
463 CleanupStack::PopAndDestroy( &file ); |
|
464 |
458 |
465 TPtrC8 mimeTypePtr = dataType.iDataType.Des8(); |
459 TPtrC8 mimeTypePtr = dataType.iDataType.Des8(); |
466 TInt len = mimeTypePtr.Length() + 1; |
460 TInt len = mimeTypePtr.Length() + 1; |
467 HBufC* contentTypeString = HBufC::NewLC( len );; |
461 HBufC* contentTypeString = HBufC::NewLC( len );; |
468 |
462 |