67 |
67 |
68 /** |
68 /** |
69 * Common pointers. |
69 * Common pointers. |
70 * |
70 * |
71 * @since S60 5.0 |
71 * @since S60 5.0 |
72 * @ingroup group_hnmetadatamodel |
72 * @ingroup group_hnmetadatamodel |
73 */ |
73 */ |
74 struct THnMdCommonPointers |
74 struct THnMdCommonPointers |
75 { |
75 { |
76 /** |
76 /** |
77 * Not own - Localization. |
77 * Not own - Localization. |
78 */ |
78 */ |
79 CHnMdLocalization* iLocalization; |
79 CHnMdLocalization* iLocalization; |
80 |
80 |
81 /** |
81 /** |
82 * Not own - Query generator. |
82 * Not own - Query generator. |
83 */ |
83 */ |
84 THnIdGenerator* iIdGenerator; |
84 THnIdGenerator* iIdGenerator; |
85 |
85 |
86 /** |
86 /** |
87 * Not own - Suite model container. |
87 * Not own - Suite model container. |
88 */ |
88 */ |
89 CHnSuiteModelContainer* iContainer; |
89 CHnSuiteModelContainer* iContainer; |
90 |
90 |
91 /** |
91 /** |
92 * Not own - Meta data model. |
92 * Not own - Meta data model. |
93 */ |
93 */ |
94 CHnMdModel* iModel; |
94 CHnMdModel* iModel; |
95 |
95 |
96 /** |
96 /** |
97 * Not own - Xml model provider. |
97 * Not own - Xml model provider. |
98 */ |
98 */ |
99 CHnXmlModelProvider* iXmlModelProvider; |
99 CHnXmlModelProvider* iXmlModelProvider; |
100 |
100 |
101 /** |
101 /** |
102 * Not own - Cache for bitmap and mask ids. |
102 * Not own - Cache for bitmap and mask ids. |
103 */ |
103 */ |
104 CHnBitmapIdCache* iBitmapIdCache; |
104 CHnBitmapIdCache* iBitmapIdCache; |
105 |
105 |
106 /** |
106 /** |
107 * Not own - Model event observer. |
107 * Not own - Model event observer. |
108 */ |
108 */ |
109 MHnMdModelEventObserver* iModelEventObserver; |
109 MHnMdModelEventObserver* iModelEventObserver; |
110 |
110 |
111 /** |
111 /** |
112 * Not own - Edit mode interface. |
112 * Not own - Edit mode interface. |
113 */ |
113 */ |
114 MHnEditModeInterface* iEditModeInterface; |
114 MHnEditModeInterface* iEditModeInterface; |
115 |
115 |
116 /** |
116 /** |
117 * Not own - Handler to file server session; |
117 * Not own - Handler to file server session; |
118 */ |
118 */ |
119 RFs& iFs; |
119 RFs& iFs; |
120 |
120 |
121 /** |
121 /** |
122 * Gets static pointer from TLS. |
122 * Gets static pointer from TLS. |
123 */ |
123 */ |
124 static THnMdCommonPointers* Static() {return (THnMdCommonPointers*)Dll::Tls(); } |
124 static THnMdCommonPointers* Static() {return (THnMdCommonPointers*)Dll::Tls(); } |
125 |
125 |
126 /** |
126 /** |
127 * Sets pointer to TLS. |
127 * Sets pointer to TLS. |
128 * |
128 * |
129 * @param aCmnPtrs Pointer to set |
129 * @param aCmnPtrs Pointer to set |
130 */ |
130 */ |
131 static void SetStatic( THnMdCommonPointers* aCmnPtrs ) { Dll::SetTls(aCmnPtrs); } |
131 static void SetStatic( THnMdCommonPointers* aCmnPtrs ) { Dll::SetTls(aCmnPtrs); } |
132 |
132 |
133 private: |
133 private: |
134 |
134 |
135 // only model can create it |
135 // only model can create it |
136 friend class CHnMdModel; |
136 friend class CHnMdModel; |
137 |
137 |
138 /** |
138 /** |
139 * Standard C++ consturctor. |
139 * Standard C++ consturctor. |
140 */ |
140 */ |
141 THnMdCommonPointers() : iFs( CEikonEnv::Static()->FsSession() ) |
141 THnMdCommonPointers() : iFs( CEikonEnv::Static()->FsSession() ) |
142 { |
142 { |
186 TInt GetNextId() |
186 TInt GetNextId() |
187 { |
187 { |
188 return iId++; |
188 return iId++; |
189 } |
189 } |
190 private: |
190 private: |
191 |
191 |
192 /** |
192 /** |
193 * Copy constructor declared as private to disallow copying. |
193 * Copy constructor declared as private to disallow copying. |
194 * @param aGenerator Id generator; |
194 * @param aGenerator Id generator; |
195 */ |
195 */ |
196 THnIdGenerator(const THnIdGenerator& aGenerator); |
196 THnIdGenerator(const THnIdGenerator& aGenerator); |
197 |
197 |
198 /** |
198 /** |
199 * Assignment operator. |
199 * Assignment operator. |
200 */ |
200 */ |
201 THnIdGenerator& operator=(const THnIdGenerator&); |
201 THnIdGenerator& operator=(const THnIdGenerator&); |
202 |
202 |
203 /** |
203 /** |
204 * Id |
204 * Id |
205 */ |
205 */ |
206 TInt iId; |
206 TInt iId; |
207 }; |
207 }; |
208 |
208 |
209 /** |
209 /** |
210 * Model event observer. |
210 * Model event observer. |
211 * |
211 * |
212 * @since S60 5.0 |
212 * @since S60 5.0 |
213 * @ingroup group_hnmetadatamodel |
213 * @ingroup group_hnmetadatamodel |
214 */ |
214 */ |
215 class MHnMdModelEventObserver |
215 class MHnMdModelEventObserver |
216 { |
216 { |
217 public: |
217 public: |
218 |
218 |
219 /** |
219 /** |
220 * Handles modlde event. |
220 * Handles modlde event. |
221 * |
221 * |
222 * @since S60 5.0 |
222 * @since S60 5.0 |
223 * @param aEventName Event name. |
223 * @param aEventName Event name. |
224 * @param aParams Parameters. |
224 * @param aParams Parameters. |
225 */ |
225 */ |
226 virtual TInt HandleModelEventL( const TDesC& aEventName, |
226 virtual TInt HandleModelEventL( const TDesC& aEventName, |
227 CLiwGenericParamList& aParams ) = 0; |
227 CLiwGenericParamList& aParams ) = 0; |
228 }; |
228 }; |
229 |
229 |
230 /** |
230 /** |
231 * Meta data model |
231 * Meta data model |
232 * |
232 * |
233 * This is the main class of the Meta Data Model component. |
233 * This is the main class of the Meta Data Model component. |
234 * |
234 * |
235 * This class is the entry point for building the meta data model |
235 * This class is the entry point for building the meta data model |
236 * and for evaluation. |
236 * and for evaluation. |
237 * |
237 * |
238 * @since S60 5.0 |
238 * @since S60 5.0 |
239 * @ingroup group_hnmetadatamodel |
239 * @ingroup group_hnmetadatamodel |
240 */ |
240 */ |
241 NONSHARABLE_CLASS( CHnMdModel ) : public CBase |
241 NONSHARABLE_CLASS( CHnMdModel ) : public CBase |
242 { |
242 { |
275 * Standard C++ virtual destructor. |
275 * Standard C++ virtual destructor. |
276 * |
276 * |
277 * @since S60 5.0 |
277 * @since S60 5.0 |
278 */ |
278 */ |
279 virtual ~CHnMdModel(); |
279 virtual ~CHnMdModel(); |
280 |
280 |
281 /** |
281 /** |
282 * Evaluates the model. Takes filter as a parameter. |
282 * Evaluates the model. Takes filter as a parameter. |
283 * |
283 * |
284 * @since S60 5.0 |
284 * @since S60 5.0 |
285 * @param aFilter Filter. |
285 * @param aFilter Filter. |
286 */ |
286 */ |
287 IMPORT_C void EvaluateL( CHnFilter& aFilter ); |
287 IMPORT_C void EvaluateL( CHnFilter& aFilter ); |
288 |
288 |
289 /** |
289 /** |
290 * Manages evaluation lock. |
290 * Manages evaluation lock. |
291 * |
291 * |
292 * @param aLock Locks evaluation if set to ETrue. |
292 * @param aLock Locks evaluation if set to ETrue. |
293 * @param aEvaluate Runs evaluation if aEvaluate == ETrue. |
293 * @param aEvaluate Runs evaluation if aEvaluate == ETrue. |
294 */ |
294 */ |
295 IMPORT_C void SetEvaluationLockL( TBool aLock, TBool aEvaluate = ETrue ); |
295 IMPORT_C void SetEvaluationLockL( TBool aLock, TBool aEvaluate = ETrue ); |
296 |
296 |
297 /** |
297 /** |
298 * Evaluates the model. |
298 * Evaluates the model. |
299 * |
299 * |
300 * @since S60 5.0 |
300 * @since S60 5.0 |
301 */ |
301 */ |
302 IMPORT_C void EvaluateL(); |
302 IMPORT_C void EvaluateL(); |
303 |
303 |
304 /** |
304 /** |
305 * Switches between edit mode and normal mode |
305 * Switches between edit mode and normal mode |
306 * |
306 * |
307 * @since S60 5.0 |
307 * @since S60 5.0 |
308 * @param aMode Suite model container. |
308 * @param aMode Suite model container. |
309 */ |
309 */ |
310 IMPORT_C void SetModeL( TMdMode aMode ); |
310 IMPORT_C void SetModeL( TMdMode aMode ); |
311 |
311 |
312 |
312 |
313 /** |
313 /** |
314 * Gets suite's meta data model. |
314 * Gets suite's meta data model. |
315 * |
315 * |
316 * @since S60 5.0 |
316 * @since S60 5.0 |
317 * @return Suite meta data model. |
317 * @return Suite meta data model. |
318 */ |
318 */ |
319 IMPORT_C CHnMdSuite* GetLastSuite(); |
319 IMPORT_C CHnMdSuite* GetLastSuite(); |
320 |
320 |
321 /** |
321 /** |
322 * Gets suite's meta data model. |
322 * Gets suite's meta data model. |
323 * |
323 * |
324 * @since S60 5.0 |
324 * @since S60 5.0 |
325 * @param aPosition Position of the suite in the stack. |
325 * @param aPosition Position of the suite in the stack. |
326 * @return Suite meta data model. |
326 * @return Suite meta data model. |
327 */ |
327 */ |
328 CHnMdSuite* GetSuite( TInt aPosition ); |
328 CHnMdSuite* GetSuite( TInt aPosition ); |
329 |
329 |
330 /** |
330 /** |
331 * Gets suite's parameters.. |
331 * Gets suite's parameters.. |
332 * |
332 * |
333 * @since S60 5.0 |
333 * @since S60 5.0 |
334 * @param aPosition Position of the suite in the stack, |
334 * @param aPosition Position of the suite in the stack, |
335 * from which gets parameters. |
335 * from which gets parameters. |
336 * @return Suite meta data model. |
336 * @return Suite meta data model. |
337 */ |
337 */ |
338 IMPORT_C CLiwGenericParamList& GetSuiteParameters( TInt aPosition ); |
338 IMPORT_C CLiwGenericParamList& GetSuiteParameters( TInt aPosition ); |
339 |
339 |
340 |
340 |
341 /** |
341 /** |
342 * Handles back event. |
342 * Handles back event. |
343 * |
343 * |
344 * @since S60 v3.2 |
344 * @since S60 v3.2 |
345 * @param aMulContainer Suite model container. |
345 * @param aMulContainer Suite model container. |
346 * @param aGenre Name of the suite. |
346 * @param aGenre Name of the suite. |
347 * @param aIterations Number of iterations. |
347 * @param aIterations Number of iterations. |
348 * @return Error code. |
348 * @return Error code. |
349 */ |
349 */ |
350 IMPORT_C TInt HandleBackEventL( CHnSuiteModelContainer* aMulContainer, |
350 IMPORT_C TInt HandleBackEventL( CHnSuiteModelContainer* aMulContainer, |
351 const TDesC& aGenre, TInt aIterations = KModelCountForRoot ); |
351 const TDesC& aGenre, TInt aIterations = KModelCountForRoot ); |
352 |
352 |
353 /** |
353 /** |
354 * Handles sis installation event. |
354 * Handles sis installation event. |
355 * |
355 * |
356 * @since S60 v3.2 |
356 * @since S60 v3.2 |
357 * @param aMulContainer Suite model container. |
357 * @param aMulContainer Suite model container. |
358 */ |
358 */ |
359 IMPORT_C void HandleSisInstallationEventL( |
359 IMPORT_C void HandleSisInstallationEventL( |
360 CHnSuiteModelContainer* aMulContainer ); |
360 CHnSuiteModelContainer* aMulContainer ); |
361 |
361 |
362 /** |
362 /** |
363 * Loads a suite from xml data. |
363 * Loads a suite from xml data. |
364 * |
364 * |
365 * @since S60 v5.0 |
365 * @since S60 v5.0 |
366 * @param aGenre Name of the suite. |
366 * @param aGenre Name of the suite. |
367 * @param aSuiteParams Suite parameters. |
367 * @param aSuiteParams Suite parameters. |
368 * @return Error code. |
368 * @return Error code. |
369 */ |
369 */ |
370 IMPORT_C TInt LoadSuiteL( const TDesC& aGenre, CLiwGenericParamList* aSuiteParams = NULL ); |
370 IMPORT_C TInt LoadSuiteL( const TDesC& aGenre, CLiwGenericParamList* aSuiteParams = NULL ); |
371 |
371 |
372 /** |
372 /** |
373 * Check if suite model exists. |
373 * Check if suite model exists. |
374 * |
374 * |
375 * @since S60 5.0 |
375 * @since S60 5.0 |
376 * @param aSuiteModel Suite model name. |
376 * @param aSuiteModel Suite model name. |
377 * @return ETrue if suite model exists, otherwise EFalse. |
377 * @return ETrue if suite model exists, otherwise EFalse. |
378 */ |
378 */ |
379 IMPORT_C TBool SuiteModelExistsL( const TDesC8& aSuiteModel ); |
379 IMPORT_C TBool SuiteModelExistsL( const TDesC8& aSuiteModel ); |
380 |
380 |
381 /** |
381 /** |
382 * Gets suite's meta data model. |
382 * Gets suite's meta data model. |
383 * |
383 * |
384 * @since S60 5.0 |
384 * @since S60 5.0 |
385 * @param aUri Current ui. |
385 * @param aUri Current ui. |
391 * Deletes last loaded suite model from data model. |
391 * Deletes last loaded suite model from data model. |
392 * |
392 * |
393 * @since S60 5.0 |
393 * @since S60 5.0 |
394 */ |
394 */ |
395 IMPORT_C void DeleteLastSuite(); |
395 IMPORT_C void DeleteLastSuite(); |
396 |
396 |
397 |
397 |
398 /** |
398 /** |
399 * Realeses localization files. |
399 * Realeses localization files. |
400 * |
400 * |
401 * @since S60 5.0 |
401 * @since S60 5.0 |
402 */ |
402 */ |
403 IMPORT_C void ReleaseLocalization(); |
403 IMPORT_C void ReleaseLocalization(); |
404 |
404 |
405 /** |
405 /** |
406 * Reloads localization. |
406 * Reloads localization. |
407 * |
407 * |
408 * @since S60 5.0 |
408 * @since S60 5.0 |
409 */ |
409 */ |
410 IMPORT_C void ReloadLocalizationL(); |
410 IMPORT_C void ReloadLocalizationL(); |
411 |
411 |
412 /** |
412 /** |
413 * Informs metadatamodel to ignore evaluations or |
413 * Informs metadatamodel to ignore evaluations or |
414 * to performing evaluations, according to the |
414 * to performing evaluations, according to the |
415 * given parameter. |
415 * given parameter. |
416 * |
416 * |
417 * @since S60 5.0 |
417 * @since S60 5.0 |
418 * @param aIgnore Metadatamodel ignores evaluations when set to ETrue. |
418 * @param aIgnore Metadatamodel ignores evaluations when set to ETrue. |
419 */ |
419 */ |
420 IMPORT_C void IgnoreEvaluations( TBool aIgnore ); |
420 IMPORT_C void IgnoreEvaluations( TBool aIgnore ); |
421 |
421 |
422 /** |
422 /** |
423 * Request that menu goes to foreground when evaluation completes. |
423 * Request that menu goes to foreground when evaluation completes. |
424 * |
424 * |
425 * Default behavior is not to go to foreground when evaluation |
425 * Default behavior is not to go to foreground when evaluation |
426 * completes. A change of this behavior requested with this method is |
426 * completes. A change of this behavior requested with this method is |
433 * Possible values are defined in the |
433 * Possible values are defined in the |
434 * TForegroundGainTriggeringEvent enum. The value ENever |
434 * TForegroundGainTriggeringEvent enum. The value ENever |
435 * simply means not to bring menu to foreground. |
435 * simply means not to bring menu to foreground. |
436 */ |
436 */ |
437 IMPORT_C void QueueForeground( TForegroundGainTriggeringEvent aWhen ); |
437 IMPORT_C void QueueForeground( TForegroundGainTriggeringEvent aWhen ); |
438 |
438 |
439 /** |
439 /** |
440 * Is there a queue for foreground gain. |
440 * Is there a queue for foreground gain. |
441 * |
441 * |
442 * @since S60 5.0 |
442 * @since S60 5.0 |
443 * @return should foreground be gained after evaluation. |
443 * @return should foreground be gained after evaluation. |
444 */ |
444 */ |
445 IMPORT_C TBool IsForegroundQueued() const; |
445 IMPORT_C TBool IsForegroundQueued() const; |
446 |
446 |
447 /** |
447 /** |
448 * Notifies this metadata model that suite evaluation has completed. |
448 * Notifies this metadata model that suite evaluation has completed. |
449 * |
449 * |
450 * @param aJustEvaluatedSuite pointer to the suite whose evaluation |
450 * @param aJustEvaluatedSuite pointer to the suite whose evaluation |
451 * has completed |
451 * has completed |
452 */ |
452 */ |
453 void SuiteModelReadyToShowL( CHnSuiteModel* aJustEvaluatedSuite ); |
453 void SuiteModelReadyToShowL( CHnSuiteModel* aJustEvaluatedSuite ); |
454 |
454 |
455 /** |
455 /** |
456 * Causes all of the loades suites except for the suite at the bottom |
456 * Causes all of the loades suites except for the suite at the bottom |
457 * of the stack to be reloaded from their corresponding xml file |
457 * of the stack to be reloaded from their corresponding xml file |
458 * definitions. |
458 * definitions. |
459 * |
459 * |
460 * @since S60 5.0 |
460 * @since S60 5.0 |
461 * @param aIgnore aModelContainer Model container object. |
461 * @param aIgnore aModelContainer Model container object. |
462 */ |
462 */ |
463 void ReloadStackSuitesL( CHnSuiteModelContainer* aModelContainer ); |
463 void ReloadStackSuitesL( CHnSuiteModelContainer* aModelContainer ); |
464 |
464 |
465 /** |
465 /** |
466 * Counts number of loaded suites. |
466 * Counts number of loaded suites. |
467 * |
467 * |
468 * @since S60 5.0 |
468 * @since S60 5.0 |
469 * @return Number of loaded suites |
469 * @return Number of loaded suites |
470 */ |
470 */ |
471 TInt LoadedSuitesCount(); |
471 TInt LoadedSuitesCount(); |
472 |
472 |
495 */ |
495 */ |
496 void ConstructL( MHnMdModelEventObserver* aModelObserver, |
496 void ConstructL( MHnMdModelEventObserver* aModelObserver, |
497 CHnSuiteModelContainer * aSuiteModelContainer ); |
497 CHnSuiteModelContainer * aSuiteModelContainer ); |
498 |
498 |
499 private: // data |
499 private: // data |
500 |
500 |
501 /** |
501 /** |
502 * Id generator. |
502 * Id generator. |
503 */ |
503 */ |
504 THnIdGenerator iIdGenerator; |
504 THnIdGenerator iIdGenerator; |
505 |
505 |
506 /** |
506 /** |
507 * Own - Localization. |
507 * Own - Localization. |
508 */ |
508 */ |
509 CHnMdLocalization* iLocalization; |
509 CHnMdLocalization* iLocalization; |
510 |
510 |
511 /** |
511 /** |
512 * Own - Xml model provider. |
512 * Own - Xml model provider. |
513 */ |
513 */ |
514 CHnXmlModelProvider* iXmlModelProvider; |
514 CHnXmlModelProvider* iXmlModelProvider; |
515 |
515 |
516 /** |
516 /** |
517 * Own - bitmap and mask ids cache. |
517 * Own - bitmap and mask ids cache. |
518 */ |
518 */ |
519 CHnBitmapIdCache* iBitmapIdCache; |
519 CHnBitmapIdCache* iBitmapIdCache; |
520 |
520 |
521 /** |
521 /** |
522 * Not Own - Event observer. |
522 * Not Own - Event observer. |
523 */ |
523 */ |
524 MHnMdModelEventObserver* iModelEventObserver; |
524 MHnMdModelEventObserver* iModelEventObserver; |
525 |
525 |
526 /** |
526 /** |
527 * Stores pointers to common objects in the system |
527 * Stores pointers to common objects in the system |
528 * This object is shared throut the whole system. |
528 * This object is shared throut the whole system. |
529 */ |
529 */ |
530 THnMdCommonPointers iCmnPtrs; |
530 THnMdCommonPointers iCmnPtrs; |
531 |
531 |
532 /** |
532 /** |
533 * Stores information about mode. |
533 * Stores information about mode. |
534 */ |
534 */ |
535 TMdMode iMode; |
535 TMdMode iMode; |
536 |
536 |
537 /** |
537 /** |
538 * Loaded Suites stack. |
538 * Loaded Suites stack. |
539 * Object and content owned. |
539 * Object and content owned. |
540 */ |
540 */ |
541 RPointerArray<CHnMdSuite> iLoadedSuites; |
541 RPointerArray<CHnMdSuite> iLoadedSuites; |
542 |
542 |
543 /** |
543 /** |
544 * Repository widget type observer. |
544 * Repository widget type observer. |
545 */ |
545 */ |
546 CHnRepositoryObserver* iRepositoryWidgetTypeObserver; |
546 CHnRepositoryObserver* iRepositoryWidgetTypeObserver; |
547 |
547 |
548 /** |
548 /** |
549 * Repository folder change observer. |
549 * Repository folder change observer. |
550 */ |
550 */ |
551 CHnRepositoryObserver* iRepositoryShowFolderObserver; |
551 CHnRepositoryObserver* iRepositoryShowFolderObserver; |
552 |
552 |
553 /** |
|
554 * Repository folder change observer. |
|
555 */ |
|
556 CHnRepositoryObserver* iRepositoryZoomObserver; |
|
557 |
|
558 /** |
553 /** |
559 * When set, forces metadatamodel to skip evaluations. |
554 * When set, forces metadatamodel to skip evaluations. |
560 */ |
555 */ |
561 TBool iIgnoreEvaluations; |
556 TBool iIgnoreEvaluations; |
562 |
557 |
563 /** |
558 /** |
564 * Queues foreground gain action. |
559 * Queues foreground gain action. |
565 */ |
560 */ |
566 TBool iForegroundQueued; |
561 TBool iForegroundQueued; |
567 |
562 |
568 /** |
563 /** |
569 * Not own - pointer to the suite model that must be evaluated |
564 * Not own - pointer to the suite model that must be evaluated |
570 * before matrix menu can be brought to foreground. |
565 * before matrix menu can be brought to foreground. |
571 * |
566 * |
572 * When NULL, then any suite evaluation brings menu to foreground. |
567 * When NULL, then any suite evaluation brings menu to foreground. |
573 * It is only meaningful when iForegroundQueued is ETrue. |
568 * It is only meaningful when iForegroundQueued is ETrue. |
574 */ |
569 */ |
575 CHnSuiteModel* iForegroundTriggeringSuite; |
570 CHnSuiteModel* iForegroundTriggeringSuite; |
576 |
571 |
577 }; |
572 }; |
578 |
573 |
579 #endif // C_HNMDMODEL_H |
574 #endif // C_HNMDMODEL_H |