--- a/voicerecorder/RecViewSrc/CVRRecViewModel.cpp Fri Mar 12 15:43:04 2010 +0200
+++ b/voicerecorder/RecViewSrc/CVRRecViewModel.cpp Mon Mar 15 12:40:50 2010 +0200
@@ -1394,7 +1394,9 @@
{
case EFunctionPlay:
{
- if ( VRUtils::UnsupportedCallTypeOngoing( ETrue ) || !dynamic_cast<CVRMdaRecorder*>(iRecorder)->IsAttachedToMemo())
+ CVRMdaRecorder* iRecorderUtility = NULL;
+ iRecorderUtility = dynamic_cast<CVRMdaRecorder*>(iRecorder);
+ if ( VRUtils::UnsupportedCallTypeOngoing( ETrue ) || iRecorderUtility == NULL || !iRecorderUtility->IsAttachedToMemo())
{
return EFalse;
}
@@ -1481,6 +1483,7 @@
}
case EFunctionRecord:
{
+ CVRMdaRecorder* iRecorderUtility = NULL;
if ( VRUtils::UnsupportedCallTypeOngoing( ETrue ) )
{
return EFalse;
@@ -1493,8 +1496,12 @@
if(iCurrentCallHandler->StateL(KPSUidCtsyCallInformation,KCTsyCallState )==EPSCTsyCallStateConnected)
{
- dynamic_cast<CVRMdaRecorder*>(iRecorder)->SetAudioInputL(CAudioInput::EVoiceCall);
- dynamic_cast<CVRMdaRecorder*>(iRecorder)->ConfigSampleRateOfVoiceCallL();
+ iRecorderUtility = dynamic_cast<CVRMdaRecorder*>(iRecorder);
+ if(iRecorderUtility != NULL)
+ {
+ iRecorderUtility->SetAudioInputL(CAudioInput::EVoiceCall);
+ iRecorderUtility->ConfigSampleRateOfVoiceCallL();
+ }
}
//Audioinput can't be changed after Record
if ( iRecorder->RecordL() != KErrNone )
@@ -1540,12 +1547,17 @@
}
case EFunctionRecordNew:
{
+ CVRMdaRecorder* iRecorderUtility = NULL;
if ( VRUtils::UnsupportedCallTypeOngoing( ETrue ) )
{
return EFalse;
}
-
- dynamic_cast<CVRMdaRecorder*>(iRecorder)->SetInRecordingFlag(ETrue);
+ iRecorderUtility = dynamic_cast<CVRMdaRecorder*>(iRecorder);
+ if(iRecorderUtility == NULL)
+ {
+ return EFalse;
+ }
+ iRecorderUtility->SetInRecordingFlag(ETrue);
iCanHandleCommands = EFalse;
// Don't accept CBA commands
@@ -1565,7 +1577,7 @@
TRAP( leaveErr2, iRecorder->AttachToMemoL( iMemo ) );
}
- TBool ifAttach = dynamic_cast <CVRMdaRecorder*>(iRecorder)->IsAttachedToMemo();
+ TBool ifAttach = iRecorderUtility->IsAttachedToMemo();
if ( leaveErr1 || leaveErr2 || !ifAttach)
{
@@ -1600,15 +1612,15 @@
//TRAPD( recLeaveErr, recError = iRecorder->RecordL() );
if(iCurrentCallHandler->StateL(KPSUidCtsyCallInformation,KCTsyCallState )==EPSCTsyCallStateConnected)
{
- dynamic_cast<CVRMdaRecorder*>(iRecorder)->SetAudioInputL(CAudioInput::EVoiceCall);
- dynamic_cast<CVRMdaRecorder*>(iRecorder)->ConfigSampleRateOfVoiceCallL();
+ iRecorderUtility->SetAudioInputL(CAudioInput::EVoiceCall);
+ iRecorderUtility->ConfigSampleRateOfVoiceCallL();
}
//Change for CS call:Audio input can't be changed after Record
TRAPD( recLeaveErr, recError = iRecorder->RecordL() );
if (GetInRecordingFlag())
{
- dynamic_cast<CVRMdaRecorder*>(iRecorder)->SetInRecordingFlag(EFalse);
+ iRecorderUtility->SetInRecordingFlag(EFalse);
}
if ( recError != KErrNone || recLeaveErr )
@@ -1953,7 +1965,12 @@
{
if( iPreviousCallState == EPSCTsyCallStateConnected )
{
- dynamic_cast<CVRMdaRecorder*>(iRecorder)->SetAudioInputL(CAudioInput::EDefaultMic);
+ CVRMdaRecorder* iRecorderUtility = NULL;
+ iRecorderUtility = dynamic_cast<CVRMdaRecorder*>(iRecorder);
+ if(iRecorderUtility != NULL)
+ {
+ iRecorderUtility->SetAudioInputL(CAudioInput::EDefaultMic);
+ }
HandleCommandL( ECmdAutoStopAtEnd );
}
break;
@@ -2330,7 +2347,13 @@
{
if(iRecorder)
{
- return dynamic_cast<CVRMdaRecorder*>(iRecorder)->GetInRecordingFlag();
+ CVRMdaRecorder* iRecorderUtility = NULL;
+ iRecorderUtility = dynamic_cast<CVRMdaRecorder*>(iRecorder);
+ if(iRecorderUtility != NULL)
+ {
+ return iRecorderUtility->GetInRecordingFlag();
+ }
+ return EFalse;
}
else
{
@@ -2349,7 +2372,13 @@
{
if(iRecorder)
{
- return dynamic_cast<CVRMdaRecorder*>(iRecorder)->GetIfStopCalled();
+ CVRMdaRecorder* iRecorderUtility = NULL;
+ iRecorderUtility = dynamic_cast<CVRMdaRecorder*>(iRecorder);
+ if(iRecorderUtility != NULL)
+ {
+ return iRecorderUtility->GetIfStopCalled();
+ }
+ return EFalse;
}
else
{
@@ -2367,7 +2396,12 @@
{
if(iRecorder)
{
- return dynamic_cast<CVRMdaRecorder*>(iRecorder)->SetInRecordingFlag(aFlag);
+ CVRMdaRecorder* iRecorderUtility = NULL;
+ iRecorderUtility = dynamic_cast<CVRMdaRecorder*>(iRecorder);
+ if(iRecorderUtility != NULL)
+ {
+ return iRecorderUtility->SetInRecordingFlag(aFlag);
+ }
}
}