voicerecorder/AppSrc/CVRAppUI.cpp
branchRCL_3
changeset 13 4e5b531d23cb
parent 10 bb90e4148332
child 14 f962425b9f8b
equal deleted inserted replaced
11:a2fdc35b8f46 13:4e5b531d23cb
    49 #include <UsbWatcherInternalPSKeys.h>
    49 #include <UsbWatcherInternalPSKeys.h>
    50 #include <usbpersonalityids.h>
    50 #include <usbpersonalityids.h>
    51 #ifdef RD_MULTIPLE_DRIVE
    51 #ifdef RD_MULTIPLE_DRIVE
    52 #include <driveinfo.h>
    52 #include <driveinfo.h>
    53 #endif
    53 #endif
    54 
    54 #include <aknwaitdialog.h>
    55 _LIT( KVRCommandRecord, "record" );
    55 _LIT( KVRCommandRecord, "record" );
    56 
    56 
    57 // ---------------------------------------------------------------------------
    57 // ---------------------------------------------------------------------------
    58 // CVRAppUi::CVRAppUi
    58 // CVRAppUi::CVRAppUi
    59 // 
    59 // 
    69 // 
    69 // 
    70 // ---------------------------------------------------------------------------
    70 // ---------------------------------------------------------------------------
    71 //
    71 //
    72 CVRAppUi::~CVRAppUi()
    72 CVRAppUi::~CVRAppUi()
    73     {
    73     {
    74     if ( iActiveWait.IsStarted() )
    74     if (iActiveWait.IsStarted())
    75     	{
    75         {
    76     	iActiveWait.AsyncStop();
    76         iActiveWait.AsyncStop();
    77     	}
    77         }
    78     
    78 
    79     if ( iDoorObserver )
    79     if (iDoorObserver)
    80          {
    80         {
    81          iDoorObserver->NotifyExit( MApaEmbeddedDocObserver::EEmpty );
    81         iDoorObserver->NotifyExit(MApaEmbeddedDocObserver::EEmpty);
    82          }
    82         }
    83 
    83 
    84 	delete iErrorUI;
    84 	delete iErrorUI;
    85 	FeatureManager::UnInitializeLib();
    85 	FeatureManager::UnInitializeLib();
    86 	}
    86 	}
    87 
    87 
   117 		TVRMemoStore memoStore = VRUtils::MemoStoreL();
   117 		TVRMemoStore memoStore = VRUtils::MemoStoreL();
   118 
   118 
   119 		if ( memoStore == EMemoStoreMMC )
   119 		if ( memoStore == EMemoStoreMMC )
   120 			{
   120 			{
   121             // check if USB is connected, if so, then need to switch to phone memory
   121             // check if USB is connected, if so, then need to switch to phone memory
   122 			if (IsUsbActive())
   122             if (CVRUSBStateHanlder::IsUsbActive())
   123 				{
   123                 {
   124 				HBufC* noteText = iCoeEnv->AllocReadResourceLC(
   124                 HBufC* noteText = iCoeEnv->AllocReadResourceLC(
   125 														 R_QTN_MEMC_VOREC_NOTE1 );
   125                         R_QTN_MEMC_VOREC_NOTE1 );
   126 				CAknInformationNote* infoNote =
   126                 CAknInformationNote* infoNote =
   127 									   new( ELeave ) CAknInformationNote( ETrue );
   127                 new( ELeave ) CAknInformationNote( ETrue );
   128 				infoNote->ExecuteLD( *noteText );
   128                 infoNote->ExecuteLD( *noteText );
   129 				CleanupStack::PopAndDestroy( noteText );
   129                 CleanupStack::PopAndDestroy( noteText );
   130 				VRUtils::SetMemoStoreL( EMemoStorePhoneMemory );				
   130                 VRUtils::SetMemoStoreL( EMemoStorePhoneMemory );
   131 				}
   131                 }
   132 
   132 
   133 			// MMC not available or locked
   133 			// MMC not available or locked
   134 			else if ( memoStore && ( mmcInfo.iDriveLocked || !mmcInfo.iDrivePresent ) )
   134 			else if ( memoStore && ( mmcInfo.iDriveLocked || !mmcInfo.iDrivePresent ) )
   135 				{
   135 				{
   136 				HBufC* noteText = iCoeEnv->AllocReadResourceLC(
   136 				HBufC* noteText = iCoeEnv->AllocReadResourceLC(
   158 				}
   158 				}
   159 			
   159 			
   160 			}
   160 			}
   161 // for multiple drives
   161 // for multiple drives
   162 #else
   162 #else
   163 		TInt memoDrive = VRUtils::MemoDriveL();
   163 
   164         TInt defaultDrive = VRUtils::DefaultMemoDriveL();
   164         TInt memoDrive = VRUtils::MemoDriveL();
   165  
   165         if (VRUtils::DriveValid(memoDrive))
   166         //not default phone memory
   166             {
   167 		if ( memoDrive != defaultDrive )
   167             VRUtils::SetMemoDriveL((TDriveNumber) memoDrive);
   168 			{
   168             }
   169              // check if USB is connected, if so, then need to switch to phone memory
   169         else
   170 			if (IsUsbActive())
   170             {
   171 				{
   171             TInt defaultDrive = VRUtils::DefaultMemoDriveL(); //eMMC
   172 				HBufC* noteText = iCoeEnv->AllocReadResourceLC(
   172             if (defaultDrive == memoDrive)
   173 														 R_QTN_MEMC_VOREC_NOTE1 );
   173                 {
   174 				CAknInformationNote* infoNote =
   174                 SetDriveL();
   175 									   new( ELeave ) CAknInformationNote( ETrue );
   175                 }
   176 				infoNote->ExecuteLD( *noteText );
   176             else
   177 				CleanupStack::PopAndDestroy( noteText );
   177                 {
   178 				VRUtils::SetMemoDriveL((TDriveNumber)defaultDrive );
   178                 if (VRUtils::DriveValid(defaultDrive))
   179 				}
   179                     {
   180 			else
   180                     VRUtils::SetMemoDriveL((TDriveNumber) defaultDrive);
   181 				{
   181                     }
   182             	TUint status( 0 );
   182                 else
   183 	        	VRUtils::GetDriveInfo(memoDrive, status);
   183                     {
   184 				
   184                     SetDriveL();
   185 				// Drive not available or locked
   185                     }
   186 				if ((status & DriveInfo::EDriveLocked) || !(status & DriveInfo::EDrivePresent))
   186                 }
   187 			    	{
   187             }
   188 			    	HBufC* noteText = iCoeEnv->AllocReadResourceLC(R_QTN_MEMC_VOREC_NOTE1 );
   188 
   189 					CAknInformationNote* infoNote = new( ELeave ) CAknInformationNote( ETrue );
   189         /***** check if memory is below min value, if yes, close app*****/
   190 					infoNote->ExecuteLD( *noteText );
   190         RFs& fs(CEikonEnv::Static()->FsSession());
   191 					CleanupStack::PopAndDestroy( noteText );
   191         if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0,
   192 					VRUtils::SetMemoDriveL((TDriveNumber)defaultDrive );
   192                 VRUtils::MemoDriveL()))
   193 					}
   193             {
   194 				else if ( status & DriveInfo::EDriveReadOnly )
   194             HBufC* errorText = StringLoader::LoadLC(
   195 			    	{
   195                     R_VR_MEMORY_LOW_STOP_WARNING);
   196 			    	HBufC* noteText = iCoeEnv->AllocReadResourceLC(R_QTN_MEMC_VOREC_NOTE2 );
   196             CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue);
   197 					CAknInformationNote* infoNote = new( ELeave ) CAknInformationNote( ETrue );
   197             dlg->ExecuteLD(*errorText);
   198 					infoNote->ExecuteLD( *noteText );
   198             CleanupStack::PopAndDestroy(errorText);
   199 					CleanupStack::PopAndDestroy( noteText );				
   199             Exit();
   200 					VRUtils::SetMemoDriveL((TDriveNumber)defaultDrive );
   200             }
   201 					}
   201         // check memory size end
   202 		    	else if ( status & DriveInfo::EDriveCorrupt )
   202 #endif
   203 			    	{
   203 
   204 			    	// Drive corrupted -> use phone memory
       
   205 			    	VRUtils::SetMemoDriveL((TDriveNumber)defaultDrive );
       
   206 			    	}
       
   207 				}
       
   208 			}
       
   209 
       
   210 
       
   211     /***** check if memory is below min value, if yes, close app*****/	
       
   212 		RFs& fs( CEikonEnv::Static()->FsSession() );
       
   213 		if (SysUtil::DiskSpaceBelowCriticalLevelL( &fs, 0, VRUtils::MemoDriveL()))
       
   214 		{			
       
   215 	        HBufC* errorText = StringLoader::LoadLC( R_VR_MEMORY_LOW_STOP_WARNING );
       
   216 	        CAknErrorNote* dlg = new( ELeave ) CAknErrorNote( ETrue );
       
   217 	        dlg->ExecuteLD( *errorText );
       
   218 	        CleanupStack::PopAndDestroy( errorText );
       
   219 			Exit();
       
   220 		}
   204 		}
   221 	 // check memory size end
   205 
   222 #endif
   206     CVRRecView* view = CVRRecView::NewLC(R_VR_RECORDER_VIEW,
   223 
   207             R_VR_RECVIEW_STATES);
   224 		}
       
   225 
       
   226 	CVRRecView* view = CVRRecView::NewLC(
       
   227 									R_VR_RECORDER_VIEW, R_VR_RECVIEW_STATES );
       
   228 
   208 
   229 	AddViewL( view );
   209 	AddViewL( view );
   230 	iLayoutChangeObserver = view;
   210 	iLayoutChangeObserver = view;
   231 	CleanupStack::Pop( view );
   211 	CleanupStack::Pop( view );
   232 
   212 
   233 	SetDefaultViewL( *view );
   213 	SetDefaultViewL( *view );
   234 
   214 
   235     // Activate view straight away, if started through new file service	
   215     // Activate view straight away, if started through new file service	
   236 	if ( iEikonEnv->StartedAsServerApp() )
   216     if (iEikonEnv->StartedAsServerApp())
   237 		{
   217         {
   238     	ActivateLocalViewL( TUid::Uid( KVRRecorderViewUID ),
   218         ActivateLocalViewL(TUid::Uid(KVRRecorderViewUID), TUid::Uid(
   239         	TUid::Uid( EContextRecordNewForRemote ), KNullDesC8 );        	
   219                 EContextRecordNewForRemote), KNullDesC8);
   240 		}        
   220         }
   241 
   221 
   242 	}
   222 	}
       
   223 
       
   224 // ---------------------------------------------------------------------------
       
   225 // Make user insert the SD card, and choose SD card as the memo storage
       
   226 // ---------------------------------------------------------------------------
       
   227 //
       
   228 void CVRAppUi::SetDriveL()
       
   229     {
       
   230     if ( VRUtils::DriveValid( EDriveF ) )
       
   231     	{
       
   232     	VRUtils::SetMemoDriveL((TDriveNumber)EDriveF );
       
   233     	}
       
   234     else
       
   235         {
       
   236         if (CVRUSBStateHanlder::IsUsbActive())
       
   237             {
       
   238             ShowDialogForWaitUSBPluggingOutL();
       
   239             Exit();
       
   240 
       
   241             }
       
   242         while (!VRUtils::DriveValid(EDriveF))
       
   243             {
       
   244             if (!ShowDialogForWaitStorageCardL())
       
   245                 {
       
   246                 Exit();
       
   247                 }
       
   248             }
       
   249         // Come to here when drive F is valid
       
   250         VRUtils::SetMemoDriveL((TDriveNumber) EDriveF);
       
   251         }
       
   252     }
       
   253 
       
   254 // ---------------------------------------------------------------------------
       
   255 // This method show a dialog to warn user to insert the SD card.
       
   256 // ---------------------------------------------------------------------------
       
   257 //
       
   258 TBool CVRAppUi::ShowDialogForWaitStorageCardL()
       
   259     {
       
   260     HBufC* text = StringLoader::LoadLC( R_QTN_CCOR_INSERT_MMC );
       
   261     CAknQueryDialog* dlg = CAknQueryDialog::NewL();
       
   262     TInt result( dlg->ExecuteLD( R_INSERT_F_CARD_DIALOG, *text ) );
       
   263     CleanupStack::PopAndDestroy( text );
       
   264 
       
   265     if ( result )
       
   266     	{
       
   267     	return ETrue;
       
   268     	}
       
   269 
       
   270     return EFalse;
       
   271     }
       
   272 
       
   273 
       
   274 TBool CVRAppUi::ShowDialogForWaitUSBPluggingOutL()
       
   275 {
       
   276     HBufC* text = StringLoader::LoadLC(R_QTN_USB_MODE_NOTE_MODE);
       
   277     CAknQueryDialog* dlg = CAknQueryDialog::NewL();
       
   278     TInt result(dlg->ExecuteLD(R_INSERT_F_USB_PLUG_IN_DIALOG, *text));
       
   279     CleanupStack::PopAndDestroy(text);
       
   280     if (result)
       
   281         {
       
   282         return ETrue;
       
   283         }
       
   284     return EFalse;    
       
   285 }
   243 
   286 
   244 // ---------------------------------------------------------------------------
   287 // ---------------------------------------------------------------------------
   245 // CVRAppUi::HandleCommandL
   288 // CVRAppUi::HandleCommandL
   246 // 
   289 // 
   247 // ---------------------------------------------------------------------------
   290 // ---------------------------------------------------------------------------
   264 			if ( iView )
   307 			if ( iView )
   265 				{
   308 				{
   266 				iView->HandleCommandL( ECmdCancelNote );				
   309 				iView->HandleCommandL( ECmdCancelNote );				
   267 				}
   310 				}
   268 
   311 
   269 			// The file service needs to abort if it's still going on
   312             // The file service needs to abort if it's still going on
   270 			if ( iEmbeddedObserver )
   313             if (iEmbeddedObserver)
   271 				{
   314                 {
   272 				CNewFileServiceBase * iNewFileService = NULL;
   315                 CNewFileServiceBase * iNewFileService = NULL;
   273 				iNewFileService = dynamic_cast<CNewFileServiceBase*>(iEmbeddedObserver);
   316                 iNewFileService
   274 				if(iNewFileService != NULL)
   317                         = dynamic_cast<CNewFileServiceBase*> (iEmbeddedObserver);
   275 					{
   318                 if (iNewFileService != NULL)
   276 					iNewFileService->SetErrorCode(KErrAbort);
   319                     {
   277 					}
   320                     iNewFileService->SetErrorCode(KErrAbort);
   278 				iEmbeddedObserver->AbortL();
   321                     }
   279 				}
   322                 iEmbeddedObserver->AbortL();
       
   323                 }
   280 
   324 
   281             Exit();
   325             Exit();
   282 			break;
   326 			break;
   283             }
   327             }
   284 		case EAknCmdExit:
   328 		case EAknCmdExit:
   286 			if ( iView )
   330 			if ( iView )
   287 				{
   331 				{
   288 				iView->HandleCommandL( ECmdCancelNote );				
   332 				iView->HandleCommandL( ECmdCancelNote );				
   289 				}
   333 				}
   290 
   334 
   291 			// The file service needs to abort if it's still going on
   335             // The file service needs to abort if it's still going on
   292 			if ( iEmbeddedObserver )
   336             if (iEmbeddedObserver)
   293 				{
   337                 {
   294 				CNewFileServiceBase * iNewFileService = NULL;
   338                 CNewFileServiceBase * iNewFileService = NULL;
   295 				iNewFileService = dynamic_cast<CNewFileServiceBase*>(iEmbeddedObserver);
   339                 iNewFileService
   296 				if(iNewFileService != NULL)
   340                         = dynamic_cast<CNewFileServiceBase*> (iEmbeddedObserver);
   297 					{
   341                 if (iNewFileService != NULL)
   298 					iNewFileService->SetErrorCode(KErrAbort);
   342                     {
   299 					}
   343                     iNewFileService->SetErrorCode(KErrAbort);
   300 				iEmbeddedObserver->AbortL();
   344                     }
   301 				}
   345                 iEmbeddedObserver->AbortL();
   302 			
   346                 }
   303 			Exit();
   347 
       
   348             Exit();
   304             break;
   349             break;
   305 			}
   350             }
   306 		case ECmdHelp:
   351         case ECmdHelp:
   307 			{
   352             {
   308 			if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
   353             if (FeatureManager::FeatureSupported(KFeatureIdHelp))
   309 				{
   354                 {
   310 				if ( iIsSettingsOpen )
   355                 if (iIsSettingsOpen)
   311 					{
   356                     {
   312 					CArrayFix<TCoeHelpContext>* contexts = AppHelpContextL();
   357                     CArrayFix<TCoeHelpContext>* contexts = AppHelpContextL();
   313 					contexts->At(0).iContext = KVOREC_HLP_SETTINGS;
   358                     contexts->At(0).iContext = KVOREC_HLP_SETTINGS;
   314 					HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
   359                     HlpLauncher::LaunchHelpApplicationL(
   315 													contexts );
   360                             iEikonEnv->WsSession(), contexts);
   316 					}
   361                     }
   317 				else
   362                 else
   318 					{
   363                     {
   319 					HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
   364                     HlpLauncher::LaunchHelpApplicationL(
   320 													AppHelpContextL() );
   365                             iEikonEnv->WsSession(), AppHelpContextL());
   321 					}
   366                     }
   322 				}
   367                 }
   323 			break;
   368             break;
   324 			}
   369             }
   325 		case ECmdSettings:
   370         case ECmdSettings:
   326 			{
   371             {
   327 			if ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ||
   372             if (FeatureManager::FeatureSupported(KFeatureIdMmc)
   328                  VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) )
   373                     || VRUtils::FeatureEnabled(EVRFeatureShowQualitySetting))
   329 				{
   374                 {
   330 				iIsSettingsOpen = ETrue;
   375                 iIsSettingsOpen = ETrue;
   331 				CVRSettingsDialog* settingsDlg = CVRSettingsDialog::NewL();
   376                 CVRSettingsDialog* settingsDlg = CVRSettingsDialog::NewL();
   332 				settingsDlg->ExecuteLD( R_VR_SETTINGS_DIALOG );
   377                 settingsDlg->ExecuteLD(R_VR_SETTINGS_DIALOG);
   333 				iIsSettingsOpen = EFalse;
   378                 iIsSettingsOpen = EFalse;
   334 				}
   379                 }
   335 			break;
   380             break;
   336 			}
   381             }
   337        	case ECmdNewFileServiceNotify:
   382         case ECmdNewFileServiceNotify:
   338    			{
   383             {
   339 			if ( iActiveWait.IsStarted() )
   384             if (iActiveWait.IsStarted())
   340 				{
   385                 {
   341 				iActiveWait.AsyncStop();
   386                 iActiveWait.AsyncStop();
   342 				}
   387                 }
   343 			break;
   388             break;
   344    			}
   389             }
   345        	case ECmdEmbeddedRecordingReady:
   390         case ECmdEmbeddedRecordingReady:
   346    			{
   391             {
   347    			if ( iEmbeddedObserver )
   392             if (iEmbeddedObserver)
   348    				{
   393                 {
   349    				TBool canExit( ETrue );
   394                 TBool canExit(ETrue);
   350    				
   395 
   351 				TVRSelectionStyle selStyle;
   396                 TVRSelectionStyle selStyle;
   352 				TPtrC memoFile( SelectionProviderL()->
   397                 TPtrC memoFile(SelectionProviderL()-> GetSelectedFilesLC(
   353 								GetSelectedFilesLC( selStyle )->
   398                         selStyle)-> MdcaPoint(0));
   354 								MdcaPoint( 0 ) );
   399                 if (memoFile.Length() > 0)
   355 				if ( memoFile.Length() > 0 )
   400                     {
   356 					{   		
   401                     TFileName myFilename(memoFile);
   357 					TFileName myFilename( memoFile );
   402                     canExit = iEmbeddedObserver->FileCompleteL(myFilename);
   358 					canExit = iEmbeddedObserver->FileCompleteL( myFilename );
   403                     }
   359 					}
       
   360 
   404 
   361 				// destroy array from GetSelectedFilesLC()
   405 				// destroy array from GetSelectedFilesLC()
   362 				CleanupStack::PopAndDestroy();
   406 				CleanupStack::PopAndDestroy();
   363 
   407 
   364 				if ( canExit )
   408 				if ( canExit )
   402 //
   446 //
   403 void CVRAppUi::HandleResourceChangeL( TInt aType )
   447 void CVRAppUi::HandleResourceChangeL( TInt aType )
   404 	{
   448 	{
   405 	CAknViewAppUi::HandleResourceChangeL( aType );
   449 	CAknViewAppUi::HandleResourceChangeL( aType );
   406 
   450 
   407 	if ( aType == KEikDynamicLayoutVariantSwitch ||
   451     if (aType == KEikDynamicLayoutVariantSwitch || aType
   408 		 aType == KAknsMessageSkinChange )
   452             == KAknsMessageSkinChange)
   409 		{
   453         {
   410 		iLayoutChangeObserver->LayoutChangedL( aType );
   454         iLayoutChangeObserver->LayoutChangedL(aType);
   411 		}
   455         }
   412 	}
   456     }
   413 
   457 
   414 // ---------------------------------------------------------------------------
   458 // ---------------------------------------------------------------------------
   415 // CVRAppUi::RecordNewFileL
   459 // CVRAppUi::RecordNewFileL
   416 // 
   460 // 
   417 // ---------------------------------------------------------------------------
   461 // ---------------------------------------------------------------------------
   437 //
   481 //
   438 TBool CVRAppUi::ProcessCommandParametersL( TApaCommand /*aCommand*/,
   482 TBool CVRAppUi::ProcessCommandParametersL( TApaCommand /*aCommand*/,
   439     TFileName& aDocumentName, const TDesC8& aTail )
   483     TFileName& aDocumentName, const TDesC8& aTail )
   440     {
   484     {
   441 
   485 
   442 	// Check if we got "-record" as command line parameter
   486     // Check if we got "-record" as command line parameter
   443 	// convert 8-bit descriptor to a 16-bit one without altering data.
   487     // convert 8-bit descriptor to a 16-bit one without altering data.
   444 	const TUint16* ptr16 = reinterpret_cast< const TUint16* >(
   488     const TUint16* ptr16 = reinterpret_cast<const TUint16*> (aTail.Ptr());
   445 												   aTail.Ptr() );
   489     TPtrC16 tail(ptr16, aTail.Size() >> 1);
   446 	TPtrC16 tail( ptr16, aTail.Size() >> 1);	
   490 
   447 
   491     if (aDocumentName.Compare(KVRCommandRecord) == 0 || tail.Compare(
   448 	if ( aDocumentName.Compare( KVRCommandRecord ) == 0
   492             KVRCommandRecord) == 0)
   449 		|| tail.Compare( KVRCommandRecord ) == 0 )
   493         {
   450 		{
   494         // Enter recording context
   451 		// Enter recording context
   495         ActivateLocalViewL(TUid::Uid(KVRRecorderViewUID), TUid::Uid(
   452 		ActivateLocalViewL( TUid::Uid( KVRRecorderViewUID ),
   496                 EContextRecordNewNormal), KNullDesC8);
   453 				TUid::Uid( EContextRecordNewNormal ), KNullDesC8 );
   497         return EFalse;
   454 		return EFalse;
   498         }
   455 		}
       
   456     else // No record parameter, start normally
   499     else // No record parameter, start normally
   457         {
   500         {
   458     	ActivateLocalViewL( TUid::Uid( KVRRecorderViewUID ),
   501         ActivateLocalViewL(TUid::Uid(KVRRecorderViewUID), TUid::Uid(
   459 	    	TUid::Uid( EContextEmptyNormal ), KNullDesC8 );        
   502                 EContextEmptyNormal), KNullDesC8);
   460         }
   503         }
   461         
   504         
   462 	if ( !ConeUtils::FileExists( aDocumentName ) )
   505 	if ( !ConeUtils::FileExists( aDocumentName ) )
   463 		{
   506 		{
   464 		aDocumentName.Copy( aTail );
   507 		aDocumentName.Copy( aTail );
   469 // ---------------------------------------------------------------------------
   512 // ---------------------------------------------------------------------------
   470 // CVRAppUi::HandleApplicationSpecificEventL
   513 // CVRAppUi::HandleApplicationSpecificEventL
   471 // 
   514 // 
   472 // ---------------------------------------------------------------------------
   515 // ---------------------------------------------------------------------------
   473 //
   516 //
   474 void CVRAppUi::HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent)
   517 void CVRAppUi::HandleApplicationSpecificEventL(TInt aType,
   475     {
   518         const TWsEvent& aEvent)
   476     if( aType == EAknSoftkeyExit )
   519     {
       
   520     if( aType == EAknSoftkeyExit || aType == KAknShutOrHideApp)
   477     	{
   521     	{
   478     	Exit();
   522     	Exit();
   479     	}
   523     	}
   480     	CEikAppUi::HandleApplicationSpecificEventL(aType, aEvent);
   524     	CEikAppUi::HandleApplicationSpecificEventL(aType, aEvent);
   481     }
   525     }
   487 //
   531 //
   488 void CVRAppUi::SetEmbeddedObserver( MVREmbeddedObserver* aObserver )
   532 void CVRAppUi::SetEmbeddedObserver( MVREmbeddedObserver* aObserver )
   489     {
   533     {
   490     iEmbeddedObserver = aObserver;
   534     iEmbeddedObserver = aObserver;
   491     }
   535     }
   492     
   536 
   493     
       
   494 // ---------------------------------------------------------------------------
       
   495 // CVRAppUi::IsUsbActive  
       
   496 // ---------------------------------------------------------------------------
       
   497 //
       
   498 TBool CVRAppUi::IsUsbActive()
       
   499     {
       
   500     TInt usbState;
       
   501     TInt err = RProperty::Get(  KPSUidUsbWatcher, KUsbWatcherSelectedPersonality,usbState);
       
   502     return !err && usbState == KUsbPersonalityIdMS;
       
   503     }
       
   504 // End of file
   537 // End of file