mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgimp.cpp
branchRCL_3
changeset 66 1f1dad4af8f8
parent 56 2cbbefa9af78
equal deleted inserted replaced
60:bdd9da0d70fe 66:1f1dad4af8f8
   306     delete iNewName;
   306     delete iNewName;
   307     delete iBottomIndex;
   307     delete iBottomIndex;
   308     delete iCurrentCba;
   308     delete iCurrentCba;
   309     delete iIncrementalOpenUtil;
   309     delete iIncrementalOpenUtil;
   310     delete iCachedSelectionIndex;
   310     delete iCachedSelectionIndex;
   311     delete iCurrentSelectedIndex;
       
   312     FeatureManager::UnInitializeLib();
   311     FeatureManager::UnInitializeLib();
   313     delete iOperatorMusicStoreName ;
   312     delete iOperatorMusicStoreName ;
   314     if ( iOperatorMusicStoreURI )
   313     if ( iOperatorMusicStoreURI )
   315         {
   314         {
   316         delete iOperatorMusicStoreURI;
   315         delete iOperatorMusicStoreURI;
   458     CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
   457     CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
   459     repository->Get( KMPXMPLocalVariation, flags );
   458     repository->Get( KMPXMPLocalVariation, flags );
   460     delete repository;
   459     delete repository;
   461     iGoToMusicShopOptionHidden =
   460     iGoToMusicShopOptionHidden =
   462         !static_cast<TBool>( flags & KMPXEnableGoToMusicShopOption );
   461         !static_cast<TBool>( flags & KMPXEnableGoToMusicShopOption );
   463     iUsingNokiaService =
   462     iUsingNokiaService = flags & KMPXEnableFindInMusicShopOption ? ETrue : EFalse;
   464         static_cast<TBool>( flags & KMPXEnableFindInMusicShopOption );
   463     
   465     MPX_DEBUG2( "CMPXCollectionViewHgImp::ConstructL(): iUsingNokiaService: %d", iUsingNokiaService );
   464     MPX_DEBUG2( "CMPXCollectionViewHgImp::ConstructL(): iUsingNokiaService: %d", iUsingNokiaService );
   466     iDisablePodcasting = flags&KMPXDisablePodcastingOption ? ETrue : EFalse;
   465     iDisablePodcasting = flags&KMPXDisablePodcastingOption ? ETrue : EFalse;
   467 
   466 
   468 #ifdef _DEBUG
   467 #ifdef _DEBUG
   469     iExitOptionHidden = EFalse;
   468     iExitOptionHidden = EFalse;
   521                             KMShopCategoryName,
   520                             KMShopCategoryName,
   522                             RProperty::ELargeText,
   521                             RProperty::ELargeText,
   523                             KMPlayerRemoteReadPolicy,
   522                             KMPlayerRemoteReadPolicy,
   524                             KMPlayerRemoteWritePolicy );
   523                             KMPlayerRemoteWritePolicy );
   525         }
   524         }
   526 
   525     // Check if Music Store dll is in ROM
       
   526     iMusicStoreAppInstalled = IsMusicAppInstalledL( TUid::Uid( iMusicStoreUID ) );
       
   527     iUsingNokiaService&=iMusicStoreAppInstalled; 
       
   528           
   527     iCachedSelectionIndex = new ( ELeave )CArrayFixFlat<TInt>( KMPXArrayGranularity );
   529     iCachedSelectionIndex = new ( ELeave )CArrayFixFlat<TInt>( KMPXArrayGranularity );
   528     iIncrementalOpenUtil = CMPXCollectionOpenUtility::NewL( this );
   530     iIncrementalOpenUtil = CMPXCollectionOpenUtility::NewL( this );
   529 
   531 
   530 #ifdef BACKSTEPPING_INCLUDED
   532 #ifdef BACKSTEPPING_INCLUDED
   531     // Initialize the Back Stepping Service Utility with the MPX Music Player
   533     // Initialize the Back Stepping Service Utility with the MPX Music Player
  1093 
  1095 
  1094                 if ( !iIsWaitNoteCanceled )
  1096                 if ( !iIsWaitNoteCanceled )
  1095                     {
  1097                     {
  1096                     iIsDeleting = ETrue;
  1098                     iIsDeleting = ETrue;
  1097                     iCollectionUiHelper->DeleteL( *path, this );
  1099                     iCollectionUiHelper->DeleteL( *path, this );
  1098                     iFirstIndexOnScreen = iContainer->FirstIndexOnScreen();               
       
  1099                     }
  1100                     }
  1100                 else if( iContainer )
  1101                 else if( iContainer )
  1101                     {
  1102                     {
  1102                     // delete was canceled before it even began, clear marked items
  1103                     // delete was canceled before it even began, clear marked items
  1103                     iContainer->ClearLbxSelection();
  1104                     iContainer->ClearLbxSelection();
  1270                 iCurrentHighlightedIndex = KErrNotFound;
  1271                 iCurrentHighlightedIndex = KErrNotFound;
  1271                 }
  1272                 }
  1272             else if ( ( aIndex > 0 )
  1273             else if ( ( aIndex > 0 )
  1273                 && ( aIndex < iContainer->CurrentListItemCount() ) )
  1274                 && ( aIndex < iContainer->CurrentListItemCount() ) )
  1274                 {
  1275                 {
  1275 				iContainer->SetLbxCurrentItemIndexAndDraw( aIndex );
  1276                 // No need to do anything here
  1276                 }
  1277                 }
  1277             else
  1278             else
  1278                 {
  1279                 {
  1279                 iContainer->SetLbxCurrentItemIndexAndDraw( 0 );
  1280                 iContainer->SetLbxCurrentItemIndexAndDraw( 0 );
  1280                 }
  1281                 }
  4287             UpdateListBoxL( aEntries, KMusicMenuPodcastMenuItemIndex, aComplete );
  4288             UpdateListBoxL( aEntries, KMusicMenuPodcastMenuItemIndex, aComplete );
  4288             ( void ) aIndex;
  4289             ( void ) aIndex;
  4289             }
  4290             }
  4290         else
  4291         else
  4291             {
  4292             {
  4292             TInt topIndex = aIndex;
  4293             UpdateListBoxL( aEntries, aIndex, aComplete );
  4293             if ( iFirstIndexOnScreen > 0 )
       
  4294                 {
       
  4295                 topIndex = iFirstIndexOnScreen;
       
  4296                 if ( aComplete )
       
  4297                     {
       
  4298                     iFirstIndexOnScreen = 0;
       
  4299                     }
       
  4300                 }
       
  4301             UpdateListBoxL( aEntries, topIndex, aComplete );            
       
  4302             }
  4294             }
  4303 #else
  4295 #else
  4304         UpdateListBoxL( aEntries, aIndex, aComplete );
  4296         UpdateListBoxL( aEntries, aIndex, aComplete );
  4305 #endif // __ENABLE_PODCAST_IN_MUSIC_MENU
  4297 #endif // __ENABLE_PODCAST_IN_MUSIC_MENU
  4306         if ( iContainer )
  4298         if ( iContainer )
  5570             LaunchMusicShopL();
  5562             LaunchMusicShopL();
  5571             break;
  5563             break;
  5572             }
  5564             }
  5573         case EMPXCmdGoToNokiaMusicShop:
  5565         case EMPXCmdGoToNokiaMusicShop:
  5574             {
  5566             {
  5575             LaunchMusicShopL();
  5567             LaunchOviMusicShopL();
  5576             break;
  5568             break;
  5577             }
  5569             }
  5578         case EMPXCmdGoToOperatorMusicShop:
  5570         case EMPXCmdGoToOperatorMusicShop:
  5579             {
  5571             {
  5580             if(iMusicStoreWebPage)
  5572             if(iMusicStoreWebPage)
  6374 						aMenuPane->SetItemDimmed( EMPXCmdSend, EFalse );
  6366 						aMenuPane->SetItemDimmed( EMPXCmdSend, EFalse );
  6375 						}
  6367 						}
  6376 					}
  6368 					}
  6377 				}
  6369 				}
  6378 					
  6370 					
  6379 				//If Operator Music store exist, show the cascade menu with Nokia and Operator music store.
  6371 			DisplayMusicShopOptions(aMenuPane);	
  6380 				if ( iOperatorMusicStore )
       
  6381 				    {
       
  6382 				    aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
       
  6383 				    }
       
  6384 				else
       
  6385 				    {
       
  6386 				    aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
       
  6387 				    }
       
  6388 
       
  6389 			break;
  6372 			break;
  6390 			}
  6373 			}
  6391 
  6374 
  6392 		case R_MPX_COLLECTION_VIEW_MENU_2:
  6375 		case R_MPX_COLLECTION_VIEW_MENU_2:
  6393             {
  6376             {
  6506 			    if( trackCount < 1 )
  6489 			    if( trackCount < 1 )
  6507 			        {
  6490 			        {
  6508 			        aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
  6491 			        aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
  6509 			        }
  6492 			        }
  6510 			    } 
  6493 			    } 
  6511 			if ( iOperatorMusicStore )
  6494 			DisplayMusicShopOptions(aMenuPane);
  6512 			    {
       
  6513 			    aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
       
  6514 			    }
       
  6515 			else
       
  6516 			    {
       
  6517 			    aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
       
  6518 			    }
       
  6519 
       
  6520 			break;
  6495 			break;
  6521 			}
  6496 			}
  6522 
  6497 
  6523 		case R_MPX_COLLECTION_VIEW_MENU_2:
  6498 		case R_MPX_COLLECTION_VIEW_MENU_2:
  6524             {
  6499             {
  6628                     {
  6603                     {
  6629                     aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
  6604                     aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
  6630                     }
  6605                     }
  6631                 }
  6606                 }
  6632             
  6607             
  6633             if ( iOperatorMusicStore )
  6608             DisplayMusicShopOptions(aMenuPane);
  6634                 {
       
  6635                 aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
       
  6636                 }
       
  6637             else
       
  6638                 {
       
  6639                 aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
       
  6640                 }
       
  6641 			break;
  6609 			break;
  6642 			}
  6610 			}
  6643 
  6611 
  6644 		case R_MPX_COLLECTION_VIEW_MENU_2:
  6612 		case R_MPX_COLLECTION_VIEW_MENU_2:
  6645             {
  6613             {
  6712 					aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
  6680 					aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
  6713 					aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
  6681 					aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
  6714 					aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
  6682 					aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
  6715 					}
  6683 					}
  6716 				}
  6684 				}
  6717 			if ( iOperatorMusicStore )
  6685 			DisplayMusicShopOptions(aMenuPane);
  6718 			    {
       
  6719 			    aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
       
  6720 			    }
       
  6721 			else
       
  6722 			    {
       
  6723 			    aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
       
  6724 			    }
       
  6725 			break;
  6686 			break;
  6726 			}
  6687 			}
  6727 
  6688 
  6728 		case R_MPX_COLLECTION_VIEW_MENU_2:
  6689 		case R_MPX_COLLECTION_VIEW_MENU_2:
  6729             {
  6690             {
  6978 void CMPXCollectionViewHgImp::DynInitMenuPaneL(
  6939 void CMPXCollectionViewHgImp::DynInitMenuPaneL(
  6979     TInt aResourceId,
  6940     TInt aResourceId,
  6980     CEikMenuPane* aMenuPane )
  6941     CEikMenuPane* aMenuPane )
  6981     {
  6942     {
  6982     MPX_FUNC( "CMPXCollectionViewHgImp::DynInitMenuPaneL" );
  6943     MPX_FUNC( "CMPXCollectionViewHgImp::DynInitMenuPaneL" );
  6983     
  6944 
  6984     if ( iContainer->IsTBoneView() )
       
  6985         {
       
  6986 	    //makesure mediawall is not flicking before handling long tap
       
  6987 	    TInt currentIndex( iContainer->CurrentLbxItemIndex() );
       
  6988 	    MPX_DEBUG2( "CMPXCollectionViewHgImp::DynInitMenuPaneL currentIndex = %d", currentIndex );
       
  6989 	    if (currentIndex == KErrNotFound)
       
  6990 	        {
       
  6991 	        MPX_DEBUG1( "DynInitMenuPaneL NOT handling stylus popup menu when flicking");        
       
  6992 	        DimAllOptions(aResourceId, aMenuPane);
       
  6993 	        return;
       
  6994 	        }
       
  6995         }
       
  6996         
       
  6997     CMPXCollectionViewListBoxArray* array =
  6945     CMPXCollectionViewListBoxArray* array =
  6998         static_cast<CMPXCollectionViewListBoxArray*>(
  6946         static_cast<CMPXCollectionViewListBoxArray*>(
  6999         iContainer->ListBoxArray() );
  6947         iContainer->ListBoxArray() );
  7000 	const CMPXMedia& containerMedia = array->ContainerMedia();
  6948 	const CMPXMedia& containerMedia = array->ContainerMedia();
  7001 
  6949 
  7496 // -----------------------------------------------------------------------------
  7444 // -----------------------------------------------------------------------------
  7497 //
  7445 //
  7498 void CMPXCollectionViewHgImp::LaunchMusicShopL()
  7446 void CMPXCollectionViewHgImp::LaunchMusicShopL()
  7499     {
  7447     {
  7500     MPX_FUNC( "CMPXCollectionViewHgImp::LaunchMusicShopL" );
  7448     MPX_FUNC( "CMPXCollectionViewHgImp::LaunchMusicShopL" );
  7501 
  7449     if (iOperatorMusicStore && !iMusicStoreAppInstalled) //Launch Operator Store
  7502     if ( iMusicStoreUID != 0)
  7450         {
  7503         {
  7451         if (iMusicStoreWebPage)
  7504     TApaTaskList taskList( iCoeEnv->WsSession() );
  7452             {
  7505         TApaTask task = taskList.FindApp( TUid::Uid(iMusicStoreUID) );
  7453             LaunchOperatorURLMusicShopL();
  7506 
  7454             }
  7507     if ( task.Exists() )
  7455         else
  7508         {
  7456             {
  7509         GfxTransEffect::BeginFullScreen( 
  7457             if (iOperatorMusicStoreType)
  7510         AknTransEffect::EApplicationStart,
  7458                 {
  7511             TRect(), 
  7459                 LaunchOperatorJavaMusicShopL(iOperatorMusicStoreUID);
  7512             AknTransEffect::EParameterType, 
  7460                 }
  7513             AknTransEffect::GfxTransParam( TUid::Uid(iMusicStoreUID),        
  7461             else
  7514             AknTransEffect::TParameter::EActivateExplicitContinue ));            
  7462                 {
  7515         task.BringToForeground();
  7463                 LaunchOperatorNativeMusicShopL();
  7516         }
  7464                 }
  7517     else
  7465             }
  7518         {
  7466         }
  7519         RApaLsSession session;
  7467     else //Launch Ovi Music Store
  7520         if ( KErrNone == session.Connect() )
  7468         {
  7521             {
  7469         LaunchOviMusicShopL();
  7522             CleanupClosePushL( session );
       
  7523             TThreadId threadId;
       
  7524                 session.CreateDocument( KNullDesC, TUid::Uid(iMusicStoreUID), threadId );
       
  7525             CleanupStack::PopAndDestroy(&session);
       
  7526                 }
       
  7527             }
       
  7528         }
  7470         }
  7529     }
  7471     }
  7530 
  7472 
  7531 
  7473 
  7532 // -----------------------------------------------------------------------------
  7474 // -----------------------------------------------------------------------------
  8544             aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
  8486             aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
  8545             aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
  8487             aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
  8546             aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
  8488             aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
  8547             aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
  8489             aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
  8548             aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
  8490             aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
  8549 			aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue ); 
       
  8550             break;
  8491             break;
  8551             }
  8492             }
  8552         case R_AVKON_MENUPANE_MARKABLE_LIST:
  8493         case R_AVKON_MENUPANE_MARKABLE_LIST:
  8553             {
  8494             {
  8554             aMenuPane->SetItemDimmed(EAknCmdEditListMenu, ETrue);
  8495             aMenuPane->SetItemDimmed(EAknCmdEditListMenu, ETrue);
  8555             break;
  8496             break;
  8556             }
  8497             }
  8557         }    
  8498         }    
  8558     }
  8499     }
       
  8500 	
       
  8501 // -----------------------------------------------------------------------------
       
  8502 // CMPXCollectionViewHgImp::IsMusicAppInstalledL
       
  8503 // -----------------------------------------------------------------------------
       
  8504 //
       
  8505 TBool CMPXCollectionViewHgImp::IsMusicAppInstalledL( const TUid& aAppUid )
       
  8506 {
       
  8507     MPX_FUNC( "CMPXCollectionViewHgImp::IsMusicAppInstalledL" );
       
  8508     TBool response = EFalse;
       
  8509 
       
  8510     RApaLsSession apaSession;
       
  8511     CleanupClosePushL( apaSession );
       
  8512     User::LeaveIfError( apaSession.Connect() );
       
  8513     apaSession.GetAllApps();
       
  8514 
       
  8515     TApaAppInfo appInfo;
       
  8516     TInt err = apaSession.GetAppInfo( appInfo, aAppUid );
       
  8517     CleanupStack::PopAndDestroy( &apaSession );
       
  8518 
       
  8519     if ( !err )
       
  8520         {
       
  8521     // app was found
       
  8522     response = ETrue;
       
  8523         }
       
  8524     MPX_DEBUG2( "CMPXCollectionViewHgImp::IsMusicAppInstalledL response = %d", response );
       
  8525     return response;
       
  8526 }
       
  8527 
       
  8528 // -----------------------------------------------------------------------------
       
  8529 // CMPXCollectionViewHgImp::DisplayMusicShopOptions
       
  8530 // -----------------------------------------------------------------------------
       
  8531 //
       
  8532 void CMPXCollectionViewHgImp::DisplayMusicShopOptions(CEikMenuPane* aMenuPane)
       
  8533     {
       
  8534     if (iOperatorMusicStore && iMusicStoreAppInstalled)
       
  8535         {
       
  8536         aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
       
  8537         aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, EFalse); //Show the cascade menu with Ovi and operator store
       
  8538         }
       
  8539     else if ((iOperatorMusicStore && !iMusicStoreAppInstalled)
       
  8540             || (!iOperatorMusicStore && iMusicStoreAppInstalled))
       
  8541         {
       
  8542         aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
       
  8543         aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, EFalse); //Show "Go to Music Store"
       
  8544         }
       
  8545     else
       
  8546         {
       
  8547         aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
       
  8548         aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
       
  8549         }
       
  8550     }
       
  8551     
       
  8552  
       
  8553  // -----------------------------------------------------------------------------
       
  8554  // CMPXCollectionViewHgImp::LaunchOviMusicShopL
       
  8555  // Launch Ovi music shop application
       
  8556  // -----------------------------------------------------------------------------
       
  8557  //
       
  8558 void CMPXCollectionViewHgImp::LaunchOviMusicShopL()
       
  8559     {
       
  8560     MPX_FUNC( "CMPXCollectionViewHgImp::LaunchOviMusicShopL" );
       
  8561     if (iMusicStoreUID != 0)
       
  8562         {
       
  8563         TApaTaskList taskList(iCoeEnv->WsSession());
       
  8564         TApaTask task = taskList.FindApp(TUid::Uid(iMusicStoreUID));
       
  8565 
       
  8566         if (task.Exists())
       
  8567             {
       
  8568             GfxTransEffect::BeginFullScreen(
       
  8569                     AknTransEffect::EApplicationStart,
       
  8570                     TRect(),
       
  8571                     AknTransEffect::EParameterType,
       
  8572             		AknTransEffect::GfxTransParam( TUid::Uid(iMusicStoreUID),        
       
  8573                             AknTransEffect::TParameter::EActivateExplicitContinue));
       
  8574             task.BringToForeground();
       
  8575             }
       
  8576         else
       
  8577             {
       
  8578             RApaLsSession session;
       
  8579             if (KErrNone == session.Connect())
       
  8580                 {
       
  8581                 CleanupClosePushL(session);
       
  8582                 TThreadId threadId;
       
  8583                 session.CreateDocument(KNullDesC, TUid::Uid(iMusicStoreUID),
       
  8584                         threadId);
       
  8585                 CleanupStack::PopAndDestroy(&session);
       
  8586                 }
       
  8587             }
       
  8588         }
       
  8589     }
  8559 //  End of File
  8590 //  End of File