--- a/voicerecorder/AppSrc/CVRAppUI.cpp Fri Mar 12 15:43:04 2010 +0200
+++ b/voicerecorder/AppSrc/CVRAppUI.cpp Mon Mar 15 12:40:50 2010 +0200
@@ -269,7 +269,12 @@
// The file service needs to abort if it's still going on
if ( iEmbeddedObserver )
{
- dynamic_cast<CNewFileServiceBase*>(iEmbeddedObserver)->SetErrorCode(KErrAbort);
+ CNewFileServiceBase * iNewFileService = NULL;
+ iNewFileService = dynamic_cast<CNewFileServiceBase*>(iEmbeddedObserver);
+ if(iNewFileService != NULL)
+ {
+ iNewFileService->SetErrorCode(KErrAbort);
+ }
iEmbeddedObserver->AbortL();
}
@@ -286,7 +291,12 @@
// The file service needs to abort if it's still going on
if ( iEmbeddedObserver )
{
- dynamic_cast<CNewFileServiceBase*>(iEmbeddedObserver)->SetErrorCode(KErrAbort);
+ CNewFileServiceBase * iNewFileService = NULL;
+ iNewFileService = dynamic_cast<CNewFileServiceBase*>(iEmbeddedObserver);
+ if(iNewFileService != NULL)
+ {
+ iNewFileService->SetErrorCode(KErrAbort);
+ }
iEmbeddedObserver->AbortL();
}
--- a/voicerecorder/RecViewSrc/CVRMdaRecorder.cpp Fri Mar 12 15:43:04 2010 +0200
+++ b/voicerecorder/RecViewSrc/CVRMdaRecorder.cpp Mon Mar 15 12:40:50 2010 +0200
@@ -180,10 +180,19 @@
{
// when mmc card is used and unpluged, this error returned
- if (iMediaServerError == KErrCorrupt)
+ if (iMediaServerError == KErrCorrupt || iMediaServerError == KErrNotReady)
{
- iAudioRecorder->Close();
- dynamic_cast <CVRRecViewModel*>(iAutoStopObserver)->HandleCommandL(EEikCmdExit);
+ CVRRecViewModel* iViewModel = NULL;
+ //iAudioRecorder->Close();
+ iViewModel = dynamic_cast <CVRRecViewModel*>(iAutoStopObserver);
+ if(iViewModel != NULL)
+ {
+ iViewModel->HandleCommandL(EEikCmdExit);
+ }
+ else
+ {
+ CEikonEnv::Static()->EikAppUi()->HandleCommandL( EAknSoftkeyExit);
+ }
}
// Media server reports KErrDied if the playing was interrupted
--- a/voicerecorder/RecViewSrc/CVRMemo.cpp Fri Mar 12 15:43:04 2010 +0200
+++ b/voicerecorder/RecViewSrc/CVRMemo.cpp Mon Mar 15 12:40:50 2010 +0200
@@ -275,7 +275,30 @@
}
#endif
+
+ TFileName memoNameTemp;
+ memoNameTemp = memoName;
+ memoNameTemp.Delete(memoName.Length()-1, 1);
+ TBool boolTemp = EFalse;
+
+ TInt intTemp = BaflUtils::IsFolder( iFs, memoNameTemp, boolTemp );
+
+ if( ! boolTemp )
+ {
+ if( BaflUtils::FileExists( iFs, memoNameTemp ) )
+ {
+ if( intTemp != KErrNone )
+ {
+ User::LeaveIfError(intTemp);
+ }
+ else
+ {
+ User::LeaveIfError(iFs.Delete( memoNameTemp ));
+ }
+ }
+ }
+
// Generate unique final file name
VRUtils::GenerateUniqueFilenameL( iFs, memoName, type );
--- a/voicerecorder/RecViewSrc/CVRRecViewContainer.cpp Fri Mar 12 15:43:04 2010 +0200
+++ b/voicerecorder/RecViewSrc/CVRRecViewContainer.cpp Mon Mar 15 12:40:50 2010 +0200
@@ -478,6 +478,7 @@
}
if ( state != EDisabled )
+ if(iActiveVolumeControl != NULL)
{
iNaviPane->PushL( *iActiveVolumeControl );
CAknVolumeControl* control = static_cast< CAknVolumeControl* >(
@@ -551,7 +552,7 @@
TEventCode aType )
{
- if( !iActiveVolumeControl || !iVolumeChangeObserver->CanSetVolume() )
+ if( iActiveVolumeControl == NULL || iVolumeChangeObserver == NULL || !iVolumeChangeObserver->CanSetVolume() )
{
// Can't process volume change yet
return KErrNotReady;
@@ -659,9 +660,9 @@
{
case EEventStateChanged:
{
- if ( aControl == static_cast< CAknVolumeControl*>(iActiveVolumeControl->DecoratedControl()))
+ if ( iActiveVolumeControl && aControl == static_cast< CAknVolumeControl*>(iActiveVolumeControl->DecoratedControl()))
{
- if( !iActiveVolumeControl || !iVolumeChangeObserver->CanSetVolume() )
+ if(iVolumeChangeObserver == NULL || !iVolumeChangeObserver->CanSetVolume() )
{
// Can't process volume change yet
User::Leave(KErrNotReady);
@@ -694,6 +695,10 @@
User::Leave(KErrTooBig);
}
}
+ else if(iActiveVolumeControl == NULL)
+ {
+ User::Leave(KErrNotReady);
+ }
}
default:
break;
--- 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);
+ }
}
}