connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/SelectWLANDlg.cpp
changeset 0 5a93021fdf25
child 1 40cb640ef159
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *     Defines dialog CSelectWLANDlg from Connection Ui Utilities
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include <AknIconArray.h>
       
    23 #include <AknsUtils.h>
       
    24 #include <AknIconUtils.h>
       
    25 #include <AknWaitDialog.h>
       
    26 #include <aknnotewrappers.h>
       
    27 #include <aknnotedialog.h>
       
    28 #include <connectionuiutilities.mbg>
       
    29 #include <ConnUiUtilsNotif.rsg>
       
    30 #include <StringLoader.h>
       
    31 #include <data_caging_path_literals.hrh>
       
    32 #include <uikon/eiksrvui.h>
       
    33 #include <utf.h>
       
    34 #include <AknGlobalNote.h>
       
    35 
       
    36 #include "ConnUiUtilsNotif.hrh"
       
    37 #include "SelectWLANDlg.h"
       
    38 #include "SelectWLanDlgPlugin.h"
       
    39 #include "ConnectionDialogsLogger.h"
       
    40 #include "NetworkInfoArray.h"
       
    41 #include "wlancoveragecheck.h"
       
    42 #include "ExpiryTimer.h"
       
    43 
       
    44 // CONSTANTS
       
    45 
       
    46 #if defined(_DEBUG)
       
    47 _LIT( KErrNullPointer, "NULL pointer" );
       
    48 #endif
       
    49 
       
    50 // ROM folder
       
    51 _LIT( KDriveZ, "z:" );
       
    52 
       
    53 // Name of the MBM file containing icons
       
    54 _LIT( KFileIcons, "ConnectionUiUtilities.mbm" );
       
    55 
       
    56 
       
    57 LOCAL_D const TInt KIconsGranularity = 4;
       
    58 
       
    59 
       
    60 // ================= MEMBER FUNCTIONS =======================
       
    61 
       
    62 // Constructor
       
    63 CSelectWLANDlg::CSelectWLANDlg( CSelectWLanDlgPlugin* aPlugin, TInt aIndex,
       
    64                                 CNetworkInfoArray* *const aNetworkArray )
       
    65 : CAknListQueryDialog( &aIndex ),
       
    66   iPlugin( aPlugin ),
       
    67   iNetworkArray( aNetworkArray ),
       
    68   iFromOkToExit( EFalse )
       
    69     {
       
    70     }
       
    71 
       
    72 
       
    73 // Destructor
       
    74 CSelectWLANDlg::~CSelectWLANDlg()
       
    75     {
       
    76     CLOG_ENTERFN( "CSelectWLANDlg::~CSelectWLANDlg " ); 
       
    77     STATIC_CAST( CEikServAppUi*, 
       
    78                 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
       
    79     CLOG_LEAVEFN( "CSelectWLANDlg::~CSelectWLANDlg " );
       
    80     delete iExpiryTimer;
       
    81     }
       
    82 
       
    83 
       
    84 // ---------------------------------------------------------
       
    85 // CSelectWLANDlg::NewL
       
    86 // ---------------------------------------------------------
       
    87 //
       
    88 CSelectWLANDlg* CSelectWLANDlg::NewL( CSelectWLanDlgPlugin* aPlugin, 
       
    89                                       CNetworkInfoArray* *const aNetworkArray )
       
    90     {
       
    91     CLOG_ENTERFN( "CSelectWLANDlg::NewL " );  
       
    92     
       
    93     CSelectWLANDlg* self = new ( ELeave )CSelectWLANDlg( aPlugin, 0, 
       
    94                                                         aNetworkArray );
       
    95     CleanupStack::PushL( self );
       
    96     self->ConstructL();
       
    97     CleanupStack::Pop( self );
       
    98 
       
    99     CLOG_LEAVEFN( "CSelectWLANDlg::NewL " );  
       
   100 
       
   101     return self;
       
   102     }
       
   103 
       
   104 
       
   105 // ---------------------------------------------------------
       
   106 // CSelectWLANDlg::ConstructL
       
   107 // ---------------------------------------------------------
       
   108 //
       
   109 void CSelectWLANDlg::ConstructL()
       
   110     {
       
   111     }
       
   112     
       
   113 // ---------------------------------------------------------
       
   114 // CSelectWLANDlg::PreLayoutDynInitL()
       
   115 // called by framework before dialog is shown
       
   116 // ---------------------------------------------------------
       
   117 //
       
   118 void CSelectWLANDlg::PreLayoutDynInitL()
       
   119     {
       
   120     CLOG_ENTERFN( "CSelectWLANDlg::PreLayoutDynInitL " );  
       
   121     
       
   122     CAknListQueryDialog::PreLayoutDynInitL();
       
   123 
       
   124     SetIconsL();
       
   125     
       
   126     CLOG_WRITEF( _L( "iNetworkArray : %d" ),  *iNetworkArray );
       
   127     
       
   128     SetOwnershipType( ELbmOwnsItemArray );    
       
   129     SetItemTextArray( *iNetworkArray );
       
   130     SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   131 
       
   132     STATIC_CAST( CEikServAppUi*, 
       
   133                 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
       
   134     
       
   135     iExpiryTimer = CExpiryTimer::NewL( *this );
       
   136     iExpiryTimer->Start();
       
   137     
       
   138     CLOG_LEAVEFN( "CSelectWLANDlg::PreLayoutDynInitL " );      
       
   139     }    
       
   140     
       
   141     
       
   142 // ---------------------------------------------------------
       
   143 // CSelectWLANDlg::RefreshDialogL
       
   144 // ---------------------------------------------------------
       
   145 //    
       
   146 void CSelectWLANDlg::RefreshDialogL()
       
   147     {  
       
   148     CLOG_ENTERFN( "CSelectWLANDlg::RefreshDialogL " );  
       
   149      
       
   150     SetItemTextArray( *iNetworkArray );
       
   151     ListBox()->HandleItemAdditionL();
       
   152     
       
   153     TInt current = ListBox()->CurrentItemIndex(); 
       
   154     
       
   155     if ( current == KErrNotFound )
       
   156         {
       
   157         // Highligt has been lost since the new list is
       
   158         // shorter than the previous one. Set highligt to bottom.
       
   159         TInt bottom = ListBox()->Model()->NumberOfItems()- 1;
       
   160     	ListBox()->SetCurrentItemIndexAndDraw( bottom );
       
   161         }  
       
   162     
       
   163     Layout();   
       
   164     SizeChanged();
       
   165     DrawNow();
       
   166     
       
   167     CLOG_LEAVEFN( "CSelectWLANDlg::RefreshDialogL " );  
       
   168               
       
   169     }
       
   170 
       
   171 // ---------------------------------------------------------
       
   172 // CSelectWLANDlg::OkToExitL( TInt aButtonId)
       
   173 // called by framework when the OK button is pressed
       
   174 // ---------------------------------------------------------
       
   175 //
       
   176 TBool CSelectWLANDlg::OkToExitL( TInt aButtonId )
       
   177     {
       
   178     CLOG_ENTERFN( "CSelectWLANDlg::OkToExitL " );  
       
   179     
       
   180     TBool result( EFalse );
       
   181     if ( aButtonId == EAknSoftkeySelect || aButtonId == EAknSoftkeyOk )
       
   182         {
       
   183         __ASSERT_DEBUG( iPlugin, User::Panic( KErrNullPointer, KErrNone ) );
       
   184         
       
   185         iFromOkToExit = ETrue;
       
   186         
       
   187         TInt index = ListBox()->CurrentItemIndex();
       
   188         CNetworkInfoBase* tempNetworkItem = ( **iNetworkArray )[index ];
       
   189                 
       
   190         TWlanSsid sSID;
       
   191         if ( tempNetworkItem->OthersEntry() )
       
   192             {
       
   193             CLOG_WRITE( "tempNetworkItem->OthersEntry()" );
       
   194 
       
   195             iPlugin->StopTimer();
       
   196             
       
   197             HBufC* buff = HBufC::NewLC( KWlanMaxSsidLength );
       
   198             TPtr16 ptr( buff->Des() );
       
   199 
       
   200             CAknQueryDialog* dlg = 
       
   201                         CAknQueryDialog::NewL( ptr, CAknQueryDialog::ENoTone );
       
   202     
       
   203             if ( dlg->ExecuteLD( R_WLAN_NAME_QUERY ) )
       
   204                 {
       
   205                 CLOG_WRITE( "dlg->ExecuteLD( R_WLAN_NAME_QUERY )" );
       
   206 
       
   207                 TWlanConnectionMode nMode;
       
   208                 TWlanConnectionSecurityMode sMode;
       
   209                 TWlanConnectionExtentedSecurityMode sExtMode;
       
   210 
       
   211                 sSID.Copy( buff->Des() );       
       
   212                 CleanupStack::PopAndDestroy( buff );
       
   213 
       
   214                 iPlugin->SetEasyWlanToHiddenL( ETrue ); 
       
   215 
       
   216                 TBool protSetupSupp;
       
   217                 if ( ScanForWlanNwL( sSID, nMode, sMode, sExtMode, protSetupSupp ) )
       
   218                     {
       
   219                     CLOG_WRITEF( _L( "Protected Setup in CSelectWLANDlg::OkToExitL: %d" ), protSetupSupp );
       
   220                     CLOG_WRITE( "Setting prefs and completing" );
       
   221 
       
   222                     iPlugin->SetNetworkPrefsL( sSID, nMode, sMode, 
       
   223                                                sExtMode, protSetupSupp );
       
   224                     iPlugin->CompleteL( KErrNone );
       
   225                     }
       
   226                 else
       
   227                     {
       
   228                     HBufC* stringLabel = StringLoader::LoadLC( 
       
   229                                                     R_INFO_NO_NETWORKS_FOUND );
       
   230 
       
   231                     //RAknUiServer* globalNote = CAknSgcClient::AknSrv();
       
   232                     //if ( globalNote->Handle() )
       
   233                     //    {
       
   234                     //    globalNote->ShowGlobalNoteL( *stringLabel, 
       
   235                     //                            EAknGlobalInformationNote );
       
   236                     //    }
       
   237                         
       
   238                     CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
       
   239                     globalNote->ShowNoteL( EAknGlobalInformationNote, *stringLabel );
       
   240                     CleanupStack::PopAndDestroy( globalNote );
       
   241                         
       
   242                     CleanupStack::PopAndDestroy( stringLabel );
       
   243                     // set network prefs because we still need ssid
       
   244 
       
   245                     iPlugin->SetNetworkPrefsL( sSID, nMode, sMode, 
       
   246                                                sExtMode, protSetupSupp );
       
   247                     iPlugin->CompleteL( KErrNotFound );
       
   248                     }
       
   249                 }
       
   250             else
       
   251                 {
       
   252                 CleanupStack::PopAndDestroy( buff );
       
   253                 iPlugin->CompleteL( KErrCancel );
       
   254                 }
       
   255             }
       
   256         else
       
   257             {
       
   258             iPlugin->SetEasyWlanToHiddenL( EFalse );
       
   259   
       
   260             //sSID.Copy( tempNetworkItem->NetworkName() );
       
   261             CnvUtfConverter::ConvertFromUnicodeToUtf8( sSID, tempNetworkItem->NetworkName() );
       
   262         
       
   263             TWlanConnectionMode nMode = 
       
   264                             ( TWlanConnectionMode )tempNetworkItem->NetworkMode();
       
   265             TWlanConnectionSecurityMode sMode = tempNetworkItem->SecurityMode();
       
   266             TWlanConnectionExtentedSecurityMode sExtMode = tempNetworkItem->ExtendedSecurityMode();
       
   267             
       
   268             // ADHOC is supported only with security modes: open and WEP.
       
   269             if ( nMode == EWlanConnectionModeAdhoc && 
       
   270                  ( sMode != EWlanConnectionSecurityOpen &&
       
   271                    sMode != EWlanConnectionSecurityWep) )
       
   272                 {
       
   273                 ShowInfoNoteL( R_CONNUIUTILITIES_NOT_SUPPORTED );
       
   274                 CLOG_LEAVEFN( "CSelectWLANDlg::OkToExitL " );  
       
   275                 return EFalse;
       
   276                 }
       
   277                 
       
   278             iPlugin->StopTimer();    
       
   279 
       
   280             TBool protSetupSupp = tempNetworkItem->ProtectedSetupSupported();
       
   281      
       
   282             CLOG_WRITEF( _L( "Protected Setup in CSelectWLANDlg::OkToExitL: %d" ), protSetupSupp );
       
   283             iPlugin->SetNetworkPrefsL( sSID, nMode, sMode, sExtMode, protSetupSupp );
       
   284             iPlugin->CompleteL( KErrNone );
       
   285             }
       
   286         
       
   287         result =  ETrue;
       
   288         }
       
   289     else if ( aButtonId == EAknSoftkeyCancel )
       
   290         {
       
   291         if ( iFromOkToExit )
       
   292             {
       
   293             // ssid query dialog is open
       
   294             result =  EFalse; 
       
   295             }
       
   296         else
       
   297             {
       
   298             iFromOkToExit = ETrue;
       
   299         
       
   300             iPlugin->StopTimer();
       
   301             iPlugin->CompleteL( KErrCancel );
       
   302 
       
   303             result =  ETrue;    
       
   304             }
       
   305         }
       
   306 
       
   307     CLOG_LEAVEFN( "CSelectWLANDlg::OkToExitL " );  
       
   308 
       
   309     return result;
       
   310     }
       
   311 
       
   312 
       
   313 // ---------------------------------------------------------
       
   314 // CSelectWLANDlg::SetIconsL()
       
   315 // ---------------------------------------------------------
       
   316 //
       
   317 void CSelectWLANDlg::SetIconsL()
       
   318     {
       
   319     // Don't change the order of the icons, or if anything should be 
       
   320     // added/removed, then also enum TIconType in ConnUiUtilsNotif.hrh should 
       
   321     // be updated!
       
   322 
       
   323     CLOG_ENTERFN( "CSelectWLANDlg::SetIconsL " ); 
       
   324     
       
   325     CFbsBitmap* bitmap = NULL;
       
   326     CFbsBitmap* mask = NULL;         
       
   327     
       
   328     CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( 
       
   329                                                         KIconsGranularity );
       
   330     CleanupStack::PushL( icons );
       
   331 
       
   332     MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
       
   333 
       
   334     TFileName iconsFileName;
       
   335 
       
   336     iconsFileName.Append( KDriveZ );
       
   337 
       
   338     iconsFileName.Append( KDC_APP_BITMAP_DIR );
       
   339 
       
   340     iconsFileName.Append( KFileIcons );
       
   341     
       
   342     CLOG_WRITEF( _L( "iconsFileName : %S" ),  &iconsFileName );
       
   343     
       
   344     CGulIcon* icon = CGulIcon::NewLC();
       
   345     
       
   346     AknsUtils::CreateColorIconL( skinInstance, 
       
   347                     KAknsIIDQgnIndiWlanSignalLowAdd, 
       
   348                     KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, 
       
   349                     bitmap, 
       
   350                     mask, 
       
   351                     iconsFileName,
       
   352                     EMbmConnectionuiutilitiesQgn_indi_wlan_signal_low_add, 
       
   353                     EMbmConnectionuiutilitiesQgn_indi_wlan_signal_low_add_mask,
       
   354                     KRgbBlack );
       
   355     icon->SetBitmap( bitmap );
       
   356     icon->SetMask( mask );    
       
   357     icons->AppendL( icon );
       
   358                 
       
   359     CleanupStack::Pop( icon ); 
       
   360 
       
   361     icon = CGulIcon::NewLC();
       
   362     
       
   363     AknsUtils::CreateColorIconL( skinInstance, 
       
   364                     KAknsIIDQgnIndiWlanSignalMedAdd, 
       
   365                     KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, 
       
   366                     bitmap, 
       
   367                     mask, 
       
   368                     iconsFileName,
       
   369                     EMbmConnectionuiutilitiesQgn_indi_wlan_signal_med_add, 
       
   370                     EMbmConnectionuiutilitiesQgn_indi_wlan_signal_med_add_mask,
       
   371                     KRgbBlack );
       
   372     icon->SetBitmap( bitmap );
       
   373     icon->SetMask( mask );    
       
   374     icons->AppendL( icon );
       
   375                 
       
   376     CleanupStack::Pop( icon );
       
   377     
       
   378     icon = CGulIcon::NewLC();
       
   379     
       
   380     AknsUtils::CreateColorIconL( skinInstance, 
       
   381                 KAknsIIDQgnIndiWlanSignalGoodAdd, 
       
   382                 KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, 
       
   383                 bitmap, 
       
   384                 mask, 
       
   385                 iconsFileName,
       
   386                 EMbmConnectionuiutilitiesQgn_indi_wlan_signal_good_add, 
       
   387                 EMbmConnectionuiutilitiesQgn_indi_wlan_signal_good_add_mask,
       
   388                 KRgbBlack );
       
   389     icon->SetBitmap( bitmap );
       
   390     icon->SetMask( mask );    
       
   391     icons->AppendL( icon );
       
   392                 
       
   393     CleanupStack::Pop( icon );     
       
   394         
       
   395     icon = CGulIcon::NewLC();
       
   396     
       
   397     AknsUtils::CreateColorIconL( skinInstance, 
       
   398                 KAknsIIDQgnIndiWlanSecureNetworkAdd, 
       
   399                 KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, 
       
   400                 bitmap, 
       
   401                 mask, 
       
   402                 iconsFileName,
       
   403                 EMbmConnectionuiutilitiesQgn_indi_wlan_secure_network_add, 
       
   404                 EMbmConnectionuiutilitiesQgn_indi_wlan_secure_network_add_mask,
       
   405                 KRgbBlack );
       
   406     icon->SetBitmap( bitmap );
       
   407     icon->SetMask( mask );    
       
   408     icons->AppendL( icon );
       
   409                 
       
   410     CleanupStack::Pop( icon );    
       
   411        
       
   412     AknIconUtils::CreateIconL( bitmap, mask, iconsFileName,
       
   413                     EMbmConnectionuiutilitiesQgn_prop_snote_wlan_adhoc, 
       
   414                     EMbmConnectionuiutilitiesQgn_prop_snote_wlan_adhoc_mask );
       
   415                                
       
   416     TInt err( KErrNone );
       
   417     TRAP( err, icons->AppendL( CGulIcon::NewL( bitmap, mask ) ) );
       
   418     if ( err )
       
   419         {
       
   420         delete bitmap;
       
   421         delete mask;
       
   422         User::Leave( err );
       
   423         }
       
   424     
       
   425     
       
   426     AknIconUtils::CreateIconL( bitmap, mask, iconsFileName,
       
   427                     EMbmConnectionuiutilitiesQgn_prop_snote_wlan_infra, 
       
   428                     EMbmConnectionuiutilitiesQgn_prop_snote_wlan_infra_mask );
       
   429                                
       
   430     TRAP( err, icons->AppendL( CGulIcon::NewL( bitmap, mask ) ) );
       
   431     if ( err )
       
   432         {
       
   433         delete bitmap;
       
   434         delete mask;
       
   435         User::Leave( err );
       
   436         }
       
   437     
       
   438     icon = CGulIcon::NewLC();
       
   439     
       
   440     AknsUtils::CreateColorIconL( skinInstance, 
       
   441                 KAknsIIDQgnIndiWifiProtectedAdd, 
       
   442                 KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, 
       
   443                 bitmap, 
       
   444                 mask, 
       
   445                 iconsFileName,
       
   446                 EMbmConnectionuiutilitiesQgn_indi_wifi_protected_add, 
       
   447                 EMbmConnectionuiutilitiesQgn_indi_wifi_protected_add,
       
   448                 KRgbBlack );
       
   449     icon->SetBitmap( bitmap );
       
   450     icon->SetMask( mask );    
       
   451     icons->AppendL( icon );
       
   452                 
       
   453     CleanupStack::Pop( icon );
       
   454     
       
   455     SetIconArrayL( icons );      
       
   456 
       
   457     CleanupStack::Pop( icons );
       
   458 
       
   459     CLOG_LEAVEFN( "CSelectWLANDlg::SetIconsL " );  
       
   460     }
       
   461 
       
   462 // ----------------------------------------------------------------------------
       
   463 // void CSelectWLANDlg::HandleResourceChange( TInt aType )
       
   464 // Handle resource change events. 
       
   465 // ----------------------------------------------------------------------------
       
   466 //
       
   467 void CSelectWLANDlg::HandleResourceChange( TInt aType )
       
   468     {
       
   469     CLOG_ENTERFN( "CSelectWLANDlg::HandleResourceChange " );  
       
   470     
       
   471     if ( aType == KAknsMessageSkinChange )
       
   472         {
       
   473         CAknListQueryDialog::HandleResourceChange( aType );
       
   474 
       
   475         TRAP_IGNORE( SetIconsL() );
       
   476         SizeChanged();
       
   477         }
       
   478     else
       
   479         {
       
   480         if ( aType == KEikDynamicLayoutVariantSwitch )
       
   481             {
       
   482             TRect mainPaneRect;
       
   483             AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
       
   484                                                mainPaneRect );
       
   485 
       
   486             TAknLayoutRect layoutRect;
       
   487             layoutRect.LayoutRect( TRect( TPoint( 0, 0 ), 
       
   488                                    mainPaneRect.Size() ),
       
   489                                    AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) );
       
   490 
       
   491             ListBox()->SetRect( layoutRect.Rect() );
       
   492             }
       
   493 
       
   494         // Base call
       
   495         CAknListQueryDialog::HandleResourceChange( aType );
       
   496         }
       
   497 
       
   498     CLOG_LEAVEFN( "CSelectWLANDlg::HandleResourceChange " );  
       
   499     }
       
   500          
       
   501 
       
   502 // --------------------------------------------------------------------------
       
   503 // CSelectWLANDlg::ScanForWlanNwL
       
   504 // --------------------------------------------------------------------------
       
   505 //
       
   506 TBool CSelectWLANDlg::ScanForWlanNwL( 
       
   507 #ifdef __WINS__
       
   508                          TWlanSsid& /*aSsid*/, 
       
   509                          TWlanConnectionMode& /*aConnectionMode*/,
       
   510                          TWlanConnectionSecurityMode& /*aSecurityMode*/,
       
   511                          TWlanConnectionExtentedSecurityMode& /*aExtSecurityMode*/,
       
   512                          TBool& /*aProtectedSetupSupported*/ )
       
   513 #else
       
   514                          TWlanSsid& aSsid, 
       
   515                          TWlanConnectionMode& aConnectionMode,
       
   516                          TWlanConnectionSecurityMode& aSecurityMode,
       
   517                          TWlanConnectionExtentedSecurityMode& aExtSecurityMode,
       
   518                          TBool& aProtectedSetupSupported )
       
   519 #endif  // __WINS__
       
   520     {
       
   521     CLOG_ENTERFN( "CSelectWLANDlg::ScanForWlanNwL" ); 
       
   522     
       
   523     TBool retVal ( EFalse );
       
   524 
       
   525     DestroyWaitDialog();
       
   526 
       
   527     CLOG_WRITE( "Creating WaitDialog..." );
       
   528 
       
   529     iWaitDialog = new( ELeave )CAknWaitDialog
       
   530                     ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ), ETrue );
       
   531     iWaitDialog->ExecuteLD( R_SEARCHING_WLAN_WAIT_NOTE ); 
       
   532 
       
   533 #ifndef __WINS__
       
   534     CWlanCoverageCheck* coverage = new( ELeave )CWlanCoverageCheck;
       
   535     CleanupStack::PushL( coverage );
       
   536 
       
   537     CLOG_WRITE( "Coverage created, calling ScanForPromptedSsidL, broadcast" );
       
   538 
       
   539     retVal = coverage->ScanForPromptedSsidL( aSsid, ETrue, aConnectionMode, 
       
   540                                              aSecurityMode,
       
   541                                              aExtSecurityMode, 
       
   542                                              aProtectedSetupSupported );
       
   543     CLOG_WRITEF( _L( "Protected Setup in CSelectWLANDlg::ScanForWlanNwL_1: %d" ), aProtectedSetupSupported );
       
   544     CLOG_WRITE( "ScanForPromptedSsidL returned" );
       
   545     
       
   546     if ( !retVal )
       
   547         {
       
   548         CLOG_WRITE( "Calling ScanForPromptedSsidL, direct" );
       
   549         retVal = coverage->ScanForPromptedSsidL( aSsid, EFalse, 
       
   550                                                  aConnectionMode, 
       
   551                                                  aSecurityMode,
       
   552                                                  aExtSecurityMode,
       
   553                                                  aProtectedSetupSupported );
       
   554     CLOG_WRITEF( _L( "Protected Setup in CSelectWLANDlg::ScanForWlanNwL_2: %d" ), aProtectedSetupSupported );
       
   555     CLOG_WRITE( "ScanForPromptedSsidL returned" );
       
   556         }
       
   557 
       
   558     CleanupStack::PopAndDestroy( coverage );
       
   559 
       
   560 #endif  // __WINS
       
   561 
       
   562     CLOG_WRITE( "Destroying WaitDialog..." );
       
   563 
       
   564     DestroyWaitDialog();
       
   565 
       
   566     return retVal;
       
   567     }
       
   568 
       
   569 
       
   570 // ---------------------------------------------------------
       
   571 // CSelectWLANDlg::DestroyWaitDialog()
       
   572 // ---------------------------------------------------------
       
   573 //
       
   574 void CSelectWLANDlg::DestroyWaitDialog()
       
   575     {
       
   576     CLOG_ENTERFN( "CSelectWLANDlg::DestroyWaitDialog " );
       
   577 
       
   578     delete iWaitDialog;
       
   579     iWaitDialog = NULL;
       
   580     }
       
   581 
       
   582 // ---------------------------------------------------------
       
   583 // CSelectWLANDlg::OfferKeyEventL
       
   584 // ---------------------------------------------------------
       
   585 //
       
   586 TKeyResponse CSelectWLANDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
       
   587                                              TEventCode aType)
       
   588     {
       
   589     if( NeedToDismissQueryL(aKeyEvent) )
       
   590         {
       
   591         return EKeyWasConsumed;
       
   592         }
       
   593  	
       
   594     return CAknListQueryDialog::OfferKeyEventL(aKeyEvent,aType);
       
   595     }
       
   596     
       
   597 // ---------------------------------------------------------
       
   598 // CSelectWLANDlg::NeedToDismissQueryL
       
   599 // ---------------------------------------------------------
       
   600 //
       
   601 TBool CSelectWLANDlg::NeedToDismissQueryL(const TKeyEvent& aKeyEvent)
       
   602     {
       
   603     if (aKeyEvent.iCode == EKeyPhoneSend)
       
   604         {
       
   605         TryExitL(EEikBidCancel);
       
   606         return ETrue;
       
   607         }
       
   608         
       
   609     return EFalse;
       
   610     }
       
   611 
       
   612 // ---------------------------------------------------------
       
   613 // CSelectWLANDlg::ShowInfoNoteL
       
   614 // ---------------------------------------------------------
       
   615 //
       
   616 void CSelectWLANDlg::ShowInfoNoteL( TInt aResId )
       
   617     {
       
   618     HBufC* stringLabel = StringLoader::LoadL( aResId, iEikonEnv );
       
   619     CleanupStack::PushL( stringLabel );
       
   620 
       
   621     CAknInformationNote* dialog = new ( ELeave )CAknInformationNote( ETrue );
       
   622     dialog->ExecuteLD( *stringLabel );
       
   623 
       
   624     CleanupStack::PopAndDestroy( stringLabel );   // stringLabel
       
   625     }
       
   626 
       
   627 void CSelectWLANDlg::HandleTimedOut()
       
   628     {
       
   629     TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
       
   630     }
       
   631 
       
   632 // End of File