voicerecorder/RecViewSrc/CVRRecView.cpp
branchRCL_3
changeset 13 4e5b531d23cb
parent 7 6aee962f6139
child 15 487b46c8e1a4
equal deleted inserted replaced
11:a2fdc35b8f46 13:4e5b531d23cb
    48 #include "CVRRecView.h"
    48 #include "CVRRecView.h"
    49 #include "CVRRecViewContainer.h"
    49 #include "CVRRecViewContainer.h"
    50 #include "CVRRecViewActivationContainer.h"
    50 #include "CVRRecViewActivationContainer.h"
    51 #include "CVRRecViewModel.h"
    51 #include "CVRRecViewModel.h"
    52 #include "VRUtils.h"
    52 #include "VRUtils.h"
       
    53 #include "VRUSBStateHanlder.h"
    53 
    54 
    54 // CONSTANTS
    55 // CONSTANTS
    55 const TUid KUidMmsEditor = { 0x100058DE };
    56 const TUid KUidMmsEditor =
    56 const TUid KUidMailEditor = { 0x101F4CD6 };
    57     {
    57 
    58     0x100058DE
       
    59     };
       
    60 const TUid KUidMailEditor =
       
    61     {
       
    62     0x101F4CD6
       
    63     };
       
    64 
       
    65 inline TBool ShowDialogForWaitUSBPluggingOutL()
       
    66     {
       
    67     HBufC* text = StringLoader::LoadLC(R_QTN_USB_MODE_NOTE_MODE);
       
    68     CAknQueryDialog* dlg = CAknQueryDialog::NewL();
       
    69     TInt result(dlg->ExecuteLD(R_INSERT_F_USB_PLUG_IN_DIALOG, *text));
       
    70     CleanupStack::PopAndDestroy(text);
       
    71     if (result)
       
    72         {
       
    73         return ETrue;
       
    74         }
       
    75     return EFalse;
       
    76     }
       
    77 
       
    78 inline TInt WaitDialogForUSBPluggingOut(CAknWaitDialog*& aDialog)
       
    79     {
       
    80     aDialog = new (ELeave) CAknWaitDialog(
       
    81             (REINTERPRET_CAST(CEikDialog**,&aDialog)));
       
    82     aDialog->SetTone(CAknNoteDialog::EConfirmationTone);
       
    83     return aDialog->ExecuteLD(R_VOREC_USB_CONNECTED_DIALOG);
       
    84     }
    58 
    85 
    59 // ================= MEMBER FUNCTIONS ========================================
    86 // ================= MEMBER FUNCTIONS ========================================
    60 
    87 
    61 // ---------------------------------------------------------------------------
    88 // ---------------------------------------------------------------------------
    62 // CVRRecView::CVRRecViewModelActivator::CVRRecViewModelActivator
    89 // CVRRecView::CVRRecViewModelActivator::CVRRecViewModelActivator
    63 // 
    90 // 
    64 // ---------------------------------------------------------------------------
    91 // ---------------------------------------------------------------------------
    65 //
    92 //
    66 CVRRecView::CVRRecViewModelActivator::CVRRecViewModelActivator( 
    93 CVRRecView::CVRRecViewModelActivator::CVRRecViewModelActivator(
    67 	CVRRecViewModel* aModel )
    94         CVRRecViewModel* aModel) :
    68 	: CAsyncOneShot( EPriorityNormal ), iModel( aModel ),
    95     CAsyncOneShot(EPriorityNormal), iModel(aModel), iContext(
    69 	  iContext( EContextEmptyNormal )
    96             EContextEmptyNormal)
    70 	{
    97     {
    71 	}
    98     }
    72 
    99 
    73 
   100 
    74 // ---------------------------------------------------------------------------
   101 // ---------------------------------------------------------------------------
    75 // CVRRecView::CVRRecViewModelActivator::~CVRRecViewModelActivator
   102 // CVRRecView::CVRRecViewModelActivator::~CVRRecViewModelActivator
    76 // 
   103 // 
   155 	if ( iActivationContainer )
   182 	if ( iActivationContainer )
   156 		{
   183 		{
   157 		AppUi()->RemoveFromViewStack( *this, iActivationContainer );
   184 		AppUi()->RemoveFromViewStack( *this, iActivationContainer );
   158 		}
   185 		}
   159 
   186 
   160 	delete iContainer;
   187     delete iContainer;
   161 	delete iActivationContainer;
   188     delete iActivationContainer;
   162 	delete iModel;
   189     delete iModel;
   163 	delete iSendUi;
   190     delete iSendUi;
   164 	delete iModelActivator;
   191     delete iModelActivator;
   165 	delete iLaunchService;
   192     delete iLaunchService;
   166 	}
   193     delete iUSBStateHandler;
   167 
   194 
       
   195     if (iUsbWaitDialog)
       
   196         {
       
   197         TRAP_IGNORE(iUsbWaitDialog->ProcessFinishedL());
       
   198         }
       
   199     }
   168 
   200 
   169 // ---------------------------------------------------------------------------
   201 // ---------------------------------------------------------------------------
   170 // CVRRecView::ConstructL
   202 // CVRRecView::ConstructL
   171 // 
   203 // 
   172 // ---------------------------------------------------------------------------
   204 // ---------------------------------------------------------------------------
   179 	TResourceReader reader;
   211 	TResourceReader reader;
   180 	iEikonEnv->CreateResourceReaderLC( reader, aModelResourceId );
   212 	iEikonEnv->CreateResourceReaderLC( reader, aModelResourceId );
   181 	iModel->ConstructFromResourceL( reader );
   213 	iModel->ConstructFromResourceL( reader );
   182 	CleanupStack::PopAndDestroy(); // reader;
   214 	CleanupStack::PopAndDestroy(); // reader;
   183 
   215 
   184 	// Create SendUi (Send as MMS, E-Mail, etc...)
   216     // Create SendUi (Send as MMS, E-Mail, etc...)
   185 	iSendUi = CSendUi::NewL();
   217     iSendUi = CSendUi::NewL();
   186 	
   218 
   187 	iModelActivator = new(ELeave) CVRRecViewModelActivator( iModel );
   219     iModelActivator = new (ELeave) CVRRecViewModelActivator(iModel);
   188  //       iCommand = 0;
   220 
   189 	}
   221     iUSBStateHandler = CVRUSBStateHanlder::NewL(this);
   190 
   222 
       
   223     if (CVRUSBStateHanlder::IsUsbActive())
       
   224         {
       
   225         ShowDialogForWaitUSBPluggingOutL();
       
   226         AppUi()->Exit();
       
   227         }
       
   228     }
   191 
   229 
   192 // ---------------------------------------------------------------------------
   230 // ---------------------------------------------------------------------------
   193 // CVRRecView::Id
   231 // CVRRecView::Id
   194 // 
   232 // 
   195 // ---------------------------------------------------------------------------
   233 // ---------------------------------------------------------------------------
   196 //
   234 //
   197 TUid CVRRecView::Id() const
   235 TUid CVRRecView::Id() const
   198 	{
   236     {
   199 	const TUid KVRRecViewUID = { KVRRecorderViewUID };
   237     const TUid KVRRecViewUID =
       
   238         {
       
   239         KVRRecorderViewUID
       
   240         };
   200 
   241 
   201 	return KVRRecViewUID;
   242 	return KVRRecViewUID;
   202 	}
   243 	}
   203 
   244 
   204 
   245 
   265 
   306 
   266 	        TFileName path;
   307 	        TFileName path;
   267 	        VRUtils::MemoStoreDirectoryL( path );
   308 	        VRUtils::MemoStoreDirectoryL( path );
   268 	        TInt sortMode = 0;
   309 	        TInt sortMode = 0;
   269 
   310 
   270 	        CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC();
   311             CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC();
   271             inParams->AppendL(TAiwGenericParam(
   312             inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant(
   272                 EGenericParamDir, TAiwVariant( path ) ) );
   313                     path)));
   273             inParams->AppendL(TAiwGenericParam(
   314             inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant(
   274                 EGenericParamDir, TAiwVariant( sortMode ) ) );
   315                     sortMode)));
   275             iLaunchService = CAknLaunchAppService::NewL(
   316             iLaunchService = CAknLaunchAppService::NewL(
   276                 TUid::Uid( 0x101F84EB ), NULL, inParams );
   317                     TUid::Uid(0x101F84EB), NULL, inParams);
   277             CleanupStack::PopAndDestroy( inParams );
   318             CleanupStack::PopAndDestroy(inParams);
   278 			break;
   319             break;
   279 			}
   320             }
   280 		case ECmdSendVia:
   321         case ECmdSendVia:
   281 			{
   322             {
   282 			iModel->SendViaL( iSendUi );
   323             iModel->SendViaL(iSendUi);
   283 			break;
   324             break;
   284 			}
   325             }
   285 					
   326 
   286 		// Handles Middle SoftKey presses in this view
   327             // Handles Middle SoftKey presses in this view
   287 		case ECmdMSK:
   328         case ECmdMSK:
   288 			{
   329             {
   289 			// Don't forward the command if dimmed button was clicked or 
   330             // Don't forward the command if dimmed button was clicked or 
   290 			// if model can't handle commands
   331             // if model can't handle commands
   291 			if ( iModel->ButtonState( iContainer->FocusedButton() ) == EDimmed ||
   332             if (iModel->ButtonState(iContainer->FocusedButton()) == EDimmed
   292 				!iModel->CanHandleCommands() )
   333                     || !iModel->CanHandleCommands())
   293 				{
   334                 {
   294 				break;
   335                 break;
   295 				}
   336                 }
   296 			
   337 
   297 			// Fetch the command to execute 
   338             // Fetch the command to execute 
   298 			TInt commandId( iModel->CommandId( iContainer->FocusedButton() ) );
   339             TInt commandId(iModel->CommandId(iContainer->FocusedButton()));
   299 			
   340 
   300 			iModel->HandleCommandL( commandId );
   341             iModel->HandleCommandL(commandId);
   301 			AppUi()->HandleCommandL( commandId );
   342             AppUi()->HandleCommandL(commandId);
   302 			
   343 
   303 			iContainer->UpdateButtonPanel( EVRUpdateStateChange );
   344             iContainer->UpdateButtonPanel(EVRUpdateStateChange);
   304 			break;
   345             break;
   305 			}
   346             }
   306 		
   347         case ECmdUSBChange:
   307 		default:
   348             if (iUsbWaitDialog)
   308 			{
   349                 {
   309 			iModel->HandleCommandL( aCommandId );
   350                 iUsbWaitDialog->ProcessFinishedL();
   310 			AppUi()->HandleCommandL( aCommandId );
   351                 }
   311 			break;
   352             iContainer->UpdateButtonPanel(EVRUpdateStateChange);
   312 			}
   353             break;
   313 		}
   354         default:
   314 	}
   355             {
   315 
   356             iModel->HandleCommandL(aCommandId);
       
   357             AppUi()->HandleCommandL(aCommandId);
       
   358             break;
       
   359             }
       
   360         }
       
   361     }
   316 
   362 
   317 // ---------------------------------------------------------------------------
   363 // ---------------------------------------------------------------------------
   318 // CVRRecView::DynInitMenuPaneL
   364 // CVRRecView::DynInitMenuPaneL
   319 // 
   365 // 
   320 // ---------------------------------------------------------------------------
   366 // ---------------------------------------------------------------------------
   326 		{
   372 		{
   327 		case R_VR_REC_MENUPANE_DEFAULT:
   373 		case R_VR_REC_MENUPANE_DEFAULT:
   328 			{
   374 			{
   329             // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item
   375             // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item
   330             if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
   376             if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
   331               {
   377                 {
   332                   aMenuPane->SetItemDimmed(ECmdHelp, ETrue);
   378                 aMenuPane->SetItemDimmed(ECmdHelp, ETrue);
   333               }
   379                 }
       
   380             if (CVRUSBStateHanlder::IsUsbActive())
       
   381                 {
       
   382                 aMenuPane->SetItemDimmed(ECmdRecord, ETrue);
       
   383                 aMenuPane->SetItemDimmed(ECmdDelete, ETrue);
       
   384                 aMenuPane->SetItemDimmed(ECmdRename, ETrue);
       
   385                 aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue);
       
   386                 }
   334 
   387 
   335 			AddSendToMenuL( aResourceId, aMenuPane );
   388 			AddSendToMenuL( aResourceId, aMenuPane );
   336 			break;
   389 			break;
   337 			}
   390 			}
   338 
   391 
   346                 if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
   399                 if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
   347                   {
   400                   {
   348                   aMenuPane->SetItemDimmed(ECmdHelp, ETrue);
   401                   aMenuPane->SetItemDimmed(ECmdHelp, ETrue);
   349                   }
   402                   }
   350 
   403 
   351 				appuid = container->Application()->AppDllUid();
   404                 if (CVRUSBStateHanlder::IsUsbActive())
   352 				if ( ( appuid == KUidMmsEditor ) ||
   405                     {
   353 					 ( appuid == KUidMailEditor ) )
   406                     aMenuPane->SetItemDimmed(ECmdSaveAttachment, ETrue);
   354 					{
   407                     }
   355 					aMenuPane->SetItemDimmed( ECmdSaveAttachment, ETrue );
   408 
   356 					}
   409                 appuid = container->Application()->AppDllUid();
   357 				else
   410                 if ((appuid == KUidMmsEditor) || (appuid == KUidMailEditor))
   358 					{
   411                     {
   359 					AddSendToMenuL( aResourceId, aMenuPane );
   412                     aMenuPane->SetItemDimmed(ECmdSaveAttachment, ETrue);
   360 					}
   413                     }
   361 				}
   414                 else
       
   415                     {
       
   416                     AddSendToMenuL(aResourceId, aMenuPane);
       
   417                     }
       
   418                 }
   362 
   419 
   363 			break;
   420 			break;
   364 			}
   421 			}
   365 		case R_VR_SETTINGS_MENUPANE:
   422 		case R_VR_SETTINGS_MENUPANE:
   366 			{
   423 			{
   378   			if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
   435   			if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
   379 				{
   436 				{
   380 				aMenuPane->SetItemDimmed(ECmdHelp, ETrue);
   437 				aMenuPane->SetItemDimmed(ECmdHelp, ETrue);
   381 				}
   438 				}
   382 
   439 
   383 			// if recording already started, not allow to start recording again.	
   440             if (CVRUSBStateHanlder::IsUsbActive())
   384   			if (iModel->GetInRecordingFlag())
   441                 {
   385 				{
   442                 aMenuPane->SetItemDimmed(ECmdRecord, ETrue);
   386 				aMenuPane->SetItemDimmed(ECmdRecord, ETrue);
   443                 aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue);
   387 				aMenuPane->SetItemDimmed(ECmdSettings, ETrue);
   444 
       
   445                 }
       
   446 
       
   447             // if recording already started, not allow to start recording again.    
       
   448             if (iModel->GetInRecordingFlag())
       
   449                 {
       
   450                 aMenuPane->SetItemDimmed(ECmdRecord, ETrue);
       
   451                 aMenuPane->SetItemDimmed(ECmdSettings, ETrue);
   388                 iModel->SetInRecordingFlag(EFalse);
   452                 iModel->SetInRecordingFlag(EFalse);
   389 				}
   453                 }
   390    
   454 
   391          break; 
   455             if (CVRUSBStateHanlder::IsUsbActive())
   392 			}
   456                 {
   393 
   457                 aMenuPane->SetItemDimmed(ECmdRecord, ETrue);
   394 		case R_VR_REC_MENUPANE_INCALL_RECORDING_DISABLED:
   458                 aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue);
   395 			{
   459                 }
   396 			// Check if HELP is enabled in FeatureManager, if not, disable the Help menu item
   460 
   397 			if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
   461             break;
   398 				{
   462             }
   399 				aMenuPane->SetItemDimmed(ECmdHelp, ETrue);
   463 
   400 				}
   464         case R_VR_REC_MENUPANE_INCALL_RECORDING_DISABLED:
   401             break; 
   465             {
   402 			}
   466             // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item
       
   467             if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
       
   468                 {
       
   469                 aMenuPane->SetItemDimmed(ECmdHelp, ETrue);
       
   470                 }
       
   471 
       
   472             if (CVRUSBStateHanlder::IsUsbActive())
       
   473                 {
       
   474                 aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue);
       
   475                 }
       
   476             break;
       
   477             }
   403 
   478 
   404 		case R_VOREC_GS_SETTINGS_MENUPANE:
   479 		case R_VOREC_GS_SETTINGS_MENUPANE:
   405 			{
   480 			{
   406 			// Check if HELP is enabled in FeatureManager, if not, disable the Help menu item
   481 			// Check if HELP is enabled in FeatureManager, if not, disable the Help menu item
   407 			if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
   482 			if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
   434 // ---------------------------------------------------------------------------
   509 // ---------------------------------------------------------------------------
   435 // CVRRecView::DoActivateL
   510 // CVRRecView::DoActivateL
   436 // 
   511 // 
   437 // ---------------------------------------------------------------------------
   512 // ---------------------------------------------------------------------------
   438 //
   513 //
   439 void CVRRecView::DoActivateL( const TVwsViewId& aPrevViewId,
   514 void CVRRecView::DoActivateL(const TVwsViewId& aPrevViewId,
   440 							 TUid aCustomMessageId,
   515         TUid aCustomMessageId, const TDesC8& aCustomMessage)
   441 							 const TDesC8& aCustomMessage )
   516     {
   442 	{
   517     TRAP_IGNORE( ReallyDoActivateL( aPrevViewId,
   443 	TRAP_IGNORE( ReallyDoActivateL( aPrevViewId, 
   518                     aCustomMessageId,
   444 									aCustomMessageId, 
   519                     aCustomMessage ) );
   445 									aCustomMessage ) );
   520 
   446 	}
   521     }
   447 
       
   448 
   522 
   449 // ---------------------------------------------------------------------------
   523 // ---------------------------------------------------------------------------
   450 // CVRRecView::DoDeactivate
   524 // CVRRecView::DoDeactivate
   451 // 
   525 // 
   452 // ---------------------------------------------------------------------------
   526 // ---------------------------------------------------------------------------
   485 #ifdef _DEBUG    
   559 #ifdef _DEBUG    
   486 	RDebug::Print( _L( "CVRRecView::ViewDeactivated" ));
   560 	RDebug::Print( _L( "CVRRecView::ViewDeactivated" ));
   487 #endif
   561 #endif
   488 
   562 
   489     TInt err = 0;
   563     TInt err = 0;
   490     
   564 
   491 	if ( !iModel->IncomingCall() && ( iModel->VisualStateId() == EStatePlaying ||
   565     if (!iModel->IncomingCall() && (iModel->VisualStateId() == EStatePlaying
   492          iModel->VisualStateId() == EStateRecording ) )
   566             || iModel->VisualStateId() == EStateRecording))
   493 		{
   567         {
   494         
   568 
   495         if (iModel->VisualStateId() == EStateRecording && iCommand ==  ECmdCancelNote )
   569         if (iModel->VisualStateId() == EStateRecording && iCommand
   496         	{
   570                 == ECmdCancelNote)
   497 		    TRAP_IGNORE (iModel->HandleCommandL( ECmdSaveAttachment ));	
   571             {
   498         	}
   572             TRAP_IGNORE (iModel->HandleCommandL( ECmdSaveAttachment ));
   499         
   573             }
       
   574 
   500         // Is autolock activating? 
   575         // Is autolock activating? 
   501         RProperty prop;
   576         RProperty prop;
   502         TInt val;
   577         TInt val;
   503         prop.Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, val );
   578         prop.Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, val );
   504                 
   579                 
   506              !iModel->GetIfStopCalled())
   581              !iModel->GetIfStopCalled())
   507     		{
   582     		{
   508     		
   583     		
   509 		//messy, if it is ACC format, stop it. in the future when Pause is supported, it needs change 
   584 		//messy, if it is ACC format, stop it. in the future when Pause is supported, it needs change 
   510 #ifdef    __AAC_ENCODER_PLUGIN 
   585 #ifdef    __AAC_ENCODER_PLUGIN 
   511     			if  ((iModel->Quality() == EQualityHigh) && (GetStateId() == EStateRecording))
   586             if ((iModel->Quality() == EQualityHigh) && (GetStateId()
   512 					{
   587                     == EStateRecording))
   513 					TRAP_IGNORE (iModel->HandleCommandL( ECmdAutoStopInterrupted ));
   588                 {
   514 					}
   589                 TRAP_IGNORE (iModel->HandleCommandL( ECmdAutoStopInterrupted ));
   515     			else
   590                 }
   516     				{
   591             else
   517 					TRAP( err, iModel->HandleCommandL( ECmdPause ) );	    		
   592                 {
   518     				}
   593                 TRAP( err, iModel->HandleCommandL( ECmdPause ) );
       
   594                 }
   519 
   595 
   520 #else			
   596 #else			
   521 	    		TRAP( err, iModel->HandleCommandL( ECmdPause ) );	
   597 	    		TRAP( err, iModel->HandleCommandL( ECmdPause ) );	
   522 #endif
   598 #endif
   523 
   599 
   524 		
   600 		
   525 				if( err )
   601 				if( err )
   526 					{	
   602 					{	
   527 #ifdef _DEBUG
   603 #ifdef _DEBUG
   528 					RDebug::Print( _L("CVRRecView::ViewDeactivated, PauseError Id: %d"), 
   604                 RDebug::Print(
   529 					err );
   605                         _L("CVRRecView::ViewDeactivated, PauseError Id: %d"),
   530 #endif		
   606                         err);
   531 					}	
   607 #endif      
   532     		}
   608                 }
       
   609             }
   533 
   610 
   534 		}
   611 		}
   535 	else
   612 	else
   536 		{
   613 		{
   537 			TRAP_IGNORE( iModel->HandleCommandL( ECmdAutoStopInterrupted ) );		
   614 			TRAP_IGNORE( iModel->HandleCommandL( ECmdAutoStopInterrupted ) );		
   547 // required when the UI is activated (e.g., for In-call recording diabling 
   624 // required when the UI is activated (e.g., for In-call recording diabling 
   548 // feature)
   625 // feature)
   549 // ---------------------------------------------------------------------------
   626 // ---------------------------------------------------------------------------
   550 //
   627 //
   551 void CVRRecView::ViewActivatedL(const TVwsViewId& aPrevViewId,
   628 void CVRRecView::ViewActivatedL(const TVwsViewId& aPrevViewId,
   552 								TUid aCustomMessageId,
   629         TUid aCustomMessageId, const TDesC8& aCustomMessage)
   553 								const TDesC8& aCustomMessage)
       
   554     {
   630     {
   555     // dismiss sound player / file manager if it was active so that recording
   631     // dismiss sound player / file manager if it was active so that recording
   556     // view becomes visible
   632     // view becomes visible
   557     delete iLaunchService;
   633     delete iLaunchService;
   558     iLaunchService = NULL;
   634     iLaunchService = NULL;
   577 // ---------------------------------------------------------------------------
   653 // ---------------------------------------------------------------------------
   578 // CVRRecView::AddSendToMenuL
   654 // CVRRecView::AddSendToMenuL
   579 // Use CSendAppUi to display the Send cascade
   655 // Use CSendAppUi to display the Send cascade
   580 // ---------------------------------------------------------------------------
   656 // ---------------------------------------------------------------------------
   581 //
   657 //
   582 void CVRRecView::AddSendToMenuL( TInt aResourceId, CEikMenuPane* aMenuPane )
   658 void CVRRecView::AddSendToMenuL(TInt aResourceId, CEikMenuPane* aMenuPane)
   583 	{
   659     {
   584 	// If the focused file is closed content (e.g. a DRM file or a protected
   660     // If the focused file is closed content (e.g. a DRM file or a protected
   585 	// MIDI file), the whole Send option mustn't be shown.
   661     // MIDI file), the whole Send option mustn't be shown.
   586 	CCommonContentPolicy* ccp = CCommonContentPolicy::NewLC();
   662     CCommonContentPolicy* ccp = CCommonContentPolicy::NewLC();
   587 	MDesCArray* filenames = iModel->GetSelectedFilesLC();
   663     MDesCArray* filenames = iModel->GetSelectedFilesLC();
   588 	if ( filenames->MdcaCount() > 0 &&
   664     if (filenames->MdcaCount() > 0 && !ccp->IsClosedFileL(
   589 		!ccp->IsClosedFileL( filenames->MdcaPoint( 0 ) ) )
   665             filenames->MdcaPoint(0)))
   590 		{
   666         {
   591 		// Set proper capabilities
   667         // Set proper capabilities
   592 		TSendingCapabilities capabilities( 0, KVRSendUiMsgSize,
   668         TSendingCapabilities capabilities(0, KVRSendUiMsgSize,
   593 								TSendingCapabilities::ESupportsAttachments );
   669                 TSendingCapabilities::ESupportsAttachments);
   594 
   670 
   595 		// We want the send menuitem after a specific item
   671         // We want the send menuitem after a specific item
   596 		TInt itemPosForSend( 0 );
   672         TInt itemPosForSend(0);
   597 		if ( aResourceId == R_VR_REC_MENUPANE_DEFAULT )
   673         if (aResourceId == R_VR_REC_MENUPANE_DEFAULT)
   598 			{
   674             {
   599 			aMenuPane->ItemAndPos( ECmdRename, itemPosForSend );
   675             aMenuPane->ItemAndPos(ECmdRename, itemPosForSend);
   600 			}
   676             }
   601 		else if ( aResourceId == R_VR_REC_MENUPANE_VIEWER )
   677         else if (aResourceId == R_VR_REC_MENUPANE_VIEWER)
   602 			{
   678             {
   603 			aMenuPane->ItemAndPos( ECmdSaveAttachment, itemPosForSend );
   679             aMenuPane->ItemAndPos(ECmdSaveAttachment, itemPosForSend);
   604 			}
   680             }
   605 		itemPosForSend++;
   681         itemPosForSend++;
   606 
   682         if (!CVRUSBStateHanlder::IsUsbActive())
   607 		iSendUi->AddSendMenuItemL( *aMenuPane, 
   683             {
   608 								   itemPosForSend, 
   684             iSendUi->AddSendMenuItemL(*aMenuPane, itemPosForSend,
   609 								   ECmdSendVia, 
   685                     ECmdSendVia, capabilities);
   610 								   capabilities );
   686             }
   611 		}
   687         }
   612 	CleanupStack::PopAndDestroy( 2 ); // ccp, filenames
   688     CleanupStack::PopAndDestroy(2); // ccp, filenames
   613 	}
   689     }
   614 
       
   615 
   690 
   616 // ---------------------------------------------------------------------------
   691 // ---------------------------------------------------------------------------
   617 // CVRRecView::LayoutChangedL
   692 // CVRRecView::LayoutChangedL
   618 // 
   693 // 
   619 // ---------------------------------------------------------------------------
   694 // ---------------------------------------------------------------------------
   631 // ---------------------------------------------------------------------------
   706 // ---------------------------------------------------------------------------
   632 // CVRRecView::ReallyDoActivateL
   707 // CVRRecView::ReallyDoActivateL
   633 // 
   708 // 
   634 // ---------------------------------------------------------------------------
   709 // ---------------------------------------------------------------------------
   635 //
   710 //
   636 void CVRRecView::ReallyDoActivateL( const TVwsViewId& /*aPrevViewId*/,
   711 void CVRRecView::ReallyDoActivateL(const TVwsViewId& /*aPrevViewId*/,
   637 									TUid aCustomMessageId,
   712         TUid aCustomMessageId, const TDesC8& /*aCustomMessage*/)
   638 									const TDesC8& /*aCustomMessage*/ )
   713     {
   639 	{
   714     // Don't do anything if activation is ongoing
   640 	// Don't do anything if activation is ongoing
   715     if (iActivationContainer)
   641 	if ( iActivationContainer )
   716         {
   642 	    {
   717         return;
   643 	    return;
   718         }
   644 	    }
   719 
   645 	
   720     // If container exists, we have already been activated
   646 	// If container exists, we have already been activated
   721     // Deactivate needed before new activation.
   647 	// Deactivate needed before new activation.
   722     if (iContainer)
   648 	if ( iContainer )
   723         {
   649 		{
   724         DoDeactivate();
   650 		DoDeactivate();
   725         }
   651 		}
       
   652 
   726 
   653 	// Display an empty UI container until model has been fully activated
   727 	// Display an empty UI container until model has been fully activated
   654 	iActivationContainer = new( ELeave ) CVRRecViewActivationContainer;
   728 	iActivationContainer = new( ELeave ) CVRRecViewActivationContainer;
   655 	iActivationContainer->ConstructL( ClientRect() );
   729 	iActivationContainer->ConstructL( ClientRect() );
   656 	CAknViewAppUi* appUi = AppUi();
   730 	CAknViewAppUi* appUi = AppUi();
   657 	appUi->AddToViewStackL( *this, iActivationContainer );
   731 	appUi->AddToViewStackL( *this, iActivationContainer );
   658 	iActivationContainer->ActivateL();
   732 	iActivationContainer->ActivateL();
   659 
   733 
   660 	// Activate model in correct context asynchronically.
   734     // Activate model in correct context asynchronically.
   661 	// iContainer will be activated trough callback after model activation
   735     // iContainer will be activated trough callback after model activation
   662 	TCallBack cb( ActivationCallBack, this );
   736     TCallBack cb(ActivationCallBack, this);
   663 	iModelActivator->Activate( static_cast< TVRRecViewContexts >(
   737     iModelActivator->Activate(
   664 									aCustomMessageId.iUid ), cb );
   738             static_cast<TVRRecViewContexts> (aCustomMessageId.iUid), cb);
   665 									
   739 
   666 	// Construct the real container
   740     // Construct the real container
   667 	iContainer = new( ELeave ) CVRRecViewContainer;
   741     iContainer = new (ELeave) CVRRecViewContainer;
   668 	iContainer->ConstructL( ClientRect(), iModel, iModel, iModel, this );	
   742     iContainer->ConstructL(ClientRect(), iModel, iModel, iModel, this);
   669 	iContainer->SetKeyObserver( iModel );
   743     iContainer->SetKeyObserver(iModel);
   670 	iContainer->SetVolumeChangeObserver( iModel );									
   744     iContainer->SetVolumeChangeObserver(iModel);
   671 	}
   745     }
   672 
   746 
   673 
   747 
   674 // ---------------------------------------------------------------------------
   748 // ---------------------------------------------------------------------------
   675 // CVRRecView::SetFileHandle
   749 // CVRRecView::SetFileHandle
   676 // 
   750 // 
   755 // ---------------------------------------------------------------------------
   829 // ---------------------------------------------------------------------------
   756 TVRQuality CVRRecView::Quality() const
   830 TVRQuality CVRRecView::Quality() const
   757 	{
   831 	{
   758 		return iModel->Quality();
   832 		return iModel->Quality();
   759 	}
   833 	}
       
   834 
       
   835 TInt CVRRecView::HandleUsbPlugInL()
       
   836     {
       
   837     if (EStateRecording == iModel->VisualStateId() || EStateRecordingPaused
       
   838             == iModel->VisualStateId() || EStatePlaying
       
   839             == iModel->VisualStateId() || EStatePlayingPaused
       
   840             == iModel->VisualStateId())
       
   841         {
       
   842         HandleCommandL(ECmdStop);
       
   843         }
       
   844 
       
   845     if (EStateIdleEmbedded == iModel->VisualStateId() || EStateRecordEmbedded
       
   846             == iModel->VisualStateId() || EStateIdleRecordEmbedded
       
   847             == iModel->VisualStateId())
       
   848         {
       
   849         ShowDialogForWaitUSBPluggingOutL();
       
   850         AppUi()->Exit();
       
   851         }
       
   852 
       
   853     HandleCommandL(ECmdUSBChange);
       
   854     WaitDialogForUSBPluggingOut(iUsbWaitDialog);
       
   855     return KErrNone;
       
   856     }
       
   857 
       
   858 TInt CVRRecView::HandleUsbPlugOutL()
       
   859     {
       
   860     if (iUsbWaitDialog)
       
   861         {
       
   862         iUsbWaitDialog->ProcessFinishedL();
       
   863         }
       
   864 
       
   865     HandleCommandL(ECmdUSBChange);
       
   866     return KErrNone;
       
   867     }
       
   868 
       
   869 void CVRRecView::DialogDismissedL(TInt /*aButtonId*/)
       
   870     {
       
   871     HandleCommandL(ECmdUSBChange);
       
   872     }
   760 
   873 
   761 // ---------------------------------------------------------------------------
   874 // ---------------------------------------------------------------------------
   762 // Called by UI Framework when view switches to and from foreground
   875 // Called by UI Framework when view switches to and from foreground
   763 // ---------------------------------------------------------------------------
   876 // ---------------------------------------------------------------------------
   764 /*
   877 /*