coreapplicationuis/Rfs/src/rfsConnectionObserver.cpp
branchRCL_3
changeset 20 c2c61fdca848
parent 19 924385140d98
--- a/coreapplicationuis/Rfs/src/rfsConnectionObserver.cpp	Tue Aug 31 15:24:25 2010 +0300
+++ b/coreapplicationuis/Rfs/src/rfsConnectionObserver.cpp	Wed Sep 01 12:24:48 2010 +0100
@@ -20,12 +20,11 @@
 // SYSTEM INCLUDES
 #include <rfs.rsg>                      
 #include <PSVariables.h>
+
 #include <featmgr.h>
-#include <eikenv.h>  
 #include <centralrepository.h>
+#include <pdpcontextmanagerpskeys.h>
 #include <pdpcontextmanagerinternalcrkeys.h>
-#include <StringLoader.h> 
-
 
 
 // USER INCLUDES
@@ -107,12 +106,12 @@
     // proceed further to create a common dialog. This will be a wait for dialog which will be 
     // of synchrnous type and can only be closed inside the RunL() of this active class.
     // Provisions needed to be added to know whether this dialog needs resetting the pointer,
-    // this will be the case when dialog is actually started using 'showl()', 
+    // this will be the case when dialog is actually started using 'ExecuteLD()', 
     // Otherwise we need to delete this dialog and reset the pointer to NULL.
-   if (iIsDialogNeedToBeDisplayed)
-       {
-       iDialog = CHbDeviceProgressDialogSymbian::NewL(CHbDeviceProgressDialogSymbian::EWaitDialog);
-       }
+    if (iIsDialogNeedToBeDisplayed)
+        {
+        iWaitDialog = new( ELeave ) CAknWaitDialog(reinterpret_cast<CEikDialog**>( &iWaitDialog ) );
+        }
    
     // Now we proceed further to setting of the next state i,e, enter the state machine of this active object
     // which will start from closing of the active connections and proceed to close the other connections
@@ -175,7 +174,6 @@
         delete iRfsConTimer;
         }
     Cancel();
-    delete iWait;
     TRACES("CRfsConnectionObserver::~CRfsConnectionObserver(): End");
     }
 
@@ -218,61 +216,36 @@
     // This means that RFS has failed as there was some problem setting the P&S keys
     User::LeaveIfError(err);
     
-    // we set the flag to indicate showl is called and the dialog needs to be
+    // we set the flag to indicate ExecuteLD is called and the dialog needs to be
     // dismissed from within the RunL()
     iIsWaitForDialogExecuted = ETrue;
     // Start displaying the dialog which will then be closed form the RunL()
     // Here the code execution blocks and we will proceed further only when 
     // this dialog is canceled
-
-    HBufC* prompt = StringLoader::LoadLC( R_CLOSING_CONNECTIONS ); 
+    err = iWaitDialog->ExecuteLD( R_CLOSING_CONNECTIONS );
     
-    iDialog->SetTextL(*prompt);
-             
-    //observer interface is used since showl is aynchronous and we have to have callbacks 
-    //if cancel is pressed or dialog is closed
-    iDialog->SetObserver(this);   
-    iDialog->ShowL();
-    //activeschedulerwait is used since we want synchronous execution and control goes into 
-    //a loop here and returns to start when dialog is cancelled or closed.              
-    iWait = new (ELeave) CActiveSchedulerWait;
-    iWait->Start();
-    delete iWait;
-    iWait=NULL;
-    CleanupStack::PopAndDestroy( prompt );
-              
-    return iAllConnectionClosed;
-     }
-
-void CRfsConnectionObserver::ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian* iDialog)
-{
+    
     // following is the case when the user presses the Cancel button from the wait 
     // for dialog and in that case we need to resend the notificaiton of RFS failed
-    // to whom all we have told previous of this to close the RFS connection 
-    
-    if (iIsSipInformedForClosingAllConnection)
-                {
-             TInt    err = iSIPProperty.Set(KPSSipRfsUid, KSipRfsState, ESipRfsFailed );
-                }
-    if (iIsPDPInformedforClosingAllConnection)
-                {
-                iPDPProperty.Set(KPDPContextManager2,KPDPContextManagerFactorySettingsReset,EPDPContextManagerFactorySettingsResetStop);
-                }
-    if(iRfsConTimer)
+    // to whom all we have told previous of this to close the RFS connection
+    if (err == EEikBidCancel)
+        {
+        if (iIsSipInformedForClosingAllConnection)
+            {
+            err = iSIPProperty.Set(KPSSipRfsUid, KSipRfsState, ESipRfsFailed );
+            }
+        if (iIsPDPInformedforClosingAllConnection)
+            {
+            iPDPProperty.Set(KPDPContextManager2,KPDPContextManagerFactorySettingsReset,EPDPContextManagerFactorySettingsResetStop);
+            }
+        if(iRfsConTimer)
             {
             // Cancel the Active timer if the user cancel the Rfs operation
             iRfsConTimer->Cancel();
-            }        
-}
-
-
-void CRfsConnectionObserver::ProgressDialogClosed(const CHbDeviceProgressDialogSymbian *  iDialog)
-{
-    //this function is called when the dialog is closed ,note that the control from progressdialogcancelled  
-    //comes to ProgressDialogClosed once dialog is closed
-      iWait->AsyncStop(); //from here the control goes to iWait->start();
-}
-
+            }
+        }
+    return iAllConnectionClosed;
+    }
 
 void CRfsConnectionObserver::ReportRfsCompletionToSip()
     {
@@ -411,7 +384,7 @@
                 iAllConnectionClosed = ETrue;
                 iRfsConTimer->Cancel();                                    
                 DismissWaitDialog();
-                }
+                }                        
             }
         } // end switch-case block
     }
@@ -489,21 +462,22 @@
     {
     TRACES("CRfsConnectionObserver::DismissWaitDialog()");
     
-    if ( iDialog && iIsWaitForDialogExecuted)
+    if ( iWaitDialog && iIsWaitForDialogExecuted)
         {
-        iDialog->Close();
+        TRAP_IGNORE( iWaitDialog->ProcessFinishedL() );
         }
     
     // Sanity Check:
     // It can be a case when dialog was need to be displayed but was not due to some error
-    // this means that the 'iDialog' was constructed but never used and destroyed
-    // i.e. the showl() was never called
-   else if(iIsDialogNeedToBeDisplayed && !iIsWaitForDialogExecuted)
+    // this means that the 'iWaitDialog' was constructed but never used and destroyed
+    // i.e. the ExecuteLD() was never called
+    else if(iIsDialogNeedToBeDisplayed && !iIsWaitForDialogExecuted)
         {
-        delete iDialog;
+        delete iWaitDialog;
         }
-      // Reset the pointer to NULL
-    iDialog = NULL;
+    
+    // Reset the pointer to NULL
+    iWaitDialog = NULL;
     
     TRACES("CRfsConnectionObserver::DismissWaitDialog(): End");
     }