vpnui/vpnmanagementui/src/vpnuiloader.cpp
branchRCL_3
changeset 38 9f4e37332ce5
parent 12 68dc8923de26
--- a/vpnui/vpnmanagementui/src/vpnuiloader.cpp	Mon Jun 21 16:49:56 2010 +0300
+++ b/vpnui/vpnmanagementui/src/vpnuiloader.cpp	Thu Aug 19 10:54:34 2010 +0300
@@ -28,6 +28,7 @@
 #include <sysutil.h>
 #include <ErrorUI.h>
 #include <bautils.h>
+#include <e32def.h>
 #include <vpnmanagementuirsc.rsg>
 #include "vpnuiloader.h"
 #include "vpnmanagementuiview.h"
@@ -70,10 +71,7 @@
     {
     LOG_("CVpnUiLoader::~CVpnUiLoader()");
     iVpnManagementUiView = NULL;
-       
-    delete iVpnManagementUiParametersView;
-    delete iVpnManagementUiServerView;
-        
+     
     if(iVersionInfoInNaviPane)
         {
         delete iVersionInfoInNaviPane; 
@@ -133,10 +131,8 @@
     
 	iPreviousAppViewId = aViewId;
 	CreateWindowL();
-    iVpnManagementUiServerView = CVpnManagementUiServerView::NewL( 
-        aRect, *this);
-    iVpnManagementUiParametersView = CServerSettingsView::NewL( aRect, *this);
-
+    
+    User::LeaveIfError( iVpnExtApi.Connect() );
 	SetRect(aRect);
 
     LOG(Log::Printf(_L("CVpnUiLoader::ConstructL() - end\n")));
@@ -186,12 +182,14 @@
 			break;
             }
 		case KChangeViewBack:
-      ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiPolicyViewId);
+		    ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiPolicyViewId);
 		    iPolicyViewVisited = EFalse;
 			((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiLogViewId);
 			iLogViewVisited = EFalse;
 			((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiParametersViewId);
+			iServerSettingsViewVisited = EFalse;
 			((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiServerViewId);
+			iServerViewVisited = EFalse;
 			((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( iGsViewId.iViewUid );
             if(iObserver)
                 {
@@ -229,8 +227,13 @@
                 localCurrentViewId );
 
 			iPreviousViewId = localCurrentViewId.iViewUid;
-
-			((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiServerView);
+			if ( iServerViewVisited == EFalse)
+			    {
+			    TRect rect;
+			    iVpnManagementUiServerView = CVpnManagementUiServerView::NewL( rect, *this);
+			    ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiServerView);
+			    } 
+			iServerViewVisited = ETrue;
 			((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( 
                   KVpnManagementUiServerViewId ); 
 			break;
@@ -265,8 +268,14 @@
                 localCurrentViewId );
 
 			iPreviousViewId = localCurrentViewId.iViewUid;
-            //Put selected server to CustomMessageId 
-			((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiParametersView);
+            //Put selected server to CustomMessageId
+			if ( iServerSettingsViewVisited == EFalse)
+			   {
+			    TRect rect;
+			    iVpnManagementUiParametersView = CServerSettingsView::NewL( rect, *this);
+			    ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiParametersView);
+			   }
+			iServerSettingsViewVisited = ETrue;
 			((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(
                   KVpnManagementUiParametersViewId,
                 TUid::Uid( aSelectionIndex), KNullDesC8 );
@@ -445,6 +454,11 @@
     TVwsViewId activeViewId;
     ((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(activeViewId);
     ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(activeViewId.iViewUid);
+    
+    if ( !iShowWaitNote )
+        {
+        iVpnApiWrapper->CancelSynchronise( );
+        }
     }
 
 // ---------------------------------------------------------
@@ -454,7 +468,6 @@
 void CVpnUiLoader::ShowWaitNoteL()
     {
     // Initialization (before the progress dialog is shown)
-    iTextToShow = EConnectingVia; // "Connecting via '%U'"
     iWaitNoteStartTime.UniversalTime();
             
     if ( iWaitDialog )
@@ -485,40 +498,18 @@
         delete iWaitDialog;
         }
     iWaitDialog = NULL;
+    iShowWaitNote = EFalse;
     }
 
 void CVpnUiLoader::SetTextL()
     {
 	LOG(Log::Printf(_L("CVpnUiLoader::SetTextL()\n")));
 
-    TTime now;
-    now.UniversalTime();
-
-    TTimeIntervalSeconds secondsPassed;
-    now.SecondsFrom(iWaitNoteStartTime, secondsPassed);
-    
-    if (secondsPassed.Int() < KSecondsToShowConnectingVia)
-        {
-        iTextToShow = EConnectingVia; //0
-        }
-    else
-        {
-        iTextToShow = EProcessingStepN; //1
-        iStateCodeToShow = 0;
-        }
-    
-    if (iTextToShow == EConnectingVia)
-        {
-        HBufC* string = StringLoader::LoadLC( R_VPN_CONNECTING_VIA_AP, iSelectionName );
+       
+        HBufC* string = StringLoader::LoadLC( R_VPN_WAIT_IMPORTING_POLICY );
         iWaitDialog->SetTextL( *string ); 
         CleanupStack::PopAndDestroy( string );
-        }
-    else
-        {
-        HBufC* string = StringLoader::LoadLC( R_VPN_WAIT_POLICY_DL_PROCESSING, iStateCodeToShow );
-        iWaitDialog->SetTextL( *string ); 
-        CleanupStack::PopAndDestroy( string );
-        }
+   
     }