cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgadv.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 setting WLAN plugin advanced settings
       
    15 *
       
    16 */
       
    17 
       
    18 #include <StringLoader.h>
       
    19 #include <akntextsettingpage.h>
       
    20 #include <aknmfnesettingpage.h> // for IP dialog
       
    21 #include <cmcommonui.h>
       
    22 #include <cmwlanui.rsg>
       
    23 #include <AknQueryDialog.h>
       
    24 #include <cmpluginbaseeng.h>
       
    25 #include <cmmanager.rsg>
       
    26 #include <csxhelp/cp.hlp.hrh>
       
    27 
       
    28 #include "cmpluginwlan.h"
       
    29 #include <cmpluginwlandef.h>
       
    30 #include "cmpwlansettingsdlgadv.h"
       
    31 #include "cmpwlansettingsdlgipv4.h"
       
    32 #include "cmpwlansettingsdlgipv6.h"
       
    33 #include "cmwlancommonconstants.h"
       
    34 #include <cmpbasesettingsdlg.h>
       
    35 #include "cmpluginmenucommands.hrh"
       
    36 #include <cmcommonconstants.h>
       
    37 #include <cmpsettingsconsts.h>
       
    38 #include "cmmanagerimpl.h"
       
    39 
       
    40 using namespace CMManager;
       
    41 
       
    42 const TUint32 KAdhocChannelSelectionItems[] = 
       
    43     {
       
    44     R_QTN_WLAN_SETT_ADHOC_CHANNEL_AUTOMATIC,
       
    45     R_QTN_WLAN_SETT_ADHOC_CHANNEL_USER_DEFINED,
       
    46     0
       
    47     };
       
    48 
       
    49 // ================= MEMBER FUNCTIONS =========================================
       
    50 
       
    51 // --------------------------------------------------------------------------
       
    52 // CmPluginWlanSettingsDlgAdv::NewL()
       
    53 // Two-phase dconstructor, second phase is ConstructAndRunLD
       
    54 // --------------------------------------------------------------------------
       
    55 //
       
    56 CmPluginWlanSettingsDlgAdv* CmPluginWlanSettingsDlgAdv::NewL( 
       
    57                                             CCmPluginBaseEng& aCmPluginBase )
       
    58 	{
       
    59 	CmPluginWlanSettingsDlgAdv* self = 
       
    60 	                new (ELeave) CmPluginWlanSettingsDlgAdv( aCmPluginBase );
       
    61 	return self;
       
    62 	}
       
    63 	
       
    64 	
       
    65 // --------------------------------------------------------------------------
       
    66 // CmPluginWlanSettingsDlgAdv::ConstructAndRunLD
       
    67 // Constructs the dialog and runs it.
       
    68 // --------------------------------------------------------------------------
       
    69 //
       
    70 TInt CmPluginWlanSettingsDlgAdv::ConstructAndRunLD( )
       
    71     {
       
    72     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
       
    73     cmMgr.WatcherRegisterL( this );
       
    74     
       
    75     return CmPluginBaseSettingsDlgAdv::ConstructAndRunLD();
       
    76     }
       
    77     	
       
    78 // --------------------------------------------------------------------------
       
    79 // CmPluginWlanSettingsDlgAdv::CmPluginWlanSettingsDlgAdv()
       
    80 // --------------------------------------------------------------------------
       
    81 //
       
    82 CmPluginWlanSettingsDlgAdv::CmPluginWlanSettingsDlgAdv( 
       
    83                                         CCmPluginBaseEng& aCmPluginBase ) :
       
    84     CmPluginBaseSettingsDlgAdv( aCmPluginBase ),
       
    85     iIpv6Supported( aCmPluginBase.FeatureSupported( KFeatureIdIPv6 ) ),
       
    86     iParent( NULL )
       
    87     {
       
    88     iHelpContext = KSET_HLP_AP_SETTING_WLAN_AS;
       
    89     }
       
    90     
       
    91 // --------------------------------------------------------------------------
       
    92 // CmPluginWlanSettingsDlgAdv::~CmPluginWlanSettingsDlgAdv
       
    93 // Destructor
       
    94 // --------------------------------------------------------------------------
       
    95 //
       
    96 CmPluginWlanSettingsDlgAdv::~CmPluginWlanSettingsDlgAdv()
       
    97     {
       
    98     }
       
    99 
       
   100 // --------------------------------------------------------------------------
       
   101 // CmPluginWlanSettingsDlgAdv::UpdateListBoxContentBearerSpecificL
       
   102 // --------------------------------------------------------------------------
       
   103 //
       
   104 void CmPluginWlanSettingsDlgAdv::UpdateListBoxContentBearerSpecificL( 
       
   105                                                     CDesCArray& aItemArray )
       
   106     {
       
   107     if ( iIpv6Supported )
       
   108         {
       
   109         // IPV4 SETTINGS
       
   110         AppendSettingTextsL( aItemArray,
       
   111                              ESettingPageCmdIpv4,
       
   112                              R_QTN_SET_IPV4_SETTINGS,
       
   113                              0 );
       
   114         // IPV6 SETTINGS
       
   115         AppendSettingTextsL( aItemArray,
       
   116                              ESettingPageCmdIpv6,
       
   117                              R_QTN_SET_IPV6_SETTINGS,
       
   118                              0 );
       
   119         }
       
   120     else
       
   121         {
       
   122         // PHONE IP ADDRESS
       
   123         AppendSettingTextsL( aItemArray, EWlanIpAddr );
       
   124         HBufC* ipAddr = iCmPluginBaseEng.GetStringAttributeL( EWlanIpAddr );
       
   125         TBool isUnspec = IsUnspecifiedIPv4Address( *ipAddr );
       
   126         delete ipAddr; ipAddr = NULL;
       
   127 
       
   128         if ( !isUnspec )
       
   129             {
       
   130             // SUBNET MASK
       
   131             AppendSettingTextsL( aItemArray, EWlanIpNetMask );
       
   132             // DEFAULT GATEWAY
       
   133             AppendSettingTextsL( aItemArray, EWlanIpGateway );
       
   134             }
       
   135                 
       
   136         // PRIMARY NAME SERVER
       
   137         AppendSettingTextsL( aItemArray, EWlanIpNameServer1 );
       
   138         // SECONDARY NAME SERVER
       
   139         AppendSettingTextsL( aItemArray, EWlanIpNameServer2 );
       
   140         }
       
   141     
       
   142     // AD-HOC CHANNEL
       
   143     if ( iCmPluginBaseEng.GetIntAttributeL( EWlanConnectionMode ) == EAdhoc )
       
   144         {
       
   145         AppendSettingTextsL( aItemArray, EWlanChannelID );
       
   146         }
       
   147     
       
   148     // PROXY SERVER ADDRESS
       
   149     AppendSettingTextsL( aItemArray, ECmProxyServerName );            
       
   150     // PROXY PORT NUMBER
       
   151     AppendSettingTextsL( aItemArray, ECmProxyPortNumber );
       
   152 /*    
       
   153     TInt valResId(0);
       
   154     // Allow SSID Roaming?
       
   155 
       
   156     TBool res = iCmPluginBaseEng.GetBoolAttributeL( EWlanAllowSSIDRoaming );
       
   157     if ( res )
       
   158         {
       
   159         valResId = R_QTN_WLAN_SETT_SSID_ROAMING_ENABLED;
       
   160         }
       
   161     else
       
   162         {
       
   163         valResId = R_QTN_WLAN_SETT_SSID_ROAMING_DISABLED;
       
   164         }    
       
   165         
       
   166     AppendSettingTextsL( aItemArray, EWlanAllowSSIDRoaming, valResId  );
       
   167 */    
       
   168     }
       
   169 
       
   170 // --------------------------------------------------------------------------
       
   171 // CmPluginWlanSettingsDlgAdv::ShowPopupSettingPageL
       
   172 // --------------------------------------------------------------------------
       
   173 //
       
   174 TBool CmPluginWlanSettingsDlgAdv::ShowPopupSettingPageL( TUint32 aAttribute,
       
   175                                                          TInt aCommandId )
       
   176     {    
       
   177     TBool retval = EFalse;
       
   178     switch ( aAttribute )
       
   179         {
       
   180         case EWlanIpAddr:
       
   181         case EWlanIpNetMask:
       
   182         case EWlanIpGateway:
       
   183         case EWlanIpNameServer1:
       
   184         case EWlanIpNameServer2:        
       
   185             {
       
   186             ShowPopupIpSettingPageL( aAttribute );
       
   187             break;
       
   188             }        
       
   189         case ESettingPageCmdIpv4:                
       
   190             {
       
   191             ShowIpv4SettingPageL();
       
   192             break;
       
   193             }
       
   194         case ESettingPageCmdIpv6:                
       
   195             {
       
   196             ShowIpv6SettingPageL();
       
   197             break;
       
   198             }
       
   199         case ECmProxyServerName:                
       
   200             {
       
   201             retval = ShowPopupTextSettingPageL( aAttribute );
       
   202             break;
       
   203             }
       
   204         case ECmProxyPortNumber:                
       
   205             {
       
   206             retval = ShowPopupPortNumSettingPageL( aAttribute );
       
   207             break;
       
   208             }
       
   209         case EWlanChannelID: // may not be correct
       
   210             {
       
   211             retval = ShowAdhocChannelSettingPageL();
       
   212             break;
       
   213             }
       
   214         case EWlanAllowSSIDRoaming:
       
   215             {
       
   216 //            retval = ShowAdhocChannelSettingPageL();
       
   217             break;            
       
   218             }
       
   219         default:
       
   220             {
       
   221             CmPluginBaseSettingsDlgAdv::ShowPopupSettingPageL( aAttribute, aCommandId );
       
   222             break;            
       
   223             }
       
   224         }
       
   225     return retval;
       
   226     }
       
   227 
       
   228 // --------------------------------------------------------------------------
       
   229 // CmPluginWlanSettingsDlgAdv::ShowIpv4SettingPageL
       
   230 // --------------------------------------------------------------------------
       
   231 //
       
   232 TBool CmPluginWlanSettingsDlgAdv::ShowIpv4SettingPageL()
       
   233     {
       
   234     TInt retVal( EFalse );
       
   235     CmPluginWlanSettingsDlgIpv4* ipv4Dlg = 
       
   236                     CmPluginWlanSettingsDlgIpv4::NewL( iCmPluginBaseEng );
       
   237 
       
   238     // This view may have to un-register as watcher here
       
   239     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
       
   240     cmMgr.WatcherUnRegister();
       
   241     
       
   242     ipv4Dlg->RegisterParentView( this );
       
   243     TInt ret = ipv4Dlg->ConstructAndRunLD();
       
   244     
       
   245     if( iNotifyFromIp == KCmNotifiedNone )
       
   246         {
       
   247         if ( ret == KDialogUserExit )
       
   248             {
       
   249             retVal = ETrue;
       
   250             TryExitL( KDialogUserExit );
       
   251             }
       
   252         else
       
   253             {
       
   254             // Re-register as watcher if advanced view comes back or exists normally
       
   255             cmMgr.WatcherRegisterL( this );
       
   256             }
       
   257         }
       
   258     else
       
   259         {
       
   260         HandleCommsDatChangeL();
       
   261         }
       
   262     
       
   263     return retVal;
       
   264     }
       
   265 
       
   266 // --------------------------------------------------------------------------
       
   267 // CmPluginWlanSettingsDlgAdv::ShowIpv6SettingPageL
       
   268 // --------------------------------------------------------------------------
       
   269 //    
       
   270 TBool CmPluginWlanSettingsDlgAdv::ShowIpv6SettingPageL()
       
   271     {
       
   272     TInt retVal( EFalse );
       
   273     CmPluginWlanSettingsDlgIpv6* ipv6Dlg = 
       
   274                     CmPluginWlanSettingsDlgIpv6::NewL( iCmPluginBaseEng );
       
   275 
       
   276     // This view may have to un-register as watcher here
       
   277     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
       
   278     cmMgr.WatcherUnRegister();
       
   279  
       
   280     ipv6Dlg->RegisterParentView( this );
       
   281     TInt ret = ipv6Dlg->ConstructAndRunLD();
       
   282  
       
   283     if( iNotifyFromIp == KCmNotifiedNone )
       
   284         {
       
   285         if ( ret == KDialogUserExit )
       
   286             {
       
   287             retVal = ETrue;
       
   288             TryExitL( KDialogUserExit );
       
   289             }
       
   290         else
       
   291             {
       
   292             // Re-register as watcher if advanced view comes back or exists normally
       
   293             cmMgr.WatcherRegisterL( this );
       
   294             }
       
   295         }
       
   296     else
       
   297         {
       
   298         HandleCommsDatChangeL();
       
   299         }
       
   300     
       
   301     return retVal;
       
   302     }
       
   303 
       
   304 
       
   305 // --------------------------------------------------------------------------
       
   306 // CmPluginWlanSettingsDlgAdv::ShowAdhocChannelSettingPageL
       
   307 // --------------------------------------------------------------------------
       
   308 //    
       
   309 TBool CmPluginWlanSettingsDlgAdv::ShowAdhocChannelSettingPageL()
       
   310     {
       
   311     TInt retVal( EFalse );
       
   312     const TCmAttribConvTable* convItem = 
       
   313                         iCmPluginBaseEng.ConvTableItem( EWlanChannelID );
       
   314     const TUint32* items = KAdhocChannelSelectionItems;
       
   315     TInt value = iCmPluginBaseEng.GetIntAttributeL( EWlanChannelID );
       
   316     
       
   317     TInt selected = value ? EAdhocUserDefined : EAdhocAutomatic;
       
   318         
       
   319     // Show the dialog  
       
   320     if ( ShowRadioButtonSettingPageL( items, 
       
   321                                       selected,
       
   322                                       R_QTN_WLAN_SETT_ADHOC_CHANNEL ) )
       
   323         {
       
   324         // 'User defined' selected
       
   325         if ( selected == EAdhocUserDefined )
       
   326             {
       
   327             // if EWlanChannelID doesn't have a valid number, use the defaul
       
   328             if ( value < KCmAdhocChannelMinValue || value > KCmAdhocChannelMaxValue )
       
   329                 {
       
   330                 value = KCmAdhocChannelDefaultValue;
       
   331                 }
       
   332             
       
   333             TBool loop ( ETrue );
       
   334             
       
   335             do
       
   336                 {
       
   337                 HBufC* buf = HBufC::NewLC( convItem->iMaxLength );
       
   338                 TPtr ptr ( buf->Des() );
       
   339                 ptr.AppendNum( value );
       
   340                 
       
   341                 // Display a numeric query dialog
       
   342                 CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( ptr );
       
   343                 
       
   344                 dlg->PrepareLC( R_NUMERIC_QUERY );
       
   345                 dlg->SetMaxLength( convItem->iMaxLength );
       
   346                 dlg->SetDefaultInputMode( EAknEditorNumericInputMode );
       
   347                 dlg->MakeLeftSoftkeyVisible( EFalse );
       
   348                 
       
   349                 HBufC* prompt = StringLoader::LoadLC( 
       
   350                                                 R_QTN_WLAN_PRMPT_ADHOC_CHANNEL );
       
   351                 dlg->SetPromptL( *prompt );
       
   352                 CleanupStack::PopAndDestroy( prompt );
       
   353                 
       
   354                 // Show the popup
       
   355                 if ( dlg->RunLD() )
       
   356                     {
       
   357                     TLex lex ( ptr );
       
   358                     lex.Val( value );
       
   359                     
       
   360                     // Check valid limits
       
   361                     if ( value >= KCmAdhocChannelMinValue && 
       
   362                          value <= KCmAdhocChannelMaxValue )
       
   363                         {
       
   364                         // set result                
       
   365                         iCmPluginBaseEng.SetIntAttributeL( EWlanChannelID, value );
       
   366                         loop = EFalse;
       
   367                         UpdateListBoxContentL();
       
   368                         retVal = ETrue;
       
   369                         }
       
   370                     else
       
   371                         {
       
   372                         value = value <  KCmAdhocChannelMinValue ? 
       
   373                                          KCmAdhocChannelMinValue : 
       
   374                                          KCmAdhocChannelMaxValue;
       
   375                         }
       
   376                     }
       
   377                 else
       
   378                     {
       
   379                     loop = EFalse;
       
   380                     }
       
   381                 CleanupStack::PopAndDestroy( buf );
       
   382                 } while ( loop );
       
   383             }
       
   384         else
       
   385             {
       
   386             iCmPluginBaseEng.SetIntAttributeL( EWlanChannelID, EAdhocAutomatic );
       
   387             UpdateListBoxContentL();
       
   388             retVal = ETrue;
       
   389             }        
       
   390         }
       
   391         
       
   392     return retVal;
       
   393     }
       
   394 
       
   395 // --------------------------------------------------------------------------
       
   396 // CmPluginWlanSettingsDlgAdv::ProcessCommandL
       
   397 // --------------------------------------------------------------------------
       
   398 //
       
   399 void CmPluginWlanSettingsDlgAdv:: ProcessCommandL( TInt aCommandId )
       
   400     {
       
   401     if ( MenuShowing() )
       
   402         {
       
   403         HideMenu();
       
   404         }
       
   405 
       
   406     switch ( aCommandId )
       
   407         {
       
   408         case EPluginBaseCmdExit:
       
   409             {
       
   410             iExitReason = KDialogUserExit;
       
   411             }            
       
   412         case EAknSoftkeyBack:
       
   413             {
       
   414             CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
       
   415             cmMgr.WatcherUnRegister();
       
   416             
       
   417             HBufC* ipAddr = iCmPluginBaseEng.GetStringAttributeL( EWlanIpAddr );
       
   418             TBool isUnspec = IsUnspecifiedIPv4Address( *ipAddr );
       
   419             delete ipAddr; ipAddr = NULL;
       
   420             
       
   421             if ( !isUnspec )
       
   422                 {
       
   423                 ipAddr = iCmPluginBaseEng.GetStringAttributeL( EWlanIpNetMask );
       
   424                 TBool isUnspec1 = IsUnspecifiedIPv4Address( *ipAddr );
       
   425                 delete ipAddr;
       
   426                 ipAddr = iCmPluginBaseEng.GetStringAttributeL( EWlanIpGateway );
       
   427                 TBool isUnspec2 = IsUnspecifiedIPv4Address( *ipAddr );
       
   428                 delete ipAddr;
       
   429                 
       
   430                 if ( isUnspec1 || isUnspec2 )
       
   431                     {
       
   432                     if ( TCmCommonUi::ShowConfirmationQueryL(
       
   433                             R_QTN_NETW_QUEST_IAP_INCOMPLETE_DELETE ) )
       
   434                         {
       
   435                         iCmPluginBaseEng.RestoreAttributeL( EWlanIpAddr );
       
   436                         iCmPluginBaseEng.RestoreAttributeL( EWlanIpNetMask );
       
   437                         iCmPluginBaseEng.RestoreAttributeL( EWlanIpGateway );
       
   438                         iCmPluginBaseEng.RestoreAttributeL( EWlanIpDNSAddrFromServer );
       
   439                         TryExitL( iExitReason );
       
   440                         }
       
   441                     }
       
   442                  else
       
   443                     {
       
   444                     TryExitL( iExitReason );
       
   445                     }
       
   446                 }
       
   447             else
       
   448                 {
       
   449                 TryExitL( iExitReason );
       
   450                 }
       
   451             break;
       
   452             }  
       
   453         case EAknSoftkeyOk:                    
       
   454         case EPluginBaseCmdChange:
       
   455             {
       
   456             ShowPopupSettingPageL( 
       
   457                         iSettingIndex->At( iListbox->CurrentItemIndex() ),
       
   458                         aCommandId );
       
   459             break;
       
   460             }
       
   461         default:
       
   462             {
       
   463             CmPluginBaseSettingsDlgAdv::ProcessCommandL( aCommandId );
       
   464             break;            
       
   465             }
       
   466         }
       
   467     }
       
   468 
       
   469 // --------------------------------------------------------------------------
       
   470 // CmPluginWlanSettingsDlgAdv::OkToExitL
       
   471 // Good to know : EAknSoftkeyCancel is never called, because
       
   472 // EEikDialogFlagNotifyEsc flag is not set in the resource.
       
   473 // --------------------------------------------------------------------------
       
   474 //
       
   475 TBool CmPluginWlanSettingsDlgAdv::OkToExitL( TInt aButtonId )
       
   476     {
       
   477     // Translate the button presses into commands for the appui & current
       
   478     // view to handle
       
   479     TBool retval( EFalse );
       
   480     
       
   481     switch ( aButtonId )
       
   482         {
       
   483         case EAknSoftkeyOk:
       
   484         case EAknSoftkeyChange:
       
   485             {
       
   486             ProcessCommandL( aButtonId );
       
   487             break;
       
   488             }        
       
   489         case EAknSoftkeyBack:
       
   490             {
       
   491             ProcessCommandL( aButtonId );
       
   492             break;
       
   493             }
       
   494         case EAknSoftkeyOptions:
       
   495             {
       
   496             DisplayMenuL();
       
   497             break;
       
   498             }
       
   499         default:
       
   500             {
       
   501             retval = ETrue;
       
   502             break;
       
   503             }
       
   504         }
       
   505 
       
   506     return retval;
       
   507     }
       
   508 
       
   509 // --------------------------------------------------------------------------
       
   510 // CmPluginWlanSettingsDlgAdv::RegisterParentView
       
   511 // --------------------------------------------------------------------------
       
   512 //
       
   513 void CmPluginWlanSettingsDlgAdv::RegisterParentView( CCmParentViewNotifier* aParent )
       
   514     {
       
   515     iParent = aParent;
       
   516     }
       
   517 
       
   518 // --------------------------------------------------------------------------
       
   519 // CmPluginWlanSettingsDlgAdv::CommsDatChangesL
       
   520 // --------------------------------------------------------------------------
       
   521 //
       
   522 void CmPluginWlanSettingsDlgAdv::CommsDatChangesL()
       
   523     {
       
   524     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
       
   525     CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
       
   526 
       
   527     if ( parentDest )
       
   528         {
       
   529         if( !cmMgr.DestinationStillExistedL( parentDest ) )
       
   530             {
       
   531             if( iParent )
       
   532                 {
       
   533                 iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
       
   534                 }
       
   535             
       
   536             cmMgr.WatcherUnRegister();
       
   537             // If parent destination is deleted by somebody then the dialog must exit back to main view
       
   538             iExitReason = KDialogUserExit;
       
   539             TryExitL( iExitReason );
       
   540             
       
   541             cmMgr.RemoveDestFromPool( parentDest );
       
   542             delete parentDest;
       
   543             return;
       
   544             }
       
   545         
       
   546         if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
       
   547             {
       
   548             if( iParent )
       
   549                 {
       
   550                 iParent->NotifyParentView( KCmNotifiedIapIsNotInThisDestination );
       
   551                 }
       
   552             
       
   553             cmMgr.WatcherUnRegister();
       
   554             // In this case, the dialog can go back to the parent view
       
   555             TryExitL( iExitReason );
       
   556             
       
   557             cmMgr.RemoveDestFromPool( parentDest );
       
   558             delete parentDest;
       
   559             return;            
       
   560             }
       
   561         
       
   562         // We may have to notify parent view to go back to its parent view even though this is still in CommsDat
       
   563         // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
       
   564         // after this call when some Iap is deleted.
       
   565         if( iParent )
       
   566             {
       
   567             iParent->NotifyParentView( KCmNotifiedIapDisappear );
       
   568             }
       
   569         cmMgr.WatcherUnRegister();
       
   570         TryExitL( iExitReason );
       
   571         
       
   572         cmMgr.RemoveDestFromPool( parentDest );
       
   573         delete parentDest;
       
   574         }
       
   575     else
       
   576         {
       
   577         if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
       
   578             {
       
   579             if( iParent )
       
   580                 {
       
   581                 iParent->NotifyParentView( KCmNotifiedIapDisappear );
       
   582                 }
       
   583             
       
   584             cmMgr.WatcherUnRegister();
       
   585             // In this case, the dialog can go back to the parent view
       
   586             TryExitL( iExitReason );
       
   587             return;
       
   588             }
       
   589         
       
   590         // We may have to notify parent view to go back to its parent view even though this is still in CommsDat
       
   591         // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
       
   592         // after this call when some Iap is deleted.
       
   593         if( iParent )
       
   594             {
       
   595             iParent->NotifyParentView( KCmNotifiedIapDisappear );
       
   596             }
       
   597         cmMgr.WatcherUnRegister();
       
   598         TryExitL( iExitReason );
       
   599         }
       
   600     }
       
   601 
       
   602 // --------------------------------------------------------------------------
       
   603 // CmPluginWlanSettingsDlgAdv::NotifyParentView
       
   604 // --------------------------------------------------------------------------
       
   605 //
       
   606 void CmPluginWlanSettingsDlgAdv::NotifyParentView( TInt aValue )
       
   607     {
       
   608     iNotifyFromIp = aValue;
       
   609     
       
   610     if( iParent )
       
   611         {
       
   612         iParent->NotifyParentView( aValue );
       
   613         }
       
   614     }
       
   615 
       
   616 // --------------------------------------------------------------------------
       
   617 // CmPluginWlanSettingsDlgAdv::HandleCommsDatChangeL
       
   618 // --------------------------------------------------------------------------
       
   619 //
       
   620 void CmPluginWlanSettingsDlgAdv::HandleCommsDatChangeL()
       
   621     {    
       
   622     if( iNotifyFromIp == KCmNotifiedIapIsNotInThisDestination || 
       
   623             iNotifyFromIp == KCmNotifiedIapDisappear )
       
   624         {
       
   625         TryExitL( iExitReason );
       
   626         }
       
   627     else if( iNotifyFromIp == KCmNotifiedDestinationDisappear )
       
   628         {
       
   629         iExitReason = KDialogUserExit;
       
   630         TryExitL( iExitReason );
       
   631         }
       
   632     }