cmmanager/cmmgr/Plugins/cmpluginvpn/src/cmpvpnsettingsdlg.cpp
branchRCL_3
changeset 58 83ca720e2b9a
equal deleted inserted replaced
57:05bc53fe583b 58:83ca720e2b9a
       
     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     
       
    81     // Set this flag to allow edit continue
       
    82     iCanEditingContinue = ETrue;
       
    83     
       
    84     CleanupStack::PushL( this );
       
    85     LoadResourceL( KPluginVPNResDirAndFileName );
       
    86     
       
    87     // check if VPN is available, as if not, we can not show the details...
       
    88     RVpnServ ps;
       
    89     CleanupClosePushL<RVpnServ>( ps );
       
    90     TInt err = ps.Connect();
       
    91     if ( err )
       
    92         {
       
    93         // show note
       
    94         HBufC* text = StringLoader::LoadLC( 
       
    95                                     R_QTN_VPN_INFO_MGMT_UI_NOT_ACCESSIBLE );
       
    96         TCmCommonUi::ShowNoteL( *text, TCmCommonUi::ECmInfoNote );
       
    97         CleanupStack::PopAndDestroy( text );        
       
    98         User::Leave( KLeaveWithoutAlert );
       
    99         }
       
   100     CleanupStack::PopAndDestroy(); // ps.close
       
   101     
       
   102     // check for compulsory fields missing & display note about it
       
   103     // information note VPN access point is incomplete. Try reconfiguring 
       
   104     // the access point. §qtn.vpn.info.vpn.iap.incomplete§ is displayed and 
       
   105     // Must be defined qtn_selec_setting_compulsory is displayed 
       
   106     // for the invalid settings.               
       
   107     if ( !CompulsoryFilledL() )
       
   108         {
       
   109         // show note
       
   110         HBufC* text = StringLoader::LoadLC( 
       
   111                                     R_QTN_VPN_INFO_VPN_IAP_INCOMPLETE );
       
   112         TCmCommonUi::ShowNoteL( *text, TCmCommonUi::ECmInfoNote );
       
   113         CleanupStack::PopAndDestroy( text );
       
   114         }
       
   115     
       
   116     CleanupStack::Pop( this );
       
   117     
       
   118     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
       
   119     cmMgr.WatcherRegisterL( this );
       
   120     
       
   121     return CmPluginBaseSettingsDlg::ConstructAndRunLD( );
       
   122     }
       
   123 
       
   124 // --------------------------------------------------------------------------
       
   125 // CmPluginVpnSettingsDlg::~CmPluginVpnSettingsDlg
       
   126 // Destructor
       
   127 // --------------------------------------------------------------------------
       
   128 //
       
   129 CmPluginVpnSettingsDlg::~CmPluginVpnSettingsDlg()
       
   130     {
       
   131     iResourceReader.Close();
       
   132     }
       
   133     
       
   134 // --------------------------------------------------------------------------
       
   135 // CmPluginVpnSettingsDlg::UpdateListBoxContentBearerSpecificL
       
   136 // --------------------------------------------------------------------------
       
   137 //
       
   138 void CmPluginVpnSettingsDlg::UpdateListBoxContentBearerSpecificL( 
       
   139                                                     CDesCArray& aItemArray )
       
   140     {
       
   141     LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::UpdateListBoxContentBearerSpecificL" );
       
   142     HBufC* value = NULL;
       
   143         
       
   144     // VPN policy - Compulsory field
       
   145     AppendSettingTextsL( aItemArray, EVpnServicePolicyName );
       
   146     
       
   147     TUint32 iapId = iCmPluginBaseEng.GetIntAttributeL( EVpnIapId );
       
   148     TUint32 destId = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerSNAPId );
       
   149     
       
   150     CCmDestinationImpl* dest = NULL;
       
   151     
       
   152     // The underlying CM is a Destination
       
   153     if ( destId )
       
   154         {
       
   155         dest = iCmPluginBaseEng.CmMgr().DestinationL( destId );
       
   156         CleanupStack::PushL( dest );
       
   157 //        CleanupReleasePushL( dest );
       
   158         value = dest->NameLC();
       
   159         }
       
   160     // The underlying CM is a CM
       
   161     else if ( iapId )
       
   162         {
       
   163         value = iCmPluginBaseEng.CmMgr().GetConnectionMethodInfoStringL( 
       
   164                                                            iapId, ECmName );
       
   165         CleanupStack::PushL( value );
       
   166         }
       
   167     else
       
   168         {
       
   169         // Must be defined
       
   170         value = StringLoader::LoadLC( R_QTN_VPN_SETT_VPN_IAP_REAL_NETW_REF_COMPULSORY );
       
   171         }
       
   172     
       
   173     AppendSettingTextsL( aItemArray,
       
   174                          ECmNextLayerIapId,
       
   175                          R_QTN_VPN_SETT_VPN_IAP_REAL_NETW_REFERENCE,
       
   176                          *value,
       
   177                          ETrue );
       
   178     CleanupStack::PopAndDestroy( value );
       
   179 
       
   180     if ( destId )
       
   181         {
       
   182         CleanupStack::PopAndDestroy( dest );
       
   183         }
       
   184                          
       
   185     // Proxy server address
       
   186     AppendSettingTextsL( aItemArray, ECmProxyServerName );
       
   187     // Proxy port number
       
   188     AppendSettingTextsL( aItemArray, ECmProxyPortNumber );
       
   189     
       
   190     }
       
   191 
       
   192 
       
   193 // --------------------------------------------------------------------------
       
   194 // CmPluginVpnSettingsDlg::RunAdvancedSettingsL
       
   195 // --------------------------------------------------------------------------
       
   196 //
       
   197 void CmPluginVpnSettingsDlg::RunAdvancedSettingsL()
       
   198     {
       
   199     /* empty functionality */
       
   200     }
       
   201 
       
   202 // --------------------------------------------------------------------------
       
   203 // CmPluginVpnSettingsDlg::DynInitMenuPaneL
       
   204 // --------------------------------------------------------------------------
       
   205 //
       
   206 void CmPluginVpnSettingsDlg::DynInitMenuPaneL( TInt aResourceId,
       
   207                                                CEikMenuPane* aMenuPane )
       
   208    {
       
   209    if ( aResourceId == R_PLUGIN_BASE_MENU )
       
   210         {
       
   211         aMenuPane->SetItemDimmed( EPluginBaseCmdAdvanced, ETrue  );           
       
   212         }
       
   213     }
       
   214         
       
   215 // --------------------------------------------------------------------------
       
   216 // CmPluginVpnSettingsDlg::ShowPopupSettingPageL
       
   217 // --------------------------------------------------------------------------
       
   218 //
       
   219 TBool CmPluginVpnSettingsDlg::ShowPopupSettingPageL( TUint32 aAttribute, 
       
   220                                                      TInt aCommandId )
       
   221     {
       
   222     LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::ShowPopupSettingPageL" );
       
   223     TBool retVal = EFalse;
       
   224     switch ( aAttribute )
       
   225         {
       
   226         case EVpnServicePolicyName:        
       
   227             {
       
   228             CmPluginVpnPolicySelectionDlg* dlg = 
       
   229                     CmPluginVpnPolicySelectionDlg::NewL( iCmPluginBaseEng );
       
   230             CleanupStack::PushL( dlg );
       
   231             retVal = dlg->ShowPolicySelectionDlgL();
       
   232             UpdateListBoxContentL();
       
   233             CleanupStack::PopAndDestroy();
       
   234             break;
       
   235             }
       
   236         case ECmProxyServerName:
       
   237             {
       
   238             retVal = ShowPopupTextSettingPageL( aAttribute );
       
   239             break;
       
   240             }
       
   241         case EVpnIapId:
       
   242         case ECmNextLayerIapId:
       
   243             {
       
   244             ShowIapSelectionSettingPageL();
       
   245             break;
       
   246             }
       
   247         case ECmProxyPortNumber:
       
   248             {
       
   249             HBufC* proxyName = iCmPluginBaseEng.GetStringAttributeL( ECmProxyServerName );
       
   250             if( !proxyName )
       
   251                 {
       
   252                 break;
       
   253                 }
       
   254             CleanupStack::PushL( proxyName );
       
   255             if( proxyName->Length() )
       
   256                 { // Port number is allowed to set after proxy address is set.
       
   257                 retVal = ShowPopupPortNumSettingPageL( aAttribute );
       
   258                 }
       
   259             CleanupStack::PopAndDestroy(); // proxyName
       
   260             break;
       
   261             }
       
   262         default:
       
   263             {
       
   264             CmPluginBaseSettingsDlg::ShowPopupSettingPageL( aAttribute, 
       
   265                                                             aCommandId );
       
   266             break;
       
   267             }
       
   268         }
       
   269     return retVal;
       
   270     }
       
   271 
       
   272 // --------------------------------------------------------------------------
       
   273 // CmPluginVpnSettingsDlg::ShowIapSelectionSettingPageL
       
   274 // --------------------------------------------------------------------------
       
   275 //
       
   276 TBool CmPluginVpnSettingsDlg::ShowIapSelectionSettingPageL()
       
   277     {  
       
   278     LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::ShowIapSelectionSettingPageL" ); 
       
   279     TBool retVal( EFalse );
       
   280     
       
   281     CCmConnSettingsUiImpl* settings = 
       
   282                                 CCmConnSettingsUiImpl::NewL();
       
   283     CleanupStack::PushL( settings );
       
   284     settings->EnableEasyWlan( ETrue );
       
   285     settings->EnableEmptyDestinations( EFalse );
       
   286     settings->EnableVirtualCMs( EFalse );
       
   287     
       
   288     CCmDestinationImpl* d = iCmPluginBaseEng.ParentDestination();
       
   289     if ( d )
       
   290         {
       
   291         settings->SetDestinationToOmit( d->Id() );
       
   292 //        settings->EnableUncat( ETrue );
       
   293         }
       
   294     else
       
   295         {
       
   296 //        settings->EnableUncat( EFalse );
       
   297         }
       
   298     delete d;
       
   299     settings->EnableUncat( ETrue );
       
   300     
       
   301     CCmPluginVpn* plugin = static_cast<CCmPluginVpn *>
       
   302                     ( &iCmPluginBaseEng );
       
   303     
       
   304     RArray<TUint32> cmArray ( KCmArrayMediumGranularity );
       
   305     CleanupClosePushL( cmArray );
       
   306     
       
   307     plugin->BindableDestinationsL( cmArray );
       
   308     
       
   309     settings->SetDestinationArrayToUseL( cmArray );
       
   310     
       
   311     TCmSettingSelection selection;
       
   312     
       
   313     // Get the underlying CM
       
   314     selection.iId = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerIapId );
       
   315     
       
   316     if ( selection.iId )
       
   317         {
       
   318         selection.iResult = EConnectionMethod;
       
   319         }
       
   320     // The underlying CM is a destination
       
   321     else
       
   322         {        
       
   323         selection.iResult = EDestination;
       
   324         selection.iId = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerSNAPId );
       
   325         }
       
   326     
       
   327     TBearerFilterArray aFilterArray;
       
   328     if ( settings->RunApplicationSettingsL( selection,
       
   329                                             EShowDestinations |
       
   330                                             EShowConnectionMethods , 
       
   331                                             aFilterArray ) )
       
   332         {
       
   333         switch ( selection.iResult )
       
   334             {
       
   335             case EDestination:
       
   336                 {
       
   337                 iCmPluginBaseEng.SetIntAttributeL( ECmNextLayerSNAPId, selection.iId );
       
   338                 break;
       
   339                 }
       
   340             case EConnectionMethod:
       
   341                 {
       
   342                 
       
   343                 iCmPluginBaseEng.SetIntAttributeL( ECmNextLayerIapId, selection.iId );
       
   344                 break;
       
   345                 }
       
   346             default:
       
   347                 {
       
   348                 User::Leave( KErrNotSupported );
       
   349                 }
       
   350             }
       
   351         UpdateListBoxContentL();
       
   352         
       
   353         // update the title pane with the new name
       
   354         HBufC* newCmName = iCmPluginBaseEng.GetStringAttributeL( ECmName );
       
   355         CleanupStack::PushL( newCmName );
       
   356         iTitlePane->SetTextL( *newCmName );
       
   357         CleanupStack::PopAndDestroy( newCmName );
       
   358         
       
   359         retVal = ETrue;
       
   360         }
       
   361     CleanupStack::PopAndDestroy( &cmArray );
       
   362     CleanupStack::PopAndDestroy( settings );
       
   363     return retVal;
       
   364     }
       
   365 
       
   366 // --------------------------------------------------------------------------
       
   367 // CmPluginVpnSettingsDlg::ProcessCommandL
       
   368 // --------------------------------------------------------------------------
       
   369 //
       
   370 void CmPluginVpnSettingsDlg::ProcessCommandL( TInt aCommandId )
       
   371     {
       
   372     if ( !iCanEditingContinue )
       
   373         {
       
   374         // We have to block all editing activity if database changed by
       
   375         // other application
       
   376         return;
       
   377         }
       
   378 
       
   379     if ( MenuShowing() )
       
   380         {
       
   381         HideMenu();
       
   382         }
       
   383     
       
   384     switch ( aCommandId )
       
   385         {
       
   386         case EAknSoftkeyOk:
       
   387         case EPluginBaseCmdChange:
       
   388             {
       
   389             ShowPopupSettingPageL( 
       
   390                     iSettingIndex->At( iListbox->CurrentItemIndex() ), 
       
   391                                         aCommandId );
       
   392             break;            
       
   393             }
       
   394         case EVpnIapId:
       
   395         case ECmNextLayerIapId:
       
   396         case ECmProxyServerName:
       
   397         case ECmProxyPortNumber:
       
   398             {
       
   399             TInt attrib = iSettingIndex->At( iListbox->CurrentItemIndex() );
       
   400             ShowPopupSettingPageL( attrib, aCommandId );  
       
   401             break;
       
   402             }
       
   403         case EVpnServicePolicyName:
       
   404             {
       
   405             CmPluginVpnPolicySelectionDlg* dlg = 
       
   406                     CmPluginVpnPolicySelectionDlg::NewL( iCmPluginBaseEng );
       
   407             CleanupStack::PushL( dlg );
       
   408             if ( dlg->ShowPolicySelectionDlgL() )
       
   409                 {
       
   410                 // update the setting
       
   411                 UpdateListBoxContentL();
       
   412                 }
       
   413             // we might need to update even if not accepted
       
   414             
       
   415             CleanupStack::PopAndDestroy();
       
   416             break;
       
   417             }
       
   418         default:
       
   419             {
       
   420             CmPluginBaseSettingsDlg::ProcessCommandL( aCommandId );
       
   421             break;            
       
   422             }
       
   423         }
       
   424     }
       
   425 
       
   426 
       
   427 // --------------------------------------------------------------------------
       
   428 // CmPluginVpnSettingsDlg::CompulsoryFilledL
       
   429 // --------------------------------------------------------------------------
       
   430 //
       
   431 TBool CmPluginVpnSettingsDlg::CompulsoryFilledL()
       
   432     {
       
   433     LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::CompulsoryFilledL" );
       
   434     
       
   435     TBool retval = ETrue;
       
   436     // compulsory settings are ECmName, EVpnIapId, EVpnServicePolicy
       
   437     
       
   438     // check name first
       
   439     HBufC* name = iCmPluginBaseEng.GetStringAttributeL( ECmName );
       
   440     if ( ( name->Compare( KNullDesC() ) ) == 0 )
       
   441         {
       
   442         retval = EFalse;
       
   443         }        
       
   444     delete name;
       
   445     
       
   446     // check VPN IAP ID
       
   447     TUint32 iapid = iCmPluginBaseEng.GetIntAttributeL( EVpnIapId );
       
   448     if ( !iapid )
       
   449         {
       
   450         TUint32 nextiapid = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerIapId  );
       
   451         TUint32 snapid = iCmPluginBaseEng.GetIntAttributeL( ECmNextLayerSNAPId );
       
   452         if ( !(nextiapid ^ snapid) )
       
   453             {
       
   454             retval = EFalse;
       
   455             }
       
   456         }
       
   457         
       
   458     // check policy
       
   459     HBufC* polId = iCmPluginBaseEng.GetStringAttributeL( EVpnServicePolicy );
       
   460     if ( ( polId->Compare( KNullDesC() ) ) == 0 )
       
   461         {
       
   462         retval = EFalse;
       
   463         }
       
   464     delete polId;
       
   465 
       
   466     // check policy name
       
   467     HBufC* polname = iCmPluginBaseEng.GetStringAttributeL( EVpnServicePolicyName );
       
   468     if ( ( polname->Compare( KNullDesC() ) ) == 0 )
       
   469         {
       
   470         retval = EFalse;
       
   471         }
       
   472     delete polname;
       
   473     
       
   474     return retval;
       
   475     }
       
   476 
       
   477 
       
   478 // --------------------------------------------------------------------------
       
   479 // CmPluginVpnSettingsDlg::OkToExitL
       
   480 // Good to know : EAknSoftkeyCancel is never called, because
       
   481 // EEikDialogFlagNotifyEsc flag is not set in the resource.
       
   482 // --------------------------------------------------------------------------
       
   483 //
       
   484 TBool CmPluginVpnSettingsDlg::OkToExitL( TInt aButtonId )
       
   485     {
       
   486     // Database has been changed by other application so exit from this view
       
   487     // without update editings to database
       
   488     if ( !iCanEditingContinue )
       
   489         {
       
   490         if ( iExitReason == KDialogUserExit )
       
   491             {
       
   492             iCmPluginBaseEng.CmMgr().WatcherUnRegister();
       
   493             
       
   494             // Set iExitReason back to KDialogUserBack so as to exit from this view through else in the next call
       
   495             TInt exitValue = KDialogUserExit;
       
   496             iExitReason = KDialogUserBack;
       
   497             // If destination has been deleted by other application
       
   498             // then we may have to exit from Cmmgr
       
   499             TryExitL( exitValue );
       
   500             return EFalse;
       
   501             }
       
   502         else
       
   503             {
       
   504             // Exit from this view here to avoid possible update to databse
       
   505             return ETrue;
       
   506             }
       
   507         }
       
   508     
       
   509     // Translate the button presses into commands for the appui & current
       
   510     // view to handle
       
   511     TBool retval( EFalse );
       
   512     
       
   513     switch ( aButtonId )
       
   514         {
       
   515         case EAknSoftkeyBack:
       
   516             {
       
   517             if ( CompulsoryFilledL() )
       
   518                 {
       
   519                 if( iIsPossibleToSaveSetting && iHasSettingChanged )
       
   520                 {
       
   521                     iCmPluginBaseEng.UpdateL();
       
   522                     iHasSettingChanged = EFalse;
       
   523                 }
       
   524                 retval = ETrue;
       
   525 
       
   526                 iCmPluginBaseEng.CmMgr().WatcherUnRegister();
       
   527                 }
       
   528             else
       
   529                 {
       
   530                 // If there are compulsory fields empty, a confirmation query
       
   531                 // Incomplete VPN access point details. Exit without saving?
       
   532                 // §qtn.vpn.quest.vpn.iap.incomplete.delete§ is displayed.
       
   533                 // show note that compulsory settings are not filled
       
   534                 TInt res = TCmCommonUi::ShowConfirmationQueryL( 
       
   535                                 R_QTN_VPN_QUEST_VPN_IAP_INCOMPLETE_DELETE );
       
   536                 if ( res )
       
   537                     { // quit without save
       
   538                     retval = ETrue;
       
   539                     TUint32 id = iCmPluginBaseEng.GetIntAttributeL( ECmId );
       
   540                     iCmPluginBaseEng.RestoreAttributeL( ECmName );
       
   541                     iCmPluginBaseEng.RestoreAttributeL( EVpnServicePolicyName );
       
   542                     // EVpnServicePolicy has been restored when EVpnServicePolicyName
       
   543                     // is restored.
       
   544                     //iCmPluginBaseEng.RestoreAttributeL( EVpnServicePolicy );
       
   545                     iCmPluginBaseEng.RestoreAttributeL( EVpnIapId );
       
   546                     iCmPluginBaseEng.RestoreAttributeL( ECmNextLayerIapId );
       
   547                     iCmPluginBaseEng.RestoreAttributeL( ECmNextLayerSNAPId );
       
   548                     iCmPluginBaseEng.RestoreAttributeL( ECmProxyServerName );
       
   549                     iCmPluginBaseEng.RestoreAttributeL( ECmProxyPortNumber );
       
   550                     
       
   551                     iCmPluginBaseEng.CmMgr().WatcherUnRegister();
       
   552                     }
       
   553                 else
       
   554                     { // do not save, reconfigure
       
   555                     retval = EFalse;                    
       
   556                     }
       
   557                 }
       
   558             break;
       
   559             }
       
   560         default:
       
   561             {
       
   562             if( aButtonId == EPluginBaseCmdExit )
       
   563                 {
       
   564                 iCmPluginBaseEng.CmMgr().WatcherUnRegister();
       
   565                 }
       
   566             
       
   567             retval = CmPluginBaseSettingsDlg::OkToExitL( aButtonId );
       
   568             break;
       
   569             }
       
   570         }
       
   571 
       
   572     return retval;
       
   573     }
       
   574     
       
   575 // --------------------------------------------------------------------------
       
   576 // CmPluginVpnSettingsDlg::GetHelpContext
       
   577 // --------------------------------------------------------------------------
       
   578 //
       
   579     
       
   580 void CmPluginVpnSettingsDlg::GetHelpContext( TCoeHelpContext& aContext ) const
       
   581     {
       
   582     LOGGER_ENTERFN( "CmPluginVpnSettingsDlg::GetHelpContext" );
       
   583     aContext.iMajor = KHelpUidPlugin;
       
   584     aContext.iContext = KSET_HLP_VPN_AP_SETTINGS_VIEW;
       
   585     }
       
   586 
       
   587 // --------------------------------------------------------------------------
       
   588 // CmPluginVpnSettingsDlg::CommsDatChangesL
       
   589 // --------------------------------------------------------------------------
       
   590 //
       
   591 void CmPluginVpnSettingsDlg::CommsDatChangesL()
       
   592     {
       
   593     if ( !iCanEditingContinue )
       
   594         {
       
   595         return;
       
   596         }
       
   597     
       
   598     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
       
   599     CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
       
   600 
       
   601     if ( parentDest )
       
   602         {
       
   603         if( !cmMgr.DestinationStillExistedL( parentDest ) )
       
   604             {
       
   605             // If parent destination diappears with some reason 
       
   606             // then the view must exit back to main view for it
       
   607             // may be danger if going back to parent view
       
   608             iExitReason = KDialogUserExit;
       
   609             iCanEditingContinue = EFalse;
       
   610 
       
   611             cmMgr.RemoveDestFromPool( parentDest );
       
   612             delete parentDest;
       
   613             return;
       
   614             }
       
   615         
       
   616         // We may have to go back to parent view if database is changed by other application
       
   617         iCanEditingContinue = EFalse;
       
   618 
       
   619         cmMgr.RemoveDestFromPool( parentDest );
       
   620         delete parentDest;
       
   621         }
       
   622     else // Legacy
       
   623         {
       
   624         // We may have to go back to parent view if database is changed by other application
       
   625         iCanEditingContinue = EFalse;
       
   626         }
       
   627     }