92 } |
92 } |
93 |
93 |
94 } |
94 } |
95 } |
95 } |
96 |
96 |
97 TBool CCSXHRuntimeIndexing::IndexFileExists() |
97 TBool CCSXHRuntimeIndexing::IndexFileExistsL() |
98 { |
98 { |
99 RFs& fileSession = iCoeEnv->FsSession(); |
99 RFs& fileSession = iCoeEnv->FsSession(); |
100 TBuf<KMaxFileName> fileName; |
100 TBuf<KMaxFileName> fileName; |
101 GetPrivatePath( fileName ); |
101 GetPrivatePath( fileName ); |
102 fileName.Append( _L("Z\\") ); |
102 fileName.Append( _L("Z\\") ); |
103 AppendLocale( fileName ); |
103 AppendLocaleL( fileName ); |
104 fileName.Append( KMasterMetaFile ); |
104 fileName.Append( KMasterMetaFile ); |
105 |
105 |
106 // Now the dirName is C:\\private\\<app-uid>\\Z\\index.xml |
106 // Now the dirName is C:\\private\\<app-uid>\\Z\\index.xml |
107 // check if it exists, if yes, runtime indexing must be launched before |
107 // check if it exists, if yes, runtime indexing must be launched before |
108 // since Z based Help content must be delivered with cell phone |
108 // since Z based Help content must be delivered with cell phone |
109 // |
109 // |
110 return BaflUtils::FileExists( fileSession, fileName ); |
110 return BaflUtils::FileExists( fileSession, fileName ); |
111 |
111 |
112 } |
112 } |
113 |
113 |
114 void CCSXHRuntimeIndexing::BeginIndexFile( const TChar& aDrive ) |
114 void CCSXHRuntimeIndexing::BeginIndexFileL( const TChar& aDrive ) |
115 { |
115 { |
116 RFs& fileSession = iCoeEnv->FsSession(); |
116 RFs& fileSession = iCoeEnv->FsSession(); |
117 TPtr des = iFullDirName->Des(); |
117 TPtr des = iFullDirName->Des(); |
118 iDriveLetter = aDrive; |
118 iDriveLetter = aDrive; |
119 des.Zero(); |
119 des.Zero(); |
120 GetPrivatePath( des ); |
120 GetPrivatePath( des ); |
121 des.Append( aDrive ); |
121 des.Append( aDrive ); |
122 des.Append( KFwdSlash ); |
122 des.Append( KFwdSlash ); |
123 AppendLocale( des ); |
123 AppendLocaleL( des ); |
124 if ( !BaflUtils::PathExists( fileSession, des ) ) |
124 if ( !BaflUtils::PathExists( fileSession, des ) ) |
125 { |
125 { |
126 // generate C:\\private\\<help-uid>\\<aDrive>\\ folder |
126 // generate C:\\private\\<help-uid>\\<aDrive>\\ folder |
127 // |
127 // |
128 fileSession.MkDir( des ); |
128 fileSession.MkDir( des ); |
173 // determined to change. |
173 // determined to change. |
174 TBuf<KMaxFileName> helpDir; |
174 TBuf<KMaxFileName> helpDir; |
175 helpDir.Append( iDriveLetter ); |
175 helpDir.Append( iDriveLetter ); |
176 helpDir.Append( KInstallPath ); |
176 helpDir.Append( KInstallPath ); |
177 // append locale information |
177 // append locale information |
178 AppendLocale( helpDir ); |
178 AppendLocaleL( helpDir ); |
179 |
179 |
180 fileSession.Modified( helpDir, time ); |
180 fileSession.Modified( helpDir, time ); |
181 err = fileSession.SetModified( newName, time ); |
181 err = fileSession.SetModified( newName, time ); |
182 |
182 |
183 } |
183 } |
212 des.Append( KMasterCollection_idTag ); |
212 des.Append( KMasterCollection_idTag ); |
213 des.Append( KIndexQuoteBegin ); |
213 des.Append( KIndexQuoteBegin ); |
214 // Append app id |
214 // Append app id |
215 des.Append( buffUid ); |
215 des.Append( buffUid ); |
216 des.Append( KIndexQuoteEnd ); |
216 des.Append( KIndexQuoteEnd ); |
|
217 // Append app priority |
|
218 des.Append( KPriorityTag ); |
|
219 des.Append( KIndexQuoteBegin ); |
|
220 des.AppendNum(aToc1.Priority()); |
|
221 des.Append( KIndexQuoteEnd ); |
217 // Append app name attribut "navtitle" |
222 // Append app name attribut "navtitle" |
218 des.Append( KTOC2NameTag ); |
223 des.Append( KTOC2NameTag ); |
219 des.Append( KIndexQuoteBegin ); |
224 des.Append( KIndexQuoteBegin ); |
220 if ( err == KErrSenInvalidCharacters ) |
225 if ( err == KErrSenInvalidCharacters ) |
221 { |
226 { |
248 aName.Append( drive ); |
253 aName.Append( drive ); |
249 aName.Append( TChar(':') ); |
254 aName.Append( TChar(':') ); |
250 aName.Append( privatePath ); |
255 aName.Append( privatePath ); |
251 } |
256 } |
252 |
257 |
253 void CCSXHRuntimeIndexing::AppendLocale( TDes& aDir ) |
258 void CCSXHRuntimeIndexing::AppendLocaleL( TDes& aDir ) |
254 { |
259 { |
255 RFs& fileSession = iCoeEnv->FsSession(); |
260 RFs& fileSession = iCoeEnv->FsSession(); |
256 RArray<TLanguage> langs; |
261 RArray<TLanguage> langs; |
257 BaflUtils::GetDowngradePathL( fileSession, User::Language(), langs ); |
262 BaflUtils::GetDowngradePathL( fileSession, User::Language(), langs ); |
258 TInt len = aDir.Length(); |
263 TInt len = aDir.Length(); |
277 |
282 |
278 aDir.Append( KFwdSlash ); |
283 aDir.Append( KFwdSlash ); |
279 langs.Reset(); |
284 langs.Reset(); |
280 } |
285 } |
281 |
286 |
282 void CCSXHRuntimeIndexing::DeleteIndexFile( const TChar& aDrive ) |
287 void CCSXHRuntimeIndexing::DeleteIndexFileL( const TChar& aDrive ) |
283 { |
288 { |
284 RFs& fileSession = iCoeEnv->FsSession(); |
289 RFs& fileSession = iCoeEnv->FsSession(); |
285 TBuf<KMaxFileName> des; |
290 TBuf<KMaxFileName> des; |
286 GetPrivatePath( des ); |
291 GetPrivatePath( des ); |
287 des.Append( aDrive ); |
292 des.Append( aDrive ); |
288 des.Append( KFwdSlash ); |
293 des.Append( KFwdSlash ); |
289 AppendLocale( des ); |
294 AppendLocaleL( des ); |
290 // C:\\private\\<app-uid>\\<drive letter>\\<language-id>\\index.xml |
295 // C:\\private\\<app-uid>\\<drive letter>\\<language-id>\\index.xml |
291 des.Append( KMasterMetaFile ); |
296 des.Append( KMasterMetaFile ); |
292 |
297 |
293 if ( BaflUtils::FileExists( fileSession, des ) ) |
298 if ( BaflUtils::FileExists( fileSession, des ) ) |
294 { |
299 { |
295 fileSession.Delete( des ); |
300 fileSession.Delete( des ); |
296 } |
301 } |
297 |
302 |
298 } |
303 } |
299 |
304 |
300 TInt CCSXHRuntimeIndexing::CheckDirChange( const TChar& aDrive ) |
305 TInt CCSXHRuntimeIndexing::CheckDirChangeL( const TChar& aDrive ) |
301 { |
306 { |
302 RFs& fsSession = iCoeEnv->FsSession(); |
307 RFs& fsSession = iCoeEnv->FsSession(); |
303 |
308 |
304 // Begin to search help content folder to see if there are date modify |
309 // Begin to search help content folder to see if there are date modify |
305 // meanwhile, compare to the related folder in private directory |
310 // meanwhile, compare to the related folder in private directory |
307 dirName.Append( aDrive ); |
312 dirName.Append( aDrive ); |
308 dirName.Append( KInstallPath ); |
313 dirName.Append( KInstallPath ); |
309 |
314 |
310 // Begin to append locale, note this will append current locale, |
315 // Begin to append locale, note this will append current locale, |
311 // thru which, app can determine if it's caused by user changed locales |
316 // thru which, app can determine if it's caused by user changed locales |
312 AppendLocale( dirName ); |
317 AppendLocaleL( dirName ); |
313 |
318 |
314 TTime dirModified(0); |
319 TTime dirModified(0); |
315 TTime fileModified(0); |
320 TTime fileModified(0); |
316 |
321 |
317 if ( BaflUtils::PathExists( fsSession, dirName ) ) |
322 if ( BaflUtils::PathExists( fsSession, dirName ) ) |
327 |
332 |
328 TFileName filename; |
333 TFileName filename; |
329 GetPrivatePath( filename ); |
334 GetPrivatePath( filename ); |
330 filename.Append( aDrive ); |
335 filename.Append( aDrive ); |
331 filename.Append( KFwdSlash ); |
336 filename.Append( KFwdSlash ); |
332 AppendLocale( filename ); |
337 AppendLocaleL( filename ); |
333 filename.Append( KMasterMetaFile ); |
338 filename.Append( KMasterMetaFile ); |
334 |
339 |
335 if ( BaflUtils::FileExists( fsSession, filename ) ) |
340 if ( BaflUtils::FileExists( fsSession, filename ) ) |
336 { |
341 { |
337 // here is modified time of index.xml |
342 // here is modified time of index.xml |