517 // ----------------------------------------------------------------------------- |
523 // ----------------------------------------------------------------------------- |
518 // |
524 // |
519 HBufC8* MmMtpDpUtility::OdfMimeTypeL( const TDesC& aFullPath ) |
525 HBufC8* MmMtpDpUtility::OdfMimeTypeL( const TDesC& aFullPath ) |
520 { |
526 { |
521 PRINT( _L( "MM MTP => MmMtpDpUtility::OdfMimeTypeL" ) ); |
527 PRINT( _L( "MM MTP => MmMtpDpUtility::OdfMimeTypeL" ) ); |
522 |
528 HBufC8* mimebuf = NULL; |
523 CContent* content = CContent::NewLC( aFullPath ); // + content |
529 |
524 HBufC* buffer = HBufC::NewLC( KMimeTypeMaxLength ); // + buffer |
530 CContent* content = CContent::NewL( aFullPath ); |
|
531 CleanupStack::PushL( content ); // + content |
|
532 |
|
533 HBufC* buffer = HBufC::NewL( KMimeTypeMaxLength ); |
|
534 CleanupStack::PushL( buffer ); // + buffer |
525 |
535 |
526 TPtr data = buffer->Des(); |
536 TPtr data = buffer->Des(); |
527 User::LeaveIfError( content->GetStringAttribute( EMimeType, data ) ); |
537 TInt err = content->GetStringAttribute( EMimeType, data ); |
528 |
538 |
529 HBufC8* mimebuf = HBufC8::NewL( buffer->Length() ); |
539 if ( err == KErrNone ) |
530 mimebuf->Des().Copy( *buffer ); |
540 { |
|
541 mimebuf = HBufC8::New( buffer->Length() ); |
|
542 |
|
543 if ( mimebuf == NULL ) |
|
544 { |
|
545 User::LeaveIfError( KErrNotFound ); |
|
546 } |
|
547 |
|
548 mimebuf->Des().Copy( *buffer ); |
|
549 } |
|
550 |
|
551 // leave if NULL |
|
552 if ( mimebuf == NULL ) |
|
553 { |
|
554 User::Leave( KErrNotFound ); |
|
555 } |
531 |
556 |
532 CleanupStack::PopAndDestroy( buffer ); // - buffer |
557 CleanupStack::PopAndDestroy( buffer ); // - buffer |
533 CleanupStack::PopAndDestroy( content ); // - content |
558 CleanupStack::PopAndDestroy( content ); // - content |
534 |
559 |
535 PRINT( _L( "MM MTP <= MmMtpDpUtility::OdfMimeTypeL" ) ); |
560 PRINT( _L( "MM MTP <= MmMtpDpUtility::OdfMimeTypeL" ) ); |