# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1266612123 -7200 # Node ID d06b1526f62c86f7aee9ebb4380cb90babcbb6bf # Parent 27f5851bd5a585c83780310ffd3539c491a5fe96 Revision: 201003 Kit: 201007 diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/inc/CSXHGenericTOC1.h --- a/csxhelp/HelpEngine/inc/CSXHGenericTOC1.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/inc/CSXHGenericTOC1.h Fri Feb 19 22:42:03 2010 +0200 @@ -63,6 +63,7 @@ */ TBool InsertChild(CCSXHHelpContentBase* atoc2,TBool aDeleteObject = ETrue); + TBool InsertChildWithPriority(CCSXHHelpContentBase* aChild, TBool aDeleteObject = ETrue); /** * @function ResetChildList * @since S60 3.2 @@ -79,7 +80,7 @@ * Construct a CCSXHGenericTOC1 * @param aName - TOC1 Name */ - CCSXHGenericTOC1(const TDesC& aName); + CCSXHGenericTOC1(const TDesC& aName, const TInt32 aPriority = 0); /** * @function InitChildList diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/inc/CSXHHTMLContentParser.h --- a/csxhelp/HelpEngine/inc/CSXHHTMLContentParser.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/inc/CSXHHTMLContentParser.h Fri Feb 19 22:42:03 2010 +0200 @@ -20,6 +20,7 @@ #define __CCSXHHTMLCONTENTPARSER_H__ #include "CSXHGenericTOC1.h" +#include "coehelp.h" #include #include #include @@ -37,6 +38,7 @@ class MSenContentHandlerClient; class CCSXHXMLParseHandler_Kywd; class CCSXHRuntimeIndexing; +class CCSXHXMLParseHandler_MetaFile; /** * CCSXHHTMLContentParser class. * This class is used to parse XML files & generate Html data @@ -131,13 +133,15 @@ void GenerateTOC2ListForKeywordSearchL(CCSXHHelpDataBase* aDataBase, CCSXHKywdTOC1* akywdtoc1); /** -* @function GetContextTopic +* @function GetContextTopicL * @since S60 3.2 * Get the help Context object -* @param aContext - Help context object -* @return database class pointer +* @param aContextName - Help context object +* @param aUid - Help content UID +* @return Help content class pointer */ - CCSXHHelpContentBase* GetContextTopic(const TUid &aUid, const TDesC &contextName); + CCSXHHelpContentBase* GetContextTopicL(CCSXHHelpDataBase *aDataBase, + TUid &aUid, TCoeContextName &aContextName); /** * @function GetHtmlTopicForUrlL * @since S60 3.2 @@ -158,7 +162,7 @@ void InsertHTMLToc1L(const TDesC &appUidName,const TDesC &appName,const TInt& aDrive, - CCSXHHelpDataBase* aDataBase,const TDesC &FeatureIds ); + CCSXHHelpDataBase* aDataBase, const TDesC &FeatureIds, TInt32 aPriority); /** * @function GetHTMLToc1 @@ -211,7 +215,12 @@ */ void ScanAndParseXMLfileToCreateTOC1ObjectL(RFs& aFileSession,CDirScan* ascanner, CCSXHHelpDataBase* aDataBase, - const TInt& aDrive,CCSXHXMLParseHandler* aXMLParser); + const TInt& aDrive, + CCSXHXMLParseHandler_MetaFile* aXMLParser); + + + + TBool IsRomBasedContentL( RFs& FileSession, const TDesC &aUid ); /** * @function HandleMasterMetaFileL( * @since S60 3.2 @@ -224,6 +233,17 @@ */ TBool HandleMasterMetaFileL(CCSXHHelpDataBase* aDataBase, TChar& aDrive, MSenContentHandlerClient *aPrevHandler); + +/** +* @function IsRedirectedL( +* @param aDatabase - Database pointer +* aPath - Context root directory +* aUid - App uid +* aContextName - file name +* @return ETrue if the context is redirected successfully, EFalse otherwise +*/ + TBool IsRedirectedL(CCSXHHelpDataBase *aDataBase, + const TDesC &aPath, TUid &aUid, TCoeContextName &aContextName); /** * @function HandleMasterKeywordFileL( * @since S60 3.2 diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/inc/CSXHHelpContentBase.h --- a/csxhelp/HelpEngine/inc/CSXHHelpContentBase.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/inc/CSXHHelpContentBase.h Fri Feb 19 22:42:03 2010 +0200 @@ -52,6 +52,8 @@ * @return Pointer which contains Name */ IMPORT_C TPtr GetName() const; + + TInt32 Priority() const; protected: /** @@ -60,7 +62,7 @@ * Construct a CCSXHHelpContentBase * @param aName - Name */ - CCSXHHelpContentBase(const TDesC& name); + CCSXHHelpContentBase(const TDesC& name, const TInt32 aPriority = 0); private: // 1. For Generic TOC1: The TOC1 entry name @@ -70,10 +72,13 @@ //typedef TBuf<30> TCoeContextName; HBufC *iName; + TInt32 iPriority; template friend TInt Orderer(const T& left, const T& right); + template + friend TInt OrdererWithPriority(const T& left, const T& right); }; /** * @function Orderer @@ -87,7 +92,25 @@ TInt Orderer(const T& left, const T& right) { //return left.GetName().CompareC(right.GetName()); - return (left.iName)->CompareC(*right.iName); + return (left.iName)->CompareF(*right.iName); } + +template +TInt OrdererWithPriority(const T& left, const T& right) + { + if (left.iPriority < right.iPriority) + { + return -1; + } + else if (left.iPriority == right.iPriority) + { + return (left.iName)->CompareF(*right.iName); + } + else + { + return 1; + } + } + #endif /* INC_CSXHHELPCONTENTBASE_H_HEADER_INCLUDED_BC0553D0 */ diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/inc/CSXHHelpDataBase.h --- a/csxhelp/HelpEngine/inc/CSXHHelpDataBase.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/inc/CSXHHelpDataBase.h Fri Feb 19 22:42:03 2010 +0200 @@ -51,7 +51,7 @@ * @param aCoeEnv - Control Environment * @return a CCSXHHelpDataBase Pointer */ - IMPORT_C static CCSXHHelpDataBase* NewL(CCoeEnv* aCoeEnv,const TApaAppCaption& aAppCaption); + IMPORT_C static CCSXHHelpDataBase* NewL(CCoeEnv* aCoeEnv,const TApaAppCaption& aAppCaption, const TApaAppCaption& aAppHelpTopic); /** * @function NewLC * @since S60 3.2 @@ -60,7 +60,7 @@ * @param aCoeEnv - Control Environment * @return a CCSXHHelpDataBase Pointer */ - static CCSXHHelpDataBase* NewLC(CCoeEnv *aCoeEnv,const TApaAppCaption& aAppCaption); + static CCSXHHelpDataBase* NewLC(CCoeEnv *aCoeEnv,const TApaAppCaption& aAppCaption, const TApaAppCaption& aAppHelpTopic); /** * @function GetInstance @@ -91,6 +91,13 @@ */ IMPORT_C CCSXHGenericTOC1* GetKywdTopics(); /** +* @function GetAppHelpsTopics +* @since S60 5.2 +* Get the instance of application (custom) helps toc1 +* @return toc1 pointer +*/ + IMPORT_C CCSXHGenericTOC1* GetAppHelpsTopics(); +/** * @function ClearAllTOC1Contents * @since S60 3.2 * Delete all the objects from the Array @@ -225,7 +232,7 @@ * Construct a CCSXHHelpDataBase * @param aCoeEnv - Control Environment */ - CCSXHHelpDataBase(CCoeEnv* aCoeEnv,const TApaAppCaption& aAppCaption); + CCSXHHelpDataBase(CCoeEnv* aCoeEnv,const TApaAppCaption& aAppCaption, const TApaAppCaption& aAppHelpTopic); /** * @function GetContextTopicL @@ -241,6 +248,8 @@ // List of keyword entries CCSXHKywdTopics *iKywdTOC1; + CCSXHMainTopics* iAppHelpsToc; + CCSXHHTMLContentParser *iHTMLContentParser; CCSXHLegacyContentParser *iLegacyContentParser; @@ -253,6 +262,7 @@ TApaAppCaption iAppCaption; + TApaAppCaption iAppHelpTopic; TInt iKeywordSearchCount; }; diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/inc/CSXHHtmlTOC1.h --- a/csxhelp/HelpEngine/inc/CSXHHtmlTOC1.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/inc/CSXHHtmlTOC1.h Fri Feb 19 22:42:03 2010 +0200 @@ -61,7 +61,7 @@ * @return a CCSXHHtmlTOC1 Pointer */ static CCSXHHtmlTOC1* NewL(const TDesC& aName,const TDesC& aFolder, - const TInt& aDrive); + const TInt& aDrive, TUid aViewId, TInt32 aPriority = 0); /** * @function ~CCSXHHtmlTOC1 * @since S60 3.2 @@ -124,7 +124,7 @@ * aUid - Application Uid * aDrive - Drive Number */ - CCSXHHtmlTOC1(const TDesC& aName,const TDesC& aFolder,const TInt& aDriveName); + CCSXHHtmlTOC1(const TDesC& aName, const TDesC& aFolder, const TInt& aDriveName, TUid aViewId, TInt32 aPriority); /** * @function InitChildList * @since S60 3.2 @@ -140,6 +140,7 @@ TAppUid iAppUid; short iDrive; + TUid iViewId; }; diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/inc/CSXHMainTopics.h --- a/csxhelp/HelpEngine/inc/CSXHMainTopics.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/inc/CSXHMainTopics.h Fri Feb 19 22:42:03 2010 +0200 @@ -37,7 +37,7 @@ * @param aCoeEnv - Control Environment * @retrun a CCSXHMainTopics pointer */ - static CCSXHMainTopics* NewL(const TUid&, const TApaAppCaption& aAppCaption); + static CCSXHMainTopics* NewL(const TUid&, const TApaAppCaption& aAppCaption, const TInt32 aPriority = 0); /** * @function CCSXHMainTopics * @since S60 3.2 @@ -45,7 +45,7 @@ * @param aCoeEnv - Control Environment * @retrun a CCSXHMainTopics pointer */ - static CCSXHMainTopics* NewLC(const TUid&,const TApaAppCaption& aAppCaption); + static CCSXHMainTopics* NewLC(const TUid&,const TApaAppCaption& aAppCaption, const TInt32 aPriority = 0); /** * @function ~CCSXHMainTopics @@ -76,7 +76,7 @@ * @param aUid - Application Uid * aName - TOC1 Object Name */ - CCSXHMainTopics(const TUid& aUid, const TDesC& aName); + CCSXHMainTopics(const TUid& aUid, const TDesC& aName, const TInt32 aPriority); const TUid &iUid; }; diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/inc/CSXHRuntimeIndexing.h --- a/csxhelp/HelpEngine/inc/CSXHRuntimeIndexing.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/inc/CSXHRuntimeIndexing.h Fri Feb 19 22:42:03 2010 +0200 @@ -74,14 +74,14 @@ * Since Z based helps must exist * Usage: to determine Help was launched before */ - TBool IndexFileExists(); + TBool IndexFileExistsL(); /* * create temporary index file * this file will be saved to C:\\private\\\\\\\\ * @param: aDrive Drive information */ - void BeginIndexFile( const TChar& aDrive ); + void BeginIndexFileL( const TChar& aDrive ); /* * close the temporary index file, and rename it to index.xml formally @@ -102,7 +102,7 @@ * please refer to BaflUtils::GetDowngradePathL * @param aDir[out] append proper locale */ - void AppendLocale( TDes& aDir ); + void AppendLocaleL( TDes& aDir ); /* * Delete master index file, particular in C: or E: or F: (user disk) @@ -110,7 +110,7 @@ * in this case, custom index mustn't exist. * @param aDrive the file to be deleted */ - void DeleteIndexFile( const TChar& aDrive ); + void DeleteIndexFileL( const TChar& aDrive ); /* * Check if helps folder changed @@ -121,7 +121,7 @@ * D: user restored the cell phone * @param aName[out] return help app private path in C */ - TInt CheckDirChange( const TChar& aDrive ); + TInt CheckDirChangeL( const TChar& aDrive ); private: diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/inc/CSXHViewIDs.h --- a/csxhelp/HelpEngine/inc/CSXHViewIDs.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/inc/CSXHViewIDs.h Fri Feb 19 22:42:03 2010 +0200 @@ -29,6 +29,8 @@ const TUid KCSXHKywdToc2ViewID = {6}; const TUid KCSXHContextHtmlTopicViewID = {7}; const TUid KCSXHContextLegacyTopicViewID = {8}; +const TUid KCSXHToc1AppHelpsViewID = {9}; +const TUid KCSXHToc2AppHelpsViewID = {10}; #endif /* INC_CSXHVIEWIDS_H_HEADER_INCLUDED_BC05356D */ diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/inc/CSXHXMLParseHandler.h --- a/csxhelp/HelpEngine/inc/CSXHXMLParseHandler.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/inc/CSXHXMLParseHandler.h Fri Feb 19 22:42:03 2010 +0200 @@ -224,6 +224,12 @@ */ TInt Characters (const TDesC8 &aBuff, const TInt aStart, const TInt aLength); + + TInt32 Priority(); + + private: + TBuf<8> iPriority; + TBool iIsPriority; }; class CCSXHXMLParseHandler_IndexFile : public CCSXHXMLParseHandler @@ -482,5 +488,95 @@ private: CCSXHHtmlTOC1 *iCurrentHtmlToc1; CCSXHHTMLContentParser *iParser; - }; + }; + +/** +* @class CCSXHXMLParseHandler_RedirectFile +* This class is used retrive the data from redirect.xml file +*/ +class CCSXHXMLParseHandler_RedirectFile : public CCSXHXMLParseHandler + { + public: +/** +* @function CCSXHXMLParseHandler_RedirectFile +* @since S60 3.2 +* Construct a CCSXHXMLParseHandler_RedirectFile +* @param aCoeEnv - Control Environment +* @param aSourceUid - source uid +* @param aSourceContextname - source context name +* @retrun a CCSXHXMLParseHandler_RedirectFile pointer +*/ + static CCSXHXMLParseHandler_RedirectFile* NewL(CCoeEnv * aCoeEnv, + const TUid &aSourceUid, const TCoeContextName &aSourceContextName); + + protected: +/** +* @function CCSXHXMLParseHandler_RedirectFile +* @since S60 3.2 +* Construct a CCSXHXMLParseHandler_RedirectFile +* @param aCoeEnv - Control Environment +* @param aSourceUid - source uid +* @param aSourceContextname - source context name +*/ + CCSXHXMLParseHandler_RedirectFile(CCoeEnv * aCoeEnv, + const TUid &aSourceUid, const TCoeContextName &aSourceContextName); + + public: +/** +* @function StartElement +* @since S60 3.2 +* Receive notification of the beginning of an element +* @param aURI - The Namespace URI, or the empty string + if the element has no Namespace URI or + if Namespace processing is not being performed. + aLocalName - The local name (without prefix) + aName - The qualified name + apAttrs - The attributes attached to the element. + If there are no attributes, it shall be + an empty array.Namespaces declared in the current + element will be located in the array also +* @return KErrNone or some of the system-wide Symbian error codes +*/ + TInt StartElement (const TDesC8 &aURI, const TDesC8 &aLocalName, + const TDesC8 &aName, const RAttributeArray &apAttrs); +/** +* @function EndElement +* @since S60 3.2 +* Receive notification of the end of an element +* @param aURI - The Namespace URI, or the empty string + if the element has no Namespace URI or + if Namespace processing is not being performed. + aLocalName - The local name (without prefix) + aName - The qualified name +* @return KErrNone or some of the system-wide Symbian error codes +*/ + TInt EndElement ( const TDesC8 &aURI,const TDesC8 &aLocalName,const TDesC8 &aName); +/** +* @function Characters +* @since S60 3.2 +* Receive notification inside an element +* @param aBuff - The characters. +* aStart - The start position in the character buffer. +* aLength - The number of characters to use from the character buffer. +* @return KErrNone or some of the system-wide Symbian error codes +*/ + TInt Characters (const TDesC8 &aBuff, const TInt aStart, + const TInt aLength); + + TBool IsTargetPathFound(); + TUid TargetUid(); + TBuf& TargetContextName(); + + private: + + TCoeContextName iSourceContextName; + TCoeContextName iFromContent; + TBuf iTargetPath; + TBool iIsFromTag; + TBool iIsToTag; + TBool iIsSourceContextNameFound; + TBool iIsTargetPathFound; + TUid iTargetUid; + TBuf iTargetContextName; + }; #endif diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/inc/csxhconstants.h --- a/csxhelp/HelpEngine/inc/csxhconstants.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/inc/csxhconstants.h Fri Feb 19 22:42:03 2010 +0200 @@ -70,6 +70,13 @@ #endif const TInt KHexPrefixLength = 2; +const TInt KHexUidLength = 8; +const TInt KOffsetFromUidToContext = 11; + +const TInt KHighestPriority = 1; +const TInt KLowestPriority = 20000; + +const TInt KMaxContextName = 30; //xhtml folder name //#define qtn_app_xhtml_folder_text ":\\resource\\xhtml\\" @@ -81,6 +88,9 @@ //mastermeta.xml file name _LIT(KMasterMetaFile,"index.xml"); +//redirect.xml file name +_LIT(KRedirectFile,"redirect.xml"); + //meta.xml file name //#define qtn_app_meta_file_text "meta.xml" _LIT(KMetaFile,"meta.xml"); @@ -89,10 +99,17 @@ //#define qtn_app_index_file_text "index.xml" _LIT(KIndexFile,"index.xml"); +_LIT(KRomAppUidFile, "appuid.dat"); //Application name tag in meta.xml //#define qtn_app_application_name_tag_text "title" _LIT(KAppNameTag,"title"); +_LIT(KPriorityTag, "priority"); + +_LIT(KFromTag, "from"); + +_LIT(KToTag, "to"); + // toc1 drive information in master index.xml // _LIT( KDriveInfo, "drive"); diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/src/CSXHGenericTOC1.cpp --- a/csxhelp/HelpEngine/src/CSXHGenericTOC1.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/src/CSXHGenericTOC1.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -21,8 +21,8 @@ // --------------------------------------------------------- // Items commented in header. // --------------------------------------------------------- -CCSXHGenericTOC1::CCSXHGenericTOC1(const TDesC& aName): - CCSXHHelpContentBase(aName),iChildList(NULL) +CCSXHGenericTOC1::CCSXHGenericTOC1(const TDesC& aName, const TInt32 aPriority): + CCSXHHelpContentBase(aName, aPriority), iChildList(NULL) {//No Implementation required } @@ -108,6 +108,20 @@ return ETrue; } +TBool CCSXHGenericTOC1::InsertChildWithPriority(CCSXHHelpContentBase* aChild, TBool aDeleteObject) + { + ConstructChildList(); + TLinearOrder anOrder(OrdererWithPriority); + if (KErrNone != iChildList->InsertInOrder(aChild,anOrder)) + { + if(aDeleteObject) + delete aChild; + + return EFalse; + } + return ETrue; + } + // --------------------------------------------------------- // Items commented in header. // --------------------------------------------------------- @@ -115,12 +129,15 @@ { TInt count = iChildList->Count(); CCSXHHelpContentBase* child; - for(TInt i=0;i toc2Entry(KTabSpace); - toc2Entry.Append(child->GetName()); - aArray->AppendL(toc2Entry); + if (child && child->GetName().Length() != 0) + { + TBuf toc2Entry(KTabSpace); + toc2Entry.Append(child->GetName()); + aArray->AppendL(toc2Entry); + } } } diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/src/CSXHHTMLContentParser.cpp --- a/csxhelp/HelpEngine/src/CSXHHTMLContentParser.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/src/CSXHHTMLContentParser.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -23,6 +23,7 @@ #include "CSXHHelpDataBase.h" #include "csxhconstants.h" #include "CSXHRuntimeIndexing.h" +#include "csxhviewids.h" #include #include @@ -108,7 +109,7 @@ // iIndexing = CCSXHRuntimeIndexing::NewL(); TInt driveListSize = DirList.Length(); - TBool dirExists = iIndexing->IndexFileExists(); + TBool dirExists = iIndexing->IndexFileExistsL(); CDirScan* scanner=CDirScan::NewLC(FileSession); #ifdef _DEBUG RDebug::Print(_L("runtime indexing object successfully build")); @@ -124,7 +125,7 @@ (DirList[dir] && info.iType != EMediaNotPresent)) { RFs::DriveToChar( dir, driveLetter ); - TInt dirChanged = iIndexing->CheckDirChange( driveLetter ); + TInt dirChanged = iIndexing->CheckDirChangeL( driveLetter ); rootDir->Delete( 0, rootDir->Length() );//Clear the previous contents rootDir->Append( driveLetter ); @@ -150,7 +151,7 @@ #ifdef _DEBUG RDebug::Print( _L("no resource folder, delete index.xml if exists") ); #endif - iIndexing->DeleteIndexFile( driveLetter ); + iIndexing->DeleteIndexFileL( driveLetter ); } } else @@ -162,7 +163,7 @@ #ifdef _DEBUG RDebug::Print( _L("No index, scan folder for parsing, drive letter: %d"), dir ); #endif - iIndexing->BeginIndexFile( driveLetter ); + iIndexing->BeginIndexFileL( driveLetter ); scanner->SetScanDataL(*rootDir ,KEntryAttDir|KEntryAttMatchExclusive, ESortByName|EAscending, CDirScan::EScanDownTree); @@ -236,7 +237,7 @@ iIndexing->GetPrivatePath( masterFile ); masterFile.Append( aDrive ); masterFile.Append( KFwdSlash ); - iIndexing->AppendLocale( masterFile ); + iIndexing->AppendLocaleL( masterFile ); masterFile.Append( KMasterMetaFile ); if(BaflUtils::FileExists( FileSession,masterFile ) ) { @@ -258,6 +259,41 @@ return ETrue; } + +TBool CCSXHHTMLContentParser::IsRedirectedL(CCSXHHelpDataBase *aDataBase, + const TDesC &aPath, TUid &aUid, TCoeContextName &aContextName) + { + RFs& FileSession = iCoeEnv->FsSession(); + TBuf redirectFile( aPath ); + redirectFile.Append( KRedirectFile ); + TBool result = EFalse; + + if ( BaflUtils::FileExists( FileSession, redirectFile ) ) + { + CCSXHXMLParseHandler_RedirectFile* XMLParser = + CCSXHXMLParseHandler_RedirectFile::NewL(iCoeEnv, aUid, aContextName); + XMLParser->SetDataBasePtr( aDataBase ); + + CleanupStack::PushL( XMLParser ); + InitializeReaderL( XMLParser ); + // ParseL is not in async + iXmlReader->ParseL( FileSession, redirectFile ); + if ( XMLParser->IsTargetPathFound() ) + { + TBuf& targetContextName = XMLParser->TargetContextName(); + if ( targetContextName.Length() <= aContextName.MaxLength() ) + { + aUid = XMLParser->TargetUid(); + aContextName = targetContextName; + result = ETrue; + } + } + CleanupStack::PopAndDestroy( XMLParser ); + ClearReader(); + } + + return result; + } void CCSXHHTMLContentParser::GenerateTOC2ListL(CCSXHGenericTOC1& aGenericTOC1Object, RPointerArray* GenericTOC2List) @@ -315,7 +351,7 @@ CDirScan* scanner, CCSXHHelpDataBase* aDataBase, const TInt& aDrive, - CCSXHXMLParseHandler* XMLParser + CCSXHXMLParseHandler_MetaFile* XMLParser ) { CDir* entryList = NULL; @@ -325,8 +361,9 @@ CleanupStack::PushL(entryList); TInt entryCount = entryList->Count(); - - TLinearOrder anOrder(Orderer); + + TInt ROMDrive; + RFs::CharToDrive( PathInfo::RomRootPath()[0], ROMDrive ); TBuf lookup; @@ -354,44 +391,136 @@ { if(!IsAppUIdPresentAlready(entry.iName)) { - CCSXHHtmlTOC1* CategoryObj = CCSXHHtmlTOC1::NewL( - XMLParser->GetApplicationName(),entry.iName,aDrive); - if ( !CategoryObj ) + CCSXHHtmlTOC1* CategoryObj = NULL; + TBool duplicateToc = EFalse; + + TInt32 priority = XMLParser->Priority(); + // Now we take a walk if it's application helps (priority == 0) + + if ( (priority != 0) + && ( ( aDrive == ROMDrive ) || IsRomBasedContentL( FileSession, entry.iName ) ) ) { - continue; + if ( priority < KHighestPriority ) + { + priority = KHighestPriority; + } + else if ( priority > KLowestPriority ) + { + priority = KLowestPriority; + } + + CategoryObj = CCSXHHtmlTOC1::NewL( + XMLParser->GetApplicationName(),entry.iName,aDrive, + KCSXHToc2ViewID, priority); + if(CategoryObj && aDataBase->GetMainTopics()->InsertChildWithPriority(CategoryObj,EFalse)) + iHtmlTOC1List.Append(CategoryObj);//Keep a local copy + else + duplicateToc = ETrue; } - iIndexing->RuntimeGenerateIndexL( *CategoryObj, XMLParser->GetFeatureIds() ); - if(CategoryObj && aDataBase->GetMainTopics()->InsertChild(CategoryObj,EFalse)) - iHtmlTOC1List.Append(CategoryObj);//Keep a local copy*/ - else - { - if(CategoryObj) - iDuplicateHelpTopicList.Append(CategoryObj); - } - } + else + { + CategoryObj = CCSXHHtmlTOC1::NewL( + XMLParser->GetApplicationName(),entry.iName, aDrive, + KCSXHToc2AppHelpsViewID, 0); + + if(CategoryObj && aDataBase->GetAppHelpsTopics()->InsertChild(CategoryObj,EFalse)) + iHtmlTOC1List.Append(CategoryObj);//Keep a local copy + else + duplicateToc = ETrue; + } + if ( CategoryObj ) + { + iIndexing->RuntimeGenerateIndexL( *CategoryObj, XMLParser->GetFeatureIds() ); + + if( duplicateToc ) + { + iDuplicateHelpTopicList.Append(CategoryObj); + } + } + } } } } CleanupStack::PopAndDestroy(entryList); } +TBool CCSXHHTMLContentParser::IsRomBasedContentL( RFs& FileSession, const TDesC &aUid ) + { +#ifdef __WINSCW__ + return ETrue; +#endif + + TBool result = EFalse; + CDirScan* scanner=CDirScan::NewLC(FileSession); + TBuf rootDir; + rootDir.Append( 'z' ); + + if( GetHTMLContentPathForDriveL( &rootDir,iCoeEnv ) ) + { + scanner->SetScanDataL(rootDir,KEntryAttDir|KEntryAttMatchExclusive, + ESortByName|EAscending, CDirScan::EScanDownTree); + CDir* entryList = NULL; + scanner->NextL(entryList); + + if ( !entryList ) + { + CleanupStack::PopAndDestroy( scanner ); + return EFalse; + } + + TInt entryCount = entryList->Count(); + + while ( entryCount-- ) + { + TEntry entry=(*entryList)[entryCount]; + if ( ( entry.iName ).CompareC(aUid) == 0 ) + { + result = ETrue; + break; + } + } + delete entryList; + } + + CleanupStack::PopAndDestroy( scanner ); + + return result; + } void CCSXHHTMLContentParser::InsertHTMLToc1L( const TDesC &appUidName,const TDesC &appName, - const TInt& aDrive , CCSXHHelpDataBase* aDataBase, const TDesC &FeatureIds) + const TInt& aDrive , CCSXHHelpDataBase* aDataBase, + const TDesC &FeatureIds, TInt32 aPriority ) { if(CheckFeatureIDL(FeatureIds)) { if(!IsAppUIdPresentAlready(appUidName)) - { - CCSXHHtmlTOC1* CategoryObj = CCSXHHtmlTOC1::NewL(appName,appUidName,aDrive); - if(CategoryObj && aDataBase->GetMainTopics()->InsertChild(CategoryObj,EFalse)) - iHtmlTOC1List.Append(CategoryObj);//Keep a local copy*/ - else - { - if(CategoryObj) - iDuplicateHelpTopicList.Append(CategoryObj); - } + { + CCSXHHtmlTOC1* CategoryObj = NULL; + TBool duplicateToc = EFalse; + // Now we take a walk if it's application helps (priority == 0) + if ( aPriority == 0 ) + { + CategoryObj = CCSXHHtmlTOC1::NewL(appName,appUidName,aDrive, + KCSXHToc2AppHelpsViewID,aPriority); + // Hardcode EDriveZ as ROM drive, need to be runtime check? + if(CategoryObj && aDataBase->GetAppHelpsTopics()->InsertChild(CategoryObj,EFalse)) + iHtmlTOC1List.Append(CategoryObj);//Keep a local copy + else + duplicateToc = ETrue; + } + else + { + CategoryObj = CCSXHHtmlTOC1::NewL(appName,appUidName,aDrive, + KCSXHToc2ViewID,aPriority); + if(CategoryObj && aDataBase->GetMainTopics()->InsertChildWithPriority(CategoryObj,EFalse)) + iHtmlTOC1List.Append(CategoryObj);//Keep a local copy*/ + else + duplicateToc = ETrue; + } + + if( CategoryObj && duplicateToc ) + iDuplicateHelpTopicList.Append(CategoryObj); } } } @@ -573,31 +702,80 @@ ClearReader(); } -CCSXHHelpContentBase* CCSXHHTMLContentParser::GetContextTopic -(const TUid& aUid, const TDesC& contextName) +CCSXHHelpContentBase* CCSXHHTMLContentParser::GetContextTopicL( + CCSXHHelpDataBase *aDataBase, + TUid &aUid, + TCoeContextName &aContextName + ) { - int toc1Count = iHtmlTOC1List.Count(); - CCSXHHtmlTOC1* toc1,*temptoc1; + TBuf path; + TInt32 toc1Count = iHtmlTOC1List.Count(); + TInt32 dupToc1Count = iDuplicateHelpTopicList.Count(); + CCSXHHtmlTOC1 *toc1 = NULL; + CCSXHHtmlTOC1 *temptoc1 = NULL; + TBool redirected = EFalse; - for(int i = 0; i < toc1Count; ++i) + for ( TInt32 i = 0; i < toc1Count; ++i ) { toc1 = iHtmlTOC1List[i]; - if(aUid == toc1->GetAppUid()) + if ( aUid == toc1->GetAppUid() ) { - return toc1->GetContextTopic(contextName); + toc1->GetHelpFileL( path ); + if ( IsRedirectedL( aDataBase, path, aUid, aContextName ) ) + { + redirected = ETrue; + } + else + { + return toc1->GetContextTopic( aContextName ); + } + break; } } + + if ( !redirected ) + { + for ( TInt32 i = 0; i < dupToc1Count; ++i ) + { + toc1 = iDuplicateHelpTopicList[i]; + if ( aUid == toc1->GetAppUid() ) + { + toc1->GetHelpFileL( path ); + if ( IsRedirectedL( aDataBase, path, aUid, aContextName ) ) + { + redirected = ETrue; + } + else + { + temptoc1 = GetCorrespondingTOC1FromMainArray(toc1->GetName()); + return temptoc1->GetContextTopic( aContextName ); + } + } + } + } + + if ( redirected ) + { + for ( TInt32 i = 0; i < toc1Count; ++i ) + { + toc1 = iHtmlTOC1List[i]; + if ( aUid == toc1->GetAppUid() ) + { + return toc1->GetContextTopic( aContextName ); + } + } + + for ( TInt32 i = 0; i < dupToc1Count; ++i ) + { + toc1 = iDuplicateHelpTopicList[i]; + if ( aUid == toc1->GetAppUid() ) + { + temptoc1 = GetCorrespondingTOC1FromMainArray( toc1->GetName() ); + return temptoc1->GetContextTopic( aContextName ); + } + } + } - toc1Count = iDuplicateHelpTopicList.Count(); - for(int i = 0; i < toc1Count; ++i) - { - toc1 = iDuplicateHelpTopicList[i]; - if(aUid == toc1->GetAppUid()) - { - temptoc1 = GetCorrespondingTOC1FromMainArray(toc1->GetName()); - return temptoc1->GetContextTopic(contextName); - } - } return NULL; } diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/src/CSXHHelpContentBase.cpp --- a/csxhelp/HelpEngine/src/CSXHHelpContentBase.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/src/CSXHHelpContentBase.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -33,10 +33,16 @@ return iName->Des(); } +TInt32 CCSXHHelpContentBase::Priority() const + { + return iPriority; + } + // --------------------------------------------------------- // Items commented in header. // --------------------------------------------------------- -CCSXHHelpContentBase::CCSXHHelpContentBase(const TDesC& name) : iName(name.Alloc()) +CCSXHHelpContentBase::CCSXHHelpContentBase(const TDesC& name, const TInt32 aPriority) + : iName(name.Alloc()), iPriority(aPriority) {//No implementation required } diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/src/CSXHHelpDataBase.cpp --- a/csxhelp/HelpEngine/src/CSXHHelpDataBase.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/src/CSXHHelpDataBase.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -38,15 +38,16 @@ #include EXPORT_C CCSXHHelpDataBase* CCSXHHelpDataBase::NewL(CCoeEnv* aCoeEnv, - const TApaAppCaption& aAppCaption) + const TApaAppCaption& aAppCaption, const TApaAppCaption& aAppHelpTopic) { - CCSXHHelpDataBase* self = CCSXHHelpDataBase::NewLC(aCoeEnv,aAppCaption); + CCSXHHelpDataBase* self = CCSXHHelpDataBase::NewLC(aCoeEnv,aAppCaption, aAppHelpTopic); CleanupStack::Pop(self); return self; } -CCSXHHelpDataBase* CCSXHHelpDataBase::NewLC(CCoeEnv* aCoeEnv,const TApaAppCaption& aAppCaption) +CCSXHHelpDataBase* CCSXHHelpDataBase::NewLC(CCoeEnv* aCoeEnv, const TApaAppCaption& aAppCaption, const TApaAppCaption& aAppHelpTopic) { + CCSXHHelpDataBase *self = NULL; //Add stuff into TLS if(Dll::Tls() == NULL ) { @@ -54,26 +55,25 @@ // been instantiated yet. Do so now, and return that // instance: // Store a pointer to the new instance in thread local storage: - CCSXHHelpDataBase* self = new(ELeave) CCSXHHelpDataBase(aCoeEnv,aAppCaption); + self = new(ELeave) CCSXHHelpDataBase(aCoeEnv,aAppCaption, aAppHelpTopic); CleanupStack::PushL(self); self->ConstructL(); TInt err = Dll::SetTls(self); - if(err == KErrNone ) + if (err != KErrNone) { - return self; - } - else - { + CleanupStack::Pop(self); delete self; - User::Leave( err ); - return NULL; + self = NULL; + User::Leave(err); } } else { - return GetInstance(); - } + self = GetInstance(); + } + + return self; } CCSXHHelpDataBase* CCSXHHelpDataBase::GetInstance() @@ -83,8 +83,8 @@ return static_cast(Dll::Tls()); } -CCSXHHelpDataBase::CCSXHHelpDataBase(CCoeEnv* aCoeEnv,const TApaAppCaption& aAppCaption) - : iCoeEnv(aCoeEnv),iAppCaption(aAppCaption),iKeywordSearchCount(0) +CCSXHHelpDataBase::CCSXHHelpDataBase(CCoeEnv* aCoeEnv, const TApaAppCaption& aAppCaption, const TApaAppCaption& aAppHelpTopic) + : iCoeEnv(aCoeEnv), iAppCaption(aAppCaption), iAppHelpTopic(aAppHelpTopic), iKeywordSearchCount(0) { } @@ -106,8 +106,15 @@ iMainTOC1 = CCSXHMainTopics::NewL(KCSXHToc1ViewID,iAppCaption); iKywdTOC1 = CCSXHKywdTopics::NewL(iAppCaption); + + //No need to delete iAppHelpsToc in destruct, + //because it will be deleted when deleting iMainTOC1. + //All third-party helps will be put to this topic + TInt appHelpPriority = 20001; + iAppHelpsToc = CCSXHMainTopics::NewL( KCSXHToc1AppHelpsViewID, iAppHelpTopic, appHelpPriority ); //Build the TOC1 list here + iMainTOC1->InsertChildWithPriority(iAppHelpsToc, EFalse); iHTMLContentParser->GenerateTOC1ListL(this); iLegacyContentParser->GenerateTOC1ListL(this); } @@ -126,6 +133,11 @@ return iKywdTOC1; } +EXPORT_C CCSXHGenericTOC1* CCSXHHelpDataBase::GetAppHelpsTopics() + { + return iAppHelpsToc; + } + EXPORT_C CCSXHHelpContentBase* CCSXHHelpDataBase::GetContextTopic(const TDesC8& aContextMessage) { TRAP_IGNORE(GetContextTopicL(aContextMessage)); @@ -158,7 +170,7 @@ { context = &(contextList->At(i)); - contextTopic = iHTMLContentParser->GetContextTopic(context->iMajor,context->iContext); + contextTopic = iHTMLContentParser->GetContextTopicL(this, context->iMajor,context->iContext); if(contextTopic) { CleanupStack::PopAndDestroy(contextList); diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/src/CSXHHtmlTOC1.cpp --- a/csxhelp/HelpEngine/src/CSXHHtmlTOC1.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/src/CSXHHtmlTOC1.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -36,9 +36,9 @@ // --------------------------------------------------------- // Items commented in header. // --------------------------------------------------------- -CCSXHHtmlTOC1* CCSXHHtmlTOC1::NewL(const TDesC& aName, const TDesC& aFolder,const TInt& aDrive) +CCSXHHtmlTOC1* CCSXHHtmlTOC1::NewL(const TDesC& aName, const TDesC& aFolder,const TInt& aDrive, TUid aViewId, TInt32 aPriority) { - CCSXHHtmlTOC1* self = new(ELeave) CCSXHHtmlTOC1(aName,aFolder,aDrive); + CCSXHHtmlTOC1* self = new(ELeave) CCSXHHtmlTOC1(aName,aFolder,aDrive, aViewId, aPriority); if(self->IsValid()) return self; delete self; @@ -48,8 +48,8 @@ // --------------------------------------------------------- // Items commented in header. // --------------------------------------------------------- -CCSXHHtmlTOC1::CCSXHHtmlTOC1(const TDesC& aName, const TDesC& aFolder,const TInt& aDrive): - CCSXHGenericTOC1(aName),iAppUid(aFolder),iDrive(aDrive) +CCSXHHtmlTOC1::CCSXHHtmlTOC1(const TDesC& aName, const TDesC& aFolder,const TInt& aDrive, TUid aViewId, TInt32 aPriority): + CCSXHGenericTOC1(aName, aPriority), iAppUid(aFolder), iDrive(aDrive), iViewId(aViewId) {//No implementation required } @@ -65,7 +65,7 @@ // --------------------------------------------------------- TUid CCSXHHtmlTOC1::GetViewID() const { - return KCSXHToc2ViewID; + return iViewId; } // --------------------------------------------------------- diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/src/CSXHLegacyContentParser.cpp --- a/csxhelp/HelpEngine/src/CSXHLegacyContentParser.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/src/CSXHLegacyContentParser.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -110,7 +110,7 @@ { appName = categoryList->MdcaPoint(i); CategoryObj = CCSXHLegacyTOC1::NewL(appName); - if(aDataBase->GetMainTopics()->InsertChild(CategoryObj)) + if ( aDataBase->GetAppHelpsTopics()->InsertChild(CategoryObj) ) iLegacyTOC1List.Append(CategoryObj);//Keep a local copy*/ } CleanupStack::Pop(categoryList); diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/src/CSXHMainTopics.cpp --- a/csxhelp/HelpEngine/src/CSXHMainTopics.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/src/CSXHMainTopics.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -24,22 +24,22 @@ #include #include -CCSXHMainTopics* CCSXHMainTopics::NewL(const TUid& aUid, const TApaAppCaption& aAppCaption) +CCSXHMainTopics* CCSXHMainTopics::NewL(const TUid& aUid, const TApaAppCaption& aAppCaption, const TInt32 aPriority) { - CCSXHMainTopics* self = CCSXHMainTopics::NewLC(aUid,aAppCaption); + CCSXHMainTopics* self = CCSXHMainTopics::NewLC(aUid,aAppCaption, aPriority); CleanupStack::Pop(self); return self; } -CCSXHMainTopics* CCSXHMainTopics::NewLC(const TUid& aUid,const TApaAppCaption& aAppCaption) +CCSXHMainTopics* CCSXHMainTopics::NewLC(const TUid& aUid,const TApaAppCaption& aAppCaption, const TInt32 aPriority) { - CCSXHMainTopics* self = new(ELeave) CCSXHMainTopics(aUid, aAppCaption); + CCSXHMainTopics* self = new(ELeave) CCSXHMainTopics(aUid, aAppCaption, aPriority); CleanupStack::PushL(self); return self; } -CCSXHMainTopics::CCSXHMainTopics(const TUid& aUid,const TDesC& aName) : -CCSXHGenericTOC1(aName), iUid(aUid) +CCSXHMainTopics::CCSXHMainTopics(const TUid& aUid,const TDesC& aName, const TInt32 aPriority) : +CCSXHGenericTOC1(aName, aPriority), iUid(aUid) {//No implementation required } diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/src/CSXHRuntimeIndexing.cpp --- a/csxhelp/HelpEngine/src/CSXHRuntimeIndexing.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/src/CSXHRuntimeIndexing.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -94,13 +94,13 @@ } } -TBool CCSXHRuntimeIndexing::IndexFileExists() +TBool CCSXHRuntimeIndexing::IndexFileExistsL() { RFs& fileSession = iCoeEnv->FsSession(); TBuf fileName; GetPrivatePath( fileName ); fileName.Append( _L("Z\\") ); - AppendLocale( fileName ); + AppendLocaleL( fileName ); fileName.Append( KMasterMetaFile ); // Now the dirName is C:\\private\\\\Z\\index.xml @@ -111,7 +111,7 @@ } -void CCSXHRuntimeIndexing::BeginIndexFile( const TChar& aDrive ) +void CCSXHRuntimeIndexing::BeginIndexFileL( const TChar& aDrive ) { RFs& fileSession = iCoeEnv->FsSession(); TPtr des = iFullDirName->Des(); @@ -120,7 +120,7 @@ GetPrivatePath( des ); des.Append( aDrive ); des.Append( KFwdSlash ); - AppendLocale( des ); + AppendLocaleL( des ); if ( !BaflUtils::PathExists( fileSession, des ) ) { // generate C:\\private\\\\\\ folder @@ -175,7 +175,7 @@ helpDir.Append( iDriveLetter ); helpDir.Append( KInstallPath ); // append locale information - AppendLocale( helpDir ); + AppendLocaleL( helpDir ); fileSession.Modified( helpDir, time ); err = fileSession.SetModified( newName, time ); @@ -214,6 +214,11 @@ // Append app id des.Append( buffUid ); des.Append( KIndexQuoteEnd ); + // Append app priority + des.Append( KPriorityTag ); + des.Append( KIndexQuoteBegin ); + des.AppendNum(aToc1.Priority()); + des.Append( KIndexQuoteEnd ); // Append app name attribut "navtitle" des.Append( KTOC2NameTag ); des.Append( KIndexQuoteBegin ); @@ -250,7 +255,7 @@ aName.Append( privatePath ); } -void CCSXHRuntimeIndexing::AppendLocale( TDes& aDir ) +void CCSXHRuntimeIndexing::AppendLocaleL( TDes& aDir ) { RFs& fileSession = iCoeEnv->FsSession(); RArray langs; @@ -279,14 +284,14 @@ langs.Reset(); } -void CCSXHRuntimeIndexing::DeleteIndexFile( const TChar& aDrive ) +void CCSXHRuntimeIndexing::DeleteIndexFileL( const TChar& aDrive ) { RFs& fileSession = iCoeEnv->FsSession(); TBuf des; GetPrivatePath( des ); des.Append( aDrive ); des.Append( KFwdSlash ); - AppendLocale( des ); + AppendLocaleL( des ); // C:\\private\\\\\\\\index.xml des.Append( KMasterMetaFile ); @@ -297,7 +302,7 @@ } -TInt CCSXHRuntimeIndexing::CheckDirChange( const TChar& aDrive ) +TInt CCSXHRuntimeIndexing::CheckDirChangeL( const TChar& aDrive ) { RFs& fsSession = iCoeEnv->FsSession(); @@ -309,7 +314,7 @@ // Begin to append locale, note this will append current locale, // thru which, app can determine if it's caused by user changed locales - AppendLocale( dirName ); + AppendLocaleL( dirName ); TTime dirModified(0); TTime fileModified(0); @@ -329,7 +334,7 @@ GetPrivatePath( filename ); filename.Append( aDrive ); filename.Append( KFwdSlash ); - AppendLocale( filename ); + AppendLocaleL( filename ); filename.Append( KMasterMetaFile ); if ( BaflUtils::FileExists( fsSession, filename ) ) diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/HelpEngine/src/CSXHXMLParseHandler.cpp --- a/csxhelp/HelpEngine/src/CSXHXMLParseHandler.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/HelpEngine/src/CSXHXMLParseHandler.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -329,6 +329,16 @@ TPtr FIdValue = iFeatureIds->Des(); FIdValue.Copy(_L("-1")); } + + if ( LocalTagName.Compare(KPriorityTag) == 0 && nElements == 0 ) + { + iIsPriority = ETrue; + iPriority.Copy(KEmptyString); + } + else + { + iIsPriority = EFalse; + } return KErrNone; } @@ -336,19 +346,43 @@ TInt CCSXHXMLParseHandler_MetaFile::EndElement ( const TDesC8& ,const TDesC8& ,const TDesC8& ) { iIsAppName = EFalse; + iIsPriority = EFalse; return KErrNone; } TInt CCSXHXMLParseHandler_MetaFile::Characters (const TDesC8& aBuff, const TInt /*aStart*/, const TInt /*aLength*/) { - TBuf TitleName; - if(iIsAppName) - { + if (iIsAppName) + { + TBuf TitleName; CnvUtfConverter::ConvertToUnicodeFromUtf8(TitleName,aBuff); iApplicationName.Append(TitleName); } + + if (iIsPriority) + { + TBuf<8> Priority; + CnvUtfConverter::ConvertToUnicodeFromUtf8(Priority,aBuff); + iPriority.Append(Priority); + } + return KErrNone; } + +TInt32 CCSXHXMLParseHandler_MetaFile::Priority() + { + //The default priority is set to 0 + TInt priority = 0; + + if (iPriority.Length() != 0) + { + TLex lex( iPriority ); + lex.Val( priority ); + iPriority.Copy(KEmptyString); + } + + return priority; + } //-------------- CCSXHXMLParseHandler_MasterMetaFile ------------------- @@ -379,6 +413,8 @@ TInt nElements = aAttributes.Count(); TBuf appUid; TBuf appName; + TBuf<8> priorityBuf; + TInt32 appPriority; RAttribute AttributeInfo; RTagInfo TagInformation; TLinearOrder anOrder(Orderer); @@ -402,6 +438,13 @@ { CnvUtfConverter::ConvertToUnicodeFromUtf8(appUid,AttributeInfo.Value().DesC()); } + + if (LocalName.Compare(KPriorityTag) == 0) + { + CnvUtfConverter::ConvertToUnicodeFromUtf8(priorityBuf,AttributeInfo.Value().DesC()); + TLex lex( priorityBuf ); + lex.Val( appPriority ); + } if(LocalName.Compare(KTOC2NameTag) == 0) { @@ -420,7 +463,7 @@ } - iParser->InsertHTMLToc1L( appUid, appName, iDrive, iDataBase, iFeatureIds->Des() ); + iParser->InsertHTMLToc1L( appUid, appName, iDrive, iDataBase, iFeatureIds->Des(), appPriority ); } if(LocalName.Compare(_L("FeatureID")) == 0) @@ -642,3 +685,124 @@ } } +//-------------- CCSXHXMLParseHandler_RedirectFile ------------------- + +CCSXHXMLParseHandler_RedirectFile* CCSXHXMLParseHandler_RedirectFile::NewL( CCoeEnv *aCoeEnv, + const TUid &aSourceUid, const TCoeContextName &aSourceContextName ) + { + CCSXHXMLParseHandler_RedirectFile* self = + new (ELeave)CCSXHXMLParseHandler_RedirectFile( aCoeEnv, aSourceUid, aSourceContextName ); + return self; + } + +CCSXHXMLParseHandler_RedirectFile::CCSXHXMLParseHandler_RedirectFile( CCoeEnv *aCoeEnv, + const TUid &aSourceUid, const TCoeContextName &aSourceContextName ) +:CCSXHXMLParseHandler( aCoeEnv ), iSourceContextName( aSourceContextName ), iTargetUid( aSourceUid ) + { + } +TInt CCSXHXMLParseHandler_RedirectFile::StartElement (const TDesC8& , + const TDesC8 &alocalName, const TDesC8& , const RAttributeArray &aAttributes) + { + if ( !iIsTargetPathFound ) + { + TBuf LocalTagName; + + CnvUtfConverter::ConvertToUnicodeFromUtf8(LocalTagName,alocalName); + + if ( LocalTagName.Compare(KFromTag) == 0 ) + { + iIsFromTag = ETrue; + iIsToTag = EFalse; + } + else if (LocalTagName.Compare(KToTag) == 0 ) + { + iIsToTag = ETrue; + iIsFromTag = EFalse; + } + else + { + iIsFromTag = EFalse; + iIsToTag = EFalse; + } + iFromContent.Copy(KEmptyString); + } + + return KErrNone; + } + +TInt CCSXHXMLParseHandler_RedirectFile::EndElement ( const TDesC8& ,const TDesC8& ,const TDesC8& ) + { + if ( iIsFromTag && iFromContent.Compare( iSourceContextName ) == 0 ) + { + iIsSourceContextNameFound = ETrue; + } + else + { + iIsSourceContextNameFound = EFalse; + } + + iIsFromTag = EFalse; + iIsToTag = EFalse; + + return KErrNone; + } + +TInt CCSXHXMLParseHandler_RedirectFile::Characters (const TDesC8& aBuff, const TInt /*aStart*/, const TInt /*aLength*/) + { + if ( iIsFromTag ) + { + TCoeContextName file; + CnvUtfConverter::ConvertToUnicodeFromUtf8(file,aBuff); + iFromContent.Append(file); + } + + else if ( iIsSourceContextNameFound && iIsToTag ) + { + TBuf targetPath; + CnvUtfConverter::ConvertToUnicodeFromUtf8(targetPath,aBuff); + iTargetPath.Append(targetPath); + + iIsTargetPathFound = ETrue; + } + + return KErrNone; + } + +TUid CCSXHXMLParseHandler_RedirectFile::TargetUid() + { + TInt loc = iTargetPath.Find( KHexPrefix ); + if ( loc != KErrNotFound ) + { + TLex lex( iTargetPath.Mid( loc+KHexPrefixLength, KHexUidLength ) ); + TUint appId = 0; + lex.Val( appId, EHex ); + + if ( appId ) + { + iTargetUid = TUid::Uid( (TInt)appId ); + } + } + + return iTargetUid; + } + +TBuf& CCSXHXMLParseHandler_RedirectFile::TargetContextName() + { + TInt loc = iTargetPath.Find( KHexPrefix ); + if ( loc != KErrNotFound ) + { + iTargetContextName = iTargetPath.Mid( loc + KOffsetFromUidToContext ); + } + else + { + iTargetContextName = iTargetPath; + } + + return iTargetContextName; + } + +TBool CCSXHXMLParseHandler_RedirectFile::IsTargetPathFound() + { + return iIsTargetPathFound; + } + diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/data/CsHelp.rss --- a/csxhelp/data/CsHelp.rss Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/data/CsHelp.rss Fri Feb 19 22:42:03 2010 +0200 @@ -1124,5 +1124,18 @@ { buf = qtn_help_toc_list_item_tutorial; } -#endif +#endif + +// --------------------------------------------------------- +// +// qtn_help_toc_app_helps +// One topic indicates for a collection of post-build helps, +// all installed helps should be put within it +// --------------------------------------------------------- +// +RESOURCE TBUF80 r_cshelp_toc_app_helps + { + buf = qtn_help_toc_app_helps; + } + // End of File diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/group/HelpEnginearm.def --- a/csxhelp/group/HelpEnginearm.def Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/group/HelpEnginearm.def Fri Feb 19 22:42:03 2010 +0200 @@ -15,7 +15,7 @@ _ZN17CCSXHHelpDataBase20ClearAllTOC1ContentsEv @ 14 NONAME _ZN17CCSXHHelpDataBase21GetKeywordSearchCountEv @ 15 NONAME _ZN17CCSXHHelpDataBase28InitGenerateKeywordTOC2ListLEP13CCSXHKywdTOC1 @ 16 NONAME - _ZN17CCSXHHelpDataBase4NewLEP7CCoeEnvRK4TBufILi256EE @ 17 NONAME + _ZN17CCSXHHelpDataBase4NewLEP7CCoeEnvRK4TBufILi256EES5_ @ 17 NONAME _ZNK13CCSXHHtmlTOC211GetHtmlUrlLER4TBufILi256EE @ 18 NONAME _ZNK13CCSXHHtmlTOC214GetHelpContextER15TCoeHelpContext @ 19 NONAME _ZNK20CCSXHHelpContentBase7GetNameEv @ 20 NONAME @@ -61,4 +61,7 @@ _ZTV35CCSXHXMLParseHandler_MasterMetaFile @ 60 NONAME ; ## _ZTI20CCSXHRuntimeIndexing @ 61 NONAME ; ## _ZTV20CCSXHRuntimeIndexing @ 62 NONAME ; ## + _ZN17CCSXHHelpDataBase17GetAppHelpsTopicsEv @ 63 NONAME + _ZTI33CCSXHXMLParseHandler_RedirectFile @ 64 NONAME + _ZTV33CCSXHXMLParseHandler_RedirectFile @ 65 NONAME diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/group/HelpEnginewinscw.def --- a/csxhelp/group/HelpEnginewinscw.def Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/group/HelpEnginewinscw.def Fri Feb 19 22:42:03 2010 +0200 @@ -19,5 +19,5 @@ ?GetTopicContentL@CCSXHHtmlTOC2@@UAEPAXXZ @ 18 NONAME ; void * CCSXHHtmlTOC2::GetTopicContentL(void) ?GetTopicContentL@CCSXHLegacyTOC2@@UAEPAXXZ @ 19 NONAME ; void * CCSXHLegacyTOC2::GetTopicContentL(void) ?InitGenerateKeywordTOC2ListL@CCSXHHelpDataBase@@QAEHPAVCCSXHKywdTOC1@@@Z @ 20 NONAME ; int CCSXHHelpDataBase::InitGenerateKeywordTOC2ListL(class CCSXHKywdTOC1 *) - ?NewL@CCSXHHelpDataBase@@SAPAV1@PAVCCoeEnv@@ABV?$TBuf@$0BAA@@@@Z @ 21 NONAME ; class CCSXHHelpDataBase * CCSXHHelpDataBase::NewL(class CCoeEnv *, class TBuf<256> const &) - + ?NewL@CCSXHHelpDataBase@@SAPAV1@PAVCCoeEnv@@ABV?$TBuf@$0BAA@@@1@Z @ 21 + ?GetAppHelpsTopics@CCSXHHelpDataBase@@QAEPAVCCSXHGenericTOC1@@XZ @ 22 diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/inc/CSXHAppUi.h --- a/csxhelp/inc/CSXHAppUi.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/inc/CSXHAppUi.h Fri Feb 19 22:42:03 2010 +0200 @@ -234,7 +234,7 @@ * @param None * @return None */ - void LoadTutorialService(); + void LoadTutorialServiceL(); #endif private: @@ -249,6 +249,8 @@ CCSXHGenericView* iKywdTOC2View; CCSXHGenericView* iTOC2View; + CCSXHGenericView* iAppHelpsTOC1View; + CCSXHGenericView* iAppHelpsTOC2View; static CCSXHAppUi* iInstance; CCSXHRuntimeAppWatcher* iRuntimeWatcher; diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/inc/CSXHGenericView.h --- a/csxhelp/inc/CSXHGenericView.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/inc/CSXHGenericView.h Fri Feb 19 22:42:03 2010 +0200 @@ -145,7 +145,7 @@ CCSXHGenericContainer *iContainer; TBool iResetContainerInActivate; - const TUid &iUid; + TUid iUid; const TInt &iAppFlags; }; diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/inc/CSXHHtmlTopicView.h --- a/csxhelp/inc/CSXHHtmlTopicView.h Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/inc/CSXHHtmlTopicView.h Fri Feb 19 22:42:03 2010 +0200 @@ -181,7 +181,7 @@ * @param None * @return None */ - void LaunchTutorial(); + void LaunchTutorialL(); #endif // FF_HELP_TUTORIAL_MERGE protected: // functions from base classes diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/loc/csxhelp.loc --- a/csxhelp/loc/csxhelp.loc Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/loc/csxhelp.loc Fri Feb 19 22:42:03 2010 +0200 @@ -132,5 +132,10 @@ //l: popup_note_wait_window //r: 5.0 #define qtn_help_noteg_install "Help content changed due to install/uninstallation, please restart Help application to see new app" - + +//d: Collection for custom applications helps +//d: This topic is a collection for all of post-build applications +//l: list_single_pane_t1 +//r: 5.2 +#define qtn_help_toc_app_helps "Application helps" // End of file diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/src/CSXHAppUi.cpp --- a/csxhelp/src/CSXHAppUi.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/src/CSXHAppUi.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -82,6 +82,8 @@ iHtmlTopicView = NULL; iLegacyTopicView = NULL; iLegacyContextTopicView = NULL; + iAppHelpsTOC1View = NULL; + iAppHelpsTOC2View = NULL; SetDefaultViewL(*iTOC1View); @@ -167,6 +169,11 @@ iTOC2View = CCSXHGenericView::NewL(KCSXHToc2ViewID,R_TOPICLIST); AddViewL(iTOC2View); } + else if(aViewID == KCSXHToc2AppHelpsViewID && iAppHelpsTOC2View == NULL) + { + iAppHelpsTOC2View = CCSXHGenericView::NewL(KCSXHToc2AppHelpsViewID,R_TOPICLIST); + AddViewL(iAppHelpsTOC2View); + } else if(aViewID == KCSXHKywdToc1ViewID && iKywdTOC1View == NULL) { iKywdTOC1View = CCSXHGenericView::NewL(KCSXHKywdToc1ViewID,R_KYWDTOC1LIST); @@ -214,6 +221,11 @@ iHtmlTopicView->SetViewTypeL(CCSXHHtmlTopicView::EHtmlView); } } + else if ( aViewID == KCSXHToc1AppHelpsViewID && !iAppHelpsTOC1View ) + { + iAppHelpsTOC1View = CCSXHGenericView::NewL( KCSXHToc1AppHelpsViewID, R_TOPICLIST ); + AddViewL( iAppHelpsTOC1View ); + } } // -------------------------------------------------------------------------- // Activates the view corresponding to the topic to be displayed @@ -238,13 +250,18 @@ iKywdTOC2View->ResetContainer(); if(iTOC2View) iTOC2View->ResetContainer(); + if (iAppHelpsTOC2View) + iAppHelpsTOC2View->ResetContainer(); } else if(viewId == KCSXHToc1ViewID || viewId == KCSXHContextHtmlTopicViewID || - viewId == KCSXHContextLegacyTopicViewID ) + viewId == KCSXHContextLegacyTopicViewID || + viewId == KCSXHToc1AppHelpsViewID) { if(iTOC2View) iTOC2View->ResetContainer(); + if (iAppHelpsTOC2View) + iAppHelpsTOC2View->ResetContainer(); } /* else if(viewId == KCSXHKywdToc1ViewID) { @@ -331,12 +348,12 @@ doc->SetDisplayTopic(doc->GetHelpDataBase()->GetMainTopics()); ActivateDisplayTopicViewL(); - HBufC* ErrorMessage = iCoeEnv->AllocReadResourceLC(R_TYPE_NO_HELP_TOPICS); - CAknGlobalNote* note = CAknGlobalNote::NewLC(); - note->ShowNoteL(EAknGlobalInformationNote, *ErrorMessage); +// HBufC* ErrorMessage = iCoeEnv->AllocReadResourceLC(R_TYPE_NO_HELP_TOPICS); +// CAknGlobalNote* note = CAknGlobalNote::NewLC(); +// note->ShowNoteL(EAknGlobalInformationNote, *ErrorMessage); - CleanupStack::PopAndDestroy(note); - CleanupStack::PopAndDestroy(ErrorMessage); +// CleanupStack::PopAndDestroy(note); +// CleanupStack::PopAndDestroy(ErrorMessage); } CCSXHAppUi* CCSXHAppUi::GetInstance() @@ -396,6 +413,10 @@ iKywdTOC2View->ResourceChangeHdl(aType); if(iTOC2View) iTOC2View->ResourceChangeHdl(aType); + if (iAppHelpsTOC2View) + iAppHelpsTOC2View->ResourceChangeHdl(aType); + if (iAppHelpsTOC1View) + iAppHelpsTOC1View->ResourceChangeHdl(aType); if(iHtmlTopicView) iHtmlTopicView->ResourceChangeHdl(aType); if(iLegacyTopicView) @@ -406,10 +427,13 @@ void CCSXHAppUi::RuntimeUpdateIndex() { - CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog(); - dlg->SetTimeout( CAknNoteDialog::EShortTimeout ); - dlg->SetTone( CAknNoteDialog::ENoTone ); - dlg->ExecuteLD( R_CSHELP_INSTALL_UNINSTALL_NOTE ); + CAknNoteDialog* dlg = new CAknNoteDialog(); + if (dlg != NULL) + { + dlg->SetTimeout( CAknNoteDialog::EShortTimeout ); + dlg->SetTone( CAknNoteDialog::ENoTone ); + TRAP_IGNORE(dlg->ExecuteLD(R_CSHELP_INSTALL_UNINSTALL_NOTE)); + } } @@ -437,7 +461,7 @@ // CCSXHAppUi::LoadTutorialService // Load service handler and attach interest for using tutorial service command. // -------------------------------------------------------------------------- -void CCSXHAppUi::LoadTutorialService() +void CCSXHAppUi::LoadTutorialServiceL() { iServiceHandler = CAiwServiceHandler::NewL(); diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/src/CSXHDocument.cpp --- a/csxhelp/src/CSXHDocument.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/src/CSXHDocument.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -59,7 +59,10 @@ // object will be called by the Application Framework iHelpAppUi = new (ELeave) CCSXHAppUi; - iHelpDataBase = CCSXHHelpDataBase::NewL(CCSXHAppUi::GetCoeEnv(),AppCaption()); + HBufC* appToc = CCSXHAppUi::GetCoeEnv()->AllocReadResourceLC( R_CSHELP_TOC_APP_HELPS ); + iHelpDataBase = CCSXHHelpDataBase::NewL(CCSXHAppUi::GetCoeEnv(),AppCaption(), *appToc); + CleanupStack::PopAndDestroy( appToc ); + iDisplayTopic = iHelpDataBase->GetMainTopics(); iPrevTopic = NULL; diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/src/CSXHGenericView.cpp --- a/csxhelp/src/CSXHGenericView.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/src/CSXHGenericView.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -90,6 +90,10 @@ doc->SetDisplayAndPrevTopic(doc->GetHelpDataBase()->GetMainTopics()); else if(iUid == KCSXHKywdToc2ViewID) doc->SetDisplayAndPrevTopic(doc->GetHelpDataBase()->GetKywdTopics()); + else if ( iUid == KCSXHToc1AppHelpsViewID ) + doc->SetDisplayAndPrevTopic( doc->GetHelpDataBase()->GetMainTopics() ); + else if ( iUid == KCSXHToc2AppHelpsViewID ) + doc->SetDisplayAndPrevTopic( doc->GetHelpDataBase()->GetAppHelpsTopics() ); AppUi()->HandleCommandL(ECSXHOpenItem); } diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/src/CSXHHtmlTopicContainer.cpp --- a/csxhelp/src/CSXHHtmlTopicContainer.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/src/CSXHHtmlTopicContainer.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -30,8 +30,8 @@ #include -#include -#include +#include +#include #include #include @@ -450,9 +450,12 @@ //then browser call back function triggers which leads to crash. This check //will avoid crash. TUid viewId = iDocument.GetDisplayTopic()->GetViewID(); - if(viewId == KCSXHToc1ViewID || viewId == KCSXHKywdToc1ViewID - || viewId == KCSXHToc2ViewID || viewId == KCSXHKywdToc2ViewID) + if (viewId == KCSXHToc1ViewID || viewId == KCSXHKywdToc1ViewID + || viewId == KCSXHToc2ViewID || viewId == KCSXHKywdToc2ViewID + || viewId == KCSXHToc1AppHelpsViewID || viewId == KCSXHToc2AppHelpsViewID) + { return; + } //When user clicks on Application Topics, application topics //corresponding to the topic being displayed has to be opened diff -r 27f5851bd5a5 -r d06b1526f62c csxhelp/src/CSXHHtmlTopicView.cpp --- a/csxhelp/src/CSXHHtmlTopicView.cpp Tue Feb 02 00:03:40 2010 +0200 +++ b/csxhelp/src/CSXHHtmlTopicView.cpp Fri Feb 19 22:42:03 2010 +0200 @@ -251,8 +251,8 @@ { if(iBCContainer) { + iBCContainer->MakeVisible(EFalse); TRAP_IGNORE(iBCContainer->CancelFetchL()); - iBCContainer->MakeVisible(EFalse); AppUi()->RemoveFromStack(iBCContainer); } } @@ -351,7 +351,7 @@ // CCSXHAppUi::LaunchTutorial // Lauch tutorial if exist, else popup a error message. // -------------------------------------------------------------------------- -void CCSXHHtmlTopicView::LaunchTutorial() +void CCSXHHtmlTopicView::LaunchTutorialL() { CCSXHDocument *doc = static_cast(AppUi()->Document()); CCSXHHtmlTOC2 *displayTopic = STATIC_CAST(CCSXHHtmlTOC2*,doc->GetDisplayTopic());