cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnsettingsdlg.cpp
changeset 20 9c97ad6591ae
parent 18 fcbbe021d614
child 21 b8e8e15e80f2
child 23 7ec726f93df1
child 28 860702281757
equal deleted inserted replaced
18:fcbbe021d614 20:9c97ad6591ae
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Dialog for editing VPN settings for a VPN
       
    15 *                connection method
       
    16 *
       
    17 */
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <cmpluginbaseeng.h>
       
    21 #include <cmpluginvpn.mbg>
       
    22 #include <cmpluginvpnui.rsg>
       
    23 #include <AknDialog.h>
       
    24 #include <StringLoader.h>
       
    25 #include <cmmanager.rsg>
       
    26 #include <akntextsettingpage.h>
       
    27 #include <akntitle.h>
       
    28 #include <cmcommonui.h>
       
    29 #include <csxhelp/cp.hlp.hrh>
       
    30 
       
    31 #include "cmlogger.h"
       
    32 #include "cmmanagerimpl.h"
       
    33 #include "cmpluginvpn.h"
       
    34 #include "cmpvpnsettingsdlg.h"
       
    35 #include "cmvpncommonconstants.h"
       
    36 #include <cmpluginvpndef.h>
       
    37 #include "cmpvpnpolicyselectiondlg.h"
       
    38 #include <cmcommonconstants.h>
       
    39 #include <cmpsettingsconsts.h>
       
    40 #include "cmconnsettingsuiimpl.h"
       
    41 #include "cmdestinationimpl.h"
       
    42 #include "cmmanagerimpl.h"
       
    43 
       
    44 using namespace CMManager;
       
    45 
       
    46 
       
    47 // ================= MEMBER FUNCTIONS =======================================
       
    48 
       
    49 // --------------------------------------------------------------------------
       
    50 // CmPluginVpnSettingsDlg::NewL()
       
    51 // Two-phase dconstructor, second phase is ConstructAndRunLD
       
    52 // --------------------------------------------------------------------------
       
    53 //
       
    54 CmPluginVpnSettingsDlg* CmPluginVpnSettingsDlg::NewL( 
       
    55                                             CCmPluginBaseEng& aCmPluginBase )
       
    56 	{
       
    57 	CmPluginVpnSettingsDlg* self = 
       
    58 	                new ( ELeave ) CmPluginVpnSettingsDlg( aCmPluginBase );
       
    59 	return self;
       
    60 	}
       
    61 	
       
    62 // --------------------------------------------------------------------------
       
    63 // CmPluginVpnSettingsDlg::CmPluginVpnSettingsDlg()
       
    64 // --------------------------------------------------------------------------
       
    65 //
       
    66 CmPluginVpnSettingsDlg::CmPluginVpnSettingsDlg( 
       
    67                                             CCmPluginBaseEng& aCmPluginBase )
       
    68     : CmPluginBaseSettingsDlg( aCmPluginBase )
       
    69     {
       
    70     
       
    71     }
       
    72     
       
    73 //---------------------------------------------------------------------------
       
    74 // CmPluginVpnSettingsDlg::ConstructAndRunLD
       
    75 // --------------------------------------------------------------------------
       
    76 //
       
    77 TInt CmPluginVpnSettingsDlg::ConstructAndRunLD( )
       
    78     {
       
    79     LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::ConstructAndRunLD" );
       
    80     CleanupStack::PushL( this );
       
    81     LoadResourceL( KPluginVPNResDirAndFileName );
       
    82     
       
    83     // check if VPN is available, as if not, we can not show the details...
       
    84     RVpnServ ps;
       
    85     CleanupClosePushL<RVpnServ>( ps );
       
    86     TInt err = ps.Connect();
       
    87     if ( err )
       
    88         {
       
    89         // show note
       
    90         HBufC* text = StringLoader::LoadLC( 
       
    91                                     R_QTN_VPN_INFO_MGMT_UI_NOT_ACCESSIBLE );
       
    92         TCmCommonUi::ShowNoteL( *text, TCmCommonUi::ECmInfoNote );
       
    93         CleanupStack::PopAndDestroy( text );        
       
    94         User::Leave( KLeaveWithoutAlert );
       
    95         }
       
    96     CleanupStack::PopAndDestroy(); // ps.close
       
    97     
       
    98     // check for compulsory fields missing & display note about it
       
    99     // information note VPN access point is incomplete. Try reconfiguring 
       
   100     // the access point. §qtn.vpn.info.vpn.iap.incomplete§ is displayed and 
       
   101     // Must be defined qtn_selec_setting_compulsory is displayed 
       
   102     // for the invalid settings.               
       
   103     if ( !CompulsoryFilledL() )
       
   104         {
       
   105         // show note
       
   106         HBufC* text = StringLoader::LoadLC( 
       
   107                                     R_QTN_VPN_INFO_VPN_IAP_INCOMPLETE );
       
   108         TCmCommonUi::ShowNoteL( *text, TCmCommonUi::ECmInfoNote );
       
   109         CleanupStack::PopAndDestroy( text );
       
   110         }
       
   111     
       
   112     CleanupStack::Pop( this );
       
   113     
       
   114     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
       
   115     cmMgr.WatcherRegisterL( this );
       
   116     
       
   117     return CmPluginBaseSettingsDlg::ConstructAndRunLD( );
       
   118     }
       
   119 
       
   120 // --------------------------------------------------------------------------
       
   121 // CmPluginVpnSettingsDlg::~CmPluginVpnSettingsDlg
       
   122 // Destructor
       
   123 // --------------------------------------------------------------------------
       
   124 //
       
   125 CmPluginVpnSettingsDlg::~CmPluginVpnSettingsDlg()
       
   126     {
       
   127     iResourceReader.Close();
       
   128     }
       
   129     
       
   130 // --------------------------------------------------------------------------
       
   131 // CmPluginVpnSettingsDlg::UpdateListBoxContentBearerSpecificL
       
   132 // --------------------------------------------------------------------------
       
   133 //
       
   134 void CmPluginVpnSettingsDlg::UpdateListBoxContentBearerSpecificL( 
       
   135                                                     CDesCArray& aItemArray )
       
   136     {
       
   137     LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::UpdateListBoxContentBearerSpecificL" );
       
   138     HBufC* value = NULL;
       
   139         
       
   140     // VPN policy - Compulsory field
       
   141     AppendSettingTextsL( aItemArray, EVpnServicePolicyName );
       
   142     
       
   143     TUint32 iapId = iCmPluginBaseEng.GetIntAttributeL( EVpnIapId );
       
   144     TUint32 destId = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerSNAPId );
       
   145     
       
   146     CCmDestinationImpl* dest = NULL;
       
   147     
       
   148     // The underlying CM is a Destination
       
   149     if ( destId )
       
   150         {
       
   151         dest = iCmPluginBaseEng.CmMgr().DestinationL( destId );
       
   152         CleanupStack::PushL( dest );
       
   153 //        CleanupReleasePushL( dest );
       
   154         value = dest->NameLC();
       
   155         }
       
   156     // The underlying CM is a CM
       
   157     else if ( iapId )
       
   158         {
       
   159         value = iCmPluginBaseEng.CmMgr().GetConnectionMethodInfoStringL( 
       
   160                                                            iapId, ECmName );
       
   161         CleanupStack::PushL( value );
       
   162         }
       
   163     else
       
   164         {
       
   165         // Must be defined
       
   166         value = StringLoader::LoadLC( R_QTN_VPN_SETT_VPN_IAP_REAL_NETW_REF_COMPULSORY );
       
   167         }
       
   168     
       
   169     AppendSettingTextsL( aItemArray,
       
   170                          ECmNextLayerIapId,
       
   171                          R_QTN_VPN_SETT_VPN_IAP_REAL_NETW_REFERENCE,
       
   172                          *value,
       
   173                          ETrue );
       
   174     CleanupStack::PopAndDestroy( value );
       
   175 
       
   176     if ( destId )
       
   177         {
       
   178         CleanupStack::PopAndDestroy( dest );
       
   179         }
       
   180                          
       
   181     // Proxy server address
       
   182     AppendSettingTextsL( aItemArray, ECmProxyServerName );
       
   183     // Proxy port number
       
   184     AppendSettingTextsL( aItemArray, ECmProxyPortNumber );
       
   185     
       
   186     }
       
   187 
       
   188 
       
   189 // --------------------------------------------------------------------------
       
   190 // CmPluginVpnSettingsDlg::RunAdvancedSettingsL
       
   191 // --------------------------------------------------------------------------
       
   192 //
       
   193 void CmPluginVpnSettingsDlg::RunAdvancedSettingsL()
       
   194     {
       
   195     /* empty functionality */
       
   196     }
       
   197 
       
   198 // --------------------------------------------------------------------------
       
   199 // CmPluginVpnSettingsDlg::DynInitMenuPaneL
       
   200 // --------------------------------------------------------------------------
       
   201 //
       
   202 void CmPluginVpnSettingsDlg::DynInitMenuPaneL( TInt aResourceId,
       
   203                                                CEikMenuPane* aMenuPane )
       
   204    {
       
   205    if ( aResourceId == R_PLUGIN_BASE_MENU )
       
   206         {
       
   207         aMenuPane->SetItemDimmed( EPluginBaseCmdAdvanced, ETrue  );           
       
   208         }
       
   209     }
       
   210         
       
   211 // --------------------------------------------------------------------------
       
   212 // CmPluginVpnSettingsDlg::ShowPopupSettingPageL
       
   213 // --------------------------------------------------------------------------
       
   214 //
       
   215 TBool CmPluginVpnSettingsDlg::ShowPopupSettingPageL( TUint32 aAttribute, 
       
   216                                                      TInt aCommandId )
       
   217     {
       
   218     LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::ShowPopupSettingPageL" );
       
   219     TBool retVal = EFalse;
       
   220     switch ( aAttribute )
       
   221         {
       
   222         case EVpnServicePolicyName:        
       
   223             {
       
   224             CmPluginVpnPolicySelectionDlg* dlg = 
       
   225                     CmPluginVpnPolicySelectionDlg::NewL( iCmPluginBaseEng );
       
   226             CleanupStack::PushL( dlg );
       
   227             retVal = dlg->ShowPolicySelectionDlgL();
       
   228             UpdateListBoxContentL();
       
   229             CleanupStack::PopAndDestroy();
       
   230             break;
       
   231             }
       
   232         case ECmProxyServerName:
       
   233             {
       
   234             retVal = ShowPopupTextSettingPageL( aAttribute );
       
   235             break;
       
   236             }
       
   237         case EVpnIapId:
       
   238         case ECmNextLayerIapId:
       
   239             {
       
   240             ShowIapSelectionSettingPageL();
       
   241             break;
       
   242             }
       
   243         case ECmProxyPortNumber:
       
   244             {
       
   245             HBufC* proxyName = iCmPluginBaseEng.GetStringAttributeL( ECmProxyServerName );
       
   246             if( !proxyName )
       
   247                 {
       
   248                 break;
       
   249                 }
       
   250             CleanupStack::PushL( proxyName );
       
   251             if( proxyName->Length() )
       
   252                 { // Port number is allowed to set after proxy address is set.
       
   253                 retVal = ShowPopupPortNumSettingPageL( aAttribute );
       
   254                 }
       
   255             CleanupStack::PopAndDestroy(); // proxyName
       
   256             break;
       
   257             }
       
   258         default:
       
   259             {
       
   260             CmPluginBaseSettingsDlg::ShowPopupSettingPageL( aAttribute, 
       
   261                                                             aCommandId );
       
   262             break;
       
   263             }
       
   264         }
       
   265     return retVal;
       
   266     }
       
   267 
       
   268 // --------------------------------------------------------------------------
       
   269 // CmPluginVpnSettingsDlg::ShowIapSelectionSettingPageL
       
   270 // --------------------------------------------------------------------------
       
   271 //
       
   272 TBool CmPluginVpnSettingsDlg::ShowIapSelectionSettingPageL()
       
   273     {  
       
   274     LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::ShowIapSelectionSettingPageL" ); 
       
   275     TBool retVal( EFalse );
       
   276     
       
   277     CCmConnSettingsUiImpl* settings = 
       
   278                                 CCmConnSettingsUiImpl::NewL();
       
   279     CleanupStack::PushL( settings );
       
   280     settings->EnableEasyWlan( ETrue );
       
   281     settings->EnableEmptyDestinations( EFalse );
       
   282     settings->EnableVirtualCMs( EFalse );
       
   283     
       
   284     CCmDestinationImpl* d = iCmPluginBaseEng.ParentDestination();
       
   285     if ( d )
       
   286         {
       
   287         settings->SetDestinationToOmit( d->Id() );
       
   288 //        settings->EnableUncat( ETrue );
       
   289         }
       
   290     else
       
   291         {
       
   292 //        settings->EnableUncat( EFalse );
       
   293         }
       
   294     delete d;
       
   295     settings->EnableUncat( ETrue );
       
   296     
       
   297     CCmPluginVpn* plugin = static_cast<CCmPluginVpn *>
       
   298                     ( &iCmPluginBaseEng );
       
   299     
       
   300     RArray<TUint32> cmArray ( KCmArrayMediumGranularity );
       
   301     CleanupClosePushL( cmArray );
       
   302     
       
   303     plugin->BindableDestinationsL( cmArray );
       
   304     
       
   305     settings->SetDestinationArrayToUseL( cmArray );
       
   306     
       
   307     TCmSettingSelection selection;
       
   308     
       
   309     // Get the underlying CM
       
   310     selection.iId = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerIapId );
       
   311     
       
   312     if ( selection.iId )
       
   313         {
       
   314         selection.iResult = EConnectionMethod;
       
   315         }
       
   316     // The underlying CM is a destination
       
   317     else
       
   318         {        
       
   319         selection.iResult = EDestination;
       
   320         selection.iId = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerSNAPId );
       
   321         }
       
   322     
       
   323     TBearerFilterArray aFilterArray;
       
   324     if ( settings->RunApplicationSettingsL( selection,
       
   325                                             EShowDestinations |
       
   326                                             EShowConnectionMethods , 
       
   327                                             aFilterArray ) )
       
   328         {
       
   329         switch ( selection.iResult )
       
   330             {
       
   331             case EDestination:
       
   332                 {
       
   333                 iCmPluginBaseEng.SetIntAttributeL( ECmNextLayerSNAPId, selection.iId );
       
   334                 break;
       
   335                 }
       
   336             case EConnectionMethod:
       
   337                 {
       
   338                 
       
   339                 iCmPluginBaseEng.SetIntAttributeL( ECmNextLayerIapId, selection.iId );
       
   340                 break;
       
   341                 }
       
   342             default:
       
   343                 {
       
   344                 User::Leave( KErrNotSupported );
       
   345                 }
       
   346             }
       
   347         UpdateListBoxContentL();
       
   348         
       
   349         // update the title pane with the new name
       
   350         HBufC* newCmName = iCmPluginBaseEng.GetStringAttributeL( ECmName );
       
   351         CleanupStack::PushL( newCmName );
       
   352         iTitlePane->SetTextL( *newCmName );
       
   353         CleanupStack::PopAndDestroy( newCmName );
       
   354         
       
   355         retVal = ETrue;
       
   356         }
       
   357     CleanupStack::PopAndDestroy( &cmArray );
       
   358     CleanupStack::PopAndDestroy( settings );
       
   359     return retVal;
       
   360     }
       
   361 
       
   362 // --------------------------------------------------------------------------
       
   363 // CmPluginVpnSettingsDlg::ProcessCommandL
       
   364 // --------------------------------------------------------------------------
       
   365 //
       
   366 void CmPluginVpnSettingsDlg::ProcessCommandL( TInt aCommandId )
       
   367     {
       
   368     if ( MenuShowing() )
       
   369         {
       
   370         HideMenu();
       
   371         }
       
   372 
       
   373     switch ( aCommandId )
       
   374         {
       
   375         case EAknSoftkeyOk:
       
   376         case EPluginBaseCmdChange:
       
   377             {
       
   378             ShowPopupSettingPageL( 
       
   379                     iSettingIndex->At( iListbox->CurrentItemIndex() ), 
       
   380                                         aCommandId );
       
   381             break;            
       
   382             }
       
   383         case EVpnIapId:
       
   384         case ECmNextLayerIapId:
       
   385         case ECmProxyServerName:
       
   386         case ECmProxyPortNumber:
       
   387             {
       
   388             TInt attrib = iSettingIndex->At( iListbox->CurrentItemIndex() );
       
   389             ShowPopupSettingPageL( attrib, aCommandId );  
       
   390             break;
       
   391             }
       
   392         case EVpnServicePolicyName:
       
   393             {
       
   394             CmPluginVpnPolicySelectionDlg* dlg = 
       
   395                     CmPluginVpnPolicySelectionDlg::NewL( iCmPluginBaseEng );
       
   396             CleanupStack::PushL( dlg );
       
   397             if ( dlg->ShowPolicySelectionDlgL() )
       
   398                 {
       
   399                 // update the setting
       
   400                 UpdateListBoxContentL();
       
   401                 }
       
   402             // we might need to update even if not accepted
       
   403             
       
   404             CleanupStack::PopAndDestroy();
       
   405             break;
       
   406             }
       
   407         default:
       
   408             {
       
   409             CmPluginBaseSettingsDlg::ProcessCommandL( aCommandId );
       
   410             break;            
       
   411             }
       
   412         }
       
   413     }
       
   414 
       
   415 
       
   416 // --------------------------------------------------------------------------
       
   417 // CmPluginVpnSettingsDlg::CompulsoryFilledL
       
   418 // --------------------------------------------------------------------------
       
   419 //
       
   420 TBool CmPluginVpnSettingsDlg::CompulsoryFilledL()
       
   421     {
       
   422     LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::CompulsoryFilledL" );
       
   423     
       
   424     TBool retval = ETrue;
       
   425     // compulsory settings are ECmName, EVpnIapId, EVpnServicePolicy
       
   426     
       
   427     // check name first
       
   428     HBufC* name = iCmPluginBaseEng.GetStringAttributeL( ECmName );
       
   429     if ( ( name->Compare( KNullDesC() ) ) == 0 )
       
   430         {
       
   431         retval = EFalse;
       
   432         }        
       
   433     delete name;
       
   434     
       
   435     // check VPN IAP ID
       
   436     TUint32 iapid = iCmPluginBaseEng.GetIntAttributeL( EVpnIapId );
       
   437     if ( !iapid )
       
   438         {
       
   439         TUint32 nextiapid = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerIapId  );
       
   440         TUint32 snapid = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerSNAPId );
       
   441         if ( !(nextiapid ^ snapid) )
       
   442             {
       
   443             retval = EFalse;
       
   444             }
       
   445         }
       
   446         
       
   447     // check policy
       
   448     HBufC* polId = iCmPluginBaseEng.GetStringAttributeL( EVpnServicePolicy );
       
   449     if ( ( polId->Compare( KNullDesC() ) ) == 0 )
       
   450         {
       
   451         retval = EFalse;
       
   452         }
       
   453     delete polId;
       
   454 
       
   455     // check policy name
       
   456     HBufC* polname = iCmPluginBaseEng.GetStringAttributeL( EVpnServicePolicyName );
       
   457     if ( ( polname->Compare( KNullDesC() ) ) == 0 )
       
   458         {
       
   459         retval = EFalse;
       
   460         }
       
   461     delete polname;
       
   462     
       
   463     return retval;
       
   464     }
       
   465 
       
   466 
       
   467 // --------------------------------------------------------------------------
       
   468 // CmPluginVpnSettingsDlg::OkToExitL
       
   469 // Good to know : EAknSoftkeyCancel is never called, because
       
   470 // EEikDialogFlagNotifyEsc flag is not set in the resource.
       
   471 // --------------------------------------------------------------------------
       
   472 //
       
   473 TBool CmPluginVpnSettingsDlg::OkToExitL( TInt aButtonId )
       
   474     {
       
   475     // Translate the button presses into commands for the appui & current
       
   476     // view to handle
       
   477     TBool retval( EFalse );
       
   478     
       
   479     switch ( aButtonId )
       
   480         {
       
   481         case EAknSoftkeyBack:
       
   482             {
       
   483             if ( CompulsoryFilledL() )
       
   484                 {
       
   485                 if( iIsPossibleToSaveSetting && iHasSettingChanged )
       
   486                 {
       
   487                     iCmPluginBaseEng.UpdateL();
       
   488                     iHasSettingChanged = EFalse;
       
   489                 }
       
   490                 retval = ETrue;
       
   491 
       
   492                 iCmPluginBaseEng.CmMgr().WatcherUnRegister();
       
   493                 }
       
   494             else
       
   495                 {
       
   496                 // If there are compulsory fields empty, a confirmation query
       
   497                 // Incomplete VPN access point details. Exit without saving?
       
   498                 // §qtn.vpn.quest.vpn.iap.incomplete.delete§ is displayed.
       
   499                 // show note that compulsory settings are not filled
       
   500                 TInt res = TCmCommonUi::ShowConfirmationQueryL( 
       
   501                                 R_QTN_VPN_QUEST_VPN_IAP_INCOMPLETE_DELETE );
       
   502                 if ( res )
       
   503                     { // quit without save
       
   504                     retval = ETrue;
       
   505                     TUint32 id = iCmPluginBaseEng.GetIntAttributeL( ECmId );
       
   506                     iCmPluginBaseEng.RestoreAttributeL( ECmName );
       
   507                     iCmPluginBaseEng.RestoreAttributeL( EVpnServicePolicyName );
       
   508                     // EVpnServicePolicy has been restored when EVpnServicePolicyName
       
   509                     // is restored.
       
   510                     //iCmPluginBaseEng.RestoreAttributeL( EVpnServicePolicy );
       
   511                     iCmPluginBaseEng.RestoreAttributeL( EVpnIapId );
       
   512                     iCmPluginBaseEng.RestoreAttributeL( ECmNextLayerIapId );
       
   513                     iCmPluginBaseEng.RestoreAttributeL( ECmNextLayerSNAPId );
       
   514                     iCmPluginBaseEng.RestoreAttributeL( ECmProxyServerName );
       
   515                     iCmPluginBaseEng.RestoreAttributeL( ECmProxyPortNumber );
       
   516                     
       
   517                     iCmPluginBaseEng.CmMgr().WatcherUnRegister();
       
   518                     }
       
   519                 else
       
   520                     { // do not save, reconfigure
       
   521                     retval = EFalse;                    
       
   522                     }
       
   523                 }
       
   524             break;
       
   525             }
       
   526         default:
       
   527             {
       
   528             if( aButtonId == EPluginBaseCmdExit )
       
   529                 {
       
   530                 iCmPluginBaseEng.CmMgr().WatcherUnRegister();
       
   531                 }
       
   532             
       
   533             retval = CmPluginBaseSettingsDlg::OkToExitL( aButtonId );
       
   534             break;
       
   535             }
       
   536         }
       
   537 
       
   538     return retval;
       
   539     }
       
   540     
       
   541 // --------------------------------------------------------------------------
       
   542 // CmPluginVpnSettingsDlg::GetHelpContext
       
   543 // --------------------------------------------------------------------------
       
   544 //
       
   545     
       
   546 void CmPluginVpnSettingsDlg::GetHelpContext( TCoeHelpContext& aContext ) const
       
   547     {
       
   548     LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::GetHelpContext" );
       
   549     aContext.iMajor = KHelpUidPlugin;
       
   550     aContext.iContext = KSET_HLP_VPN_AP_SETTINGS_VIEW;
       
   551     }
       
   552 
       
   553 // --------------------------------------------------------------------------
       
   554 // CmPluginVpnSettingsDlg::CommsDatChangesL
       
   555 // --------------------------------------------------------------------------
       
   556 //
       
   557 void CmPluginVpnSettingsDlg::CommsDatChangesL()
       
   558     {
       
   559     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
       
   560     CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
       
   561 
       
   562     if ( parentDest )
       
   563         {
       
   564         if( !cmMgr.DestinationStillExistedL( parentDest ) )
       
   565             {
       
   566             cmMgr.WatcherUnRegister();
       
   567             // If parent destination diappears with some reason 
       
   568             // then the view must exit back to main view for it
       
   569             // may be danger if going back to parent view
       
   570             iExitReason = KDialogUserExit;
       
   571             TryExitL( iExitReason );
       
   572             
       
   573             cmMgr.RemoveDestFromPool( parentDest );
       
   574             delete parentDest;
       
   575             return;
       
   576             }
       
   577         
       
   578         if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
       
   579             {
       
   580             cmMgr.WatcherUnRegister();
       
   581             // In this case, the view can go back to the parent view
       
   582             TryExitL( iExitReason );
       
   583             
       
   584             cmMgr.RemoveDestFromPool( parentDest );
       
   585             delete parentDest;
       
   586             return;            
       
   587             }
       
   588         
       
   589         // We may have to go back to parent view even though this Iap is still in CommsDat
       
   590         // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
       
   591         // after this call when some Iap is deleted.
       
   592         cmMgr.WatcherUnRegister();
       
   593         TryExitL( iExitReason );
       
   594         
       
   595         cmMgr.RemoveDestFromPool( parentDest );
       
   596         delete parentDest;
       
   597         }
       
   598     else
       
   599         {
       
   600         if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
       
   601             {
       
   602             cmMgr.WatcherUnRegister();
       
   603             // In this case, the dialog can go back to the parent view
       
   604             TryExitL( iExitReason );
       
   605             return;
       
   606             }
       
   607         
       
   608         // We may have to go back to parent view even though this Iap is still in CommsDat
       
   609         // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
       
   610         // after this call when some Iap is deleted.
       
   611         cmMgr.WatcherUnRegister();
       
   612         TryExitL( iExitReason );
       
   613         }
       
   614     }