diff -r 41fba8bcf7b7 -r c9b63fff5abf voicerecorder/RecViewSrc/CVRRecView.cpp --- a/voicerecorder/RecViewSrc/CVRRecView.cpp Wed Sep 15 12:15:47 2010 +0300 +++ b/voicerecorder/RecViewSrc/CVRRecView.cpp Wed Oct 13 14:34:59 2010 +0300 @@ -43,8 +43,6 @@ #include #include #include -#include -#include #include "voicerecorder.hrh" #include "CVRRecView.h" @@ -118,13 +116,10 @@ // void CVRRecView::CVRRecViewModelActivator::RunL() { - if(iModel->GetIsDriveReady()) - { - // Activate model in correct context - iModel->SetMemoNameNewL( iContext == EContextRecordNewForRemote); - iModel->EnterContextL( iContext ); - iModel->ActivateL(); - } + // Activate model in correct context + iModel->SetMemoNameNewL( iContext == EContextRecordNewForRemote); + iModel->EnterContextL( iContext ); + iModel->ActivateL(); // Notify recview iCallback.CallBack(); @@ -155,101 +150,6 @@ { } -// --------------------------------------------------------------------------- -// CVRRecView::CVRRecViewDialogActivator::CVRRecViewDialogActivator -// -// --------------------------------------------------------------------------- -// -CVRRecView::CVRRecViewDialogActivator::CVRRecViewDialogActivator( CVRRecViewModel* aModel) -:CAsyncOneShot(EPriorityNormal), iModel(aModel) - { - - } - -// --------------------------------------------------------------------------- -// CVRRecView::CVRRecViewDialogActivator::~CVRRecViewDialogActivator -// -// --------------------------------------------------------------------------- -// -CVRRecView::CVRRecViewDialogActivator::~CVRRecViewDialogActivator() - { - Cancel(); - } - -// --------------------------------------------------------------------------- -// CVRRecView::CVRRecViewDialogActivator::~CVRRecViewDialogActivator -// -// --------------------------------------------------------------------------- -// -void CVRRecView::CVRRecViewDialogActivator::SetDialogType(TDialogTypeID aType) - { - iType = aType; - } - -// --------------------------------------------------------------------------- -// CVRRecView::CVRRecViewDialogActivator::SetViewContexts -// -// --------------------------------------------------------------------------- -// -void CVRRecView::CVRRecViewDialogActivator::SetViewContexts(TVRRecViewContexts aContext) - { - iContext = aContext; - } - -// --------------------------------------------------------------------------- -// CVRRecView::CVRRecViewDialogActivator::DoCancel -// -// --------------------------------------------------------------------------- -// -void CVRRecView::CVRRecViewDialogActivator::DoCancel() - { - } - -// --------------------------------------------------------------------------- -// CVRRecView::CVRRecViewNoteActivator::RunL -// -// --------------------------------------------------------------------------- -// -void CVRRecView::CVRRecViewDialogActivator::RunL() - { - if(iType == EDialogForWaitStorageCard) - { - TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL(); - while ( !VRUtils::DriveValid( (TDriveNumber) driveRemovableMassStorage ) ) - { - if (!ShowDialogForWaitStorageCardL()) - { - iModel->SendExitEvent(); - } - } - // Come to here when driveRemovableMassStorage is valid - VRUtils::SetMemoDriveL( (TDriveNumber) driveRemovableMassStorage ); - - /***** check if memory is below min value, if yes, close app*****/ - RFs& fs(CEikonEnv::Static()->FsSession()); - if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, VRUtils::MemoDriveL())) - { - HBufC* errorText = StringLoader::LoadLC( - R_VR_MEMORY_LOW_STOP_WARNING); - CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue); - dlg->ExecuteLD(*errorText); - CleanupStack::PopAndDestroy(errorText); - iModel->SendExitEvent(); - } - // check memory size end - - // To activate view model - iModel->SetMemoNameNewL( iContext == EContextRecordNewForRemote); - iModel->SetIsDriveReady(ETrue); - iModel->EnterContextL( iContext ); - iModel->ActivateL(); - } - else if(iType == EDialogForWaitUSBPluggingOut) - { - ShowDialogForWaitUSBPluggingOutL(); - iModel->SendExitEvent(); - } - } // --------------------------------------------------------------------------- // CVRRecView::NewLC @@ -286,7 +186,6 @@ delete iContainer; delete iActivationContainer; - delete iDialogActivator; delete iModel; delete iSendUi; delete iModelActivator; @@ -827,15 +726,11 @@ appUi->AddToViewStackL( *this, iActivationContainer ); iActivationContainer->ActivateL(); - iDialogActivator = new( ELeave ) CVRRecViewDialogActivator(iModel); - CheckDriveState(); - // Activate model in correct context asynchronically. // iContainer will be activated trough callback after model activation TCallBack cb(ActivationCallBack, this); - iContext = static_cast (aCustomMessageId.iUid); - iDialogActivator->SetViewContexts(iContext); - iModelActivator->Activate(iContext , cb); + iModelActivator->Activate( + static_cast (aCustomMessageId.iUid), cb); // Construct the real container iContainer = new (ELeave) CVRRecViewContainer; @@ -844,108 +739,6 @@ iContainer->SetVolumeChangeObserver(iModel); } -// --------------------------------------------------------------------------- -// CVRRecView::CheckDriveState -// -// --------------------------------------------------------------------------- -// -void CVRRecView::CheckDriveState() - { - TInt memoDrive = VRUtils::MemoDriveL(); - if (VRUtils::DriveValid(memoDrive)) - { - VRUtils::SetMemoDriveL((TDriveNumber) memoDrive); - } - else - { - TInt defaultDrive = VRUtils::DefaultMemoDriveL(); //eMMC - if (defaultDrive == memoDrive) - { - SetDriveL(); - } - else - { - if (VRUtils::DriveValid(defaultDrive)) - { - VRUtils::SetMemoDriveL((TDriveNumber) defaultDrive); - } - else - { - SetDriveL(); - } - } - } - - - if (iModel->GetIsDriveReady() && CVRUSBStateHanlder::IsUsbActive()) - { - iModel->SetIsDriveReady(EFalse); - iDialogActivator->SetDialogType(EDialogForWaitUSBPluggingOut); - iDialogActivator->Call(); - } - - - if(iModel->GetIsDriveReady()) - { - /***** check if memory is below min value, if yes, close app*****/ - RFs& fs(CEikonEnv::Static()->FsSession()); - if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, VRUtils::MemoDriveL())) - { - HBufC* errorText = StringLoader::LoadLC( - R_VR_MEMORY_LOW_STOP_WARNING); - CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue); - dlg->ExecuteLD(*errorText); - CleanupStack::PopAndDestroy(errorText); - iModel->SendExitEvent(); - } - // check memory size end - } - } - -// --------------------------------------------------------------------------- -// Make user insert the SD card, and choose SD card as the memo storage -// --------------------------------------------------------------------------- -// -void CVRRecView::SetDriveL() - { - TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL(); - if ( VRUtils::DriveValid( (TDriveNumber) driveRemovableMassStorage ) ) - { - VRUtils::SetMemoDriveL( (TDriveNumber) driveRemovableMassStorage ); - } - else - { - iModel->SetIsDriveReady(EFalse); - if (CVRUSBStateHanlder::IsUsbActive()) - { - iDialogActivator->SetDialogType(EDialogForWaitUSBPluggingOut); - iDialogActivator->Call(); - } - else - { - iDialogActivator->SetDialogType(EDialogForWaitStorageCard); - iDialogActivator->Call(); - } - } - } - -// --------------------------------------------------------------------------- -// This method show a dialog to warn user to insert the SD card. -// --------------------------------------------------------------------------- -// -TBool CVRRecView::ShowDialogForWaitStorageCardL() - { - HBufC* text = StringLoader::LoadLC( R_QTN_CCOR_INSERT_MMC ); - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - TInt result( dlg->ExecuteLD( R_INSERT_F_CARD_DIALOG, *text ) ); - CleanupStack::PopAndDestroy( text ); - - if ( result ) - { - return ETrue; - } - return EFalse; - } // --------------------------------------------------------------------------- // CVRRecView::SetFileHandle @@ -1054,18 +847,8 @@ == iModel->VisualStateId() || EStateIdleRecordEmbedded == iModel->VisualStateId()) { - if ( !iUSBConnectedDialogOpen ) - { - iUSBConnectedDialogOpen = ETrue; - TRAPD( err, ShowDialogForWaitUSBPluggingOutL() ); - iUSBConnectedDialogOpen = EFalse; - User::LeaveIfError( err ); - AppUi()->Exit(); - } - else - { - return KErrNone; - } + ShowDialogForWaitUSBPluggingOutL(); + AppUi()->Exit(); } HandleCommandL(ECmdUSBChange); @@ -1084,11 +867,6 @@ HandleCommandL(ECmdUSBChange); - - if(!VRUtils::DriveValid(VRUtils::MemoDriveL())) - { - iModel->SendExitEvent(); - } return KErrNone; }