voicerecorder/RecViewSrc/CVRRecViewModel.cpp
branchRCL_3
changeset 13 4e5b531d23cb
parent 10 bb90e4148332
child 14 f962425b9f8b
equal deleted inserted replaced
11:a2fdc35b8f46 13:4e5b531d23cb
    43 #include <featmgr.h>	// Feature manager
    43 #include <featmgr.h>	// Feature manager
    44 #include <SendUiConsts.h>          // Disable e-mail  
    44 #include <SendUiConsts.h>          // Disable e-mail  
    45 #include "MessagingDomainCRKeys.h" // Disable e-mail variation flag
    45 #include "MessagingDomainCRKeys.h" // Disable e-mail variation flag
    46 
    46 
    47 #include <centralrepository.h> // link against centralrepository.lib
    47 #include <centralrepository.h> // link against centralrepository.lib
       
    48 #ifdef RD_MULTIPLE_DRIVE
       
    49 #include <driveinfo.h>
       
    50 #endif
    48 #include "VoiceRecorderInternalCRKeys.h"
    51 #include "VoiceRecorderInternalCRKeys.h"
    49 
    52 
    50 #include <voicerecorder.rsg>
    53 #include <voicerecorder.rsg>
    51 #include "CVRMemo.h"
    54 #include "CVRMemo.h"
    52 #include "TVRState.h"
    55 #include "TVRState.h"
    53 #include "CVRMdaRecorder.h"
    56 #include "CVRMdaRecorder.h"
    54 #include "VRConsts.h"
    57 #include "VRConsts.h"
    55 #include "CVRSystemEventHandler.h"
    58 #include "CVRSystemEventHandler.h"
    56 #include "CVRUSBEventHandler.h"
       
    57 #include "CVRMediaRemovalMonitor.h"
    59 #include "CVRMediaRemovalMonitor.h"
    58 #include "VRUtils.h"
    60 #include "VRUtils.h"
    59 #include "CVRRecViewModel.h"
    61 #include "CVRRecViewModel.h"
    60 #include <csxhelp/vorec.hlp.hrh>
    62 #include <csxhelp/vorec.hlp.hrh>
       
    63 
       
    64 #include "VRUSBStateHanlder.h"
    61 
    65 
    62 
    66 
    63 // CONSTANTS
    67 // CONSTANTS
    64 const TInt KAllowInCallRecording( 1 );
    68 const TInt KAllowInCallRecording( 1 );
    65 
    69 
   111 	
   115 	
   112 	if (iCurrentCallHandler) 
   116 	if (iCurrentCallHandler) 
   113 		{
   117 		{
   114 		delete iCurrentCallHandler;
   118 		delete iCurrentCallHandler;
   115 		}
   119 		}
   116 
       
   117 	delete iCurrentUSBHandler;
       
   118 	
       
   119 	delete iCurrentMMCEjectHandler;
   120 	delete iCurrentMMCEjectHandler;
   120 	
   121 	
   121 	}
   122 	}
   122 
   123 
   123 
   124 
   130 	{
   131 	{
   131 
   132 
   132 	TRAP_IGNORE( iCurrentCallHandler = CVRSystemEventHandler::NewL() );
   133 	TRAP_IGNORE( iCurrentCallHandler = CVRSystemEventHandler::NewL() );
   133 	iCurrentCallHandler->Listen( KPSUidCtsyCallInformation, KCTsyCallState, 
   134 	iCurrentCallHandler->Listen( KPSUidCtsyCallInformation, KCTsyCallState, 
   134 								 this );
   135 								 this );
   135 
       
   136     // for USB
       
   137     iCurrentUSBHandler = CVRUSBEventHandler::NewL();
       
   138 	iCurrentUSBHandler->Listen( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality,
       
   139 								 this );
       
   140 
       
   141 	//listen MMC eject
   136 	//listen MMC eject
   142 	iCurrentMMCEjectHandler = CVRMediaRemovalMonitor::NewL(EDriveF, CEikonEnv::Static()->FsSession(), this);
   137 	iCurrentMMCEjectHandler = CVRMediaRemovalMonitor::NewL(EDriveF, CEikonEnv::Static()->FsSession(), this);
   143 
   138 
   144 	if ( FeatureManager::FeatureSupported( KFeatureIdKeypadNoVoiceKey ) &&
   139 	if ( FeatureManager::FeatureSupported( KFeatureIdKeypadNoVoiceKey ) &&
   145 		FeatureManager::FeatureSupported( 
   140 		FeatureManager::FeatureSupported( 
   806 // special cases (end and the beginning of the clip) can be handled here.
   801 // special cases (end and the beginning of the clip) can be handled here.
   807 // ---------------------------------------------------------------------------
   802 // ---------------------------------------------------------------------------
   808 //	
   803 //	
   809 TInt CVRRecViewModel::ButtonState( TInt aButtonId ) const
   804 TInt CVRRecViewModel::ButtonState( TInt aButtonId ) const
   810 	{
   805 	{
       
   806     if(CVRUSBStateHanlder::IsUsbActive())
       
   807         {
       
   808             return EDimmed;
       
   809         }
   811 	// Disable rewind button if there's nothing to rewind
   810 	// Disable rewind button if there's nothing to rewind
   812 	if ( aButtonId == EButtonRewind &&
   811 	if ( aButtonId == EButtonRewind &&
   813 		( Position().Int64() / KVRSecondAsMicroSeconds ) < 1 )
   812 		( Position().Int64() / KVRSecondAsMicroSeconds ) < 1 )
   814 		{
   813 		{
   815 		return EDimmed;
   814 		return EDimmed;
  2207 			ShowNoteL( R_VR_MEMORY_MMC_WARNING, EAknGlobalWarningNote );
  2206 			ShowNoteL( R_VR_MEMORY_MMC_WARNING, EAknGlobalWarningNote );
  2208 			}
  2207 			}
  2209 			
  2208 			
  2210 //multiple drive
  2209 //multiple drive
  2211 #else
  2210 #else
  2212 		if (VRUtils::MemoDriveL() == VRUtils::DefaultMemoDriveL())
  2211 		TInt memoDrive = VRUtils::MemoDriveL();
  2213 			{
  2212 		TUint status( 0 );
       
  2213 		VRUtils::GetDriveInfo( memoDrive, status );
       
  2214 		        
       
  2215 		if ( status & DriveInfo::EDriveInternal )
       
  2216 		    {
  2214 			ShowNoteL( R_VR_MEMORY_WARNING, EAknGlobalWarningNote );
  2217 			ShowNoteL( R_VR_MEMORY_WARNING, EAknGlobalWarningNote );
  2215 			}
  2218 			}
  2216 		else
  2219 		else
  2217 			{
  2220 			{
  2218 			ShowNoteL( R_VR_MEMORY_MMC_WARNING, EAknGlobalWarningNote );
  2221 			ShowNoteL( R_VR_MEMORY_MMC_WARNING, EAknGlobalWarningNote );
  2409 			}		
  2412 			}		
  2410 		}
  2413 		}
  2411 	}
  2414 	}
  2412 
  2415 
  2413 
  2416 
  2414 // ---------------------------------------------------------------------------
       
  2415 // CVRRecViewModel::HandleUSBEventL
       
  2416 // 
       
  2417 // ---------------------------------------------------------------------------
       
  2418 //
       
  2419 void CVRRecViewModel::HandleUSBEventL()
       
  2420 	{
       
  2421 	// Fetch the changed value from Pubsub
       
  2422     TInt usbState( 0 );
       
  2423     RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, usbState );
       
  2424 	if ( !iActive )
       
  2425 		{
       
  2426 		return;
       
  2427 		}
       
  2428 
       
  2429 	// Actions to take when playing
       
  2430     if ( usbState == KUsbPersonalityIdMS )
       
  2431 		{
       
  2432 		ShowNoteL( R_QTN_MEMC_VOREC_NOTE1, EAknGlobalInformationNote );		
       
  2433 //  when not support multiple drives
       
  2434 #ifndef RD_MULTIPLE_DRIVE    
       
  2435 		if (iMemo->MemoStore() != EMemoStorePhoneMemory) 
       
  2436 			{
       
  2437             HandleCommandL( EEikCmdExit);
       
  2438 			}		
       
  2439 //multiple drive
       
  2440 #else
       
  2441 		if (iMemo->StorageDrive() != VRUtils::DefaultMemoDriveL()) 
       
  2442 			{
       
  2443 			
       
  2444 	        HandleCommandL( EEikCmdExit );
       
  2445 			}
       
  2446 #endif			
       
  2447 		}
       
  2448 
       
  2449 	}
       
  2450 
       
  2451 
       
  2452 // End of file
       
  2453 
  2417 
  2454 
  2418 
  2455 // ---------------------------------------------------------------------------
  2419 // ---------------------------------------------------------------------------
  2456 // CVRRecViewModel::HandleMMCEjectEventL
  2420 // CVRRecViewModel::HandleMMCEjectEventL
  2457 // 
  2421 // 
  2460 void CVRRecViewModel::HandleMMCEjectEventL()
  2424 void CVRRecViewModel::HandleMMCEjectEventL()
  2461 	{
  2425 	{
  2462 	
  2426 	
  2463 	// Actions to take when recording
  2427 	// Actions to take when recording
  2464 	TInt storageDrive = VRUtils::MemoDriveL();   	 
  2428 	TInt storageDrive = VRUtils::MemoDriveL();   	 
  2465     if ( storageDrive == EDriveF)
  2429     if ( storageDrive == EDriveF && !CVRUSBStateHanlder::IsUsbActive())
  2466 		{
  2430 		{
  2467         //exit for mmc dismount	
  2431         //exit for mmc dismount	
  2468         TWsEvent event;
  2432         TWsEvent event;
  2469         event.SetType( EAknSoftkeyExit );
  2433         event.SetType( EAknSoftkeyExit );
  2470         event.SetTimeNow();
  2434         event.SetTimeNow();