vpnui/vpnmanagementui/src/vpnuiloader.cpp
branchRCL_3
changeset 38 9f4e37332ce5
parent 12 68dc8923de26
equal deleted inserted replaced
32:352850cbed81 38:9f4e37332ce5
    26 #include <cmapplicationsettingsui.h>
    26 #include <cmapplicationsettingsui.h>
    27 #include <commdb.h>
    27 #include <commdb.h>
    28 #include <sysutil.h>
    28 #include <sysutil.h>
    29 #include <ErrorUI.h>
    29 #include <ErrorUI.h>
    30 #include <bautils.h>
    30 #include <bautils.h>
       
    31 #include <e32def.h>
    31 #include <vpnmanagementuirsc.rsg>
    32 #include <vpnmanagementuirsc.rsg>
    32 #include "vpnuiloader.h"
    33 #include "vpnuiloader.h"
    33 #include "vpnmanagementuiview.h"
    34 #include "vpnmanagementuiview.h"
    34 #include "vpnmanagementuipolicyview.h"
    35 #include "vpnmanagementuipolicyview.h"
    35 #include "vpnmanagementuiserverview.h"
    36 #include "vpnmanagementuiserverview.h"
    68 //
    69 //
    69 CVpnUiLoader::~CVpnUiLoader()
    70 CVpnUiLoader::~CVpnUiLoader()
    70     {
    71     {
    71     LOG_("CVpnUiLoader::~CVpnUiLoader()");
    72     LOG_("CVpnUiLoader::~CVpnUiLoader()");
    72     iVpnManagementUiView = NULL;
    73     iVpnManagementUiView = NULL;
    73        
    74      
    74     delete iVpnManagementUiParametersView;
       
    75     delete iVpnManagementUiServerView;
       
    76         
       
    77     if(iVersionInfoInNaviPane)
    75     if(iVersionInfoInNaviPane)
    78         {
    76         {
    79         delete iVersionInfoInNaviPane; 
    77         delete iVersionInfoInNaviPane; 
    80         }
    78         }
    81     delete iVpnApiWrapper;
    79     delete iVpnApiWrapper;
   131     iNaviPane =  static_cast<CAknNavigationControlContainer*> (
   129     iNaviPane =  static_cast<CAknNavigationControlContainer*> (
   132         statusPane->ControlL( TUid::Uid(EEikStatusPaneUidNavi) ) );
   130         statusPane->ControlL( TUid::Uid(EEikStatusPaneUidNavi) ) );
   133     
   131     
   134 	iPreviousAppViewId = aViewId;
   132 	iPreviousAppViewId = aViewId;
   135 	CreateWindowL();
   133 	CreateWindowL();
   136     iVpnManagementUiServerView = CVpnManagementUiServerView::NewL( 
   134     
   137         aRect, *this);
   135     User::LeaveIfError( iVpnExtApi.Connect() );
   138     iVpnManagementUiParametersView = CServerSettingsView::NewL( aRect, *this);
       
   139 
       
   140 	SetRect(aRect);
   136 	SetRect(aRect);
   141 
   137 
   142     LOG(Log::Printf(_L("CVpnUiLoader::ConstructL() - end\n")));
   138     LOG(Log::Printf(_L("CVpnUiLoader::ConstructL() - end\n")));
   143     }
   139     }
   144 
   140 
   184                 iPreviousViewId );
   180                 iPreviousViewId );
   185                 }
   181                 }
   186 			break;
   182 			break;
   187             }
   183             }
   188 		case KChangeViewBack:
   184 		case KChangeViewBack:
   189       ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiPolicyViewId);
   185 		    ((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiPolicyViewId);
   190 		    iPolicyViewVisited = EFalse;
   186 		    iPolicyViewVisited = EFalse;
   191 			((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiLogViewId);
   187 			((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiLogViewId);
   192 			iLogViewVisited = EFalse;
   188 			iLogViewVisited = EFalse;
   193 			((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiParametersViewId);
   189 			((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiParametersViewId);
       
   190 			iServerSettingsViewVisited = EFalse;
   194 			((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiServerViewId);
   191 			((CAknViewAppUi*)iAvkonAppUi)->RemoveView(KVpnManagementUiServerViewId);
       
   192 			iServerViewVisited = EFalse;
   195 			((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( iGsViewId.iViewUid );
   193 			((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( iGsViewId.iViewUid );
   196             if(iObserver)
   194             if(iObserver)
   197                 {
   195                 {
   198                 iObserver->UiComplete(KUirEventNone);
   196                 iObserver->UiComplete(KUirEventNone);
   199                 }
   197                 }
   227             TVwsViewId localCurrentViewId;
   225             TVwsViewId localCurrentViewId;
   228 			((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId( 
   226 			((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId( 
   229                 localCurrentViewId );
   227                 localCurrentViewId );
   230 
   228 
   231 			iPreviousViewId = localCurrentViewId.iViewUid;
   229 			iPreviousViewId = localCurrentViewId.iViewUid;
   232 
   230 			if ( iServerViewVisited == EFalse)
   233 			((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiServerView);
   231 			    {
       
   232 			    TRect rect;
       
   233 			    iVpnManagementUiServerView = CVpnManagementUiServerView::NewL( rect, *this);
       
   234 			    ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiServerView);
       
   235 			    } 
       
   236 			iServerViewVisited = ETrue;
   234 			((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( 
   237 			((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( 
   235                   KVpnManagementUiServerViewId ); 
   238                   KVpnManagementUiServerViewId ); 
   236 			break;
   239 			break;
   237             }
   240             }
   238         case KChangeViewLog: //Log view
   241         case KChangeViewLog: //Log view
   263 			TVwsViewId localCurrentViewId;
   266 			TVwsViewId localCurrentViewId;
   264 			((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId( 
   267 			((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId( 
   265                 localCurrentViewId );
   268                 localCurrentViewId );
   266 
   269 
   267 			iPreviousViewId = localCurrentViewId.iViewUid;
   270 			iPreviousViewId = localCurrentViewId.iViewUid;
   268             //Put selected server to CustomMessageId 
   271             //Put selected server to CustomMessageId
   269 			((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiParametersView);
   272 			if ( iServerSettingsViewVisited == EFalse)
       
   273 			   {
       
   274 			    TRect rect;
       
   275 			    iVpnManagementUiParametersView = CServerSettingsView::NewL( rect, *this);
       
   276 			    ((CAknViewAppUi*)iAvkonAppUi)->AddViewL(iVpnManagementUiParametersView);
       
   277 			   }
       
   278 			iServerSettingsViewVisited = ETrue;
   270 			((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(
   279 			((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(
   271                   KVpnManagementUiParametersViewId,
   280                   KVpnManagementUiParametersViewId,
   272                 TUid::Uid( aSelectionIndex), KNullDesC8 );
   281                 TUid::Uid( aSelectionIndex), KNullDesC8 );
   273 			break;
   282 			break;
   274 			}
   283 			}
   443     // very quickly. Thus, we ensure that the UI ends up in an active
   452     // very quickly. Thus, we ensure that the UI ends up in an active
   444     // state by activating the view that should be active.
   453     // state by activating the view that should be active.
   445     TVwsViewId activeViewId;
   454     TVwsViewId activeViewId;
   446     ((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(activeViewId);
   455     ((CAknViewAppUi*)iAvkonAppUi)->GetActiveViewId(activeViewId);
   447     ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(activeViewId.iViewUid);
   456     ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL(activeViewId.iViewUid);
       
   457     
       
   458     if ( !iShowWaitNote )
       
   459         {
       
   460         iVpnApiWrapper->CancelSynchronise( );
       
   461         }
   448     }
   462     }
   449 
   463 
   450 // ---------------------------------------------------------
   464 // ---------------------------------------------------------
   451 // CVpnUiLoader::ShowWaitNoteL
   465 // CVpnUiLoader::ShowWaitNoteL
   452 // ---------------------------------------------------------
   466 // ---------------------------------------------------------
   453 //
   467 //
   454 void CVpnUiLoader::ShowWaitNoteL()
   468 void CVpnUiLoader::ShowWaitNoteL()
   455     {
   469     {
   456     // Initialization (before the progress dialog is shown)
   470     // Initialization (before the progress dialog is shown)
   457     iTextToShow = EConnectingVia; // "Connecting via '%U'"
       
   458     iWaitNoteStartTime.UniversalTime();
   471     iWaitNoteStartTime.UniversalTime();
   459             
   472             
   460     if ( iWaitDialog )
   473     if ( iWaitDialog )
   461         {
   474         {
   462         delete iWaitDialog;
   475         delete iWaitDialog;
   483         {
   496         {
   484         // on error destroy wait note by force.
   497         // on error destroy wait note by force.
   485         delete iWaitDialog;
   498         delete iWaitDialog;
   486         }
   499         }
   487     iWaitDialog = NULL;
   500     iWaitDialog = NULL;
       
   501     iShowWaitNote = EFalse;
   488     }
   502     }
   489 
   503 
   490 void CVpnUiLoader::SetTextL()
   504 void CVpnUiLoader::SetTextL()
   491     {
   505     {
   492 	LOG(Log::Printf(_L("CVpnUiLoader::SetTextL()\n")));
   506 	LOG(Log::Printf(_L("CVpnUiLoader::SetTextL()\n")));
   493 
   507 
   494     TTime now;
   508        
   495     now.UniversalTime();
   509         HBufC* string = StringLoader::LoadLC( R_VPN_WAIT_IMPORTING_POLICY );
   496 
       
   497     TTimeIntervalSeconds secondsPassed;
       
   498     now.SecondsFrom(iWaitNoteStartTime, secondsPassed);
       
   499     
       
   500     if (secondsPassed.Int() < KSecondsToShowConnectingVia)
       
   501         {
       
   502         iTextToShow = EConnectingVia; //0
       
   503         }
       
   504     else
       
   505         {
       
   506         iTextToShow = EProcessingStepN; //1
       
   507         iStateCodeToShow = 0;
       
   508         }
       
   509     
       
   510     if (iTextToShow == EConnectingVia)
       
   511         {
       
   512         HBufC* string = StringLoader::LoadLC( R_VPN_CONNECTING_VIA_AP, iSelectionName );
       
   513         iWaitDialog->SetTextL( *string ); 
   510         iWaitDialog->SetTextL( *string ); 
   514         CleanupStack::PopAndDestroy( string );
   511         CleanupStack::PopAndDestroy( string );
   515         }
   512    
   516     else
       
   517         {
       
   518         HBufC* string = StringLoader::LoadLC( R_VPN_WAIT_POLICY_DL_PROCESSING, iStateCodeToShow );
       
   519         iWaitDialog->SetTextL( *string ); 
       
   520         CleanupStack::PopAndDestroy( string );
       
   521         }
       
   522     }
   513     }
   523 
   514 
   524 
   515 
   525 void CVpnUiLoader::GetSelectionNameL( TDes& aText )
   516 void CVpnUiLoader::GetSelectionNameL( TDes& aText )
   526     {
   517     {