1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This is a utility class that provides functionality |
|
15 * for scanning app help folder, generate index XML |
|
16 * at runtime, and also update it if any install/uninstall |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef CSXHRUNTIMEINDEXING_H |
|
21 #define CSXHRUNTIMEINDEXING_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 |
|
27 // CONSTANTS |
|
28 // the help content folder doesn't exist |
|
29 const TInt KNoDirExist = -3; |
|
30 // there is no changes in help content folder (like install/uninstall) |
|
31 const TInt KNoChange = -2; |
|
32 // there is no index.xml file (due to no help content at previous time) |
|
33 const TInt KNoIndexExist = -1; |
|
34 |
|
35 // FORWARD CLASS DECLARATION |
|
36 class CCSXHHtmlTOC1; |
|
37 class CCSXHKywdTOC1; |
|
38 class CCoeEnv; |
|
39 |
|
40 /* |
|
41 * runtime indexing handling class |
|
42 * responsible for generating index file, maintaining it. |
|
43 * this class also create CS X Help private folder if not exist |
|
44 * |
|
45 */ |
|
46 class CCSXHRuntimeIndexing : public CBase |
|
47 { |
|
48 public: |
|
49 |
|
50 /* |
|
51 * constructor |
|
52 */ |
|
53 CCSXHRuntimeIndexing(); |
|
54 /* |
|
55 |
|
56 * destructor |
|
57 */ |
|
58 ~CCSXHRuntimeIndexing(); |
|
59 |
|
60 /* |
|
61 * Two-phase constructor |
|
62 */ |
|
63 static CCSXHRuntimeIndexing* NewL(); |
|
64 |
|
65 /* |
|
66 * Generate the master index file content |
|
67 * @param aToc1: TOC1 object which contains main topic information |
|
68 * @param aFeature: Feature information, supported by Feature Mgr |
|
69 */ |
|
70 void RuntimeGenerateIndexL( const CCSXHHtmlTOC1& aToc1, const TDesC& aFeature ); |
|
71 |
|
72 /* |
|
73 * Check whether master index exist |
|
74 * Since Z based helps must exist |
|
75 * Usage: to determine Help was launched before |
|
76 */ |
|
77 TBool IndexFileExistsL(); |
|
78 |
|
79 /* |
|
80 * create temporary index file |
|
81 * this file will be saved to C:\\private\\<help-uid>\\<aDrive>\\<lang-id>\\ |
|
82 * @param: aDrive Drive information |
|
83 */ |
|
84 void BeginIndexFileL( const TChar& aDrive ); |
|
85 |
|
86 /* |
|
87 * close the temporary index file, and rename it to index.xml formally |
|
88 * tmp.xml -> index.xml |
|
89 * this function can backup index.xml, once exception happens |
|
90 */ |
|
91 void FinishAndCloseIndexFileL(); |
|
92 |
|
93 /* |
|
94 * Get help application private path in C drive |
|
95 * @param aName[out] return help app private path in C |
|
96 */ |
|
97 void GetPrivatePath( TDes& aName ); |
|
98 |
|
99 /* |
|
100 * Get proper locale, and append it to descriptor |
|
101 * for more information about proper locale |
|
102 * please refer to BaflUtils::GetDowngradePathL |
|
103 * @param aDir[out] append proper locale |
|
104 */ |
|
105 void AppendLocaleL( TDes& aDir ); |
|
106 |
|
107 /* |
|
108 * Delete master index file, particular in C: or E: or F: (user disk) |
|
109 * this will only occur when user remove all custom helps, no more helps folder |
|
110 * in this case, custom index mustn't exist. |
|
111 * @param aDrive the file to be deleted |
|
112 */ |
|
113 void DeleteIndexFileL( const TChar& aDrive ); |
|
114 |
|
115 /* |
|
116 * Check if helps folder changed |
|
117 * changes include: |
|
118 * A: install new application |
|
119 * B: uninstall (if unistall all helps, custom helps folder will also removed) |
|
120 * C: user changed the language |
|
121 * D: user restored the cell phone |
|
122 * @param aName[out] return help app private path in C |
|
123 */ |
|
124 TInt CheckDirChangeL( const TChar& aDrive ); |
|
125 |
|
126 private: |
|
127 |
|
128 /* |
|
129 * two-phase constructor, private |
|
130 */ |
|
131 void ConstructL(); |
|
132 |
|
133 private: |
|
134 |
|
135 /* |
|
136 * buff current index file name |
|
137 * owned |
|
138 */ |
|
139 HBufC* iFullDirName; |
|
140 |
|
141 /* |
|
142 * CoeEnv |
|
143 * not owned |
|
144 */ |
|
145 CCoeEnv * iCoeEnv; |
|
146 |
|
147 /* |
|
148 * current index file handle |
|
149 */ |
|
150 RFile iFile; |
|
151 |
|
152 /* |
|
153 * actually it's iFullDirName's drive letter |
|
154 * for more convenient, keep it as a class member |
|
155 */ |
|
156 TChar iDriveLetter; |
|
157 |
|
158 }; |
|
159 |
|
160 #endif // CSXHRUNTIMEINDEXING_H |
|