767 // or if we're actively playing during call |
768 // or if we're actively playing during call |
768 if ( IsForeground() || EPbStatePlaying == playerState || EPbStatePlaying == pdPlayerState ) |
769 if ( IsForeground() || EPbStatePlaying == playerState || EPbStatePlaying == pdPlayerState ) |
769 { |
770 { |
770 if ( aData != iCurrentVolume ) |
771 if ( aData != iCurrentVolume ) |
771 { |
772 { |
772 SetVolume( aData ); |
773 SetVolumeL( aData ); |
773 } |
774 } |
774 // popup volume control even if volume didn't change |
775 // popup volume control even if volume didn't change |
775 HandlePopupL( EPbCmdSetVolume ); |
776 HandlePopupL( EPbCmdSetVolume ); |
776 } |
777 } |
777 } |
778 } |
|
779 ); |
778 break; |
780 break; |
779 } |
781 } |
780 case EPbCmdMuteVolume: |
782 case EPbCmdMuteVolume: |
781 { |
783 { |
|
784 TRAP_IGNORE( |
782 TMPXPlaybackState playerState( EPbStateNotInitialised ); |
785 TMPXPlaybackState playerState( EPbStateNotInitialised ); |
783 playerState = iPlaybackUtility->StateL(); |
786 playerState = iPlaybackUtility->StateL(); |
784 if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) || |
787 if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) || |
785 ( playerState == EPbStatePlaying ) || |
788 ( playerState == EPbStatePlaying ) || |
786 ( playerState == EPbStateSeekingForward ) || |
789 ( playerState == EPbStateSeekingForward ) || |
794 } |
797 } |
795 // only process command if there no call ongoing |
798 // only process command if there no call ongoing |
796 // or if we're actively playing during call |
799 // or if we're actively playing during call |
797 if ( IsForeground() || EPbStatePlaying == playerState || EPbStatePlaying == pdPlayerState ) |
800 if ( IsForeground() || EPbStatePlaying == playerState || EPbStatePlaying == pdPlayerState ) |
798 { |
801 { |
799 MuteVolume(); |
802 MuteVolumeL(); |
800 HandlePopupL( EPbCmdMuteVolume ); |
803 HandlePopupL( EPbCmdMuteVolume ); |
801 } |
804 } |
802 } |
805 } |
|
806 ); |
803 break; |
807 break; |
804 } |
808 } |
805 case EPbCmdUnMuteVolume: |
809 case EPbCmdUnMuteVolume: |
806 { |
810 { |
|
811 TRAP_IGNORE( |
807 TMPXPlaybackState playerState( EPbStateNotInitialised ); |
812 TMPXPlaybackState playerState( EPbStateNotInitialised ); |
808 playerState = iPlaybackUtility->StateL(); |
813 playerState = iPlaybackUtility->StateL(); |
809 if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) || |
814 if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) || |
810 ( playerState == EPbStatePlaying ) || |
815 ( playerState == EPbStatePlaying ) || |
811 ( playerState == EPbStateSeekingForward ) || |
816 ( playerState == EPbStateSeekingForward ) || |
836 { |
842 { |
837 // Forward the command to view to handle when |
843 // Forward the command to view to handle when |
838 // music is foreground app and not displaying |
844 // music is foreground app and not displaying |
839 // dialogs or the options menu |
845 // dialogs or the options menu |
840 if ( iView ) |
846 if ( iView ) |
841 { |
847 { |
842 MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand sending command %d to view", MPXCmdForPbCmd(aCommand) ); |
848 MPX_TRAPD( err, iView->HandleCommandL( MPXCmdForPbCmd(aCommand) ) ); |
843 iView->HandleCommandL( MPXCmdForPbCmd(aCommand) ); |
849 MPX_DEBUG3( "CMPXAppUi::HandleMediaKeyCommand sending command %d to view err%d", MPXCmdForPbCmd(aCommand), err ); |
844 } |
850 } |
845 } |
851 } |
846 else |
852 else |
847 { |
853 { |
848 TMPXPlaybackState playerState( EPbStateNotInitialised ); |
854 TMPXPlaybackState playerState( EPbStateNotInitialised ); |
849 playerState = iPlaybackUtility->StateL(); |
855 MPX_TRAPD( err, playerState = iPlaybackUtility->StateL() ); |
850 if ( foregroundApp && IsDisplayingDialog() ) |
856 if ( foregroundApp && IsDisplayingDialog() ) |
851 { |
857 { |
852 // displaying dialog in the foreground |
858 // displaying dialog in the foreground |
853 if ( EPbStatePlaying == playerState || |
859 if ( EPbStatePlaying == playerState || |
854 EPbStatePaused == playerState || |
860 EPbStatePaused == playerState || |
857 aCommand == EPbCmdPlay || |
863 aCommand == EPbCmdPlay || |
858 aCommand == EPbCmdPlayPause ) |
864 aCommand == EPbCmdPlayPause ) |
859 { |
865 { |
860 // In playing/paused state, all media keys are active. |
866 // In playing/paused state, all media keys are active. |
861 // Now playing view is not bring to foreground. |
867 // Now playing view is not bring to foreground. |
862 // Seeking forward/backwards is also "playing" |
868 // Seeking forward/backwards is also "playing" |
863 MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand Dialog displaying, sending command %d to DoHandleMediaKeyCommandL", aCommand ); |
869 MPX_TRAP( err, DoHandleMediaKeyCommandL( aCommand ) ); |
864 DoHandleMediaKeyCommandL( aCommand ); |
870 MPX_DEBUG3( "CMPXAppUi::HandleMediaKeyCommand Dialog displaying, sending command %d to DoHandleMediaKeyCommandL err%d", aCommand, err ); |
865 } |
871 } |
866 else |
872 else |
867 { |
873 { |
868 MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand Dialog displaying, inactive state, command %d ignored", aCommand ); |
874 MPX_DEBUG3( "CMPXAppUi::HandleMediaKeyCommand Dialog displaying, inactive state, command %d, err%d ignored", aCommand , err ); |
869 } |
875 } |
870 } |
876 } |
871 else |
877 else |
872 { |
878 { |
873 // displaying menu/not foreground, pass to view to handle only play command |
879 // displaying menu/not foreground, pass to view to handle only play command |
874 if ( EPbStatePlaying == playerState || |
880 if ( EPbStatePlaying == playerState || |
875 EPbStatePaused == playerState || |
881 EPbStatePaused == playerState || |
876 EPbStateSeekingForward == playerState || |
882 EPbStateSeekingForward == playerState || |
877 EPbStateSeekingBackward == playerState ) |
883 EPbStateSeekingBackward == playerState ) |
878 { |
884 { |
879 MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, sending command %d to DoHandleMediaKeyCommandL", aCommand ); |
885 MPX_TRAP( err, DoHandleMediaKeyCommandL( aCommand ) ); |
880 DoHandleMediaKeyCommandL( aCommand ); |
886 MPX_DEBUG3( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, sending command %d to DoHandleMediaKeyCommandL err%d", aCommand, err ); |
881 } |
887 } |
882 else if ( ( aCommand == EPbCmdPlay || aCommand == EPbCmdPlayPause ) && iView ) |
888 else if ( ( aCommand == EPbCmdPlay || aCommand == EPbCmdPlayPause ) && iView ) |
883 { |
889 { |
884 if ( !foregroundApp ) |
890 if ( !foregroundApp ) |
885 { |
891 { |
886 MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, active idle foreground, sending command %d to DoHandleMediaKeyCommandL", aCommand ); |
|
887 // not foreground, play without loading playback view |
892 // not foreground, play without loading playback view |
888 DoHandleMediaKeyCommandL( aCommand ); |
893 MPX_TRAP( err, DoHandleMediaKeyCommandL( aCommand ) ); |
|
894 MPX_DEBUG3( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, active idle foreground, sending command %d to DoHandleMediaKeyCommandL err%d", aCommand, err ); |
889 } |
895 } |
890 else |
896 else |
891 { |
897 { |
892 MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, sending command %d to view", aCommand ); |
898 MPX_TRAP( err, iView->HandleCommandL( MPXCmdForPbCmd(aCommand) ) ); |
893 iView->HandleCommandL( MPXCmdForPbCmd(aCommand) ); |
899 MPX_DEBUG3( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, sending command %d to view err%d", aCommand, err ); |
894 } |
900 } |
895 } |
901 } |
896 else if ( aCommand == EPbCmdPlay || aCommand == EPbCmdPlayPause ) |
902 else if ( aCommand == EPbCmdPlay || aCommand == EPbCmdPlayPause ) |
897 { |
903 { |
898 // play command without a view, this case |
904 // play command without a view, this case |
2010 } |
2016 } |
2011 |
2017 |
2012 } |
2018 } |
2013 else if ( op == EMcMsgDiskRemoved ) |
2019 else if ( op == EMcMsgDiskRemoved ) |
2014 { |
2020 { |
2015 if ( !IsEmbedded() ) |
2021 TBool usbDiskRemovalEvent( EFalse ); |
2016 { |
2022 if ( (op == EMcMsgDiskRemoved) && iIsUsbOnGoing ) |
2017 TBool usbDiskRemovalEvent(EFalse); |
2023 { |
2018 if ( (op == EMcMsgDiskRemoved) && iIsUsbOnGoing ) |
2024 usbDiskRemovalEvent = ETrue; |
2019 { |
2025 } |
2020 usbDiskRemovalEvent = ETrue; |
2026 else |
2021 } |
2027 { |
2022 else |
2028 MPX_DEBUG1( "CMPXAppUi::HandleBroadcastMessageL. MMC ejected and the application needs to close." ); |
2023 { |
2029 RunAppShutter(); |
2024 MPX_DEBUG1( "CMPXAppUi::HandleBroadcastMessageL. MMC ejected and the application needs to close." ); |
2030 return; |
2025 RunAppShutter(); |
2031 } |
2026 return; |
|
2027 } |
|
2028 |
2032 |
2029 CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL ( ); |
2033 CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL ( ); |
2030 CleanupStack::PushL ( cPath ); |
2034 CleanupStack::PushL ( cPath ); |
2031 if ( cPath->Levels ( )> 1 && !iFormattingOnGoing && !usbDiskRemovalEvent && |
2035 if ( cPath->Levels ( )> 1 && !iFormattingOnGoing && !usbDiskRemovalEvent && |
2032 iCurrentViewType.iUid != KMPXPluginTypePlaybackUid ) |
2036 iCurrentViewType.iUid != KMPXPluginTypePlaybackUid ) |
2033 { |
2037 { |
2034 |
2038 cPath->Back(); |
2035 cPath->Back ( ); |
2039 iCollectionUtility->Collection().OpenL( *cPath ); |
2036 iCollectionUtility->Collection().OpenL ( *cPath ); |
2040 |
2037 |
2041 } |
2038 } |
2042 CleanupStack::PopAndDestroy( cPath ); |
2039 CleanupStack::PopAndDestroy ( cPath ); |
|
2040 } |
|
2041 } |
2043 } |
2042 // Re-open the collection view after a refresh |
2044 // Re-open the collection view after a refresh |
2043 // and after album art or metadata dialog or add songs editor dialog closes |
2045 // and after album art or metadata dialog or add songs editor dialog closes |
2044 if (((op == EMcMsgRefreshEnd ) || (op == EMcMsgUSBMassStorageEnd)) |
2046 if (((op == EMcMsgRefreshEnd ) || (op == EMcMsgUSBMassStorageEnd)) |
2045 && (IsActiveView(KMPXPluginTypeAlbumArtEditorUid) |
2047 && (IsActiveView(KMPXPluginTypeAlbumArtEditorUid) |
4282 { |
4284 { |
4283 RunAppShutter(); |
4285 RunAppShutter(); |
4284 } |
4286 } |
4285 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
4287 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
4286 // ----------------------------------------------------------------------------- |
4288 // ----------------------------------------------------------------------------- |
4287 // CMPXAppUi::IsBrowserClosed |
4289 // CMPXAppUi::IsBrowserClosedL |
4288 // ----------------------------------------------------------------------------- |
4290 // ----------------------------------------------------------------------------- |
4289 // |
4291 // |
4290 TBool CMPXAppUi::IsBrowserClosed( |
4292 TBool CMPXAppUi::IsBrowserClosedL( |
4291 const TDesC8& aParams ) |
4293 const TDesC8& aParams ) |
4292 { |
4294 { |
4293 TBool ret(EFalse); |
4295 TBool ret(EFalse); |
4294 CBufFlat* paramBuf = CBufFlat::NewL( /*anExpandSize*/1 ); |
4296 CBufFlat* paramBuf = CBufFlat::NewL( /*anExpandSize*/1 ); |
4295 CleanupStack::PushL( paramBuf ); |
4297 CleanupStack::PushL( paramBuf ); |
4351 return ( iStandAlone ); |
4353 return ( iStandAlone ); |
4352 #endif |
4354 #endif |
4353 } |
4355 } |
4354 |
4356 |
4355 // ----------------------------------------------------------------------------- |
4357 // ----------------------------------------------------------------------------- |
4356 // CMPXAppUi::SetVolume |
4358 // CMPXAppUi::SetVolumeL |
4357 // ----------------------------------------------------------------------------- |
4359 // ----------------------------------------------------------------------------- |
4358 // |
4360 // |
4359 void CMPXAppUi::SetVolume( const TInt aVolume ) |
4361 void CMPXAppUi::SetVolumeL( const TInt aVolume ) |
4360 { |
4362 { |
4361 CMPXCommand* cmd( CMPXCommand::NewL() ); |
4363 CMPXCommand* cmd( CMPXCommand::NewL() ); |
4362 CleanupStack::PushL( cmd ); |
4364 CleanupStack::PushL( cmd ); |
4363 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral ); |
4365 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral ); |
4364 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
4366 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
4373 |
4375 |
4374 CleanupStack::PopAndDestroy( cmd ); |
4376 CleanupStack::PopAndDestroy( cmd ); |
4375 } |
4377 } |
4376 |
4378 |
4377 // ----------------------------------------------------------------------------- |
4379 // ----------------------------------------------------------------------------- |
4378 // CMPXAppUi::MuteVolume |
4380 // CMPXAppUi::MuteVolumeL |
4379 // ----------------------------------------------------------------------------- |
4381 // ----------------------------------------------------------------------------- |
4380 // |
4382 // |
4381 void CMPXAppUi::MuteVolume() |
4383 void CMPXAppUi::MuteVolumeL() |
4382 { |
4384 { |
4383 CMPXCommand* cmd( CMPXCommand::NewL() ); |
4385 CMPXCommand* cmd( CMPXCommand::NewL() ); |
4384 CleanupStack::PushL( cmd ); |
4386 CleanupStack::PushL( cmd ); |
4385 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral ); |
4387 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral ); |
4386 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
4388 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
4394 |
4396 |
4395 CleanupStack::PopAndDestroy( cmd ); |
4397 CleanupStack::PopAndDestroy( cmd ); |
4396 } |
4398 } |
4397 |
4399 |
4398 // ----------------------------------------------------------------------------- |
4400 // ----------------------------------------------------------------------------- |
4399 // CMPXAppUi::UnMuteVolume |
4401 // CMPXAppUi::UnMuteVolumeL |
4400 // ----------------------------------------------------------------------------- |
4402 // ----------------------------------------------------------------------------- |
4401 // |
4403 // |
4402 void CMPXAppUi::UnMuteVolume() |
4404 void CMPXAppUi::UnMuteVolumeL() |
4403 { |
4405 { |
4404 CMPXCommand* cmd( CMPXCommand::NewL() ); |
4406 CMPXCommand* cmd( CMPXCommand::NewL() ); |
4405 CleanupStack::PushL( cmd ); |
4407 CleanupStack::PushL( cmd ); |
4406 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral ); |
4408 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral ); |
4407 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
4409 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |