usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp
changeset 4 7e15987c4500
parent 3 47c263f7e521
child 16 d895b6d953c9
--- a/usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp	Tue Jan 26 12:55:41 2010 +0200
+++ b/usbuis/usbuinotif/src/usbuinotifmsmmerror.cpp	Tue Feb 02 00:52:37 2010 +0200
@@ -24,6 +24,7 @@
 #include <AknQueryDialog.h> 
 #include <aknnotewrappers.h>
 #include <usb/hostms/srverr.h> 
+#include <featmgr.h>
 
 #include <usbuinotif.h>                     // pck
 #include <usbuinotif.rsg>                   // Own resources
@@ -67,6 +68,8 @@
     //this virtual function call is to local CUsbUiNotifMSMMError::Cancel, 
     //not to any possibly derived class implementation. 
     Cancel();
+    delete iDialerWatcher;    
+    delete iQuery;    
     }
 
 void CUsbUiNotifMSMMError::ConstructL()
@@ -141,16 +144,28 @@
     {
     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::RunL"));
     TInt returnValue = KErrNone;
-
+    FeatureManager::InitializeLibL();
+    if ( FeatureManager::FeatureSupported( KFeatureIdFfKeypadNoSendKey ) )
+        { 
+        if (!iDialerWatcher)
+            {
+            iDialerWatcher = CUsbuinotifDialerWatcher::NewL(this);
+            }
+        }        
+    iDismissed=EFalse;
     DisableKeylock();
     SuppressAppSwitching( ETrue );
 
     //Excute dialog and check return value
     returnValue = QueryUserResponseL();
-
-    SuppressAppSwitching( EFalse );
-    RestoreKeylock();
-    CompleteMessage( returnValue );
+    if (!iDismissed)
+        {
+        SuppressAppSwitching( EFalse );
+        RestoreKeylock();
+        delete iDialerWatcher;
+        iDialerWatcher = NULL;
+        CompleteMessage( returnValue );
+        }
 
     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::RunL() completed"));
     }
@@ -163,17 +178,56 @@
 void CUsbUiNotifMSMMError::Cancel()
     {
     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel"));
+    // If dialog is not dismissed this is normal cancel and if query
+    // doesn't exsist notifier is canceled during dismission
+    if (!iDismissed || !iQuery )
+        {        
+        delete iDialerWatcher;
+        iDialerWatcher = NULL;
+        CompleteMessage( KErrCancel );
+        }        
     if (iQuery)
         {
         delete iQuery;
         iQuery = NULL;
         }
-    CompleteMessage( KErrCancel );
+
 
     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::Cancel() completed"));
     }
 
 // ----------------------------------------------------------------------------
+// CUsbUiNotifOtgError::DialerActivated
+// Release all own resources (member variables)
+// ----------------------------------------------------------------------------
+//
+void CUsbUiNotifMSMMError::DialerActivated()
+    {
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::AppKeyPressed()"));
+    if ( iQuery )
+        {
+        iDismissed=ETrue;    
+        Cancel();
+        }    
+    }
+
+// ----------------------------------------------------------------------------
+// CUsbUiNotifOtgError::ReActivateDialog
+// Release all own resources (member variables)
+// ----------------------------------------------------------------------------
+//	
+void CUsbUiNotifMSMMError::ReActivateDialog()
+    {    
+    FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::ReActivateDialog()"));
+    if ( !IsActive())
+        {
+        SetActive();
+        iStatus = KRequestPending;
+        TRequestStatus* stat = &iStatus;
+        User::RequestComplete( stat, KErrNone );
+        }
+    }	
+// ----------------------------------------------------------------------------
 // CUsbUiNotifMSMMError::QueryUserResponseL
 // Show query dialog. 
 // ----------------------------------------------------------------------------
@@ -183,9 +237,17 @@
     FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::QueryUserResponseL"));
     TInt returnValue = KErrNone;
     TInt resourceId = R_USB_QUERY_OTG_ERROR;
-
-    iQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone );
-
+    if (iDismissed)
+        {
+        iQuery = CAknQueryDialog::NewL();
+        }
+    else
+        {
+        iQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone );
+        }
+    
+    
+    iDismissed=EFalse;
     if (iCoverDisplaySupported)
         {
         iQuery->PublishDialogL( iErrorId, KUsbUiNotifMsmmError );