# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1268649650 -7200 # Node ID 49233e24b2ab9a8ca37b0b50c8eee7ac6f7ce3b0 # Parent 6aee962f6139a32faa61f856fa7a1c016be4bddd Revision: 201009 Kit: 201010 diff -r 6aee962f6139 -r 49233e24b2ab voicerecorder/AppSrc/CVRAppUI.cpp --- 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(iEmbeddedObserver)->SetErrorCode(KErrAbort); + CNewFileServiceBase * iNewFileService = NULL; + iNewFileService = dynamic_cast(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(iEmbeddedObserver)->SetErrorCode(KErrAbort); + CNewFileServiceBase * iNewFileService = NULL; + iNewFileService = dynamic_cast(iEmbeddedObserver); + if(iNewFileService != NULL) + { + iNewFileService->SetErrorCode(KErrAbort); + } iEmbeddedObserver->AbortL(); } diff -r 6aee962f6139 -r 49233e24b2ab voicerecorder/RecViewSrc/CVRMdaRecorder.cpp --- 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 (iAutoStopObserver)->HandleCommandL(EEikCmdExit); + CVRRecViewModel* iViewModel = NULL; + //iAudioRecorder->Close(); + iViewModel = dynamic_cast (iAutoStopObserver); + if(iViewModel != NULL) + { + iViewModel->HandleCommandL(EEikCmdExit); + } + else + { + CEikonEnv::Static()->EikAppUi()->HandleCommandL( EAknSoftkeyExit); + } } // Media server reports KErrDied if the playing was interrupted diff -r 6aee962f6139 -r 49233e24b2ab voicerecorder/RecViewSrc/CVRMemo.cpp --- 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 ); diff -r 6aee962f6139 -r 49233e24b2ab voicerecorder/RecViewSrc/CVRRecViewContainer.cpp --- 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; diff -r 6aee962f6139 -r 49233e24b2ab voicerecorder/RecViewSrc/CVRRecViewModel.cpp --- 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(iRecorder)->IsAttachedToMemo()) + CVRMdaRecorder* iRecorderUtility = NULL; + iRecorderUtility = dynamic_cast(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(iRecorder)->SetAudioInputL(CAudioInput::EVoiceCall); - dynamic_cast(iRecorder)->ConfigSampleRateOfVoiceCallL(); + iRecorderUtility = dynamic_cast(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(iRecorder)->SetInRecordingFlag(ETrue); + iRecorderUtility = dynamic_cast(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 (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(iRecorder)->SetAudioInputL(CAudioInput::EVoiceCall); - dynamic_cast(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(iRecorder)->SetInRecordingFlag(EFalse); + iRecorderUtility->SetInRecordingFlag(EFalse); } if ( recError != KErrNone || recLeaveErr ) @@ -1953,7 +1965,12 @@ { if( iPreviousCallState == EPSCTsyCallStateConnected ) { - dynamic_cast(iRecorder)->SetAudioInputL(CAudioInput::EDefaultMic); + CVRMdaRecorder* iRecorderUtility = NULL; + iRecorderUtility = dynamic_cast(iRecorder); + if(iRecorderUtility != NULL) + { + iRecorderUtility->SetAudioInputL(CAudioInput::EDefaultMic); + } HandleCommandL( ECmdAutoStopAtEnd ); } break; @@ -2330,7 +2347,13 @@ { if(iRecorder) { - return dynamic_cast(iRecorder)->GetInRecordingFlag(); + CVRMdaRecorder* iRecorderUtility = NULL; + iRecorderUtility = dynamic_cast(iRecorder); + if(iRecorderUtility != NULL) + { + return iRecorderUtility->GetInRecordingFlag(); + } + return EFalse; } else { @@ -2349,7 +2372,13 @@ { if(iRecorder) { - return dynamic_cast(iRecorder)->GetIfStopCalled(); + CVRMdaRecorder* iRecorderUtility = NULL; + iRecorderUtility = dynamic_cast(iRecorder); + if(iRecorderUtility != NULL) + { + return iRecorderUtility->GetIfStopCalled(); + } + return EFalse; } else { @@ -2367,7 +2396,12 @@ { if(iRecorder) { - return dynamic_cast(iRecorder)->SetInRecordingFlag(aFlag); + CVRMdaRecorder* iRecorderUtility = NULL; + iRecorderUtility = dynamic_cast(iRecorder); + if(iRecorderUtility != NULL) + { + return iRecorderUtility->SetInRecordingFlag(aFlag); + } } }