77 * Search Function for cache |
78 * Search Function for cache |
78 */ |
79 */ |
79 void PerformSearchL(const CPsSettings& aPcsSettings, |
80 void PerformSearchL(const CPsSettings& aPcsSettings, |
80 CPsQuery& aCondition, |
81 CPsQuery& aCondition, |
81 RPointerArray<CPsClientData>& aData, |
82 RPointerArray<CPsClientData>& aData, |
82 RPointerArray<CPsPattern>& aPattern); |
83 RPointerArray<CPsPattern>& aPattern); |
83 |
84 |
84 /** |
85 /** |
85 * Search Function for input string |
86 * Search Function for input string |
86 */ |
87 */ |
87 void SearchInputL(CPsQuery& aSearchQuery, |
88 void SearchInputL(CPsQuery& aSearchQuery, |
88 TDesC& aSearchData, |
89 TDesC& aSearchData, |
89 RPointerArray<TDesC>& aMatchSet, |
90 RPointerArray<TDesC>& aMatchSet, |
90 RArray<TPsMatchLocation>& aMatchLocation ); |
91 RArray<TPsMatchLocation>& aMatchLocation ); |
91 |
92 |
92 |
93 |
93 /** |
94 /** |
94 * Performs search on a input string, and return result also as a string |
95 * Performs search on a input string, and return result also as a string |
95 */ |
96 */ |
96 void SearchMatchStringL( CPsQuery& aSearchQuery, |
97 void SearchMatchStringL( CPsQuery& aSearchQuery, |
97 TDesC& aSearchData, |
98 TDesC& aSearchData, |
98 TDes& aMatch ); |
99 TDes& aMatch ); |
99 |
100 |
100 /** |
101 /** |
101 * Returns ETrue if this language is supported |
102 * Returns ETrue if this language is supported |
102 */ |
103 */ |
103 TBool IsLanguageSupportedL(const TUint32 aLanguage); |
104 TBool IsLanguageSupportedL(const TUint32 aLanguage); |
115 /** |
116 /** |
116 * Sets the sort order for a cache |
117 * Sets the sort order for a cache |
117 */ |
118 */ |
118 void ChangeSortOrderL(TDesC& aURI, RArray<TInt>& aSortOrder); |
119 void ChangeSortOrderL(TDesC& aURI, RArray<TInt>& aSortOrder); |
119 |
120 |
120 |
121 /** |
121 // -------------------------------------------------------------------- |
122 * Get the Adaptive Grid for one or more URIs |
122 |
123 */ |
123 public: |
|
124 |
|
125 // --------------- From base class MDataStoreObserver ----------------- |
|
126 |
|
127 /** |
|
128 * Add a contact to the cache |
|
129 */ |
|
130 void AddData( TDesC& aDataStore, CPsData* aData ); |
|
131 |
|
132 /** |
|
133 * Remove a contact from the cache based on contact id |
|
134 */ |
|
135 void RemoveData( TDesC& aDataStore, TInt aItemId ); |
|
136 |
|
137 /** |
|
138 * Removes all the contacts from a particular datastore |
|
139 */ |
|
140 void RemoveAll( TDesC& aDataStore ); |
|
141 |
|
142 /** |
|
143 * Updates the caching status for a particular datastore |
|
144 */ |
|
145 void UpdateCachingStatus(TDesC& aDataStore, TInt aStatus); |
|
146 |
|
147 /** |
|
148 * Get the Adaptive Grid for one or more URIs |
|
149 */ |
|
150 void GetAdaptiveGridL( const MDesCArray& aURIs, |
124 void GetAdaptiveGridL( const MDesCArray& aURIs, |
151 const TBool aCompanyName, |
125 const TBool aCompanyName, |
152 TDes& aAdaptiveGrid ); |
126 TDes& aAdaptiveGrid ); |
153 |
127 |
154 // -------------------------------------------------------------------- |
128 // -------------------------------------------------------------------- |
155 |
129 |
156 public: |
130 public: |
157 |
131 |
|
132 // --------------- From base class MDataStoreObserver ----------------- |
|
133 |
|
134 /** |
|
135 * Add a contact to the cache |
|
136 */ |
|
137 void AddData ( TDesC& aDataStore, CPsData* aData); |
|
138 |
|
139 /** |
|
140 * Remove a contact from the cache based on contact id |
|
141 */ |
|
142 void RemoveData ( TDesC& aDataStore, TInt aItemId ); |
|
143 |
|
144 /** |
|
145 * Removes all the contacts from a particular datastore |
|
146 */ |
|
147 void RemoveAll ( TDesC& aDataStore); |
|
148 |
|
149 /** |
|
150 * Updates the caching status for a particular datastore |
|
151 */ |
|
152 void UpdateCachingStatus(TDesC& aDataStore, TInt aStatus); |
|
153 |
|
154 // -------------------------------------------------------------------- |
|
155 |
|
156 public: |
|
157 |
158 // ----------------- From base class MStoreListObserver --------------- |
158 // ----------------- From base class MStoreListObserver --------------- |
159 |
159 |
160 /** |
160 /** |
161 * This method is called whenever any new store has been added |
161 * This method is called whenever any new store has been added |
162 */ |
162 */ |
163 void AddDataStore( TDesC& aDataStore ); |
163 void AddDataStore ( TDesC& aDataStore); |
164 |
164 |
165 /** |
165 /** |
166 * This method is called whenever a data store is removed |
166 * This method is called whenever a data store is removed |
167 */ |
167 */ |
168 void RemoveDataStore( TDesC& aDataStore ); |
168 void RemoveDataStore ( TDesC& aDataStore); |
169 |
169 |
170 // -------------------------------------------------------------------- |
170 // -------------------------------------------------------------------- |
171 |
171 |
172 public: |
172 public: |
173 |
173 |
174 /** |
174 /** |
175 * Returns the array index of cache (in iPcsCache) for a datastore |
175 * Returns the array index of cache (in iPcsCache) for a datastore |
176 */ |
176 */ |
177 TInt GetCacheIndex(const TDesC& aDataStore); |
177 TInt GetCacheIndex(TDesC& aDataStore); |
178 |
178 |
179 /** |
179 /** |
180 * Return the cache instance at a specific array index |
180 * Return the cache instance at a specific array index |
181 */ |
181 */ |
182 inline CPcsCache* GetCache(TInt aIndex) |
182 inline CPcsCache* GetCache(TInt aIndex) |
188 * Returns the key map instance |
188 * Returns the key map instance |
189 */ |
189 */ |
190 inline CPcsKeyMap* GetKeyMap() |
190 inline CPcsKeyMap* GetKeyMap() |
191 { |
191 { |
192 return iKeyMap; |
192 return iKeyMap; |
|
193 }; |
|
194 |
|
195 |
|
196 private: |
|
197 |
|
198 /** |
|
199 * Constructor |
|
200 */ |
|
201 CPcsAlgorithm2(); |
|
202 |
|
203 /** |
|
204 * 2nd phase construtor |
|
205 */ |
|
206 void ConstructL(); |
|
207 |
|
208 private: |
|
209 |
|
210 /** |
|
211 * Define a P&S property with given key under the internal category |
|
212 * UID of PCS. Leave if definition fails for any other reason than |
|
213 * key already existing. |
|
214 */ |
|
215 void DefinePropertyL( TPcsInternalKeyCacheStatus aPsKey ); |
|
216 |
|
217 /** |
|
218 * Replace occurance of "0" in ITU-T mode with space |
|
219 */ |
|
220 TBool ReplaceZeroWithSpaceL(CPsQuery& aQuery); |
|
221 |
|
222 /** |
|
223 * Search function helper |
|
224 */ |
|
225 void DoSearchL(const CPsSettings& aPcsSettings, |
|
226 CPsQuery& aCondition, |
|
227 RPointerArray<CPsData>& searchResults, |
|
228 RPointerArray<CPsPattern>& searchSeqs ); |
|
229 |
|
230 /** |
|
231 * Search function helper |
|
232 */ |
|
233 void DoSearchInputL(CPsQuery& aQuery, |
|
234 TDesC& aData, |
|
235 RPointerArray<TDesC>& searchSeqs, |
|
236 RArray<TPsMatchLocation>& aMatchLocation ); |
|
237 |
|
238 /** |
|
239 * Returns the index corresponding a URI in iDataStoreUri |
|
240 */ |
|
241 TInt FindStoreUri ( TDesC& aDataStoreUri ); |
|
242 |
|
243 /** |
|
244 * Function to return all cached content |
|
245 */ |
|
246 void GetAllContentsL(const CPsSettings& aPcsSettings, |
|
247 RPointerArray<CPsData>& searchResults ); |
|
248 |
|
249 /** |
|
250 * Checks if search is on groups |
|
251 * Return ETrue if there is a valid group URI |
|
252 */ |
|
253 TBool IsGroupSearchL ( CPsSettings& aSettings, |
|
254 RArray<TInt>& aGroupIdArray ); |
|
255 |
|
256 /** |
|
257 * Utility function to replace groups uri with that of contacts uri |
|
258 */ |
|
259 void ReplaceGroupsUriL ( CPsSettings& aSettings ); |
|
260 |
|
261 /** |
|
262 * Filters the search results array for groups |
|
263 */ |
|
264 void FilterSearchResultsForGroupsL(RArray<TInt>& aGroupContactIds, |
|
265 RPointerArray<CPsData>& aSearchResults); |
|
266 |
|
267 /** |
|
268 * Get the list of contact ids that belong to a group. |
|
269 */ |
|
270 void GetContactsInGroupL ( TInt aGroupId, |
|
271 RArray<TInt>& aGroupContactIds ); |
|
272 |
|
273 /** |
|
274 * Read sort order for a data store from the central repository |
|
275 * @param aURI - The data store URI for which sort order is required |
|
276 * @param aSortOrder - The persisted sort order from the cenrep |
|
277 */ |
|
278 void ReadSortOrderFromCenRepL ( TDesC& aURI, |
|
279 RArray<TInt>& aSortOrder ); |
|
280 |
|
281 /** Write sort order for a data store to the central repository |
|
282 * @param aURI - The data store URI for which sort order is to be persisted |
|
283 * @param aSortOrder - The sort order to be persisted |
|
284 */ |
|
285 void WriteSortOrderToCenRepL ( TDesC& aURI, |
|
286 RArray<TInt>& aSortOrder ); |
|
287 |
|
288 /** |
|
289 * Utility function that sets the caching error value |
|
290 */ |
|
291 void SetCachingError ( TDesC& aDataStore, |
|
292 TInt aError ); |
|
293 |
|
294 /** |
|
295 * Write the content required by client |
|
296 */ |
|
297 CPsClientData* WriteClientDataL ( CPsData& aPsData ); |
|
298 |
|
299 /** |
|
300 * Function to return data base URI for an internal identifier |
|
301 */ |
|
302 TDesC& GetUriForIdL( TUint8 aUriId ); |
|
303 |
|
304 /** |
|
305 * Inform clients about update happened on the cache |
|
306 */ |
|
307 void HandleCacheUpdated( TCachingStatus aStatus ); |
|
308 |
|
309 /** |
|
310 * launch plugins by idle |
|
311 */ |
|
312 void DoLaunchPluginsL(); |
|
313 |
|
314 /** |
|
315 * launch plugins |
|
316 */ |
|
317 static TInt DoLaunchPluginsL(TAny* aPtr); |
|
318 |
|
319 public: |
|
320 |
|
321 inline TInt GetFirstNameIndex() |
|
322 { |
|
323 return iFirstNameIndex; |
|
324 } |
|
325 |
|
326 inline TInt GetLastNameIndex() |
|
327 { |
|
328 return iLastNameIndex; |
193 } |
329 } |
194 |
330 |
195 inline CFindUtilChineseECE* FindUtilECE() |
331 inline CFindUtilChineseECE* FindUtilECE() |
196 { |
332 { |
197 return iFindUtilECE; |
333 return iFindUtilECE; |
198 } |
334 } |
199 |
335 |
|
336 inline CFindUtil* FindUtil() |
|
337 { |
|
338 return iFindUtil; |
|
339 } |
|
340 |
200 void ReconstructCacheDataL(); |
341 void ReconstructCacheDataL(); |
201 |
342 |
202 private: |
343 public: // From MFindStringConverter |
203 |
344 void Converter(const TDesC& aSourStr, TDes& aDestStr); |
204 /** |
|
205 * Constructor |
|
206 */ |
|
207 CPcsAlgorithm2(); |
|
208 |
|
209 /** |
|
210 * 2nd phase construtor |
|
211 */ |
|
212 void ConstructL(); |
|
213 |
|
214 private: |
|
215 |
|
216 /** |
|
217 * Define a P&S property with given key under the internal category |
|
218 * UID of PCS. Leave if definition fails for any other reason than |
|
219 * key already existing. |
|
220 */ |
|
221 void DefinePropertyL( TPcsInternalKeyCacheStatus aPsKey ); |
|
222 |
|
223 /** |
|
224 * Remove leading and trailing spaces of search query |
|
225 */ |
|
226 void RemoveSpacesL( CPsQuery& aQuery ); |
|
227 |
|
228 /** |
|
229 * Replace occurances of "0" in predictive mode with space |
|
230 * if those are on the same button |
|
231 */ |
|
232 TBool ReplaceZeroWithSpaceL( CPsQuery& aQuery ); |
|
233 |
|
234 /** |
|
235 * Search function helper |
|
236 */ |
|
237 void DoSearchL( const CPsSettings& aPcsSettings, |
|
238 CPsQuery& aCondition, |
|
239 RPointerArray<CPsData>& aSearchResults, |
|
240 RPointerArray<CPsPattern>& aSearchSeqs ); |
|
241 |
|
242 /** |
|
243 * Search function helper |
|
244 */ |
|
245 void DoSearchInputL( CPsQuery& aQuery, |
|
246 const TDesC& aData, |
|
247 RPointerArray<TDesC>& aSearchSeqs, |
|
248 RArray<TPsMatchLocation>& aMatchLocation ); |
|
249 |
|
250 /** |
|
251 * Returns the index corresponding a URI in iDataStoreUri |
|
252 */ |
|
253 TInt FindStoreUri( const TDesC& aDataStoreUri ); |
|
254 |
|
255 /** |
|
256 * Function to return all cached content |
|
257 */ |
|
258 void GetAllContentsL( const CPsSettings& aPcsSettings, |
|
259 RPointerArray<CPsData>& aSearchResults ); |
|
260 |
|
261 /** |
|
262 * Checks if search is on groups |
|
263 * Return ETrue if there is a valid group URI |
|
264 */ |
|
265 TBool IsGroupSearchL( CPsSettings& aSettings, |
|
266 RArray<TInt>& aGroupIdArray ); |
|
267 |
|
268 /** |
|
269 * Utility function to replace groups uri with that of contacts uri |
|
270 */ |
|
271 void ReplaceGroupsUriL( CPsSettings& aSettings ); |
|
272 |
|
273 /** |
|
274 * Filters the search results array for groups |
|
275 */ |
|
276 void FilterSearchResultsForGroupsL(RArray<TInt>& aGroupContactIds, |
|
277 RPointerArray<CPsData>& aSearchResults); |
|
278 |
|
279 /** |
|
280 * Get the list of contact ids that belong to a group. |
|
281 */ |
|
282 void GetContactsInGroupL( TInt aGroupId, |
|
283 RArray<TInt>& aGroupContactIds ); |
|
284 |
|
285 /** |
|
286 * Read sort order for a data store from the central repository |
|
287 * @param aURI - The data store URI for which sort order is required |
|
288 * @param aSortOrder - The persisted sort order from the cenrep |
|
289 */ |
|
290 void ReadSortOrderFromCenRepL( const TDesC& aURI, |
|
291 RArray<TInt>& aSortOrder ); |
|
292 |
|
293 /** Write sort order for a data store to the central repository |
|
294 * @param aURI - The data store URI for which sort order is to be persisted |
|
295 * @param aSortOrder - The sort order to be persisted |
|
296 */ |
|
297 void WriteSortOrderToCenRepL( const TDesC& aURI, |
|
298 RArray<TInt>& aSortOrder ); |
|
299 |
|
300 /** |
|
301 * Utility function that sets the caching error value |
|
302 */ |
|
303 void SetCachingError( const TDesC& aDataStore, TInt aError ); |
|
304 |
|
305 /** |
|
306 * Write the content required by client |
|
307 */ |
|
308 CPsClientData* WriteClientDataL( CPsData& aPsData ); |
|
309 |
|
310 /** |
|
311 * Function to return data base URI for an internal identifier |
|
312 */ |
|
313 const TDesC& GetUriForIdL( TUint8 aUriId ); |
|
314 |
|
315 /** |
|
316 * Inform clients about update happened on the cache |
|
317 */ |
|
318 void HandleCacheUpdated( TCachingStatus aStatus ); |
|
319 |
|
320 /** |
|
321 * launch plugins by idle |
|
322 */ |
|
323 void DoLaunchPluginsL(); |
|
324 |
|
325 /** |
|
326 * launch plugins |
|
327 */ |
|
328 static TInt DoLaunchPluginsL(TAny* aPtr); |
|
329 |
345 |
330 private: |
346 private: |
331 |
347 |
332 /** |
348 /** |
333 * Instance of contacts cache |
349 * Instance of contacts cache |
334 * Own |
350 * Own |
335 */ |
351 */ |
336 RPointerArray<CPcsCache> iPcsCache; |
352 RPointerArray<CPcsCache> iPcsCache; |
337 |
353 |
338 /** |
354 /** |
339 * Keeps the count of caches |
355 * Keeps the count of caches |
340 */ |
356 */ |
341 TUint8 iCacheCount; |
357 TUint8 iCacheCount; |
342 |
358 |
343 /** |
359 /** |
344 * Instance of key map |
360 * Instance of key map |
345 * Own. |
361 * Own. |
346 */ |
362 */ |