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