327 |
327 |
328 TRAP_IGNORE(iFeatureIds = HBufC::NewL(2)); |
328 TRAP_IGNORE(iFeatureIds = HBufC::NewL(2)); |
329 TPtr FIdValue = iFeatureIds->Des(); |
329 TPtr FIdValue = iFeatureIds->Des(); |
330 FIdValue.Copy(_L("-1")); |
330 FIdValue.Copy(_L("-1")); |
331 } |
331 } |
|
332 |
|
333 if ( LocalTagName.Compare(KPriorityTag) == 0 && nElements == 0 ) |
|
334 { |
|
335 iIsPriority = ETrue; |
|
336 iPriority.Copy(KEmptyString); |
|
337 } |
|
338 else |
|
339 { |
|
340 iIsPriority = EFalse; |
|
341 } |
332 |
342 |
333 return KErrNone; |
343 return KErrNone; |
334 } |
344 } |
335 |
345 |
336 TInt CCSXHXMLParseHandler_MetaFile::EndElement ( const TDesC8& ,const TDesC8& ,const TDesC8& ) |
346 TInt CCSXHXMLParseHandler_MetaFile::EndElement ( const TDesC8& ,const TDesC8& ,const TDesC8& ) |
337 { |
347 { |
338 iIsAppName = EFalse; |
348 iIsAppName = EFalse; |
|
349 iIsPriority = EFalse; |
339 return KErrNone; |
350 return KErrNone; |
340 } |
351 } |
341 |
352 |
342 TInt CCSXHXMLParseHandler_MetaFile::Characters (const TDesC8& aBuff, const TInt /*aStart*/, const TInt /*aLength*/) |
353 TInt CCSXHXMLParseHandler_MetaFile::Characters (const TDesC8& aBuff, const TInt /*aStart*/, const TInt /*aLength*/) |
343 { |
354 { |
344 TBuf<KMaxFileName> TitleName; |
355 if (iIsAppName) |
345 if(iIsAppName) |
356 { |
346 { |
357 TBuf<KMaxFileName> TitleName; |
347 CnvUtfConverter::ConvertToUnicodeFromUtf8(TitleName,aBuff); |
358 CnvUtfConverter::ConvertToUnicodeFromUtf8(TitleName,aBuff); |
348 iApplicationName.Append(TitleName); |
359 iApplicationName.Append(TitleName); |
349 } |
360 } |
350 return KErrNone; |
361 |
|
362 if (iIsPriority) |
|
363 { |
|
364 TBuf<8> Priority; |
|
365 CnvUtfConverter::ConvertToUnicodeFromUtf8(Priority,aBuff); |
|
366 iPriority.Append(Priority); |
|
367 } |
|
368 |
|
369 return KErrNone; |
|
370 } |
|
371 |
|
372 TInt32 CCSXHXMLParseHandler_MetaFile::Priority() |
|
373 { |
|
374 //The default priority is set to 0 |
|
375 TInt priority = 0; |
|
376 |
|
377 if (iPriority.Length() != 0) |
|
378 { |
|
379 TLex lex( iPriority ); |
|
380 lex.Val( priority ); |
|
381 iPriority.Copy(KEmptyString); |
|
382 } |
|
383 |
|
384 return priority; |
351 } |
385 } |
352 |
386 |
353 |
387 |
354 //-------------- CCSXHXMLParseHandler_MasterMetaFile ------------------- |
388 //-------------- CCSXHXMLParseHandler_MasterMetaFile ------------------- |
355 CCSXHXMLParseHandler_MasterMetaFile* CCSXHXMLParseHandler_MasterMetaFile::NewL(CCoeEnv* aCoeEnv) |
389 CCSXHXMLParseHandler_MasterMetaFile* CCSXHXMLParseHandler_MasterMetaFile::NewL(CCoeEnv* aCoeEnv) |
377 RAttributeArray& aAttributes) |
411 RAttributeArray& aAttributes) |
378 { |
412 { |
379 TInt nElements = aAttributes.Count(); |
413 TInt nElements = aAttributes.Count(); |
380 TBuf<KMaxFileName> appUid; |
414 TBuf<KMaxFileName> appUid; |
381 TBuf<KMaxFileName> appName; |
415 TBuf<KMaxFileName> appName; |
|
416 TBuf<8> priorityBuf; |
|
417 TInt32 appPriority; |
382 RAttribute AttributeInfo; |
418 RAttribute AttributeInfo; |
383 RTagInfo TagInformation; |
419 RTagInfo TagInformation; |
384 TLinearOrder<CCSXHHelpContentBase> anOrder(Orderer<CCSXHHelpContentBase>); |
420 TLinearOrder<CCSXHHelpContentBase> anOrder(Orderer<CCSXHHelpContentBase>); |
385 |
421 |
386 for(TInt i=0; i<nElements; i++) |
422 for(TInt i=0; i<nElements; i++) |
399 } |
435 } |
400 |
436 |
401 if(LocalName.Compare(KMasterCollection_idTag) == 0) |
437 if(LocalName.Compare(KMasterCollection_idTag) == 0) |
402 { |
438 { |
403 CnvUtfConverter::ConvertToUnicodeFromUtf8(appUid,AttributeInfo.Value().DesC()); |
439 CnvUtfConverter::ConvertToUnicodeFromUtf8(appUid,AttributeInfo.Value().DesC()); |
|
440 } |
|
441 |
|
442 if (LocalName.Compare(KPriorityTag) == 0) |
|
443 { |
|
444 CnvUtfConverter::ConvertToUnicodeFromUtf8(priorityBuf,AttributeInfo.Value().DesC()); |
|
445 TLex lex( priorityBuf ); |
|
446 lex.Val( appPriority ); |
404 } |
447 } |
405 |
448 |
406 if(LocalName.Compare(KTOC2NameTag) == 0) |
449 if(LocalName.Compare(KTOC2NameTag) == 0) |
407 { |
450 { |
408 CnvUtfConverter::ConvertToUnicodeFromUtf8(appName,AttributeInfo.Value().DesC()); |
451 CnvUtfConverter::ConvertToUnicodeFromUtf8(appName,AttributeInfo.Value().DesC()); |
418 TPtr FIdValue = iFeatureIds->Des(); |
461 TPtr FIdValue = iFeatureIds->Des(); |
419 FIdValue.Copy(_L("-1")); |
462 FIdValue.Copy(_L("-1")); |
420 } |
463 } |
421 |
464 |
422 |
465 |
423 iParser->InsertHTMLToc1L( appUid, appName, iDrive, iDataBase, iFeatureIds->Des() ); |
466 iParser->InsertHTMLToc1L( appUid, appName, iDrive, iDataBase, iFeatureIds->Des(), appPriority ); |
424 } |
467 } |
425 |
468 |
426 if(LocalName.Compare(_L("FeatureID")) == 0) |
469 if(LocalName.Compare(_L("FeatureID")) == 0) |
427 { |
470 { |
428 if(iFeatureIds) |
471 if(iFeatureIds) |
640 } |
683 } |
641 } |
684 } |
642 } |
685 } |
643 } |
686 } |
644 |
687 |
|
688 //-------------- CCSXHXMLParseHandler_RedirectFile ------------------- |
|
689 |
|
690 CCSXHXMLParseHandler_RedirectFile* CCSXHXMLParseHandler_RedirectFile::NewL( CCoeEnv *aCoeEnv, |
|
691 const TUid &aSourceUid, const TCoeContextName &aSourceContextName ) |
|
692 { |
|
693 CCSXHXMLParseHandler_RedirectFile* self = |
|
694 new (ELeave)CCSXHXMLParseHandler_RedirectFile( aCoeEnv, aSourceUid, aSourceContextName ); |
|
695 return self; |
|
696 } |
|
697 |
|
698 CCSXHXMLParseHandler_RedirectFile::CCSXHXMLParseHandler_RedirectFile( CCoeEnv *aCoeEnv, |
|
699 const TUid &aSourceUid, const TCoeContextName &aSourceContextName ) |
|
700 :CCSXHXMLParseHandler( aCoeEnv ), iSourceContextName( aSourceContextName ), iTargetUid( aSourceUid ) |
|
701 { |
|
702 } |
|
703 TInt CCSXHXMLParseHandler_RedirectFile::StartElement (const TDesC8& , |
|
704 const TDesC8 &alocalName, const TDesC8& , const RAttributeArray &aAttributes) |
|
705 { |
|
706 if ( !iIsTargetPathFound ) |
|
707 { |
|
708 TBuf<KMaxFileName> LocalTagName; |
|
709 |
|
710 CnvUtfConverter::ConvertToUnicodeFromUtf8(LocalTagName,alocalName); |
|
711 |
|
712 if ( LocalTagName.Compare(KFromTag) == 0 ) |
|
713 { |
|
714 iIsFromTag = ETrue; |
|
715 iIsToTag = EFalse; |
|
716 } |
|
717 else if (LocalTagName.Compare(KToTag) == 0 ) |
|
718 { |
|
719 iIsToTag = ETrue; |
|
720 iIsFromTag = EFalse; |
|
721 } |
|
722 else |
|
723 { |
|
724 iIsFromTag = EFalse; |
|
725 iIsToTag = EFalse; |
|
726 } |
|
727 iFromContent.Copy(KEmptyString); |
|
728 } |
|
729 |
|
730 return KErrNone; |
|
731 } |
|
732 |
|
733 TInt CCSXHXMLParseHandler_RedirectFile::EndElement ( const TDesC8& ,const TDesC8& ,const TDesC8& ) |
|
734 { |
|
735 if ( iIsFromTag && iFromContent.Compare( iSourceContextName ) == 0 ) |
|
736 { |
|
737 iIsSourceContextNameFound = ETrue; |
|
738 } |
|
739 else |
|
740 { |
|
741 iIsSourceContextNameFound = EFalse; |
|
742 } |
|
743 |
|
744 iIsFromTag = EFalse; |
|
745 iIsToTag = EFalse; |
|
746 |
|
747 return KErrNone; |
|
748 } |
|
749 |
|
750 TInt CCSXHXMLParseHandler_RedirectFile::Characters (const TDesC8& aBuff, const TInt /*aStart*/, const TInt /*aLength*/) |
|
751 { |
|
752 if ( iIsFromTag ) |
|
753 { |
|
754 TCoeContextName file; |
|
755 CnvUtfConverter::ConvertToUnicodeFromUtf8(file,aBuff); |
|
756 iFromContent.Append(file); |
|
757 } |
|
758 |
|
759 else if ( iIsSourceContextNameFound && iIsToTag ) |
|
760 { |
|
761 TBuf<KMaxFileName> targetPath; |
|
762 CnvUtfConverter::ConvertToUnicodeFromUtf8(targetPath,aBuff); |
|
763 iTargetPath.Append(targetPath); |
|
764 |
|
765 iIsTargetPathFound = ETrue; |
|
766 } |
|
767 |
|
768 return KErrNone; |
|
769 } |
|
770 |
|
771 TUid CCSXHXMLParseHandler_RedirectFile::TargetUid() |
|
772 { |
|
773 TInt loc = iTargetPath.Find( KHexPrefix ); |
|
774 if ( loc != KErrNotFound ) |
|
775 { |
|
776 TLex lex( iTargetPath.Mid( loc+KHexPrefixLength, KHexUidLength ) ); |
|
777 TUint appId = 0; |
|
778 lex.Val( appId, EHex ); |
|
779 |
|
780 if ( appId ) |
|
781 { |
|
782 iTargetUid = TUid::Uid( (TInt)appId ); |
|
783 } |
|
784 } |
|
785 |
|
786 return iTargetUid; |
|
787 } |
|
788 |
|
789 TBuf<KMaxFileName>& CCSXHXMLParseHandler_RedirectFile::TargetContextName() |
|
790 { |
|
791 TInt loc = iTargetPath.Find( KHexPrefix ); |
|
792 if ( loc != KErrNotFound ) |
|
793 { |
|
794 iTargetContextName = iTargetPath.Mid( loc + KOffsetFromUidToContext ); |
|
795 } |
|
796 else |
|
797 { |
|
798 iTargetContextName = iTargetPath; |
|
799 } |
|
800 |
|
801 return iTargetContextName; |
|
802 } |
|
803 |
|
804 TBool CCSXHXMLParseHandler_RedirectFile::IsTargetPathFound() |
|
805 { |
|
806 return iIsTargetPathFound; |
|
807 } |
|
808 |