Revision: 201021 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 09 Jun 2010 09:44:44 +0300
branchRCL_3
changeset 15 487b46c8e1a4
parent 14 f962425b9f8b
child 17 41c99112ff9d
Revision: 201021 Kit: 2010123
voicerecorder/AppSrc/CVRAppUI.cpp
voicerecorder/RecViewSrc/CVRRecView.cpp
voicerecorder/RecViewSrc/CVRRecViewModel.cpp
voicerecorder/UtilsInc/VRUSBStateHanlder.h
voicerecorder/UtilsSrc/VRUSBStateHanlder.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,
--- 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;
--- 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;
--- 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
--- 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)