# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1276065884 -10800 # Node ID 487b46c8e1a467d2101954670532910bb030e303 # Parent f962425b9f8bc21cc6d98eabdafd34d399f17ffc Revision: 201021 Kit: 2010123 diff -r f962425b9f8b -r 487b46c8e1a4 voicerecorder/AppSrc/CVRAppUI.cpp --- a/voicerecorder/AppSrc/CVRAppUI.cpp Tue May 25 12:45:15 2010 +0300 +++ b/voicerecorder/AppSrc/CVRAppUI.cpp Wed Jun 09 09:44:44 2010 +0300 @@ -186,6 +186,12 @@ } } + if (CVRUSBStateHanlder::IsUsbActive()) + { + ShowDialogForWaitUSBPluggingOutL(); + Exit(); + } + /***** check if memory is below min value, if yes, close app*****/ RFs& fs(CEikonEnv::Static()->FsSession()); if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, diff -r f962425b9f8b -r 487b46c8e1a4 voicerecorder/RecViewSrc/CVRRecView.cpp --- a/voicerecorder/RecViewSrc/CVRRecView.cpp Tue May 25 12:45:15 2010 +0300 +++ b/voicerecorder/RecViewSrc/CVRRecView.cpp Wed Jun 09 09:44:44 2010 +0300 @@ -219,12 +219,6 @@ iModelActivator = new (ELeave) CVRRecViewModelActivator(iModel); iUSBStateHandler = CVRUSBStateHanlder::NewL(this); - - if (CVRUSBStateHanlder::IsUsbActive()) - { - ShowDialogForWaitUSBPluggingOutL(); - AppUi()->Exit(); - } } // --------------------------------------------------------------------------- @@ -385,7 +379,8 @@ aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue); } - AddSendToMenuL( aResourceId, aMenuPane ); + TRAP_IGNORE(AddSendToMenuL( aResourceId, aMenuPane )); + break; } @@ -413,7 +408,7 @@ } else { - AddSendToMenuL(aResourceId, aMenuPane); + TRAP_IGNORE(AddSendToMenuL(aResourceId, aMenuPane)); } } @@ -834,6 +829,12 @@ TInt CVRRecView::HandleUsbPlugInL() { + if(MenuBar()->IsDisplayed()) + { + MenuBar()->StopDisplayingMenuBar(); + MenuBar()->TryDisplayMenuBarL(); + } + if (EStateRecording == iModel->VisualStateId() || EStateRecordingPaused == iModel->VisualStateId() || EStatePlaying == iModel->VisualStateId() || EStatePlayingPaused @@ -851,16 +852,19 @@ } HandleCommandL(ECmdUSBChange); - WaitDialogForUSBPluggingOut(iUsbWaitDialog); + if(iUsbWaitDialog == NULL) + WaitDialogForUSBPluggingOut(iUsbWaitDialog); return KErrNone; } TInt CVRRecView::HandleUsbPlugOutL() { - if (iUsbWaitDialog) - { - iUsbWaitDialog->ProcessFinishedL(); - } + if(MenuBar()->IsDisplayed()) + { + MenuBar()->StopDisplayingMenuBar(); + MenuBar()->TryDisplayMenuBarL(); + } + HandleCommandL(ECmdUSBChange); return KErrNone; diff -r f962425b9f8b -r 487b46c8e1a4 voicerecorder/RecViewSrc/CVRRecViewModel.cpp --- a/voicerecorder/RecViewSrc/CVRRecViewModel.cpp Tue May 25 12:45:15 2010 +0300 +++ b/voicerecorder/RecViewSrc/CVRRecViewModel.cpp Wed Jun 09 09:44:44 2010 +0300 @@ -2427,7 +2427,9 @@ // Actions to take when recording TInt storageDrive = VRUtils::MemoDriveL(); - if ( storageDrive == VRUtils::GetRemovableMassStorageL() && !CVRUSBStateHanlder::IsUsbActive()) + if ( ( ( storageDrive == VRUtils::GetRemovableMassStorageL()) || + ( iMemo != NULL && iMemo->StorageDrive() == VRUtils::GetRemovableMassStorageL() ) ) && + ( !CVRUSBStateHanlder::IsUsbActive() ) ) { //exit for mmc dismount TWsEvent event; diff -r f962425b9f8b -r 487b46c8e1a4 voicerecorder/UtilsInc/VRUSBStateHanlder.h --- a/voicerecorder/UtilsInc/VRUSBStateHanlder.h Tue May 25 12:45:15 2010 +0300 +++ b/voicerecorder/UtilsInc/VRUSBStateHanlder.h Wed Jun 09 09:44:44 2010 +0300 @@ -68,6 +68,13 @@ RProperty iProperty; #endif MVRUSBStateObserver* iObserver; + enum TUSBConnectionStatus + { + EStateUninitialized, + EStateConnected, + EStateDisConnected + }; + TUSBConnectionStatus iConnectionStatus; }; #endif // VRUSBSTATEHANLDER_H diff -r f962425b9f8b -r 487b46c8e1a4 voicerecorder/UtilsSrc/VRUSBStateHanlder.cpp --- a/voicerecorder/UtilsSrc/VRUSBStateHanlder.cpp Tue May 25 12:45:15 2010 +0300 +++ b/voicerecorder/UtilsSrc/VRUSBStateHanlder.cpp Wed Jun 09 09:44:44 2010 +0300 @@ -22,7 +22,8 @@ CVRUSBStateHanlder::CVRUSBStateHanlder(MVRUSBStateObserver* aObserver) : CActive(EPriorityStandard), // Standard priority - iObserver(aObserver) + iObserver(aObserver), + iConnectionStatus(EStateUninitialized) { } @@ -83,22 +84,39 @@ { #ifdef DUMMY_USB_TESTING CDummyUSBState::HandleUSBEventL(); +#else + StartL(); #endif - if (IsUsbActive()) + + + TBool isUsbActive (IsUsbActive()); + + if (isUsbActive) { - iObserver->HandleUsbPlugInL(); + if(iConnectionStatus != EStateConnected) + { + iObserver->HandleUsbPlugInL(); + iConnectionStatus = EStateConnected; + } } else { - iObserver->HandleUsbPlugOutL(); + if(iConnectionStatus != EStateDisConnected) + { + iObserver->HandleUsbPlugOutL(); + iConnectionStatus = EStateDisConnected; + } } + #ifdef DUMMY_USB_TESTING // iStatus = KRequestPending; SetActive(); // Tell scheduler a request is active iTimer.After(iStatus, 10000000); // Set for later -#else - StartL(); + + #endif + + } TInt CVRUSBStateHanlder::RunError(TInt aError)