connectionutilities/ConnectionDialogs/cconndlg/src/ConnDlgPlugin.cpp
branchRCL_3
changeset 55 fc7b30ed2058
parent 26 0a9e01492035
child 57 05bc53fe583b
equal deleted inserted replaced
54:984e13af52c4 55:fc7b30ed2058
     1 /*
     1 /*
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    36 #include <rmpm.h>
    36 #include <rmpm.h>
    37 #include <startupdomainpskeys.h>
    37 #include <startupdomainpskeys.h>
    38 
    38 
    39 #include <CConnDlgPlugin.rsg>
    39 #include <CConnDlgPlugin.rsg>
    40 #include <data_caging_path_literals.hrh>
    40 #include <data_caging_path_literals.hrh>
       
    41 #include <vpnapi.h>
    41 
    42 
    42 using namespace CommsDat;
    43 using namespace CommsDat;
    43 
    44 
    44 // CONSTANTS
    45 // CONSTANTS
    45 
    46 
   845         {
   846         {
   846         // Is there any active connection
   847         // Is there any active connection
   847     	err = GetActiveConnection( iap, snap, bearer );
   848     	err = GetActiveConnection( iap, snap, bearer );
   848         }
   849         }
   849                                       
   850                                       
   850     if ( ( err == KErrNone ) && 
   851     RVpnServ vpn;
       
   852     TInt vpnErr( KErrNone );
       
   853     TInt policyCount( 0 );
       
   854     TBool forceDialogForIntranetUsers( EFalse );
       
   855     
       
   856     vpnErr = vpn.Connect();
       
   857     if ( !vpnErr ) 
       
   858     	  {
       
   859     	  vpnErr = vpn.EnumeratePolicies(policyCount);
       
   860     	  if ( !vpnErr && policyCount > 0 )
       
   861     	  	  {
       
   862     	  	  forceDialogForIntranetUsers = ETrue;
       
   863     	  	  }
       
   864         vpn.Close();
       
   865         }
       
   866         
       
   867     if ( !forceDialogForIntranetUsers &&
       
   868     	 ( err == KErrNone ) && 
   851          ( iap != 0 || snap != 0 ) && 
   869          ( iap != 0 || snap != 0 ) && 
   852          ( iPrefs().iBearerSet & bearer ) &&
   870          ( iPrefs().iBearerSet & bearer ) &&
   853          ( iPrefs().iDirection == 0 ) )     // JavaVM sets iDirection to "1"
   871          ( iPrefs().iDirection == 0 ) )     // JavaVM sets iDirection to "1"
   854         {
   872         {
   855     	// a suitable connection is already active
   873     	// a suitable connection is already active