141 // |
141 // |
142 // --------------------------------------------------------------------------- |
142 // --------------------------------------------------------------------------- |
143 // |
143 // |
144 CHnSuiteModel* CHnEngine::GetLastSuiteModelL() |
144 CHnSuiteModel* CHnEngine::GetLastSuiteModelL() |
145 { |
145 { |
146 return iSuiteContainer->GetLastSuiteModel(); |
146 return iSuiteContainer->GetLastSuiteModel(); |
147 } |
147 } |
148 |
148 |
149 // --------------------------------------------------------------------------- |
149 // --------------------------------------------------------------------------- |
150 // |
150 // |
151 // --------------------------------------------------------------------------- |
151 // --------------------------------------------------------------------------- |
152 // |
152 // |
153 CHnSuiteModel* CHnEngine::GetParentSuiteModelL() |
153 CHnSuiteModel* CHnEngine::GetParentSuiteModelL() |
154 { |
154 { |
155 return iSuiteContainer->GetParentSuiteModel(); |
155 return iSuiteContainer->GetParentSuiteModel(); |
156 } |
156 } |
157 |
157 |
158 // --------------------------------------------------------------------------- |
158 // --------------------------------------------------------------------------- |
159 // |
159 // |
160 // --------------------------------------------------------------------------- |
160 // --------------------------------------------------------------------------- |
161 // |
161 // |
162 EXPORT_C TInt CHnEngine::TriggerHnEventL( const TInt aHnEventId, |
162 EXPORT_C TInt CHnEngine::TriggerHnEventL( const TInt aHnEventId, |
163 const TInt aRecipientId, CLiwGenericParamList* aEventParameters ) |
163 const TInt aRecipientId, CLiwGenericParamList* aEventParameters ) |
164 { |
164 { |
165 TInt ret = iSuiteContainer->OfferHnEventL( aHnEventId, aRecipientId, |
165 TInt ret = iSuiteContainer->OfferHnEventL( aHnEventId, aRecipientId, |
166 aEventParameters); |
166 aEventParameters); |
167 return ret; |
167 return ret; |
185 |
185 |
186 // --------------------------------------------------------------------------- |
186 // --------------------------------------------------------------------------- |
187 // |
187 // |
188 // --------------------------------------------------------------------------- |
188 // --------------------------------------------------------------------------- |
189 // |
189 // |
190 TInt CHnEngine::LoadSuiteFromUriL( const TDesC8& aSuiteName, |
190 TInt CHnEngine::LoadSuiteFromUriL( const TDesC8& aSuiteName, |
191 const TDesC8& aUriQuery, const TDesC8& aUriFragment ) |
191 const TDesC8& aUriQuery, const TDesC8& aUriFragment ) |
192 { |
192 { |
193 TInt error( KErrNone ); |
193 TInt error( KErrNone ); |
194 |
194 |
195 if( !( aSuiteName.Compare( KRoot8 ) ) ) |
195 if( !( aSuiteName.Compare( KRoot8 ) ) ) |
196 { |
196 { |
197 CLiwGenericParamList* uriParams = |
197 CLiwGenericParamList* uriParams = |
198 UriQueryToLiwListLC( aUriQuery, aUriFragment, aSuiteName ); |
198 UriQueryToLiwListLC( aUriQuery, aUriFragment, aSuiteName ); |
199 CLiwGenericParamList* params = CLiwGenericParamList::NewLC(); |
199 CLiwGenericParamList* params = CLiwGenericParamList::NewLC(); |
200 params->AppendL( iMetaDataModel->GetSuiteParameters( 0 ) ); |
200 params->AppendL( iMetaDataModel->GetSuiteParameters( 0 ) ); |
201 params->AppendL( *uriParams ); |
201 params->AppendL( *uriParams ); |
202 ResetModelsL(); |
202 ResetModelsL(); |
209 { |
209 { |
210 CLiwGenericParamList* params = |
210 CLiwGenericParamList* params = |
211 UriQueryToLiwListLC( aUriQuery, aUriFragment, aSuiteName ); |
211 UriQueryToLiwListLC( aUriQuery, aUriFragment, aSuiteName ); |
212 |
212 |
213 HBufC* suiteName = HnConvUtils::Str8ToStrLC( aSuiteName ); |
213 HBufC* suiteName = HnConvUtils::Str8ToStrLC( aSuiteName ); |
214 params->AppendL( TLiwGenericParam( KNewSuiteParamNameEn, |
214 params->AppendL( TLiwGenericParam( KNewSuiteParamNameEn, |
215 TLiwVariant( *suiteName ) ) ); |
215 TLiwVariant( *suiteName ) ) ); |
216 |
216 |
217 error = HandleNewSuiteLoadedEventL( *params ); |
217 error = HandleNewSuiteLoadedEventL( *params ); |
218 |
218 |
219 CleanupStack::PopAndDestroy( suiteName ); |
219 CleanupStack::PopAndDestroy( suiteName ); |
220 CleanupStack::PopAndDestroy( params ); |
220 CleanupStack::PopAndDestroy( params ); |
221 } |
221 } |
222 |
222 |
223 return error; |
223 return error; |
224 } |
224 } |
225 |
225 |
226 // --------------------------------------------------------------------------- |
226 // --------------------------------------------------------------------------- |
227 // |
227 // |
271 // |
271 // |
272 EXPORT_C void CHnEngine::LoadSuitesFromUriL( const TDesC8& aUri ) |
272 EXPORT_C void CHnEngine::LoadSuitesFromUriL( const TDesC8& aUri ) |
273 { |
273 { |
274 DEBUG(("_MM_:CHnEngine::LoadSuitesFromUriL IN")); |
274 DEBUG(("_MM_:CHnEngine::LoadSuitesFromUriL IN")); |
275 DEBUG8(("_MM_:\tURI: %S",&aUri)); |
275 DEBUG8(("_MM_:\tURI: %S",&aUri)); |
276 |
276 |
277 TBool consumed(EFalse); |
277 TBool consumed(EFalse); |
278 |
278 |
279 if ( aUri.Find( KSetFocusWithPref ) != KErrNotFound ) |
279 if ( aUri.Find( KSetFocusWithPref ) != KErrNotFound ) |
280 { |
280 { |
281 LoadFromCrL( aUri ); |
281 LoadFromCrL( aUri ); |
282 consumed = ETrue; |
282 consumed = ETrue; |
283 } |
283 } |
284 |
284 |
285 if ( !consumed ) |
285 if ( !consumed ) |
286 { |
286 { |
287 consumed = HandleActionL( aUri ); |
287 consumed = HandleActionL( aUri ); |
288 } |
288 } |
289 |
289 |
290 if ( !consumed ) |
290 if ( !consumed ) |
291 { |
291 { |
292 LoadSuitesL( aUri ); |
292 LoadSuitesL( aUri ); |
293 } |
293 } |
294 |
294 |
295 DEBUG(("_MM_:CHnEngine::LoadSuitesFromUriL OUT")); |
295 DEBUG(("_MM_:CHnEngine::LoadSuitesFromUriL OUT")); |
296 } |
296 } |
297 |
297 |
298 // --------------------------------------------------------------------------- |
298 // --------------------------------------------------------------------------- |
299 // |
299 // |
301 // |
301 // |
302 TInt CHnEngine::HandleModelEventL( const TDesC& aEventName, |
302 TInt CHnEngine::HandleModelEventL( const TDesC& aEventName, |
303 CLiwGenericParamList& aParams ) |
303 CLiwGenericParamList& aParams ) |
304 { |
304 { |
305 TInt ret(KErrNotFound); |
305 TInt ret(KErrNotFound); |
306 |
306 |
307 if ( aEventName == KNewSuiteLoadedMdEvent ) |
307 if ( aEventName == KNewSuiteLoadedMdEvent ) |
308 { |
308 { |
309 // This handles new suite creation, putting its visual model |
309 // This handles new suite creation, putting its visual model |
310 // onto the stack eventually. |
310 // onto the stack eventually. |
311 ret = HandleNewSuiteLoadedEventL( aParams ); |
311 ret = HandleNewSuiteLoadedEventL( aParams ); |
312 } |
312 } |
313 else if ( aEventName == KBackMdEvent ) |
313 else if ( aEventName == KBackMdEvent ) |
314 { |
314 { |
347 else if (aEventName == KStopEditModeMdEvent ) |
347 else if (aEventName == KStopEditModeMdEvent ) |
348 { |
348 { |
349 // Stopping edit mode |
349 // Stopping edit mode |
350 iControllerInterface.NotifyUiRefreshL( EStopEditMode ); |
350 iControllerInterface.NotifyUiRefreshL( EStopEditMode ); |
351 ret = KErrNone; |
351 ret = KErrNone; |
352 } |
352 } |
353 else if (aEventName == KSetFocusEvent ) |
353 else if (aEventName == KSetFocusEvent ) |
354 { |
354 { |
355 // SetFocus |
355 // SetFocus |
356 ret = HandleSetFocusEventL( aParams ); |
356 ret = HandleSetFocusEventL( aParams ); |
357 } |
357 } |
358 else if (aEventName == KZoomLarge ) |
|
359 { |
|
360 // Stopping edit mode |
|
361 iControllerInterface.NotifyUiRefreshL( EZoomLarge ); |
|
362 ret = KErrNone; |
|
363 } |
|
364 else if (aEventName == KZoomSmall) |
|
365 { |
|
366 // Stopping edit mode |
|
367 iControllerInterface.NotifyUiRefreshL( EZoomSmall ); |
|
368 ret = KErrNone; |
|
369 } |
|
370 else if (aEventName == KZoomNormal ) |
|
371 { |
|
372 // Stopping edit mode |
|
373 iControllerInterface.NotifyUiRefreshL( EZoomNormal ); |
|
374 ret = KErrNone; |
|
375 } |
|
376 else if (aEventName == KAppGainForeground ) |
358 else if (aEventName == KAppGainForeground ) |
377 { |
359 { |
378 //force matrix gain foreground |
360 //force matrix gain foreground |
379 DEBUG(("_MM_:CHnEngine::HandleModelEventL EForegroundGain")); |
361 DEBUG(("_MM_:CHnEngine::HandleModelEventL EForegroundGain")); |
380 iControllerInterface.NotifyUiRefreshL( EForegroundGain ); |
362 iControllerInterface.NotifyUiRefreshL( EForegroundGain ); |
385 //force matrix gain background |
367 //force matrix gain background |
386 DEBUG(("_MM_:CHnEngine::HandleModelEventL EBackgroundGain")); |
368 DEBUG(("_MM_:CHnEngine::HandleModelEventL EBackgroundGain")); |
387 iControllerInterface.NotifyUiRefreshL( EBackgroundGain ); |
369 iControllerInterface.NotifyUiRefreshL( EBackgroundGain ); |
388 ret = KErrNone; |
370 ret = KErrNone; |
389 } |
371 } |
390 |
372 |
391 return ret; |
373 return ret; |
392 } |
374 } |
393 |
375 |
394 // --------------------------------------------------------------------------- |
376 // --------------------------------------------------------------------------- |
395 // |
377 // |
396 // --------------------------------------------------------------------------- |
378 // --------------------------------------------------------------------------- |
397 // |
379 // |
398 TInt CHnEngine::HandleWidgetChangeL( |
380 TInt CHnEngine::HandleWidgetChangeL( |
399 CLiwGenericParamList& aParams ) |
381 CLiwGenericParamList& aParams ) |
400 { |
382 { |
401 THnSuiteWidgetType type = EChangeWidget; |
383 THnSuiteWidgetType type = EChangeWidget; |
402 TInt pos( 0 ); |
384 TInt pos( 0 ); |
403 const TLiwGenericParam* param = NULL; |
385 const TLiwGenericParam* param = NULL; |
404 param = aParams.FindFirst( pos, KWidgetTypeAttrName8 ); |
386 param = aParams.FindFirst( pos, KWidgetTypeAttrName8 ); |
405 if ( pos != KErrNotFound ) |
387 if ( pos != KErrNotFound ) |
406 { |
388 { |
407 TPtrC widgetType( KNullDesC ); |
389 TPtrC widgetType( KNullDesC ); |
408 param->Value().Get( widgetType ); |
390 param->Value().Get( widgetType ); |
409 if ( widgetType.Compare( KWidgetTypeList ) == 0 ) |
391 if ( widgetType.Compare( KWidgetTypeList ) == 0 ) |
410 type = EListWidget; |
392 type = EListWidget; |
411 else if ( widgetType.Compare( KWidgetTypeGrid ) == 0 ) |
393 else if ( widgetType.Compare( KWidgetTypeGrid ) == 0 ) |
412 type = EGridWidget; |
394 type = EGridWidget; |
413 else if ( widgetType.Compare( KWidgetTypeCoverFlow ) == 0 ) |
395 else if ( widgetType.Compare( KWidgetTypeCoverFlow ) == 0 ) |
414 type = ECoverFlowWidget; |
396 type = ECoverFlowWidget; |
415 } |
397 } |
416 |
398 |
417 CHnSuiteModel* model = iSuiteContainer->GetLastSuiteModel(); |
399 CHnSuiteModel* model = iSuiteContainer->GetLastSuiteModel(); |
418 return HandleWidgetChangeL( model->SuiteName(), type ); |
400 return HandleWidgetChangeL( model->SuiteName(), type ); |
419 } |
401 } |
420 |
402 |
421 // --------------------------------------------------------------------------- |
403 // --------------------------------------------------------------------------- |
422 // |
404 // |
423 // --------------------------------------------------------------------------- |
405 // --------------------------------------------------------------------------- |
424 // |
406 // |
425 TInt CHnEngine::HandleWidgetChangeL( const TDesC& aSuiteName, |
407 TInt CHnEngine::HandleWidgetChangeL( const TDesC& aSuiteName, |
426 THnSuiteWidgetType aType ) |
408 THnSuiteWidgetType aType ) |
427 { |
409 { |
428 DEBUG(("_MM_:CMatrixMenuAppUi::HandleWidgetChangeL IN")); |
410 DEBUG(("_MM_:CMatrixMenuAppUi::HandleWidgetChangeL IN")); |
429 TInt ret( KErrGeneral ); |
411 TInt ret( KErrGeneral ); |
430 |
412 |
431 CHnRepositoryManager* rep = CHnRepositoryManager::NewLC(); |
413 CHnRepositoryManager* rep = CHnRepositoryManager::NewLC(); |
432 THnSuiteWidgetType type( EUnspecified ); |
414 THnSuiteWidgetType type( EUnspecified ); |
433 TInt err( rep->ReadSuiteWidgetTypeL( aSuiteName, type ) ); |
415 TInt err( rep->ReadSuiteWidgetTypeL( aSuiteName, type ) ); |
434 |
416 |
435 if( ( !err || err == KErrNotFound ) && type != EUnspecified ) |
417 if( ( !err || err == KErrNotFound ) && type != EUnspecified ) |
436 { |
418 { |
437 ret = rep->StoreSuiteWidgetTypeL( aSuiteName, aType ); |
419 ret = rep->StoreSuiteWidgetTypeL( aSuiteName, aType ); |
438 } |
420 } |
439 CleanupStack::PopAndDestroy( rep ); |
421 CleanupStack::PopAndDestroy( rep ); |
440 DEBUG(("_MM_:CMatrixMenuAppUi::HandleWidgetChangeL OUT")); |
422 DEBUG(("_MM_:CMatrixMenuAppUi::HandleWidgetChangeL OUT")); |
441 return ret; |
423 return ret; |
443 |
425 |
444 // --------------------------------------------------------------------------- |
426 // --------------------------------------------------------------------------- |
445 // |
427 // |
446 // --------------------------------------------------------------------------- |
428 // --------------------------------------------------------------------------- |
447 // |
429 // |
448 TInt CHnEngine::HandleReevaluateEventL( |
430 TInt CHnEngine::HandleReevaluateEventL( |
449 CLiwGenericParamList& aParams ) |
431 CLiwGenericParamList& aParams ) |
450 { |
432 { |
451 TInt ret(KErrNone); |
433 TInt ret(KErrNone); |
452 // Paths to retrieve filter values |
434 // Paths to retrieve filter values |
453 _LIT8( KGenreGlobalPath, "filter:genre"); |
435 _LIT8( KGenreGlobalPath, "filter:genre"); |
454 _LIT8( KIdGlobalPath, "filter:id"); |
436 _LIT8( KIdGlobalPath, "filter:id"); |
455 _LIT8( KGenrePath, "filter:[%d]/genre"); |
437 _LIT8( KGenrePath, "filter:[%d]/genre"); |
456 _LIT8( KItemPath, "filter:[%d]/item"); |
438 _LIT8( KItemPath, "filter:[%d]/item"); |
457 |
439 |
458 CHnFilter* filter = CHnFilter::NewLC(); |
440 CHnFilter* filter = CHnFilter::NewLC(); |
459 |
441 |
460 TLiwGenericParam param; |
442 TLiwGenericParam param; |
461 param.PushL(); |
443 param.PushL(); |
462 aParams.AtL(0, param); |
444 aParams.AtL(0, param); |
463 ASSERT( !param.Name().Compare( KFilterElementItem8 ) ); |
445 ASSERT( !param.Name().Compare( KFilterElementItem8 ) ); |
464 |
446 |
465 TLiwVariant suiteIdVariant; |
447 TLiwVariant suiteIdVariant; |
466 suiteIdVariant.PushL(); |
448 suiteIdVariant.PushL(); |
467 TLiwVariant genreVariant; |
449 TLiwVariant genreVariant; |
468 genreVariant.PushL(); |
450 genreVariant.PushL(); |
469 TInt idFound = |
451 TInt idFound = |
470 HnLiwUtils::GetVariantL( aParams, KIdGlobalPath(), suiteIdVariant ); |
452 HnLiwUtils::GetVariantL( aParams, KIdGlobalPath(), suiteIdVariant ); |
471 TInt found = |
453 TInt found = |
472 HnLiwUtils::GetVariantL(aParams, KGenreGlobalPath(), genreVariant ); |
454 HnLiwUtils::GetVariantL(aParams, KGenreGlobalPath(), genreVariant ); |
473 if (idFound != KErrNotFound) |
455 if (idFound != KErrNotFound) |
474 { |
456 { |
475 filter->SetSuiteId( suiteIdVariant.AsTInt32() ); |
457 filter->SetSuiteId( suiteIdVariant.AsTInt32() ); |
476 filter->SetEvaluateSuiteL( ETrue ); |
458 filter->SetEvaluateSuiteL( ETrue ); |
496 path.CreateL( KItemPath().Length() ); |
478 path.CreateL( KItemPath().Length() ); |
497 path.Format( KItemPath, i ); |
479 path.Format( KItemPath, i ); |
498 TLiwVariant itemVariant; |
480 TLiwVariant itemVariant; |
499 HnLiwUtils::GetVariantL(aParams, path, itemVariant ); |
481 HnLiwUtils::GetVariantL(aParams, path, itemVariant ); |
500 CleanupStack::PopAndDestroy( &path ); |
482 CleanupStack::PopAndDestroy( &path ); |
501 |
483 |
502 TPtrC suiteName; |
484 TPtrC suiteName; |
503 TPtrC itemId; |
485 TPtrC itemId; |
504 genreVariant.Get(suiteName); |
486 genreVariant.Get(suiteName); |
505 itemVariant.Get(itemId); |
487 itemVariant.Get(itemId); |
506 |
488 |
507 CHnItemId* itemIdObject = CHnItemId::NewLC(suiteName, itemId); |
489 CHnItemId* itemIdObject = CHnItemId::NewLC(suiteName, itemId); |
508 filter->AppendItemIdL( itemIdObject ); |
490 filter->AppendItemIdL( itemIdObject ); |
509 CleanupStack::Pop( itemIdObject ); |
491 CleanupStack::Pop( itemIdObject ); |
510 |
492 |
511 genreVariant.Reset(); |
493 genreVariant.Reset(); |
512 itemVariant.Reset(); |
494 itemVariant.Reset(); |
513 } |
495 } |
514 } |
496 } |
515 CleanupStack::PopAndDestroy( &genreVariant ); |
497 CleanupStack::PopAndDestroy( &genreVariant ); |
537 TInt CHnEngine::HandleNewSuiteLoadedEventL( |
519 TInt CHnEngine::HandleNewSuiteLoadedEventL( |
538 CLiwGenericParamList& aParams ) |
520 CLiwGenericParamList& aParams ) |
539 { |
521 { |
540 DEBUG(("_MM_:CHnEngine::HandleNewSuiteLoadedEventL IN")); |
522 DEBUG(("_MM_:CHnEngine::HandleNewSuiteLoadedEventL IN")); |
541 TInt err( KErrNone ); |
523 TInt err( KErrNone ); |
542 const TLiwGenericParam* param = |
524 const TLiwGenericParam* param = |
543 aParams.FindFirst( err, KNewSuiteParamNameEn ); |
525 aParams.FindFirst( err, KNewSuiteParamNameEn ); |
544 if( err != KErrNotFound ) |
526 if( err != KErrNotFound ) |
545 { |
527 { |
546 TPtrC genre; |
528 TPtrC genre; |
547 param->Value().Get( genre ); |
529 param->Value().Get( genre ); |
600 delete message; |
582 delete message; |
601 } |
583 } |
602 } |
584 } |
603 DEBUG(("_MM_:\tReturned error code: %d",err)); |
585 DEBUG(("_MM_:\tReturned error code: %d",err)); |
604 DEBUG(("_MM_:CHnEngine::HandleNewSuiteLoadedEventL OUT")); |
586 DEBUG(("_MM_:CHnEngine::HandleNewSuiteLoadedEventL OUT")); |
605 |
587 |
606 return err; |
588 return err; |
607 } |
589 } |
608 |
590 |
609 // --------------------------------------------------------------------------- |
591 // --------------------------------------------------------------------------- |
610 // |
592 // |
611 // --------------------------------------------------------------------------- |
593 // --------------------------------------------------------------------------- |
612 // |
594 // |
613 TInt CHnEngine::HandleSetFocusEventL( const CLiwGenericParamList& aParams ) |
595 TInt CHnEngine::HandleSetFocusEventL( const CLiwGenericParamList& aParams ) |
614 { |
596 { |
615 // Triggering event in hierarchy navigator, specifying |
597 // Triggering event in hierarchy navigator, specifying |
616 // that suite given by the name genre has been |
598 // that suite given by the name genre has been |
617 DEBUG(("_MM_:CHnEngine::HandleSetFocusEventL IN")); |
599 DEBUG(("_MM_:CHnEngine::HandleSetFocusEventL IN")); |
618 |
600 |
619 TInt posSuite( 0 ); |
601 TInt posSuite( 0 ); |
620 TInt posItem( 0 ); |
602 TInt posItem( 0 ); |
621 TInt64 suiteCustomId( KErrNotFound ); |
603 TInt64 suiteCustomId( KErrNotFound ); |
622 TInt64 itemCustomId( KErrNotFound ); |
604 TInt64 itemCustomId( KErrNotFound ); |
623 |
605 |
624 // Get suite's and item's custom ids. |
606 // Get suite's and item's custom ids. |
625 const TLiwGenericParam* paramSuiteId = aParams.FindFirst( posSuite, KSuiteCustomId8 ); |
607 const TLiwGenericParam* paramSuiteId = aParams.FindFirst( posSuite, KSuiteCustomId8 ); |
626 const TLiwGenericParam* paramItemId = aParams.FindFirst( posItem, KItemCustomId8 ); |
608 const TLiwGenericParam* paramItemId = aParams.FindFirst( posItem, KItemCustomId8 ); |
627 |
609 |
628 |
610 |
629 if ( posSuite >= 0 && posItem >= 0 ) |
611 if ( posSuite >= 0 && posItem >= 0 ) |
630 { |
612 { |
631 suiteCustomId = paramSuiteId->Value().AsTInt64(); |
613 suiteCustomId = paramSuiteId->Value().AsTInt64(); |
632 itemCustomId = paramItemId->Value().AsTInt64(); |
614 itemCustomId = paramItemId->Value().AsTInt64(); |
633 |
615 |
634 // Get matching suite. |
616 // Get matching suite. |
635 CHnSuiteModel* suiteModel = iSuiteContainer->GetMatchingSuiteModel( suiteCustomId ); |
617 CHnSuiteModel* suiteModel = iSuiteContainer->GetMatchingSuiteModel( suiteCustomId ); |
636 |
618 |
637 if ( suiteModel ) |
619 if ( suiteModel ) |
638 { |
620 { |
639 // If suite is not null, then find matching item model. |
621 // If suite is not null, then find matching item model. |
640 TInt index( KErrNotFound ); |
622 TInt index( KErrNotFound ); |
641 CHnItemModel* itemModel = suiteModel->GetMatchingItemModelL( itemCustomId, index ); |
623 CHnItemModel* itemModel = suiteModel->GetMatchingItemModelL( itemCustomId, index ); |
642 |
624 |
643 if ( itemModel ) |
625 if ( itemModel ) |
644 { |
626 { |
645 // If itemModel is not null then set highlight and set highligh |
627 // If itemModel is not null then set highlight and set highligh |
646 // on matching item. |
628 // on matching item. |
647 suiteModel->SetSuiteHighlightL( index ); |
629 suiteModel->SetSuiteHighlightL( index ); |
648 iControllerInterface.HandleSuiteEventL( ESuiteHighlightChanged, suiteModel ); |
630 iControllerInterface.HandleSuiteEventL( ESuiteHighlightChanged, suiteModel ); |
649 } |
631 } |
650 else |
632 else |
651 { |
633 { |
652 suiteModel->QueueFocus( itemCustomId ); |
634 suiteModel->QueueFocus( itemCustomId ); |
653 } |
635 } |
654 } |
636 } |
655 } |
637 } |
656 |
638 |
657 DEBUG(("_MM_:CHnEngine::HandleSetFocusEventL OUT")); |
639 DEBUG(("_MM_:CHnEngine::HandleSetFocusEventL OUT")); |
658 return KErrNone; |
640 return KErrNone; |
659 } |
641 } |
660 |
642 |
661 // --------------------------------------------------------------------------- |
643 // --------------------------------------------------------------------------- |
663 // --------------------------------------------------------------------------- |
645 // --------------------------------------------------------------------------- |
664 // |
646 // |
665 TInt CHnEngine::HandleMoveFocusBeforeDeleteEventL( |
647 TInt CHnEngine::HandleMoveFocusBeforeDeleteEventL( |
666 const CLiwGenericParamList& /* aParams */ ) |
648 const CLiwGenericParamList& /* aParams */ ) |
667 { |
649 { |
668 // Triggering event in hierarchy navigator, specifying |
650 // Triggering event in hierarchy navigator, specifying |
669 // that suite given by the name genre has been |
651 // that suite given by the name genre has been |
670 DEBUG(("_MM_:CHnEngine::HandleMoveFocusBeforeDeleteEventL IN")); |
652 DEBUG(("_MM_:CHnEngine::HandleMoveFocusBeforeDeleteEventL IN")); |
671 |
653 |
672 TInt currentHighlight( GetLastSuiteModelL()->GetSuiteHighlight() ); |
654 TInt currentHighlight( GetLastSuiteModelL()->GetSuiteHighlight() ); |
673 TInt itemsCount( GetLastSuiteModelL()->GetItemModelsCount() ); |
655 TInt itemsCount( GetLastSuiteModelL()->GetItemModelsCount() ); |
674 |
656 |
675 TInt shift( 0 ); |
657 TInt shift( 0 ); |
676 if( AknLayoutUtils::PenEnabled() && iEditMode ) |
658 if( AknLayoutUtils::PenEnabled() && iEditMode ) |
677 { |
659 { |
678 // add empty item |
660 // add empty item |
679 shift = 1; |
661 shift = 1; |
750 // --------------------------------------------------------------------------- |
732 // --------------------------------------------------------------------------- |
751 // |
733 // |
752 // --------------------------------------------------------------------------- |
734 // --------------------------------------------------------------------------- |
753 // |
735 // |
754 EXPORT_C TInt CHnEngine::InitializeL( CLiwGenericParamList& aParam ) |
736 EXPORT_C TInt CHnEngine::InitializeL( CLiwGenericParamList& aParam ) |
755 { |
737 { |
756 DEBUG(("_MM_:CMatrixMenuAppUi::InitializeL IN")); |
738 DEBUG(("_MM_:CMatrixMenuAppUi::InitializeL IN")); |
757 User::LeaveIfError( HandleNewSuiteLoadedEventL( aParam ) ); |
739 User::LeaveIfError( HandleNewSuiteLoadedEventL( aParam ) ); |
758 DEBUG(("_MM_:CMatrixMenuAppUi::InitializeL OUT")); |
740 DEBUG(("_MM_:CMatrixMenuAppUi::InitializeL OUT")); |
759 // This is an interface method so some value has to be returned. |
741 // This is an interface method so some value has to be returned. |
760 return KErrNone; |
742 return KErrNone; |
761 } |
743 } |
762 |
744 |
763 // --------------------------------------------------------------------------- |
745 // --------------------------------------------------------------------------- |
764 // |
746 // |
765 // --------------------------------------------------------------------------- |
747 // --------------------------------------------------------------------------- |
861 // |
843 // |
862 CLiwGenericParamList* CHnEngine::UriQueryToLiwListLC( |
844 CLiwGenericParamList* CHnEngine::UriQueryToLiwListLC( |
863 const TDesC8& aUriQuery, const TDesC8& aUriFragment, const TDesC8& aSuiteName ) |
845 const TDesC8& aUriQuery, const TDesC8& aUriFragment, const TDesC8& aSuiteName ) |
864 { |
846 { |
865 CLiwGenericParamList* list = CLiwGenericParamList::NewLC(); |
847 CLiwGenericParamList* list = CLiwGenericParamList::NewLC(); |
866 |
848 |
867 CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
849 CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
868 map->PushL(); |
850 map->PushL(); |
869 |
851 |
870 RPointerArray< HBufC8 > params = SplitL( aUriQuery, KAnd8 ); |
852 RPointerArray< HBufC8 > params = SplitL( aUriQuery, KAnd8 ); |
871 |
853 |
872 for( TInt i = 0; i < params.Count(); i++ ) |
854 for( TInt i = 0; i < params.Count(); i++ ) |
873 { |
855 { |
874 RPointerArray< HBufC8 > paramValue = SplitL( *params[ i ], KEquals8 ); |
856 RPointerArray< HBufC8 > paramValue = SplitL( *params[ i ], KEquals8 ); |
875 CleanupResetAndDestroyPushL( paramValue ); |
857 CleanupResetAndDestroyPushL( paramValue ); |
876 ASSERT( paramValue.Count() == 2 ); |
858 ASSERT( paramValue.Count() == 2 ); |
877 map->InsertL( *paramValue[ 0 ], TLiwVariant( *paramValue[ 1 ] ) ); |
859 map->InsertL( *paramValue[ 0 ], TLiwVariant( *paramValue[ 1 ] ) ); |
878 CleanupStack::PopAndDestroy( ¶mValue ); |
860 CleanupStack::PopAndDestroy( ¶mValue ); |
879 } |
861 } |
880 |
862 |
881 if ( aUriFragment.Length() > 0 && aSuiteName.Length() > 0 ) |
863 if ( aUriFragment.Length() > 0 && aSuiteName.Length() > 0 ) |
882 { |
864 { |
883 map->InsertL( KUriHighlight, TLiwVariant( aUriFragment ) ); |
865 map->InsertL( KUriHighlight, TLiwVariant( aUriFragment ) ); |
884 map->InsertL( KUriHighlightSuite, TLiwVariant( aSuiteName ) ); |
866 map->InsertL( KUriHighlightSuite, TLiwVariant( aSuiteName ) ); |
885 } |
867 } |
886 |
868 |
887 list->AppendL( TLiwGenericParam( KParams8, TLiwVariant( map ))); |
869 list->AppendL( TLiwGenericParam( KParams8, TLiwVariant( map ))); |
888 |
870 |
889 params.ResetAndDestroy(); |
871 params.ResetAndDestroy(); |
890 CleanupStack::PopAndDestroy( map ); |
872 CleanupStack::PopAndDestroy( map ); |
891 |
873 |
892 return list; |
874 return list; |
893 } |
875 } |
899 RPointerArray< HBufC8 > CHnEngine::SplitL( const TDesC8& aSource, |
881 RPointerArray< HBufC8 > CHnEngine::SplitL( const TDesC8& aSource, |
900 const TDesC8& aSeparator ) |
882 const TDesC8& aSeparator ) |
901 { |
883 { |
902 RPointerArray< HBufC8 > tokens; |
884 RPointerArray< HBufC8 > tokens; |
903 CleanupResetAndDestroyPushL( tokens ); |
885 CleanupResetAndDestroyPushL( tokens ); |
904 |
886 |
905 if ( aSource.Length() > 0 && aSeparator.Length() > 0 ) |
887 if ( aSource.Length() > 0 && aSeparator.Length() > 0 ) |
906 { |
888 { |
907 TPtrC8 tmpSource = aSource; |
889 TPtrC8 tmpSource = aSource; |
908 |
890 |
909 TPtrC8 token( KNullDesC8 ); |
891 TPtrC8 token( KNullDesC8 ); |
910 |
892 |
911 while( ETrue ) |
893 while( ETrue ) |
912 { |
894 { |
913 TInt length = tmpSource.Find( aSeparator ); |
895 TInt length = tmpSource.Find( aSeparator ); |
914 |
896 |
915 if ( length >= 0 ) |
897 if ( length >= 0 ) |
916 { |
898 { |
917 token.Set( tmpSource.Mid( 0, length ) ); |
899 token.Set( tmpSource.Mid( 0, length ) ); |
918 tokens.AppendL( token.AllocL() ); |
900 tokens.AppendL( token.AllocL() ); |
919 tmpSource.Set( tmpSource.Mid( length + 1 ) ); |
901 tmpSource.Set( tmpSource.Mid( length + 1 ) ); |
945 { |
927 { |
946 iMetaDataModel->SetModeL( EMdModeNormal ); |
928 iMetaDataModel->SetModeL( EMdModeNormal ); |
947 } |
929 } |
948 //The suite on top of the stack is probably displayed. |
930 //The suite on top of the stack is probably displayed. |
949 //Switching to edit mode has some dramatic ui impact, |
931 //Switching to edit mode has some dramatic ui impact, |
950 //thus when parts of the suite will get displayed |
932 //thus when parts of the suite will get displayed |
951 //it may look awkward thus the suite on top of the stack |
933 //it may look awkward thus the suite on top of the stack |
952 //is marked as uninitialized, therefore ui will be able to |
934 //is marked as uninitialized, therefore ui will be able to |
953 //react only to the ready suite model. |
935 //react only to the ready suite model. |
954 if (AknLayoutUtils::PenEnabled() || (!AknLayoutUtils::PenEnabled() && iEditMode)) |
936 if (AknLayoutUtils::PenEnabled() || (!AknLayoutUtils::PenEnabled() && iEditMode)) |
955 { |
937 { |
956 GetLastSuiteModelL()->GetItemsOrder()->MarkSuiteUninitialized(); |
938 GetLastSuiteModelL()->GetItemsOrder()->MarkSuiteUninitialized(); |
971 // --------------------------------------------------------------------------- |
953 // --------------------------------------------------------------------------- |
972 // |
954 // |
973 // --------------------------------------------------------------------------- |
955 // --------------------------------------------------------------------------- |
974 // |
956 // |
975 |
957 |
976 EXPORT_C void CHnEngine::HandleRequestL( const CLiwGenericParamList& aParam, |
958 EXPORT_C void CHnEngine::HandleRequestL( const CLiwGenericParamList& aParam, |
977 CLiwGenericParamList* /*aOutput*/ ) |
959 CLiwGenericParamList* /*aOutput*/ ) |
978 { |
960 { |
979 TInt pos( 0 ); |
961 TInt pos( 0 ); |
980 aParam.FindFirst( pos, KHnRequest ); |
962 aParam.FindFirst( pos, KHnRequest ); |
981 if (pos != KErrNotFound) |
963 if (pos != KErrNotFound) |
1011 // |
993 // |
1012 void CHnEngine::LoadFromCrL( const TDesC8& aUri ) |
994 void CHnEngine::LoadFromCrL( const TDesC8& aUri ) |
1013 { |
995 { |
1014 HBufC8* uriBuf = HBufC8::NewLC( aUri.Length() ); |
996 HBufC8* uriBuf = HBufC8::NewLC( aUri.Length() ); |
1015 uriBuf->Des().Copy( aUri ); |
997 uriBuf->Des().Copy( aUri ); |
1016 |
998 |
1017 TUriParser8 parser; |
999 TUriParser8 parser; |
1018 parser.Parse( *uriBuf ); |
1000 parser.Parse( *uriBuf ); |
1019 User::LeaveIfError( parser.IsSchemeValid() ? KErrNone : KErrPathNotFound ); |
1001 User::LeaveIfError( parser.IsSchemeValid() ? KErrNone : KErrPathNotFound ); |
1020 |
1002 |
1021 const TDesC8& query = parser.Extract( EUriQuery ); |
1003 const TDesC8& query = parser.Extract( EUriQuery ); |
1022 RPointerArray< HBufC8 > params = SplitL( query, HnLogicalRelations::KLogicalAnd8); |
1004 RPointerArray< HBufC8 > params = SplitL( query, HnLogicalRelations::KLogicalAnd8); |
1023 |
1005 |
1024 TBuf8<KApaMaxAppGroupName + KTimeStampBufferLength + KUidStringLength + 2> item; |
1006 TBuf8<KApaMaxAppGroupName + KTimeStampBufferLength + KUidStringLength + 2> item; |
1025 |
1007 |
1026 for( TInt i = 0; i < params.Count(); i++ ) |
1008 for( TInt i = 0; i < params.Count(); i++ ) |
1027 { |
1009 { |
1028 RPointerArray< HBufC8 > paramValue = SplitL( *params[ i ], HnLogicalRelations::KLogicalEqual8 ); |
1010 RPointerArray< HBufC8 > paramValue = SplitL( *params[ i ], HnLogicalRelations::KLogicalEqual8 ); |
1029 CleanupResetAndDestroyPushL( paramValue ); |
1011 CleanupResetAndDestroyPushL( paramValue ); |
1030 ASSERT( paramValue.Count() == 2 ); |
1012 ASSERT( paramValue.Count() == 2 ); |
1031 |
1013 |
1032 if ( !paramValue[0]->Compare(KMcsAppGroupName8) ) |
1014 if ( !paramValue[0]->Compare(KMcsAppGroupName8) ) |
1033 { |
1015 { |
1034 TBuf8<KApaMaxAppGroupName> appgrname; |
1016 TBuf8<KApaMaxAppGroupName> appgrname; |
1035 if( paramValue[1]->Length()<=KApaMaxAppGroupName ) |
1017 if( paramValue[1]->Length()<=KApaMaxAppGroupName ) |
1036 { |
1018 { |
1052 item.Append( *paramValue[1] ); |
1034 item.Append( *paramValue[1] ); |
1053 } |
1035 } |
1054 } |
1036 } |
1055 CleanupStack::PopAndDestroy( ¶mValue ); |
1037 CleanupStack::PopAndDestroy( ¶mValue ); |
1056 } |
1038 } |
1057 |
1039 |
1058 TBuf<KApaMaxAppGroupName + KTimeStampBufferLength + KUidStringLength + 2> item1; |
1040 TBuf<KApaMaxAppGroupName + KTimeStampBufferLength + KUidStringLength + 2> item1; |
1059 item1.Copy(item); |
1041 item1.Copy(item); |
1060 CRepository *cenRep = CRepository::NewLC( KCRUidMenu ); |
1042 CRepository *cenRep = CRepository::NewLC( KCRUidMenu ); |
1061 cenRep->Set(KMenuShowFolder, item1); |
1043 cenRep->Set(KMenuShowFolder, item1); |
1062 CleanupStack::PopAndDestroy( cenRep ); |
1044 CleanupStack::PopAndDestroy( cenRep ); |
1063 |
1045 |
1064 params.ResetAndDestroy(); |
1046 params.ResetAndDestroy(); |
1065 CleanupStack::PopAndDestroy( uriBuf ); |
1047 CleanupStack::PopAndDestroy( uriBuf ); |
1066 |
1048 |
1067 } |
1049 } |
1068 // --------------------------------------------------------------------------- |
1050 // --------------------------------------------------------------------------- |
1069 // |
1051 // |
1070 // --------------------------------------------------------------------------- |
1052 // --------------------------------------------------------------------------- |
1071 // |
1053 // |
1072 void CHnEngine::LightStatusChanged(TInt aTarget, |
1054 void CHnEngine::LightStatusChanged(TInt aTarget, |
1073 CHWRMLight::TLightStatus aStatus) |
1055 CHWRMLight::TLightStatus aStatus) |
1074 { |
1056 { |
1092 } |
1074 } |
1093 DEBUG(("_Mm_:CMmAppUi::LightStatusChanged - OUT")); |
1075 DEBUG(("_Mm_:CMmAppUi::LightStatusChanged - OUT")); |
1094 } |
1076 } |
1095 |
1077 |
1096 // --------------------------------------------------------------------------- |
1078 // --------------------------------------------------------------------------- |
1097 // |
1079 // |
1098 // --------------------------------------------------------------------------- |
1080 // --------------------------------------------------------------------------- |
1099 // |
1081 // |
1100 TBool CHnEngine::HandleActionL( const TDesC8& aUri ) |
1082 TBool CHnEngine::HandleActionL( const TDesC8& aUri ) |
1101 { |
1083 { |
1102 TBool exitActionConsumed(EFalse); |
1084 TBool exitActionConsumed(EFalse); |
1103 |
1085 |
1104 HBufC8* uriBuf = HBufC8::NewLC( aUri.Length() ); |
1086 HBufC8* uriBuf = HBufC8::NewLC( aUri.Length() ); |
1105 uriBuf->Des().Copy( aUri ); |
1087 uriBuf->Des().Copy( aUri ); |
1106 |
1088 |
1107 TUriParser8 parser; |
1089 TUriParser8 parser; |
1108 parser.Parse( *uriBuf ); |
1090 parser.Parse( *uriBuf ); |
1109 User::LeaveIfError( parser.IsSchemeValid() ? KErrNone : KErrPathNotFound ); |
1091 User::LeaveIfError( parser.IsSchemeValid() ? KErrNone : KErrPathNotFound ); |
1110 |
1092 |
1111 const TDesC8& host8 = parser.Extract( EUriHost ); |
1093 const TDesC8& host8 = parser.Extract( EUriHost ); |
1112 const TDesC8& query = parser.Extract( EUriQuery ); |
1094 const TDesC8& query = parser.Extract( EUriQuery ); |
1113 |
1095 |
1114 RBuf action; |
1096 RBuf action; |
1115 CleanupClosePushL( action ); |
1097 CleanupClosePushL( action ); |
1116 CLiwGenericParamList* paramsUri = UriQueryToLiwListLC( query, KNullDesC8, KNullDesC8 ); |
1098 CLiwGenericParamList* paramsUri = UriQueryToLiwListLC( query, KNullDesC8, KNullDesC8 ); |
1117 HnLiwUtils::GetStringL( *paramsUri, KActionParams, action ); |
1099 HnLiwUtils::GetStringL( *paramsUri, KActionParams, action ); |
1118 |
1100 |
1143 CLiwGenericParamList* pl = CLiwGenericParamList::NewL(); |
1125 CLiwGenericParamList* pl = CLiwGenericParamList::NewL(); |
1144 CleanupStack::PushL( pl ); |
1126 CleanupStack::PushL( pl ); |
1145 HandleModelEventL( KAppGainBackground, *pl ); |
1127 HandleModelEventL( KAppGainBackground, *pl ); |
1146 CleanupStack::PopAndDestroy( pl ); |
1128 CleanupStack::PopAndDestroy( pl ); |
1147 } |
1129 } |
1148 |
1130 |
1149 if ( exitHideHostNotFound && iSuiteContainer->GetLastSuiteModel() == suiteModel ) |
1131 if ( exitHideHostNotFound && iSuiteContainer->GetLastSuiteModel() == suiteModel ) |
1150 { |
1132 { |
1151 HandleBackEventL( host, 1 ); |
1133 HandleBackEventL( host, 1 ); |
1152 } |
1134 } |
1153 else |
1135 else |
1154 { |
1136 { |
1155 //reset to root |
1137 //reset to root |
1156 CLiwGenericParamList* params = CLiwGenericParamList::NewLC(); |
1138 CLiwGenericParamList* params = CLiwGenericParamList::NewLC(); |
1157 params->AppendL( iMetaDataModel->GetSuiteParameters( 0 ) ); |
1139 params->AppendL( iMetaDataModel->GetSuiteParameters( 0 ) ); |
1158 ResetModelsL(); |
1140 ResetModelsL(); |
1159 InitializeL( *params ); |
1141 InitializeL( *params ); |
1160 CleanupStack::PopAndDestroy( params ); |
1142 CleanupStack::PopAndDestroy( params ); |
1161 } |
1143 } |
1162 |
1144 |
1163 CleanupStack::PopAndDestroy( &host ); |
1145 CleanupStack::PopAndDestroy( &host ); |
1164 exitActionConsumed = ETrue; |
1146 exitActionConsumed = ETrue; |
1165 } |
1147 } |
1166 |
1148 |
1167 CleanupStack::PopAndDestroy( paramsUri ); |
1149 CleanupStack::PopAndDestroy( paramsUri ); |
1168 CleanupStack::PopAndDestroy( &action ); |
1150 CleanupStack::PopAndDestroy( &action ); |
1169 CleanupStack::PopAndDestroy( uriBuf ); |
1151 CleanupStack::PopAndDestroy( uriBuf ); |
1170 return exitActionConsumed; |
1152 return exitActionConsumed; |
1171 } |
1153 } |
1172 |
1154 |
1173 // --------------------------------------------------------------------------- |
1155 // --------------------------------------------------------------------------- |
1174 // |
1156 // |
1175 // --------------------------------------------------------------------------- |
1157 // --------------------------------------------------------------------------- |
1176 // |
1158 // |
1177 void CHnEngine::LoadSuitesL( const TDesC8& aUri ) |
1159 void CHnEngine::LoadSuitesL( const TDesC8& aUri ) |
1178 { |
1160 { |
1179 TBool sendToForeground(EFalse); |
1161 TBool sendToForeground(EFalse); |
1180 HBufC8* uriBuf = HBufC8::NewLC( aUri.Length() ); |
1162 HBufC8* uriBuf = HBufC8::NewLC( aUri.Length() ); |
1181 uriBuf->Des().Copy( aUri ); |
1163 uriBuf->Des().Copy( aUri ); |
1182 |
1164 |
1183 TUriParser8 parser; |
1165 TUriParser8 parser; |
1184 parser.Parse( *uriBuf ); |
1166 parser.Parse( *uriBuf ); |
1185 User::LeaveIfError( parser.IsSchemeValid() ? KErrNone : KErrPathNotFound ); |
1167 User::LeaveIfError( parser.IsSchemeValid() ? KErrNone : KErrPathNotFound ); |
1186 |
1168 |
1187 CDesC8ArrayFlat* suiteNameArray = new( ELeave ) CDesC8ArrayFlat( KDefaultGranularity ) ; |
1169 CDesC8ArrayFlat* suiteNameArray = new( ELeave ) CDesC8ArrayFlat( KDefaultGranularity ) ; |
1188 CleanupStack::PushL( suiteNameArray ); |
1170 CleanupStack::PushL( suiteNameArray ); |
1189 |
1171 |
1190 const TDesC8& host = parser.Extract( EUriHost ); |
1172 const TDesC8& host = parser.Extract( EUriHost ); |
1191 RBuf8 host8; |
1173 RBuf8 host8; |
1192 CleanupClosePushL( host8 ); |
1174 CleanupClosePushL( host8 ); |
1193 if (host.Compare( KNullDesC8 )) |
1175 if (host.Compare( KNullDesC8 )) |
1194 { |
1176 { |
1205 path8->Des().Copy( path ); |
1187 path8->Des().Copy( path ); |
1206 path8->Des().LowerCase(); |
1188 path8->Des().LowerCase(); |
1207 ParseSuiteUriPathL( *path8, *suiteNameArray ); |
1189 ParseSuiteUriPathL( *path8, *suiteNameArray ); |
1208 CleanupStack::PopAndDestroy( path8 ); |
1190 CleanupStack::PopAndDestroy( path8 ); |
1209 } |
1191 } |
1210 |
1192 |
1211 TBool suiteExists( EFalse ); |
1193 TBool suiteExists( EFalse ); |
1212 iMetaDataModel->IgnoreEvaluations( ETrue ); |
1194 iMetaDataModel->IgnoreEvaluations( ETrue ); |
1213 iMetaDataModel->QueueForeground( CHnMdModel::EWhenAnySuiteIsEvaluated ); |
1195 iMetaDataModel->QueueForeground( CHnMdModel::EWhenAnySuiteIsEvaluated ); |
1214 |
1196 |
1215 if( host8.Length() == 0 || ( host8.Length() > 0 && |
1197 if( host8.Length() == 0 || ( host8.Length() > 0 && |
1216 !iMetaDataModel->SuiteModelExistsL( host8 ) ) ) |
1198 !iMetaDataModel->SuiteModelExistsL( host8 ) ) ) |
1217 { |
1199 { |
1218 suiteNameArray->Reset(); |
1200 suiteNameArray->Reset(); |
1219 suiteNameArray->AppendL( KRoot8 ); |
1201 suiteNameArray->AppendL( KRoot8 ); |
1220 } |
1202 } |
1221 |
1203 |
1222 for( TInt i = 0; i < suiteNameArray->Count(); ++i ) |
1204 for( TInt i = 0; i < suiteNameArray->Count(); ++i ) |
1223 { |
1205 { |
1224 suiteExists = iMetaDataModel->SuiteModelExistsL( |
1206 suiteExists = iMetaDataModel->SuiteModelExistsL( |
1225 ( *suiteNameArray )[i] ); |
1207 ( *suiteNameArray )[i] ); |
1226 TBool nextExists = i < suiteNameArray->Count() - 1 && |
1208 TBool nextExists = i < suiteNameArray->Count() - 1 && |
1227 iMetaDataModel->SuiteModelExistsL( ( *suiteNameArray )[i + 1] ); |
1209 iMetaDataModel->SuiteModelExistsL( ( *suiteNameArray )[i + 1] ); |
1228 TBool isLast = ( i == ( suiteNameArray->Count() - 1 ) ); |
1210 TBool isLast = ( i == ( suiteNameArray->Count() - 1 ) ); |
1229 |
1211 |
1230 TBool turnOnEvaluation = ( suiteExists && ( !nextExists || isLast ) ); |
1212 TBool turnOnEvaluation = ( suiteExists && ( !nextExists || isLast ) ); |
1231 if( turnOnEvaluation || !suiteExists ) |
1213 if( turnOnEvaluation || !suiteExists ) |
1232 { |
1214 { |
1233 iMetaDataModel->IgnoreEvaluations( EFalse ); |
1215 iMetaDataModel->IgnoreEvaluations( EFalse ); |
1234 } |
1216 } |
1235 |
1217 |
1236 TInt err( KErrNone ); |
1218 TInt err( KErrNone ); |
1237 |
1219 |
1238 // Ignore loading new suite if the last suite in model is the same |
1220 // Ignore loading new suite if the last suite in model is the same |
1239 // as first one in the uri. |
1221 // as first one in the uri. |
1240 if ( i == 0 ) |
1222 if ( i == 0 ) |
1259 ( *suiteNameArray )[i], parser.Extract( EUriQuery ), parser.Extract( EUriFragment ) ); |
1241 ( *suiteNameArray )[i], parser.Extract( EUriQuery ), parser.Extract( EUriFragment ) ); |
1260 if ( KErrNone == err && !nextExists && iMetaDataModel->IsForegroundQueued() ) |
1242 if ( KErrNone == err && !nextExists && iMetaDataModel->IsForegroundQueued() ) |
1261 { |
1243 { |
1262 // Tricky: if foreground is still queued it means that the suite is evaluated |
1244 // Tricky: if foreground is still queued it means that the suite is evaluated |
1263 // asynchronously. Override the previos foreground queue setting with one |
1245 // asynchronously. Override the previos foreground queue setting with one |
1264 // that will be effective only if the last loaded suite is evaluated. |
1246 // that will be effective only if the last loaded suite is evaluated. |
1265 iMetaDataModel->QueueForeground( CHnMdModel::EWhenCurrentTopSuiteIsEvaluated ); |
1247 iMetaDataModel->QueueForeground( CHnMdModel::EWhenCurrentTopSuiteIsEvaluated ); |
1266 } |
1248 } |
1267 if ( err != KErrNone ) |
1249 if ( err != KErrNone ) |
1268 { |
1250 { |
1269 sendToForeground = ETrue; |
1251 sendToForeground = ETrue; |
1270 } |
1252 } |
1271 } |
1253 } |
1272 |
1254 |
1273 if( !suiteExists || err != KErrNone || !nextExists ) |
1255 if( !suiteExists || err != KErrNone || !nextExists ) |
1274 { |
1256 { |
1275 CHnFilter* filter = CHnFilter::NewLC(); |
1257 CHnFilter* filter = CHnFilter::NewLC(); |
1276 |
1258 |
1277 filter->SetSuiteId( |
1259 filter->SetSuiteId( |
1278 iSuiteContainer->GetLastSuiteModel()->CustomId() ); |
1260 iSuiteContainer->GetLastSuiteModel()->CustomId() ); |
1279 |
1261 |
1280 filter->SetEvaluateSuiteL( ETrue ); |
1262 filter->SetEvaluateSuiteL( ETrue ); |
1281 iMetaDataModel->IgnoreEvaluations( EFalse ); |
1263 iMetaDataModel->IgnoreEvaluations( EFalse ); |
1282 |
1264 |
1283 TRAPD( err, iMetaDataModel->EvaluateL( *filter ) ); |
1265 TRAPD( err, iMetaDataModel->EvaluateL( *filter ) ); |
1284 |
1266 |
1285 CleanupStack::PopAndDestroy( filter ); |
1267 CleanupStack::PopAndDestroy( filter ); |
1286 if( err ) |
1268 if( err ) |
1287 { |
1269 { |
1288 iMetaDataModel->DeleteLastSuite(); |
1270 iMetaDataModel->DeleteLastSuite(); |
1289 iSuiteContainer->PopSuiteModelL( |
1271 iSuiteContainer->PopSuiteModelL( |
1291 sendToForeground = ETrue; |
1273 sendToForeground = ETrue; |
1292 } |
1274 } |
1293 break; |
1275 break; |
1294 } |
1276 } |
1295 } |
1277 } |
1296 |
1278 |
1297 // set highlight only when path is valid! |
1279 // set highlight only when path is valid! |
1298 if( suiteExists ) |
1280 if( suiteExists ) |
1299 { |
1281 { |
1300 HighlightPlacementFromUriL( parser.Extract( EUriFragment ) ); |
1282 HighlightPlacementFromUriL( parser.Extract( EUriFragment ) ); |
1301 } |
1283 } |
1302 |
1284 |
1303 CleanupStack::PopAndDestroy( &host8 ); |
1285 CleanupStack::PopAndDestroy( &host8 ); |
1304 CleanupStack::PopAndDestroy( suiteNameArray ); |
1286 CleanupStack::PopAndDestroy( suiteNameArray ); |
1305 CleanupStack::PopAndDestroy( uriBuf ); |
1287 CleanupStack::PopAndDestroy( uriBuf ); |
1306 |
1288 |
1307 // send to foreground |
1289 // send to foreground |
1308 if ( sendToForeground ) |
1290 if ( sendToForeground ) |
1309 { |
1291 { |
1310 CLiwGenericParamList* pl = CLiwGenericParamList::NewL(); |
1292 CLiwGenericParamList* pl = CLiwGenericParamList::NewL(); |
1311 CleanupStack::PushL( pl ); |
1293 CleanupStack::PushL( pl ); |