mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgcontainer.cpp
branchRCL_3
changeset 18 c54d95799c80
parent 17 c8156a91d13c
child 21 a1247965635c
equal deleted inserted replaced
17:c8156a91d13c 18:c54d95799c80
   288 // -----------------------------------------------------------------------------
   288 // -----------------------------------------------------------------------------
   289 //
   289 //
   290 TTypeUid::Ptr CMPXCollectionViewHgContainer::MopSupplyObject( TTypeUid aId )
   290 TTypeUid::Ptr CMPXCollectionViewHgContainer::MopSupplyObject( TTypeUid aId )
   291 	{
   291 	{
   292     MPX_FUNC( "CMPXCollectionViewHgContainer::MopSupplyObject" );
   292     MPX_FUNC( "CMPXCollectionViewHgContainer::MopSupplyObject" );
   293 	return MAknsControlContext::SupplyMopObject(aId, iBgContext );
   293     if( aId.iUid == MAknsControlContext::ETypeId && iBgContext )
       
   294         {
       
   295         return MAknsControlContext::SupplyMopObject(aId, iBgContext );
       
   296         }
       
   297     
       
   298     return CCoeControl::MopSupplyObject(aId);
   294 	}
   299 	}
   295 
   300 
   296 // ---------------------------------------------------------------------------
   301 // ---------------------------------------------------------------------------
   297 // Sets playback status
   302 // Sets playback status
   298 // ---------------------------------------------------------------------------
   303 // ---------------------------------------------------------------------------
   740                 }
   745                 }
   741 			SetDetailIconShuffleL();
   746 			SetDetailIconShuffleL();
   742             }
   747             }
   743         else if ( aType == KEikDynamicLayoutVariantSwitch )
   748         else if ( aType == KEikDynamicLayoutVariantSwitch )
   744             {
   749             {
       
   750             iLayoutSwitch = ETrue;
       
   751 
   745             if ( iCurrentViewType == EMPXViewMediawall )
   752             if ( iCurrentViewType == EMPXViewMediawall )
   746                 {
   753                 {
   747                 if ( iDialog )
   754                 if ( iDialog )
   748                     {
   755                     {
   749                     iDialog->CancelPopup();
   756                     iDialog->CancelPopup();
   750                     }
   757                     }
       
   758                 // make cba visible so that visible screen area is calculated correctly in list view
       
   759                 if( iCbaHandler )
       
   760                     iCbaHandler->ChangeCbaVisibility( ETrue );
   751                 }
   761                 }
   752             iSetEmptyTextNeeded = ETrue;
   762             iSetEmptyTextNeeded = ETrue;
   753 
       
   754             // Coe env is in middle if notifying observers (controls).
       
   755             // Just to be safe, lets just create a small async callback and then
       
   756             // call HandleLbxItemAdditionL
       
   757             if( !iAsyncCallBack->IsActive() )
       
   758                 {
       
   759                 iAsyncCallBack->CallBack();
       
   760                 }
       
   761 
       
   762             iLayoutSwitch = ETrue;
       
   763 
   763 
   764 
   764 
   765             TRect clientRect = ((CAknView*)iView)->ClientRect();
   765             TRect clientRect = ((CAknView*)iView)->ClientRect();
   766             SetRect( clientRect );
   766             SetRect( clientRect );
   767             iBgContext->SetRect(((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect());
   767             iBgContext->SetRect(((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect());
       
   768             
       
   769             // call HandleLbxItemAdditionL
       
   770             HandleLbxItemAdditionL();
   768             }
   771             }
   769         );
   772         );
   770     if(iMediaWall)
   773     if(iMediaWall)
   771         iMediaWall->HandleResourceChange( aType );
   774         iMediaWall->HandleResourceChange( aType );
   772     if(iListWidget)
   775     if(iListWidget)
  1079 
  1082 
  1080     // TODO, check if we need to support this with other view types also
  1083     // TODO, check if we need to support this with other view types also
  1081     // David: This needs to be supported for Mediawall and Tbone
  1084     // David: This needs to be supported for Mediawall and Tbone
  1082     if ( iListWidget && iCurrentViewType == EMPXViewList )
  1085     if ( iListWidget && iCurrentViewType == EMPXViewList )
  1083         {
  1086         {
  1084         // aIndex is the song index, so need take "ShuffleAll" item 
  1087         iListWidget->SetSelectedIndex( aIndex );
  1085         // into account
       
  1086         iListWidget->SetSelectedIndex( aIndex + iShuffleItem );
       
  1087         }
  1088         }
  1088     }
  1089     }
  1089 
  1090 
  1090 
  1091 
  1091 // -----------------------------------------------------------------------------
  1092 // -----------------------------------------------------------------------------
  1467         {
  1468         {
  1468         TRect clientRect = ((CAknView*)iView)->ClientRect();        
  1469         TRect clientRect = ((CAknView*)iView)->ClientRect();        
  1469         TInt mediaIndex = MediaIndex(iListWidget->SelectedIndex());
  1470         TInt mediaIndex = MediaIndex(iListWidget->SelectedIndex());
  1470         mediaIndex = ( mediaIndex >= 0 && (mediaIndex < (mediaCount)) ) ? mediaIndex : (mediaCount - 1);
  1471         mediaIndex = ( mediaIndex >= 0 && (mediaIndex < (mediaCount)) ) ? mediaIndex : (mediaCount - 1);
  1471         	
  1472         	
       
  1473         TInt prevItemCount = iListWidget->ItemCount();
       
  1474         
  1472         iListWidget->InitScreenL( clientRect );
  1475         iListWidget->InitScreenL( clientRect );
  1473         iListWidget->Reset();
  1476         iListWidget->Reset();
  1474         if ( aCount )
  1477         if ( aCount )
  1475             {
  1478             {
       
  1479             // enable scroll buffering now as it has not been enabled when empty list was constructed 
       
  1480             if ( !prevItemCount ) 
       
  1481                 { 
       
  1482                 iListWidget->EnableScrollBufferL( *this, KMPXListBufferSize, KMPXListBufferSize/4 ); 
       
  1483                 }
  1476             iListWidget->ResizeL( aCount );
  1484             iListWidget->ResizeL( aCount );
  1477             ProvideDataWithoutThumbnailsL(aMediaArray);
  1485             ProvideDataWithoutThumbnailsL(aMediaArray);
  1478             iListWidget->SetSelectedIndex( mediaIndex + iShuffleItem );
  1486             iListWidget->SetSelectedIndex( mediaIndex + iShuffleItem );
  1479             }
  1487             }
  1480         else
  1488         else
  1487         // In case of mediawall components we switch to different view type if orientation changes
  1495         // In case of mediawall components we switch to different view type if orientation changes
  1488         // so there is no need to set new client rect for mediawall.
  1496         // so there is no need to set new client rect for mediawall.
  1489         TInt mediaIndex = MediaIndex(iMediaWall->SelectedIndex());
  1497         TInt mediaIndex = MediaIndex(iMediaWall->SelectedIndex());
  1490         
  1498         
  1491         // Correct the array index if it is out of range
  1499         // Correct the array index if it is out of range
  1492         // This case may happen when last album or album beside selected album is deleted
  1500         // This case may happen when last album or album beside selected album is deleted     
  1493         mediaIndex = ( mediaIndex >= 0 && ( mediaIndex < mediaCount ) ) ? mediaIndex : (mediaCount - 1);
  1501 		// mediaIndex -1 is valid and it represents shuffle item
  1494 	        
  1502         
  1495         if( iSelectedAlbumIndex != mediaIndex  )
  1503         if ( mediaIndex >= mediaCount || mediaIndex < -1)
       
  1504             {
       
  1505             mediaIndex = mediaCount - 1; // last item of the list
       
  1506             }
       
  1507           
       
  1508         //in case of shuffle item is seleted (mediaIndex -1), there is no need to save it.
       
  1509         if( (iSelectedAlbumIndex != mediaIndex) && ( mediaIndex != -1) )            
  1496             {
  1510             {
  1497              iSelectedAlbumIndex = mediaIndex; 
  1511              iSelectedAlbumIndex = mediaIndex; 
  1498              SaveSelectedAlbumItemL( iSelectedAlbumIndex );
  1512              SaveSelectedAlbumItemL( iSelectedAlbumIndex );
  1499             }
  1513             }
  1500   
  1514   
  1525     MPX_FUNC("CMPXCollectionViewHgContainer::PrepareListL");
  1539     MPX_FUNC("CMPXCollectionViewHgContainer::PrepareListL");
  1526 
  1540 
  1527 	if (!((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->IsVisible())
  1541 	if (!((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->IsVisible())
  1528 		((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(ETrue);
  1542 		((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(ETrue);
  1529 
  1543 
       
  1544 	if( iCbaHandler )
       
  1545 	    iCbaHandler->UpdateCba();
       
  1546 	
  1530     TRect clientRect = ((CAknView*)iView)->ClientRect();
  1547     TRect clientRect = ((CAknView*)iView)->ClientRect();
  1531     iThumbnailManager->SetSizeL( EAudioListThumbnailSize );
  1548     iThumbnailManager->SetSizeL( EAudioListThumbnailSize );
  1532     iImageSize = CHgDoubleGraphicListFlat::PreferredImageSize();
  1549     iImageSize = CHgDoubleGraphicListFlat::PreferredImageSize();
  1533 
  1550 
  1534     if( !iListWidget )
  1551     if( !iListWidget )
  1536         iListWidget = CHgDoubleGraphicListFlat::NewL (
  1553         iListWidget = CHgDoubleGraphicListFlat::NewL (
  1537                 clientRect,
  1554                 clientRect,
  1538                 aCount,
  1555                 aCount,
  1539                 NULL,
  1556                 NULL,
  1540                 NULL );
  1557                 NULL );
  1541         iListWidget->SetMopParent(this);
  1558         iListWidget->SetMenuProviderL(this);
  1542         iListWidget->SetSelectionObserver(*this);
  1559         iListWidget->SetSelectionObserver(*this);
  1543         // TODO. check if this is correct for all lists
  1560         // TODO. check if this is correct for all lists
  1544         iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
  1561         iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
  1545         iListWidget->SetFocus(ETrue);
  1562         iListWidget->SetFocus(ETrue);
  1546         iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
  1563         iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
  1547         iListWidget->DrawableWindow()->SetOrdinalPosition( -1 );
  1564         iListWidget->DrawableWindow()->SetOrdinalPosition( -1 );
       
  1565         iListWidget->DrawableWindow()->SetFaded(((CAknAppUi*)iCoeEnv->AppUi())->IsFaded(), RWindowTreeNode::EFadeIncludeChildren);
  1548         ProvideDataWithoutThumbnailsL(aMediaArray);
  1566         ProvideDataWithoutThumbnailsL(aMediaArray);
  1549         }
  1567         }
  1550     else
  1568     else
  1551         {
  1569         {
  1552         iListWidget->Reset();
  1570         iListWidget->Reset();
  1561         {
  1579         {
  1562         iListWidget->SetSelectedIndex( iAlbumIndex + iShuffleItem );
  1580         iListWidget->SetSelectedIndex( iAlbumIndex + iShuffleItem );
  1563         }
  1581         }
  1564     
  1582     
  1565     // TODO. Define here in which views we need to have buffering enabled in the list
  1583     // TODO. Define here in which views we need to have buffering enabled in the list
  1566     if( ( iContext == EContextGroupAlbum ||
  1584     if( ( ( iContext == EContextGroupAlbum ) ||
  1567         iContext == EContextGroupArtist ||
  1585         ( iContext == EContextGroupArtist ) ||
  1568         iContext == EContextGroupSong ||
  1586         ( iContext == EContextGroupSong ) ||
  1569         iContext == EContextItemPlaylist ) && ( aCount > 0) ) 
  1587 		( iContext == EContextItemGenre ) ||
  1570         {
  1588         ( iContext == EContextItemPlaylist ) ) &&
  1571         iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
  1589         // Check if the list is empty, Enable scroll buffer won't call requst if list is empty
       
  1590         ( iListWidget->ItemCount() != 0 ) )
       
  1591         {
       
  1592         MPX_DEBUG1("CMPXCollectionViewHgContainer::PrepareListL - EnableScrollBufferL");
       
  1593         iListWidget->EnableScrollBufferL( *this, KMPXListBufferSize, KMPXListBufferSize/4 );
  1572         }
  1594         }
  1573     else
  1595     else
  1574         {
  1596         {
  1575         EndFullScreenAnimation();
  1597         EndFullScreenAnimation();
  1576         iListWidget->RefreshScreen(0);
  1598         iListWidget->RefreshScreen(0);
  1632         iMediaWall->SetSelectionObserver(*this);
  1654         iMediaWall->SetSelectionObserver(*this);
  1633 		ProvideDataWithoutThumbnailsMwL(aMediaArray);
  1655 		ProvideDataWithoutThumbnailsMwL(aMediaArray);
  1634 
  1656 
  1635 		// Create the list to be used with Media wall view
  1657 		// Create the list to be used with Media wall view
  1636 		iMwListWidget = CHgSingleTextListWithIcon::NewL(mwListRect, 0, NULL, NULL);
  1658 		iMwListWidget = CHgSingleTextListWithIcon::NewL(mwListRect, 0, NULL, NULL);
  1637 		iMwListWidget->SetMopParent(this);
  1659 		iMwListWidget->SetMenuProviderL(this);
  1638 		iMwListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
  1660 		iMwListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
  1639 		iMwListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
  1661 		iMwListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
  1640 		iMwListWidget->SetSelectionObserver(*this);
  1662 		iMwListWidget->SetSelectionObserver(*this);
  1641         }
  1663         }
  1642 	else
  1664 	else
  1648 	    iMediaWall->EnableScrollBufferL(*this, KMPXListBufferSizeWithMediaWall, KMPXListBufferSizeWithMediaWall/4);
  1670 	    iMediaWall->EnableScrollBufferL(*this, KMPXListBufferSizeWithMediaWall, KMPXListBufferSizeWithMediaWall/4);
  1649         iMediaWall->MakeVisible( ETrue );
  1671         iMediaWall->MakeVisible( ETrue );
  1650         if ( !iMwListWidget )
  1672         if ( !iMwListWidget )
  1651             {
  1673             {
  1652             iMwListWidget = CHgSingleTextListWithIcon::NewL(mwListRect, 0, NULL, NULL);
  1674             iMwListWidget = CHgSingleTextListWithIcon::NewL(mwListRect, 0, NULL, NULL);
  1653             iMwListWidget->SetMopParent(this);
  1675             iMwListWidget->SetMenuProviderL(this);
  1654             iMwListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
  1676             iMwListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
  1655             iMwListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
  1677             iMwListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
  1656             iMwListWidget->SetSelectionObserver(*this);
  1678             iMwListWidget->SetSelectionObserver(*this);
  1657             }
  1679             }
  1658         else
  1680         else
  1700     {
  1722     {
  1701     MPX_FUNC("CMPXCollectionViewHgContainer::PrepareMediaWallL");
  1723     MPX_FUNC("CMPXCollectionViewHgContainer::PrepareMediaWallL");
  1702    	TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect();
  1724    	TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect();
  1703 	((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse);
  1725 	((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse);
  1704 	iThumbnailManager->SetSizeL( EAudioFullScreenThumbnailSize );
  1726 	iThumbnailManager->SetSizeL( EAudioFullScreenThumbnailSize );
       
  1727 	if( iCbaHandler )
       
  1728 	    iCbaHandler->UpdateCba();
  1705     // get front rectange from layout
  1729     // get front rectange from layout
  1706     TAknLayoutRect frontRect;
  1730     TAknLayoutRect frontRect;
  1707     frontRect.LayoutRect( appRect, AknLayoutScalable_Apps::cf0_flow_pane_g1(0) );
  1731     frontRect.LayoutRect( appRect, AknLayoutScalable_Apps::cf0_flow_pane_g1(0) );
  1708 	iImageSize = frontRect.Rect().Size();
  1732 	iImageSize = frontRect.Rect().Size();
  1709 
  1733 
  1729             iMediaWall->HandleLosingForeground();
  1753             iMediaWall->HandleLosingForeground();
  1730 
  1754 
  1731         iMediaWall->SetMopParent(this);
  1755         iMediaWall->SetMopParent(this);
  1732         iMediaWall->SetSelectionObserver(*this);
  1756         iMediaWall->SetSelectionObserver(*this);
  1733         iMediaWall->SetObserver( this ); // softkey visibility event observer
  1757         iMediaWall->SetObserver( this ); // softkey visibility event observer
  1734         iMediaWall->EnableScrollBufferL(
  1758         // Check if the list is empty, Enable scroll buffer won't call requst if list is empty
       
  1759         if( iMediaWall->ItemCount() != 0 )
       
  1760             {
       
  1761         		iMediaWall->EnableScrollBufferL(
  1735                 *this,
  1762                 *this,
  1736                 KMPXListBufferSizeWithMediaWall,
  1763                 KMPXListBufferSizeWithMediaWall,
  1737                 KMPXListBufferSizeWithMediaWall / 4);
  1764                 KMPXListBufferSizeWithMediaWall / 4);
       
  1765             }
       
  1766         else
       
  1767             {
       
  1768             EndFullScreenAnimation();
       
  1769             iMediaWall->RefreshScreen( 0 );
       
  1770             }
  1738         // We want softkeys to be drawn on top of mediawall, thats we need to manipulate window pos
  1771         // We want softkeys to be drawn on top of mediawall, thats we need to manipulate window pos
  1739         iMediaWall->DrawableWindow()->SetOrdinalPosition( -1 );
  1772         iMediaWall->DrawableWindow()->SetOrdinalPosition( -1 );
       
  1773         if(((CAknAppUi*)iCoeEnv->AppUi())->IsFaded())
       
  1774             {
       
  1775             iMediaWall->DrawableWindow()->SetFaded(ETrue, RWindowTreeNode::EFadeIncludeChildren);
       
  1776             iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallFaded );
       
  1777             }
  1740         ProvideDataWithoutThumbnailsMwL(aMediaArray);
  1778         ProvideDataWithoutThumbnailsMwL(aMediaArray);
  1741         if( iAlbumIndex == KErrNotFound )
  1779         if( iAlbumIndex == KErrNotFound )
  1742             iMediaWall->SetSelectedIndex( iRestoredAlbumIndex + iShuffleItem );
  1780             iMediaWall->SetSelectedIndex( iRestoredAlbumIndex + iShuffleItem );
  1743         else
  1781         else
  1744             iMediaWall->SetSelectedIndex( iAlbumIndex + iShuffleItem );
  1782             iMediaWall->SetSelectedIndex( iAlbumIndex + iShuffleItem );
  1748 	    if( iMediaWall->Style() != CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen )
  1786 	    if( iMediaWall->Style() != CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen )
  1749 	        iMediaWall->ChangeStyleL( CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen, appRect, ETrue );
  1787 	        iMediaWall->ChangeStyleL( CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen, appRect, ETrue );
  1750 
  1788 
  1751 	    iMediaWall->MakeVisible( ETrue );
  1789 	    iMediaWall->MakeVisible( ETrue );
  1752         iMediaWall->SetFocus( ETrue );
  1790         iMediaWall->SetFocus( ETrue );
  1753         iMediaWall->EnableScrollBufferL(
  1791 		// Check if the list is empty, Enable scroll buffer won't call requst if list is empty
       
  1792         if( iMediaWall->ItemCount() != 0 )
       
  1793             {
       
  1794         		iMediaWall->EnableScrollBufferL(
  1754                 *this,
  1795                 *this,
  1755                 KMPXListBufferSizeWithMediaWall,
  1796                 KMPXListBufferSizeWithMediaWall,
  1756                 KMPXListBufferSizeWithMediaWall / 4);
  1797                 KMPXListBufferSizeWithMediaWall / 4);
       
  1798             }
       
  1799         else
       
  1800             {
       
  1801             EndFullScreenAnimation();
       
  1802             iMediaWall->RefreshScreen( 0 );
       
  1803             }
  1757         if( iAlbumIndex == KErrNotFound )
  1804         if( iAlbumIndex == KErrNotFound )
  1758             iMediaWall->SetSelectedIndex( iRestoredAlbumIndex + iShuffleItem );
  1805             iMediaWall->SetSelectedIndex( iRestoredAlbumIndex + iShuffleItem );
  1759         else
  1806         else
  1760             iMediaWall->SetSelectedIndex( iAlbumIndex + iShuffleItem );
  1807             iMediaWall->SetSelectedIndex( iAlbumIndex + iShuffleItem );
  1761 	    }
  1808 	    }
  3029                 {
  3076                 {
  3030                 aVisualItem->SetTitleL( title );
  3077                 aVisualItem->SetTitleL( title );
  3031                 }
  3078                 }
  3032             else
  3079             else
  3033                 {
  3080                 {
  3034                 HBufC* unknownText =
  3081                 if ( iContext == EContextGroupGenre )
  3035                     StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN );
  3082                     {
  3036                 aVisualItem->SetTitleL( *unknownText );
  3083                     HBufC* unknownText =
  3037                 CleanupStack::PopAndDestroy( unknownText );
  3084                         StringLoader::LoadLC( R_MPX_GENRE_UNKNOWN );
       
  3085                     aVisualItem->SetTitleL( *unknownText );
       
  3086                     CleanupStack::PopAndDestroy( unknownText );
       
  3087                     }
  3038                 }
  3088                 }
  3039             }
  3089             }
  3040         }
  3090         }
  3041     }
  3091     }
  3042 
  3092 
  3074 void CMPXCollectionViewHgContainer::SetDetailCountL(
  3124 void CMPXCollectionViewHgContainer::SetDetailCountL(
  3075     CHgItem* aVisualItem,
  3125     CHgItem* aVisualItem,
  3076     CMPXMedia* aMedia )
  3126     CMPXMedia* aMedia )
  3077     {
  3127     {
  3078     MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailCountL" );
  3128     MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailCountL" );
  3079 	if ( aMedia->IsSupported( KMPXMediaGeneralCount ) )
  3129     if ( aMedia->IsSupported( KMPXMediaGeneralCount ) )
  3080 		{
  3130         {
  3081 		TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
  3131         TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
  3082 
  3132 		
  3083 #ifdef HG_MP_LOC_AVAILABLE
  3133         if ( iContext == EContextGroupGenre )
  3084 
  3134             {
  3085         if ( iContext == EContextGroupArtist )
  3135             HBufC* numSongsText = NULL;
  3086 			{
  3136             if ( count > 1 || count == 0 )
  3087 			if ( count > 1 )
  3137                 {
  3088 			    {
  3138                 numSongsText = StringLoader::LoadLC( R_MPX_MUSIC_NUM_SONGS, count );
  3089                 HBufC* albumsTitle = StringLoader::LoadLC( R_MPX_COLLECTION_DETAILS_NUMBER_OF_SONGS, // mod by anjokela
  3139                 }
  3090                     count );
  3140             else
  3091                 TPtr ptr = albumsTitle->Des();
  3141                 {
  3092                 AknTextUtils::LanguageSpecificNumberConversion( ptr );
  3142                 numSongsText = StringLoader::LoadLC( R_MPX_MUSIC_ONE_SONG );            
  3093                 aVisualItem->SetTextL( ptr );
  3143                 }
  3094                 CleanupStack::PopAndDestroy( albumsTitle );
  3144             TPtr ptr = numSongsText->Des();
  3095 			    }
  3145             AknTextUtils::LanguageSpecificNumberConversion( ptr );
  3096 			else
  3146             aVisualItem->SetTextL( ptr );
  3097 			    {
  3147             CleanupStack::PopAndDestroy( numSongsText );
  3098         		aVisualItem->SetTextL( *iSongTitle ); // mod by anjokela
  3148             }
  3099 			    }
  3149         }
  3100 			}
       
  3101 		else
       
  3102 			{
       
  3103 			if ( count > 1 )
       
  3104 			    {
       
  3105                 HBufC* songsTitle = StringLoader::LoadLC( R_MPX_COLLECTION_DETAILS_NUMBER_OF_SONGS, count );
       
  3106                 TPtr ptr = songsTitle->Des();
       
  3107                 AknTextUtils::LanguageSpecificNumberConversion( ptr );
       
  3108         		aVisualItem->SetTextL( ptr );
       
  3109                 CleanupStack::PopAndDestroy( songsTitle );
       
  3110 			    }
       
  3111 			else
       
  3112 			    {
       
  3113         		aVisualItem->SetTextL( *iSongTitle );
       
  3114 			    }
       
  3115 			}
       
  3116 #else //HG_MP_LOC_AVAILABLE
       
  3117 
       
  3118         TBuf<10> temp;
       
  3119         temp.AppendNum( count );
       
  3120         AknTextUtils::LanguageSpecificNumberConversion( temp );
       
  3121 
       
  3122 		TBuf<KMPXMaxFileLength> detailText;
       
  3123         detailText.Append( temp );
       
  3124         if ( iContext == EContextGroupPodcast )
       
  3125 			{
       
  3126 			detailText.Append( (count > 1 ) ? KEpisodes() : KEpisode() );
       
  3127 			}
       
  3128         else if ( iContext == EContextGroupArtist )
       
  3129 			{
       
  3130 			detailText.Append( (count > 1 ) ? KAlbums() : KAlbum() );
       
  3131 			}
       
  3132 		else
       
  3133 			{
       
  3134 			detailText.Append( (count > 1 ) ? KSongs() : KSong() );
       
  3135 			}
       
  3136 		aVisualItem->SetTextL( detailText );
       
  3137 #endif //HG_MP_LOC_AVAILABLE
       
  3138 
       
  3139 		}
       
  3140     }
  3150     }
  3141 
  3151 
  3142 // -----------------------------------------------------------------------------
  3152 // -----------------------------------------------------------------------------
  3143 // Set Detail - Artist to the visual item
  3153 // Set Detail - Artist to the visual item
  3144 // -----------------------------------------------------------------------------
  3154 // -----------------------------------------------------------------------------
  3233     {
  3243     {
  3234     MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailDurationL" );
  3244     MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailDurationL" );
  3235     if ( iContext == EContextGroupPlaylist &&
  3245     if ( iContext == EContextGroupPlaylist &&
  3236          aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
  3246          aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
  3237 	     aMedia->IsSupported( KMPXMediaGeneralCount ) )
  3247 	     aMedia->IsSupported( KMPXMediaGeneralCount ) )
  3238 		{
  3248         {
  3239 		// AK - Needs to be localized
  3249         TBuf<KMPXMaxFileLength> detailText;
  3240 		TBuf<KMPXMaxFileLength> detailText;
  3250         TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
  3241 		TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
  3251         TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
  3242    		TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
  3252 
  3243 
  3253         UpdateTimeIndicatorsL(detailText, duration);        
  3244 #ifdef HG_MP_LOC_AVAILABLE
  3254         HBufC* numSongsDurationText = NULL;
  3245     	if ( count > 1 || count == 0 )
  3255     	if ( count > 1 || count == 0 )
  3246     	    {
  3256     	    {
  3247             HBufC* songsTitle = StringLoader::LoadLC( R_MPX_COLLECTION_DETAILS_NUMBER_OF_SONGS, count );
  3257     	    numSongsDurationText = StringLoader::LoadLC( R_MPX_MUSIC_NUM_SONGS_DURATION, detailText, count );
  3248     	    detailText.Append(*songsTitle);
       
  3249     	    detailText.Append(KMPXDash);
       
  3250             UpdateTimeIndicatorsL(detailText, duration);
       
  3251     		aVisualItem->SetTextL( detailText );
       
  3252             CleanupStack::PopAndDestroy( songsTitle );
       
  3253     	    }
  3258     	    }
  3254     	else
  3259     	else
  3255     	    {
  3260     	    {
  3256     	    detailText.Append(*iSongTitle);
  3261     	    numSongsDurationText = StringLoader::LoadLC( R_MPX_MUSIC_ONE_SONG_DURATION, detailText );
  3257     	    detailText.Append(KMPXDash);
  3262     	    }        
  3258             UpdateTimeIndicatorsL(detailText, duration);
  3263         TPtr ptr = numSongsDurationText->Des();
  3259     		aVisualItem->SetTextL( detailText );
  3264         AknTextUtils::LanguageSpecificNumberConversion( ptr );   	
  3260     	    }
  3265         aVisualItem->SetTextL( ptr );
  3261 #else //HG_MP_LOC_AVAILABLE
  3266         CleanupStack::PopAndDestroy( numSongsDurationText );
  3262 		TBuf<10> temp;
  3267         }
  3263 		temp.AppendNum( count );
       
  3264         AknTextUtils::LanguageSpecificNumberConversion( temp );
       
  3265         detailText.Append( temp );
       
  3266 		detailText.Append( (count > 1 ) ? KSongsDash() : KSongDash() );
       
  3267         UpdateTimeIndicatorsL(detailText, duration);
       
  3268         aVisualItem->SetTextL( detailText );
       
  3269 #endif //HG_MP_LOC_AVAILABLE
       
  3270 		}
       
  3271     else if ( iContext == EContextItemPodcast &&
  3268     else if ( iContext == EContextItemPodcast &&
  3272          aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
  3269          aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
  3273          aMedia->IsSupported( KMPXMediaGeneralSize ) )
  3270          aMedia->IsSupported( KMPXMediaGeneralSize ) )
  3274         {
  3271         {
  3275         TBuf<KMPXMaxFileLength> detailText;
  3272         TBuf<KMPXMaxFileLength> detailText;
  3661 void CMPXCollectionViewHgContainer::SetCollectionContextL()
  3658 void CMPXCollectionViewHgContainer::SetCollectionContextL()
  3662     {
  3659     {
  3663     MPX_FUNC( "CMPXCollectionViewHgContainer::SetCollectionContextL" );
  3660     MPX_FUNC( "CMPXCollectionViewHgContainer::SetCollectionContextL" );
  3664 
  3661 
  3665     const CMPXMedia& media = iListBoxArray->ContainerMedia();
  3662     const CMPXMedia& media = iListBoxArray->ContainerMedia();
  3666 
  3663     
       
  3664     if ( NULL == &media )
       
  3665         { 
       
  3666         MPX_DEBUG1( "CMPXCollectionViewHgContainer::SetCollectionContextL NO media"); 
       
  3667         User::Leave(KErrNotFound);
       
  3668         }       
       
  3669         
  3667     TMPXGeneralType containerType( EMPXNoType );
  3670     TMPXGeneralType containerType( EMPXNoType );
  3668     if ( media.IsSupported( KMPXMediaGeneralType ) )
  3671     if ( media.IsSupported( KMPXMediaGeneralType ) )
  3669         {
  3672         {
  3670         containerType = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
  3673         containerType = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
  3671         }
  3674         }
  4476     GfxTransEffect::Deregister( iDialog );
  4479     GfxTransEffect::Deregister( iDialog );
  4477     GfxTransEffect::Register( iDialog, KAppUidMusicPlayerX, EFalse );
  4480     GfxTransEffect::Register( iDialog, KAppUidMusicPlayerX, EFalse );
  4478     // Trap ExecuteLD to make sure iDialog always get reset.
  4481     // Trap ExecuteLD to make sure iDialog always get reset.
  4479     TRAP_IGNORE( play = iDialog->ExecuteLD() );
  4482     TRAP_IGNORE( play = iDialog->ExecuteLD() );
  4480     iDialog = NULL;
  4483     iDialog = NULL;
  4481     if( play )
  4484     if( play && iMediaWall )
  4482         {
  4485         {
  4483         iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
  4486         iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
  4484         iMediaWall->DrawNow();
  4487         iMediaWall->DrawNow();
  4485         TInt index = listBox->CurrentItemIndex();
  4488         TInt index = listBox->CurrentItemIndex();
  4486         // If item in list was opened, we only play the selected one.
  4489         // If item in list was opened, we only play the selected one.
  4487         SaveSelectedAlbumItemL(iSelectedAlbumIndex);
  4490         SaveSelectedAlbumItemL(iSelectedAlbumIndex);
  4488         // Open the selected song of album
  4491         // Open the selected song of album
  4489         UpdatePathAndOpenL(index);
  4492         UpdatePathAndOpenL(index);
  4490         }
  4493         }
  4491     else
  4494     else if( !iLayoutSwitch && iMediaWall )
  4492         {
  4495         {
  4493         // Close mediawall "flip animation"
  4496         // Close mediawall "flip animation"
  4494         iMediaWall->StartOpeningAnimationL( EFalse );
  4497         iMediaWall->StartOpeningAnimationL( EFalse );
  4495         }
  4498         }
  4496 
  4499 
  4885 // ---------------------------------------------------------------------------
  4888 // ---------------------------------------------------------------------------
  4886 //
  4889 //
  4887 void CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL()
  4890 void CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL()
  4888     {
  4891     {
  4889     MPX_FUNC( "CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL" );
  4892     MPX_FUNC( "CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL" );
  4890 
  4893     MPX_DEBUG2( "CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL - iContext %d", iContext );
  4891     if ( iContext == EContextGroupAlbum )
  4894     
  4892         {
  4895     TInt resId( 0 );
  4893         HBufC* emptyText = StringLoader::LoadLC( R_MPX_VMP_NO_ALBUMS );
  4896     
  4894         SetLbxEmptyTextL( *emptyText );
  4897     switch ( iContext )
  4895         CleanupStack::PopAndDestroy( emptyText );
  4898         {
  4896         }
  4899         case EContextGroupAlbum:
       
  4900             {
       
  4901             resId = R_MPX_VMP_NO_ALBUMS;
       
  4902             break;
       
  4903             }
       
  4904         case EContextGroupGenre:
       
  4905         case EContextItemGenre:
       
  4906             {
       
  4907             resId = R_MPX_VMP_NO_GENRES;
       
  4908             break;
       
  4909             }
       
  4910         case EContextItemSong:
       
  4911         case EContextGroupSong:
       
  4912         case EContextItemPlaylist:
       
  4913             {
       
  4914             resId = R_MPX_VMP_NO_SONGS;
       
  4915             break;
       
  4916             }
       
  4917         default:
       
  4918             {
       
  4919             MPX_DEBUG1( "CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL - some empty text is missing" );
       
  4920             return;
       
  4921             }
       
  4922         }
       
  4923     HBufC* emptyText = StringLoader::LoadLC( resId );
       
  4924     SetLbxEmptyTextL( *emptyText );
       
  4925     CleanupStack::PopAndDestroy( emptyText );
  4897     }
  4926     }
  4898 
  4927 
  4899 // ---------------------------------------------------------------------------
  4928 // ---------------------------------------------------------------------------
  4900 // Set previous view Uid
  4929 // Set previous view Uid
  4901 // ---------------------------------------------------------------------------
  4930 // ---------------------------------------------------------------------------