csxhelp/HelpEngine/src/CSXHRuntimeIndexing.cpp
branchRCL_3
changeset 49 a7ccb69868af
parent 45 cbffe13eac63
child 54 156dce2f0a3b
equal deleted inserted replaced
45:cbffe13eac63 49:a7ccb69868af
   130     
   130     
   131     // for temporary usage, once it's finished successfully,
   131     // for temporary usage, once it's finished successfully,
   132     // rename to index.xml. otherwise, the old index file still exists.
   132     // rename to index.xml. otherwise, the old index file still exists.
   133     //
   133     //
   134     des.Append( KMasterMetaTmpFile );
   134     des.Append( KMasterMetaTmpFile );
   135     iFile.Replace( fileSession, des, EFileWrite );
   135     TInt err = KErrNone;
       
   136     err = iFile.Replace( fileSession, des, EFileWrite );
       
   137     if ( KErrNone != err || 0 == iFile.SubSessionHandle() )
       
   138         {
       
   139         return;
       
   140         }
   136     
   141     
   137     HBufC8* driveInfo = HBufC8::NewLC( KMaxDriveInfo );
   142     HBufC8* driveInfo = HBufC8::NewLC( KMaxDriveInfo );
   138     TPtr8 ptr = driveInfo->Des();
   143     TPtr8 ptr = driveInfo->Des();
   139     ptr.Append( KIndexXMLVesion );
   144     ptr.Append( KIndexXMLVesion );
   140     ptr.Append( _L( "<collections drive=\"" ) );
   145     ptr.Append( _L( "<collections drive=\"" ) );
   144     CleanupStack::PopAndDestroy( driveInfo );
   149     CleanupStack::PopAndDestroy( driveInfo );
   145     }
   150     }
   146     
   151     
   147 void CCSXHRuntimeIndexing::FinishAndCloseIndexFileL()
   152 void CCSXHRuntimeIndexing::FinishAndCloseIndexFileL()
   148     {
   153     {
       
   154     if ( 0 == iFile.SubSessionHandle() )
       
   155         {
       
   156         return;
       
   157         }
   149     RFs& fileSession = iCoeEnv->FsSession();
   158     RFs& fileSession = iCoeEnv->FsSession();
   150     iFile.Write( KIndexCollectEnd );
   159     iFile.Write( KIndexCollectEnd );
   151     iFile.Close();  
   160     iFile.Close();  
   152       
   161       
   153     TTime time;
   162     TTime time;
   184     
   193     
   185     }
   194     }
   186       
   195       
   187 void CCSXHRuntimeIndexing::RuntimeGenerateIndexL( const CCSXHHtmlTOC1& aToc1, const TDesC& aFeature )
   196 void CCSXHRuntimeIndexing::RuntimeGenerateIndexL( const CCSXHHtmlTOC1& aToc1, const TDesC& aFeature )
   188     {
   197     {
       
   198     if ( 0 == iFile.SubSessionHandle() )
       
   199         {
       
   200         return;
       
   201         }
   189     // Form into an entry, like
   202     // Form into an entry, like
   190     // <collection FeatureID="-1" id="0x10005951" navtitle="Bluetooth"></collection>
   203     // <collection FeatureID="-1" id="0x10005951" navtitle="Bluetooth"></collection>
   191     HBufC8* appName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aToc1.GetName() );
   204     HBufC8* appName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aToc1.GetName() );
   192     CleanupStack::PushL(appName);
   205     CleanupStack::PushL(appName);
   193     TRAPD( err, SenXmlUtils::LeaveOnXmlEscapesL( *appName ) );
   206     TRAPD( err, SenXmlUtils::LeaveOnXmlEscapesL( *appName ) );