581 { |
581 { |
582 deleteOpml = ETrue; |
582 deleteOpml = ETrue; |
583 } |
583 } |
584 result = ETrue; |
584 result = ETrue; |
585 } |
585 } |
586 CleanupStack::PopAndDestroy(); //rfile |
586 |
587 |
587 |
588 // delete the downloaded file if it is not handled |
588 // delete the downloaded file if it is not handled |
589 if(deleteOpml && (dataTypeDes.Compare(KOPMLMimeType) == 0 )) |
589 if(deleteOpml && (dataTypeDes.Compare(KOPMLMimeType) == 0 )) |
590 { |
590 { |
591 rfs.Delete(fileName); |
591 rfs.Delete(fileName); |
592 } |
592 } |
593 } |
593 } |
594 CleanupStack::PopAndDestroy(); //rfs |
594 |
595 } |
595 // If open file was handled, skip sending to feeds engine |
596 |
596 // otherwise, pass it on |
597 // If open file was handled, skip sending to feeds engine |
597 if(!result) |
598 // otherwise, pass it on |
598 { |
599 if(!result) |
599 TInt fileSize; |
600 { |
600 // Read the file from the beginning into a buffer |
601 // Launch the Feeds Engine |
601 User::LeaveIfError(rfile.Size(fileSize)); |
602 iContentView->HandleSubscribeToWithUrlL(url); |
602 HBufC8* buffer = HBufC8::NewLC(fileSize); |
603 result = ETrue; |
603 TPtr8 bufferPtr(buffer->Des()); |
|
604 TInt startPos = 0; |
|
605 User::LeaveIfError(rfile.Read(startPos, bufferPtr, fileSize)); |
|
606 |
|
607 _LIT8( searchTag1, "<feed" ); //Atom 1.0 Feed |
|
608 _LIT8( searchTag2, "<rdf" ); //RSS 1.0 Feed |
|
609 _LIT8( searchTag3, "<rss" ); //RSS 2.0 Feed |
|
610 |
|
611 if( ( bufferPtr.FindF( searchTag1 ) != KErrNotFound ) || (bufferPtr.FindF( searchTag2 ) != KErrNotFound ) || |
|
612 (bufferPtr.FindF( searchTag3 ) != KErrNotFound ) ) |
|
613 { |
|
614 // Launch the Feeds Engine only when xml file contain atleast one of the above mentioned feeds tag |
|
615 iContentView->HandleSubscribeToWithUrlL(url); |
|
616 } |
|
617 else |
|
618 { |
|
619 //Delete the file, if it is not fwd to Feeds Engine, As displaying of xml files is not supported. |
|
620 rfs.Delete(fileName); |
|
621 } |
|
622 result = ETrue; |
|
623 CleanupStack::PopAndDestroy(); //buffer |
|
624 } |
|
625 |
|
626 CleanupStack::PopAndDestroy(); //rfile |
|
627 CleanupStack::PopAndDestroy(); //rfs |
604 } |
628 } |
605 } |
629 } |
606 |
630 |
607 return result; |
631 return result; |
608 } |
632 } |