mpxmusicplayer/app/src/mpxappui.cpp
changeset 2 b70d77332e66
parent 0 ff3acec5bc43
child 4 beaa16f65879
--- a/mpxmusicplayer/app/src/mpxappui.cpp	Thu Jan 07 12:45:53 2010 +0200
+++ b/mpxmusicplayer/app/src/mpxappui.cpp	Mon Jan 18 20:18:06 2010 +0200
@@ -2001,14 +2001,20 @@
         {
         if ( !IsEmbedded() )
             {
-            CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL ( );
-            CleanupStack::PushL ( cPath );
             TBool usbDiskRemovalEvent(EFalse);
             if ( (op == EMcMsgDiskRemoved) && iIsUsbOnGoing )
                 {
                 usbDiskRemovalEvent = ETrue;
                 }
-
+            else
+                {
+                MPX_DEBUG1( "CMPXAppUi::HandleBroadcastMessageL. MMC ejected and the application needs to close." );
+                RunAppShutter();
+				return;
+                }
+
+            CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL ( );
+            CleanupStack::PushL ( cPath );
             if ( cPath->Levels ( )> 1 && !iFormattingOnGoing && !usbDiskRemovalEvent &&
                  iCurrentViewType.iUid != KMPXPluginTypePlaybackUid )
                 {
@@ -3631,14 +3637,9 @@
 					{
 					TRAP( err, iCoeEnv->SimulateKeyEventL(key,EEventKey); )
 					}
-
-				// Options/Exit selected, close also the MM suite
-                if( aCommand == EAknCmdExit )
-                    {
-                    LaunchMmViewL( KMmMessage );
-                    }
-				}
-
+                }
+
+            TBool needToExit( EFalse );
             if ( iSaveMode != EMPXSaveModeIdle )
                 {
                 iCancelFileMan = ETrue;
@@ -3656,7 +3657,16 @@
                     TRAP_IGNORE( manager.ClearSelectPlayersL() );
                     iPlaybackUtility->CommandL( EPbCmdClose );
                     }
-
+                needToExit = ETrue;
+                }
+
+            if( aCommand == EAknCmdExit )
+                {
+                // Options/Exit selected, close also the MM suite
+                LaunchMmViewL( KMmMessage );
+                }
+            if( needToExit )
+                {
                 Exit();
                 }
             break;