wlanutilities/wlansniffer/aiplugin/src/wsfaicontroller.cpp
changeset 19 10810c91db26
parent 3 ff3b37722600
child 22 498f36116140
equal deleted inserted replaced
3:ff3b37722600 19:10810c91db26
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Implementation of TWsfAiController.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  EXTERNAL INCLUDES
       
    20 #include <apgcli.h>
       
    21 #include <centralrepository.h>
       
    22 #include <browseruisdkcrkeys.h>
       
    23 #include <AknIconArray.h>
       
    24 #include <AknQueryDialog.h>
       
    25 #include <cmpluginwlandef.h>
       
    26 #include <ErrorUI.h>
       
    27 #include <StringLoader.h>
       
    28 #include <aknnotewrappers.h>
       
    29 #include <wsfaipluginrsc.rsg>
       
    30 #include <rconnmon.h>
       
    31 #include <utf.h>
       
    32 #include <cmmanager.h>
       
    33 #include <internetconnectivitycrkeys.h>
       
    34 #include <wlanerrorcodes.h>
       
    35 #include <ConnectionUiUtilities.h>
       
    36 
       
    37 //  CLASS HEADER
       
    38 #include "wsfaicontroller.h"
       
    39 
       
    40 //  INTERNAL INCLUDES
       
    41 #include "wsfwlaninfo.h"
       
    42 #include "wsfwlaninfoarray.h"
       
    43 #include "wsfaiuiobserver.h"
       
    44 #include "wsfaimodel.h"
       
    45 #include "wsficonarraycreator.h"
       
    46 #include "wsfmodel.h"
       
    47 #include "wsfsearchwlansdialog.h"
       
    48 #include "wsfaicontrollercmds.h"
       
    49 #include "wsfactivewaiter.h"
       
    50 #include "wsflogger.h"
       
    51 #include "wsfdbobserver.h"
       
    52 
       
    53 
       
    54 //  MACROS
       
    55 #ifdef _DEBUG
       
    56     _LIT( KControllerPanic, "CWsfAiController" );
       
    57     #define _ASS_D( cond ) __ASSERT_DEBUG( (cond), \
       
    58             User::Panic( KControllerPanic, __LINE__) )
       
    59 #else
       
    60     #define _ASS_D( cond )
       
    61 #endif //_DEBUG
       
    62 
       
    63 
       
    64 //  LOCAL DEFINITIONS
       
    65 LOCAL_D const TInt KFirstItemArrayIndex = 0;
       
    66 
       
    67 // Category UID of AiHelper property
       
    68 static const TUid KWsfAiHelperCategoryUid = { 0x10281CEB };
       
    69 
       
    70 // key numbers within the property 
       
    71 static const TUint KWsfAiHelperExitCodeKey = 0;
       
    72 static const TUint KWsfAiHelperIapIdKey = 1;
       
    73 static const TInt KSuppressRefreshIndex = 1024;
       
    74 
       
    75 
       
    76 
       
    77 // --------------------------------------------------------------------------
       
    78 // TWsfAiController::TWsfAiController
       
    79 // --------------------------------------------------------------------------
       
    80 //
       
    81 TWsfAiController::TWsfAiController():
       
    82     iModel( NULL ),
       
    83     iAiModel( NULL ),
       
    84     iUi( NULL ),
       
    85     iDbObserver( NULL ),
       
    86     iShouldConnectOnly( EFalse ),
       
    87     iTestAccessPoint( EFalse )
       
    88     {
       
    89     // null the pointers
       
    90     iConnectedWlan.iConnectionState = ENotConnected;
       
    91     }
       
    92 
       
    93 
       
    94 // ---------------------------------------------------------
       
    95 // CWsfActiveWaiter::DeInitializeL
       
    96 // ---------------------------------------------------------
       
    97 //    
       
    98 void TWsfAiController::DeInitializeL()
       
    99     {
       
   100     LOG_ENTERFN( "TWsfAiController::DeInitializeL" );
       
   101     iModel->AbortConnectingL();
       
   102     iModel->AbortScanningL();
       
   103     }
       
   104 
       
   105 
       
   106 // --------------------------------------------------------------------------
       
   107 // TWsfAiController::Initialize
       
   108 // --------------------------------------------------------------------------
       
   109 //
       
   110 void TWsfAiController::InitializeL( CWsfModel* aModel, CWsfAiModel* aAiModel,
       
   111 		                             CWsfDbObserver* aObserver )
       
   112     {
       
   113     LOG_ENTERFN( "TWsfAiController::InitializeL" );
       
   114     iModel = aModel;
       
   115     iAiModel = aAiModel;
       
   116     iDbObserver = aObserver;
       
   117     iDbObserver->SetController( this );
       
   118     iDbObserver->ActivateItL();
       
   119     iModel->SetEngineObserver( this );
       
   120     
       
   121     iAiModel->SetConnected( iModel->IsConnectedL() );
       
   122     }
       
   123 
       
   124 
       
   125 // ---------------------------------------------------------------------------
       
   126 // TWsfMainController::BrowserLaunchCompleteL
       
   127 // ---------------------------------------------------------------------------
       
   128 // 
       
   129 void TWsfAiController::BrowserLaunchCompleteL()
       
   130     {
       
   131     LOG_ENTERFN( "TWsfAiController::BrowserLaunchCompleteL" );
       
   132     // no implementation required
       
   133     }
       
   134 
       
   135 
       
   136 // ---------------------------------------------------------------------------
       
   137 // TWsfMainController::BrowserExitL
       
   138 // ---------------------------------------------------------------------------
       
   139 // 
       
   140 void TWsfAiController::BrowserExitL()
       
   141     {
       
   142     LOG_ENTERFN( "TWsfAiController::BrowserExitL" ); 
       
   143     // no implementation required
       
   144     }
       
   145 
       
   146 
       
   147 // ---------------------------------------------------------------------------
       
   148 // TWsfMainController::BrowserLaunchFailed
       
   149 // ---------------------------------------------------------------------------
       
   150 //
       
   151 #ifdef _DEBUG
       
   152 void TWsfAiController::BrowserLaunchFailed( TInt aError )
       
   153     {
       
   154     LOG_ENTERFN( "TWsfAiController::BrowserLaunchFailed" ); 
       
   155     LOG_WRITEF( "error = %d", aError );
       
   156 #else
       
   157 void TWsfAiController::BrowserLaunchFailed( TInt /*aError*/ )
       
   158     {   
       
   159     // no implementation required
       
   160 #endif
       
   161     }
       
   162 
       
   163 
       
   164 // ---------------------------------------------------------------------------
       
   165 // TWsfMainController::ConnectingL
       
   166 // ---------------------------------------------------------------------------
       
   167 //
       
   168 void TWsfAiController::ConnectingL( TUint32 /*aIapId*/ )
       
   169     {
       
   170     LOG_ENTERFN( "TWsfAiController::ConnectingL" ); 
       
   171     iModel->SetConnecting( ETrue );
       
   172     iAiModel->SetConnecting( ETrue );
       
   173     iUi->StartConnectingAnimationL();
       
   174     RefreshUiL();
       
   175     }
       
   176 
       
   177 
       
   178 // ---------------------------------------------------------------------------
       
   179 // TWsfMainController::ConnectingFinishedL
       
   180 // ---------------------------------------------------------------------------
       
   181 //
       
   182 #ifdef _DEBUG
       
   183 void TWsfAiController::ConnectingFinishedL( TInt aResult )
       
   184     {
       
   185     LOG_ENTERFN( "TWsfAiController::ConnectingFinishedL" );
       
   186     LOG_WRITEF( "aResult = %d", aResult );
       
   187 #else
       
   188 void TWsfAiController::ConnectingFinishedL( TInt /*aResult*/ )
       
   189     {
       
   190 #endif
       
   191     if ( iModel->IsConnecting() )
       
   192         {
       
   193         iModel->SetConnecting( EFalse );
       
   194         }
       
   195     iAiModel->SetConnecting( EFalse );
       
   196     RefreshUiL();
       
   197     }
       
   198 
       
   199 
       
   200 // --------------------------------------------------------------------------
       
   201 // TWsfAiController::StartupRefreshL
       
   202 // --------------------------------------------------------------------------
       
   203 //
       
   204 void TWsfAiController::StartupRefreshL()
       
   205     {
       
   206     LOG_ENTERFN( "TWsfAiController::StartupRefreshL" );
       
   207     iModel->GetConnectedWlanDetailsL( iConnectedWlan );
       
   208     iAiModel->SetConnectedWlanInfo( iConnectedWlan );
       
   209     
       
   210     iInfoArray = iModel->GetWlanListL();
       
   211     MDesCArray* data = iAiModel->FormatSingleLineWlanListL( iInfoArray );
       
   212     
       
   213     // index value to suppress 1 second refreshing state
       
   214     const TInt KSuppressRefreshIndex = 1024;
       
   215     
       
   216     iUi->UpdateHotSpotsL( data, KSuppressRefreshIndex );    
       
   217     }
       
   218 
       
   219 
       
   220 // --------------------------------------------------------------------------
       
   221 // TWsfAiController::SetUi
       
   222 // --------------------------------------------------------------------------
       
   223 //
       
   224 void TWsfAiController::SetUi( MWsfAiUiObserver& aUi )
       
   225     {
       
   226     LOG_ENTERFN( "TWsfAiController::SetUi" );
       
   227     iUi = &aUi;    
       
   228     }
       
   229 
       
   230 
       
   231 // --------------------------------------------------------------------------
       
   232 // TWsfAiController::HandleSelectionKeyL
       
   233 // --------------------------------------------------------------------------
       
   234 //
       
   235 void TWsfAiController::HandleSelectionKeyL()
       
   236     {
       
   237     LOG_ENTERFN( "TWsfAiController::HandleSelectionKeyL" );
       
   238     _ASS_D( iAiModel );
       
   239     
       
   240     if ( !iAiModel->ScanningOn() && !iAiModel->Connected() )
       
   241         {
       
   242         // scanning was off and there wasn't a connected network
       
   243         EnableScanL();
       
   244         }
       
   245     else
       
   246         {
       
   247         // scanning was on
       
   248         // menu contents depend on the connection and browser status
       
   249         if ( iModel->IsConnecting() )
       
   250             {
       
   251             // connecting
       
   252             HandleMskIfConnectingL();
       
   253             }
       
   254         else if ( !iAiModel->Connected() )
       
   255             {
       
   256             // not connected
       
   257             HandleMskIfOfflineL();
       
   258             }
       
   259         else
       
   260             {
       
   261             // connected
       
   262             if ( IsWlanUsedByBrowserL() )
       
   263                 {
       
   264                 // browser is using active WLAN connection
       
   265                 HandleMskIfBrowsingL();
       
   266                 }
       
   267             else
       
   268                 {
       
   269                 // browser is not running or not using the WLAN
       
   270                 HandleMskIfConnectedL();
       
   271                 }
       
   272             }
       
   273         }
       
   274 
       
   275     }
       
   276 
       
   277 
       
   278 // --------------------------------------------------------------------------
       
   279 // TWsfAiController::DismissDialogsL
       
   280 // --------------------------------------------------------------------------
       
   281 //
       
   282 void TWsfAiController::DismissDialogsL()
       
   283     {
       
   284     LOG_ENTERFN("TWsfAiController::DismissDialogsL" );
       
   285     TKeyEvent key;
       
   286     key.iCode = EKeyEscape;
       
   287     key.iModifiers = 0;
       
   288     CEikonEnv::Static()->SimulateKeyEventL( key, EEventKey );
       
   289     }
       
   290 
       
   291 
       
   292 // --------------------------------------------------------------------------
       
   293 // TWsfAiController::WlanListChangedL
       
   294 // --------------------------------------------------------------------------
       
   295 //
       
   296 void TWsfAiController::WlanListChangedL()
       
   297     {
       
   298     LOG_ENTERFN("TWsfAiController::WlanListChangedL" );
       
   299  
       
   300     _ASS_D( iAiModel );
       
   301     
       
   302     if ( !iAiModel->ScanningOn() )
       
   303         {
       
   304         return;
       
   305         }
       
   306     
       
   307     _ASS_D( iModel );
       
   308     _ASS_D( iUi );
       
   309     
       
   310     TBool match( EFalse );    
       
   311     TWsfWlanInfo previousSelected;        
       
   312     CWsfWlanInfoArray* modelArr = iAiModel->GetInfoArray();   
       
   313     
       
   314     if ( modelArr )
       
   315         {
       
   316         TInt selectedItem = iUi->SelectedItem();
       
   317         if ( selectedItem >= KFirstItemArrayIndex && 
       
   318              selectedItem < modelArr->Count() )
       
   319             {
       
   320             TWsfWlanInfo* temp = modelArr->At( selectedItem );
       
   321             if ( temp )
       
   322                 {
       
   323                 match = ETrue;
       
   324                 previousSelected = *temp;
       
   325                 }                
       
   326             }
       
   327         }
       
   328     iInfoArray = iModel->GetWlanListL();
       
   329     TBool connected = iModel->GetConnectedWlanDetailsL( iConnectedWlan );
       
   330     iAiModel->SetConnected( connected );
       
   331     iAiModel->SetConnectedWlanInfo( iConnectedWlan );
       
   332         
       
   333     MDesCArray* data = iUi->MultilineControl() ? 
       
   334             iAiModel->FormatWlanListL( iInfoArray, ETrue ): 
       
   335             iAiModel->FormatSingleLineWlanListL( iInfoArray );
       
   336     
       
   337     
       
   338     TInt index( KErrNotFound );
       
   339     if ( match )
       
   340         {            
       
   341         TWsfWlanInfo* currentMatch = iInfoArray->Match( 
       
   342                                                     previousSelected.iSsid, 
       
   343                                                     iInfoArray->Count() );
       
   344         if ( currentMatch )
       
   345             {
       
   346             index = iInfoArray->GetArrayIndex( currentMatch );
       
   347             }
       
   348         }
       
   349     
       
   350     if ( !iUi->MultilineControl() && iModel->IsConnecting() )
       
   351         {
       
   352         index = KSuppressRefreshIndex;
       
   353         }
       
   354     
       
   355     iUi->UpdateHotSpotsL( data, index );
       
   356 
       
   357     }
       
   358 
       
   359 
       
   360 // --------------------------------------------------------------------------
       
   361 // TWsfAiController::NotifyEngineError
       
   362 // --------------------------------------------------------------------------
       
   363 //
       
   364 void TWsfAiController::NotifyEngineError( TInt aError )
       
   365     {
       
   366     LOG_ENTERFN( "TWsfAiController::NotifyEngineError" );
       
   367     //Let the user know about the error.
       
   368     LOG_WRITEF( "error = %d", aError );
       
   369     TRAP_IGNORE( DoHandleEngineErrorL( aError ) ); 
       
   370     }
       
   371 
       
   372 
       
   373 // --------------------------------------------------------------------------
       
   374 // TWsfAiController::ScanDisabledL
       
   375 // --------------------------------------------------------------------------
       
   376 //
       
   377 void TWsfAiController::ScanDisabledL()
       
   378     {
       
   379     LOG_ENTERFN( "TWsfAiController::ScanDisabledL" );
       
   380     // no implementation required
       
   381     }
       
   382 
       
   383 
       
   384 // --------------------------------------------------------------------------
       
   385 // TWsfAiController::ScanEnabledL
       
   386 // --------------------------------------------------------------------------
       
   387 //
       
   388 void TWsfAiController::ScanEnabledL()
       
   389     {
       
   390     LOG_ENTERFN( "TWsfAiController::ScanEnabledL" );
       
   391     iModel->RefreshScanL();
       
   392     }
       
   393 
       
   394 
       
   395 // --------------------------------------------------------------------------
       
   396 // TWsfAiController::WlanConnectionActivatedL
       
   397 // --------------------------------------------------------------------------
       
   398 //
       
   399 void TWsfAiController::WlanConnectionActivatedL( 
       
   400                                             const TDesC& /*aAccessPointName*/ )
       
   401     {
       
   402     LOG_ENTERFN( "TWsfAiController::WlanConnectionActivatedL" );
       
   403     iModel->SetConnecting( EFalse );
       
   404     iModel->GetConnectedWlanDetailsL( iConnectedWlan );
       
   405     iAiModel->SetConnectedWlanInfo( iConnectedWlan );
       
   406     iAiModel->SetConnected( ETrue );
       
   407     iAiModel->SetConnecting( EFalse );
       
   408 
       
   409     RefreshUiL();
       
   410     } 
       
   411 
       
   412 
       
   413 // --------------------------------------------------------------------------
       
   414 // TWsfAiController::WlanConnectionClosedL
       
   415 // --------------------------------------------------------------------------
       
   416 //
       
   417 void TWsfAiController::WlanConnectionClosedL()
       
   418     {
       
   419     LOG_ENTERFN( "TWsfAiController::WlanConnectionClosedL" );
       
   420     iModel->SetConnecting( EFalse );
       
   421     iAiModel->SetConnected( EFalse );
       
   422     iAiModel->SetConnecting( EFalse );
       
   423     if ( iAiModel->ScanningOn() )
       
   424         {
       
   425         // update the model and refresh ui
       
   426         if ( iInfoArray )
       
   427             {
       
   428             // check if the array has any items
       
   429             if ( iInfoArray->Count() )
       
   430                 {
       
   431                 iInfoArray->SortArrayL();
       
   432                 TWsfWlanInfo* firstItem = iInfoArray->At( KFirstItemArrayIndex );
       
   433                 if ( firstItem && firstItem->Connected() )
       
   434                     {
       
   435                     firstItem->iConnectionState = ENotConnected;                 
       
   436                     }
       
   437                 }
       
   438             }
       
   439         // Abort current scan if exists so that we get 
       
   440         // newest scan results propagated to ui
       
   441         iModel->AbortScanningL();
       
   442         iModel->RefreshScanL();
       
   443         RefreshUiL();  
       
   444         }
       
   445     else
       
   446         {
       
   447         iUi->DisplayEngineOffL();
       
   448         }
       
   449         
       
   450     }
       
   451 
       
   452 
       
   453 // ---------------------------------------------------------------------------
       
   454 // TWsfMainController::ConnectionCreationProcessFinished
       
   455 // ---------------------------------------------------------------------------
       
   456 //
       
   457 void TWsfAiController::ConnectionCreationProcessFinishedL( TInt aResult )
       
   458     {
       
   459     LOG_ENTERFN( "TWsfAiController::ConnectionCreationProcessFinished" );
       
   460     LOG_WRITEF( "aResult = %d", aResult );
       
   461     // release flags if we leave occures
       
   462     CleanupStack::PushL( TCleanupItem( CleanUpConnectingL, this ) );
       
   463     if ( iModel->IsConnecting() )
       
   464         {
       
   465         iModel->SetConnecting( EFalse );
       
   466         }
       
   467     iAiModel->SetConnecting( EFalse );
       
   468     if ( aResult == KErrNone )
       
   469         {
       
   470         iAiModel->SetConnected( ETrue );
       
   471         iModel->FinalizeConnectL();
       
   472         if ( !iShouldConnectOnly )
       
   473             {
       
   474             StartWebBrowserL( iUsedInfo );
       
   475             }
       
   476         if ( iTestAccessPoint )
       
   477             {
       
   478             iModel->TestConnectedAccessPointL( iUsedInfo, iShouldConnectOnly );
       
   479             }
       
   480         }
       
   481     else
       
   482         {
       
   483         iAiModel->SetConnected( EFalse );
       
   484         }
       
   485     RefreshUiL();
       
   486     // pop cleanup item 
       
   487     CleanupStack::Pop();
       
   488     }
       
   489 
       
   490 
       
   491 // --------------------------------------------------------------------------
       
   492 // TWsfAiController::StartBrowsingL
       
   493 // --------------------------------------------------------------------------
       
   494 //
       
   495 void TWsfAiController::StartBrowsingL( TWsfWlanInfo& aInfo )
       
   496     {
       
   497     LOG_ENTERFN( "TWsfAiController::StartBrowsingL" );
       
   498     
       
   499     _ASS_D( iModel );
       
   500     
       
   501     iUsedInfo = aInfo;
       
   502     
       
   503     // Prevent connections to ad-hoc + WPA 
       
   504     if ( iUsedInfo.iNetMode == CMManager::EAdhoc 
       
   505             && iUsedInfo.iSecurityMode == CMManager::EWlanSecModeWpa )
       
   506         {
       
   507         CErrorUI* errorUi = CErrorUI::NewLC();
       
   508         errorUi->ShowGlobalErrorNoteL( KErrNotSupported );
       
   509         CleanupStack::PopAndDestroy( errorUi ); // errorUi
       
   510         return;
       
   511         }
       
   512     
       
   513     // make sure we don't show connecting stuff forever
       
   514     CleanupStack::PushL( TCleanupItem( CleanUpConnectingL, this ) );
       
   515     
       
   516     if ( !iUsedInfo.Connected() )
       
   517         {
       
   518         ConnectL( iUsedInfo, EFalse );
       
   519         }
       
   520     else
       
   521         {
       
   522         LOG_WRITE("Start browser to connected network...");
       
   523         iShouldConnectOnly = EFalse;
       
   524         StartWebBrowserL( iUsedInfo );
       
   525         }
       
   526     
       
   527     // pop cleanup item 
       
   528     CleanupStack::Pop();
       
   529     }
       
   530 
       
   531 
       
   532 // --------------------------------------------------------------------------
       
   533 // TWsfAiController::StartWebBrowserL
       
   534 // --------------------------------------------------------------------------
       
   535 //
       
   536 void TWsfAiController::StartWebBrowserL( TWsfWlanInfo& aInfo )
       
   537     {
       
   538     LOG_ENTERFN( "TWsfAiController::StartWebBrowserL" );
       
   539     
       
   540     _ASS_D( iModel );
       
   541     
       
   542     TUint32 passedIap( aInfo.iIapId );
       
   543 
       
   544     if ( aInfo.Connected() && !passedIap )
       
   545         {
       
   546         // in case we have an EasyWLAN here
       
   547         RCmManager cmmanager;
       
   548         cmmanager.OpenLC();
       
   549 
       
   550         passedIap = cmmanager.EasyWlanIdL();
       
   551 
       
   552         CleanupStack::PopAndDestroy( &cmmanager );
       
   553         }
       
   554     
       
   555     // launch the browser
       
   556     iModel->LaunchBrowserL( passedIap );
       
   557     }
       
   558 
       
   559 
       
   560 // --------------------------------------------------------------------------
       
   561 // TWsfAiController::ConnectL
       
   562 // --------------------------------------------------------------------------
       
   563 //
       
   564 void TWsfAiController::ConnectL( TWsfWlanInfo& aInfo, TBool aShoulConnectOnly )
       
   565     {
       
   566     LOG_ENTERFN( "TWsfAiController::ConnectL" );
       
   567     
       
   568     _ASS_D( iModel );
       
   569     iTestAccessPoint = EFalse;
       
   570     iShouldConnectOnly = aShoulConnectOnly;
       
   571     iUsedInfo = aInfo;
       
   572     
       
   573     // Prevent connections to ad-hoc + WPA 
       
   574     if ( iUsedInfo.iNetMode == CMManager::EAdhoc 
       
   575             && iUsedInfo.iSecurityMode == CMManager::EWlanSecModeWpa )
       
   576         {
       
   577         CErrorUI* errorUi = CErrorUI::NewLC();
       
   578         errorUi->ShowGlobalErrorNoteL(KErrNotSupported);
       
   579         CleanupStack::PopAndDestroy(errorUi); // errorUi
       
   580         return;
       
   581         }
       
   582     
       
   583     // make sure we don't show connecting stuff forever
       
   584     CleanupStack::PushL( TCleanupItem( CleanUpConnectingL, this ) );
       
   585     
       
   586     if ( !iUsedInfo.iIapId && !iUsedInfo.Hidden() &&
       
   587             iUsedInfo.iSecurityMode == CMManager::EWlanSecModeOpen )
       
   588         {
       
   589         TBool success( EFalse );
       
   590         // just create the IAP
       
   591         TRAPD( accessPointCreatedError, 
       
   592                 success = iModel->CreateAccessPointL( 
       
   593                 iUsedInfo, EFalse ); 
       
   594         );
       
   595         
       
   596         // notify user that Disk is full or creation of a WAPI IAP 
       
   597         // is not supported on-the-fly and leave
       
   598         if ( accessPointCreatedError == KErrDiskFull ||
       
   599              accessPointCreatedError == KErrWlanProtectedSetupSetupLocked )
       
   600             {
       
   601             LOG_WRITE( "showing error note" );
       
   602             CErrorUI* errorUi = CErrorUI::NewLC();
       
   603             errorUi->ShowGlobalErrorNoteL( accessPointCreatedError );
       
   604             CleanupStack::PopAndDestroy( errorUi );
       
   605             User::Leave( accessPointCreatedError );
       
   606             }
       
   607         // just leave because we failed to create accesspoint
       
   608         else if ( accessPointCreatedError != KErrNone || !success )
       
   609             {
       
   610             User::Leave( accessPointCreatedError );
       
   611             }
       
   612         ConnectingL( iUsedInfo.iIapId );
       
   613         iTestAccessPoint = ETrue;
       
   614         }
       
   615     else if ( !iUsedInfo.iIapId )
       
   616         {
       
   617         // let the helper app do the query if necessary
       
   618         LOG_WRITE("AiHelper needs to be launched");
       
   619         LaunchAiHelperAppL( iUsedInfo );
       
   620         ConnectingL( iUsedInfo.iIapId );
       
   621         iTestAccessPoint = ETrue;
       
   622         }
       
   623     
       
   624     // Connect
       
   625     if ( iUsedInfo.iIapId )
       
   626         {
       
   627         TInt result = KErrNone;
       
   628         result = iModel->ConnectWithoutConnWaiterL( iUsedInfo.iIapId, 
       
   629                                                     !iTestAccessPoint );
       
   630 
       
   631         if ( result != KErrNone )
       
   632             {
       
   633             LOG_WRITEF( "Connect failed with error = %d", result );
       
   634             User::Leave( result );
       
   635             }
       
   636         }
       
   637     // pop cleanup item 
       
   638     CleanupStack::Pop();
       
   639     }
       
   640 
       
   641 
       
   642 // ---------------------------------------------------------------------------
       
   643 // TWsfAiController::CleanUpConnectingL
       
   644 // ---------------------------------------------------------------------------
       
   645 //
       
   646 void TWsfAiController::CleanUpConnectingL( TAny* aPtr )
       
   647     {
       
   648     LOG_ENTERFN( "TWsfAiController::CleanUpConnectingL" );
       
   649     TWsfAiController* self = static_cast<TWsfAiController*>( aPtr );
       
   650     self->iModel->SetConnecting( EFalse );
       
   651     self->iAiModel->SetConnecting( EFalse );
       
   652     TRAP_IGNORE( self->RefreshUiL());
       
   653     }
       
   654 
       
   655 
       
   656 // --------------------------------------------------------------------------
       
   657 // TWsfAiController::LaunchAiHelperAppL
       
   658 // --------------------------------------------------------------------------
       
   659 //
       
   660 void TWsfAiController::LaunchAiHelperAppL( TWsfWlanInfo& aInfo )
       
   661     {
       
   662     LOG_ENTERFN( "TWsfAiController::LaunchAiHelperAppL" );
       
   663 
       
   664     CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL();
       
   665     CleanupStack::PushL( waiter );
       
   666     
       
   667     RProperty aiHelperApp;
       
   668     User::LeaveIfError( aiHelperApp.Attach( 
       
   669                                        KWsfAiHelperCategoryUid, 
       
   670                                        KWsfAiHelperExitCodeKey ) );
       
   671     CleanupClosePushL( aiHelperApp );
       
   672     
       
   673     aiHelperApp.Subscribe( waiter->iStatus );
       
   674 
       
   675     LOG_WRITE("launching...");
       
   676     iModel->LaunchHelperApplicationL( aInfo, ETrue, EFalse );
       
   677     waiter->WaitForRequest();
       
   678     
       
   679     TInt exitCode( KErrNone );
       
   680     aiHelperApp.Get( exitCode );
       
   681     
       
   682     LOG_WRITEF("AiHelper returned %d", exitCode );   
       
   683     
       
   684     if ( exitCode == KErrNone )
       
   685         {
       
   686         User::LeaveIfError( aiHelperApp.Attach( 
       
   687                                        KWsfAiHelperCategoryUid, 
       
   688                                        KWsfAiHelperIapIdKey ) );
       
   689         TInt iapId( 0 );
       
   690         aiHelperApp.Get( iapId );
       
   691         aInfo.iIapId = TUint32( iapId );
       
   692         LOG_WRITEF("AiHelper iap id = %d", iapId );
       
   693         }
       
   694     else
       
   695         {
       
   696         User::Leave( exitCode );
       
   697         }
       
   698     
       
   699     CleanupStack::PopAndDestroy( &aiHelperApp );
       
   700     CleanupStack::PopAndDestroy( waiter );
       
   701     }
       
   702 
       
   703 
       
   704 // --------------------------------------------------------------------------
       
   705 // TWsfAiController::ContinueBrowsingL
       
   706 // --------------------------------------------------------------------------
       
   707 //
       
   708 void TWsfAiController::ContinueBrowsingL()
       
   709     {
       
   710     LOG_ENTERFN( "TWsfAiController::ContinueBrowsingL" );
       
   711 
       
   712     _ASS_D( iModel );
       
   713 
       
   714     iModel->ContinueBrowsingL();
       
   715     }
       
   716 
       
   717 
       
   718 // --------------------------------------------------------------------------
       
   719 // TWsfAiController::LaunchSearchDialogL
       
   720 // --------------------------------------------------------------------------
       
   721 //
       
   722 TBool TWsfAiController::LaunchSearchDialogL( TWsfWlanInfo& aInfo )
       
   723     {
       
   724     LOG_ENTERFN( "TWsfAiController::LaunchSearchDialogL" );
       
   725     
       
   726     _ASS_D( iAiModel );
       
   727     _ASS_D( iUi );
       
   728     
       
   729     MWsfAiUiObserver* temp = iUi;
       
   730     TInt selectedWlan( KFirstItemArrayIndex );
       
   731     TBool success( EFalse );
       
   732 
       
   733     TRAPD( err, success = DoLaunchSearchDialogL( selectedWlan ) );
       
   734     
       
   735     iUi = temp;
       
   736     User::LeaveIfError( err );
       
   737     
       
   738     if ( success )
       
   739         {
       
   740         if ( iAiModel->Connected() )
       
   741             {
       
   742             // show the error note of double connections
       
   743             HBufC* txt = StringLoader::LoadLC( 
       
   744                                  R_QTN_WLAN_INFO_CONNECTION_ALREADY_ACTIVE );
       
   745             
       
   746             CAknErrorNote* errorNote = new (ELeave) CAknErrorNote;
       
   747             errorNote->ExecuteLD( *txt );
       
   748             
       
   749             CleanupStack::PopAndDestroy( txt );
       
   750             success = EFalse;
       
   751             }
       
   752         else
       
   753             {
       
   754             // check that the model still has the entry
       
   755             if ( selectedWlan < iAiModel->GetInfoArray()->Count() )
       
   756                 {
       
   757                 // get wlan info
       
   758                 aInfo = *iAiModel->GetInfoArray()->At( selectedWlan );
       
   759                 }
       
   760             else
       
   761                 {
       
   762                 // other unlisted item was selected
       
   763                 }
       
   764             }
       
   765         }
       
   766         
       
   767     RefreshUiL();
       
   768     
       
   769     return success;
       
   770     }
       
   771 
       
   772 
       
   773 // --------------------------------------------------------------------------
       
   774 // TWsfAiController::DoLaunchSearchDialogL
       
   775 // --------------------------------------------------------------------------
       
   776 //
       
   777 TBool TWsfAiController::DoLaunchSearchDialogL( TInt& aSelectedItem )
       
   778     {
       
   779     LOG_ENTERFN( "TWsfAiController::DoLaunchSearchDialogL" );
       
   780     
       
   781     _ASS_D( iAiModel );
       
   782     _ASS_D( iModel );
       
   783     
       
   784     CWsfSearchWlansDialog* dialog = CWsfSearchWlansDialog::NewL( 
       
   785                                                              aSelectedItem );
       
   786     dialog->PrepareLC( R_QTN_PLUGIN_SEARCH_WLAN_NETWORKS );
       
   787 
       
   788     // ownership of the icon array is passed
       
   789     CAknIconArray* icons = CWsfIconArrayCreator::CreateArrayL();
       
   790     CleanupStack::PushL( icons );
       
   791     iAiModel->AppendBrandIconsL( *icons );
       
   792     dialog->SetIconArrayL( icons ); // ownership of the icon array is passed
       
   793     CleanupStack::Pop( icons );
       
   794 
       
   795     // the dialog is ready to receive data...
       
   796     iUi = dialog;           
       
   797     iUi->UpdateHotSpotsL( iAiModel->FormatWlanListL( iModel->GetWlanListL(), EFalse ),
       
   798                           KFirstItemArrayIndex );
       
   799     
       
   800     return dialog->RunLD();
       
   801     }
       
   802     
       
   803 
       
   804 // --------------------------------------------------------------------------
       
   805 // TWsfAiController::RefreshUiL
       
   806 // --------------------------------------------------------------------------
       
   807 //
       
   808 void TWsfAiController::RefreshUiL()
       
   809     {
       
   810     LOG_ENTERFN( "TWsfAiController::RefreshUiL" );
       
   811 
       
   812     _ASS_D( iAiModel );
       
   813     _ASS_D( iUi );
       
   814 
       
   815     if ( !iInfoArray )
       
   816         {
       
   817         return;
       
   818         }
       
   819     
       
   820     MDesCArray* data = iUi->MultilineControl() ? 
       
   821             iAiModel->FormatWlanListL( iInfoArray, ETrue ): 
       
   822             iAiModel->FormatSingleLineWlanListL( iInfoArray );
       
   823             
       
   824     TInt currentItem = ( iModel->IsConnecting() )? 
       
   825                           KSuppressRefreshIndex: KFirstItemArrayIndex;  
       
   826 
       
   827     iUi->UpdateHotSpotsL( data, currentItem );    
       
   828     }
       
   829 
       
   830 
       
   831 // --------------------------------------------------------------------------
       
   832 // TWsfAiController::EnableScanL
       
   833 // --------------------------------------------------------------------------
       
   834 //
       
   835 void TWsfAiController::EnableScanL()
       
   836     {
       
   837     LOG_ENTERFN( "TWsfAiController::EnableScanL" );
       
   838     
       
   839     _ASS_D( iAiModel );
       
   840     _ASS_D( iModel );
       
   841     _ASS_D( iUi );
       
   842     
       
   843     if ( iAiModel->ScanningOn() )
       
   844         {
       
   845         return;
       
   846         }
       
   847     iModel->EnableScanL();
       
   848     iAiModel->SetScanningOn();
       
   849     iDbObserver->EnableScanL();
       
   850 
       
   851     MDesCArray *data = iAiModel->FormatRefreshingL();
       
   852     iUi->UpdateHotSpotsL( data, KFirstItemArrayIndex );
       
   853     }
       
   854 
       
   855 
       
   856 // --------------------------------------------------------------------------
       
   857 // TWsfAiController::DisableScanL
       
   858 // --------------------------------------------------------------------------
       
   859 //
       
   860 void TWsfAiController::DisableScanL()
       
   861     {
       
   862     LOG_ENTERFN( "TWsfAiController::DisableScanL" );
       
   863     
       
   864     _ASS_D( iAiModel );
       
   865     _ASS_D( iModel );
       
   866     _ASS_D( iUi );
       
   867 
       
   868     if ( !iAiModel->ScanningOn() )
       
   869         {
       
   870         return;
       
   871         } 
       
   872     iModel->DisableScanL();
       
   873     iAiModel->SetScanningOff();
       
   874     iDbObserver->DisableScanL();
       
   875     iUi->DisplayEngineOffL();
       
   876     }
       
   877 
       
   878 
       
   879 // --------------------------------------------------------------------------
       
   880 // TWsfAiController::DisconnectL
       
   881 // --------------------------------------------------------------------------
       
   882 //
       
   883 void TWsfAiController::DisconnectL()
       
   884     {
       
   885     LOG_ENTERFN( "TWsfAiController::DisconnectL" );
       
   886     
       
   887     _ASS_D( iModel );
       
   888 
       
   889     iModel->DisconnectL();  
       
   890     }
       
   891 
       
   892 
       
   893 // --------------------------------------------------------------------------
       
   894 // TWsfAiController::DoHandleEngineErrorL
       
   895 // --------------------------------------------------------------------------
       
   896 //
       
   897 void TWsfAiController::DoHandleEngineErrorL( TInt aError )
       
   898     {
       
   899     LOG_ENTERFN( "TWsfAiController::DoHandleEngineErrorL" );
       
   900     // start by freeing some resources... 
       
   901     // we could start by freeing wlan search results
       
   902     _ASS_D( iAiModel );
       
   903 
       
   904     // show error to user...
       
   905     CEikonEnv::Static()->ResolveError( aError );
       
   906     }
       
   907 
       
   908 
       
   909 // ---------------------------------------------------------------------------
       
   910 // TWsfAiController::IsWlanUsedByBrowserL
       
   911 // ---------------------------------------------------------------------------
       
   912 //
       
   913 TBool TWsfAiController::IsWlanUsedByBrowserL()
       
   914     {
       
   915     LOG_ENTERFN( "CWsfMainView::IsWlanUsedByBrowserL" );
       
   916     
       
   917     _ASS_D( iAiModel );
       
   918     
       
   919     const TInt KBrowserUid = 0x10008D39;
       
   920     TUid id( TUid::Uid( KBrowserUid ) );
       
   921     
       
   922     // Check if the Browser application is already running.
       
   923     TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
       
   924     TApaTask task = taskList.FindApp( id );
       
   925     TBool isWlanUsed( EFalse );
       
   926     
       
   927 #ifndef __WINS__
       
   928 
       
   929     if ( task.Exists() )
       
   930         {
       
   931         LOG_WRITE( "The Browser is running." );
       
   932         // The Browser is already running.
       
   933         // Check if the selected WLAN is connected.
       
   934         TBool connected( iAiModel->Connected() );
       
   935         LOG_WRITEF("Connected? %d", connected);
       
   936 
       
   937         if ( connected )
       
   938             {
       
   939             RConnectionMonitor connectionMonitor;
       
   940             connectionMonitor.ConnectL();
       
   941             // We have to check if the Browser using the selected 
       
   942             // connection.
       
   943             // We have get the connectiond ID first.
       
   944             CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL();
       
   945             CleanupStack::PushL( waiter );
       
   946             
       
   947             // first call, need to get the connection parameters
       
   948             TUint connectionCount( 0 );
       
   949             
       
   950             connectionMonitor.GetConnectionCount( connectionCount, 
       
   951                                                   waiter->iStatus );
       
   952             waiter->WaitForRequest();
       
   953             
       
   954             // find the connection with WLAN bearer 
       
   955             // that will be the selected WLAN
       
   956             TUint connectionId( 0 );
       
   957             for ( TUint i = 1; i <= connectionCount; ++i )
       
   958                 {
       
   959                 TUint tmpConnectionId( 0 );
       
   960                 TUint subConnectionCount( 0 );
       
   961                 TConnMonBearerType bearerType( EBearerUnknown );
       
   962                 
       
   963                 connectionMonitor.GetConnectionInfo( i, 
       
   964                                                      tmpConnectionId, 
       
   965                                                      subConnectionCount );
       
   966                 connectionMonitor.GetIntAttribute( tmpConnectionId, 
       
   967                                                    0, 
       
   968                                                    KBearer, 
       
   969                                                    ( TInt& )bearerType, 
       
   970                                                    waiter->iStatus );
       
   971                 waiter->WaitForRequest();
       
   972                 if ( bearerType == EBearerWLAN )
       
   973                     {
       
   974                     connectionId = tmpConnectionId;
       
   975                     break;
       
   976                     }
       
   977                 }
       
   978             // Now we have the connectiond ID.
       
   979             LOG_WRITEF( "connectionId: %d", connectionId );
       
   980             
       
   981             TInt count( 0 );
       
   982             TConnMonClientEnumBuf clientBuf;
       
   983                 
       
   984             connectionMonitor.GetPckgAttribute( connectionId,
       
   985                                                 0,
       
   986                                                 KClientInfo,
       
   987                                                 clientBuf,
       
   988                                                 waiter->iStatus );
       
   989             waiter->WaitForRequest();
       
   990             if ( !waiter->iStatus.Int() )
       
   991                 {
       
   992                 count = clientBuf().iCount;
       
   993                 }
       
   994             
       
   995             RApaLsSession appSess;
       
   996             TApaAppInfo appInfo;
       
   997             
       
   998             // The connection could be shared by several applications
       
   999             User::LeaveIfError( appSess.Connect() );
       
  1000             
       
  1001             for ( TUint i = 0; i < count; i++ )
       
  1002                 {
       
  1003                 appInfo.iCaption.Zero();
       
  1004                 TInt result = appSess.GetAppInfo( appInfo, 
       
  1005                                                   clientBuf().iUid[i] );
       
  1006                 
       
  1007                 LOG_WRITEF( "result: %d", result ); 
       
  1008                 LOG_WRITEF( "iClientInfo.iUid[i].iUid: %x", 
       
  1009                              clientBuf().iUid[i].iUid );
       
  1010                 
       
  1011                 if ( clientBuf().iUid[i].iUid == KBrowserUid )
       
  1012                     {
       
  1013                     isWlanUsed = ETrue;
       
  1014                     }
       
  1015                 }
       
  1016             CleanupStack::PopAndDestroy( waiter );
       
  1017             appSess.Close();
       
  1018             connectionMonitor.Close();
       
  1019             }                
       
  1020         }
       
  1021     else 
       
  1022         {
       
  1023         LOG_WRITE( "No Browser running." );
       
  1024         }
       
  1025         
       
  1026 #endif // __WINS__
       
  1027     
       
  1028     LOG_WRITEF( "isWlanUsedByBrowser: %d", isWlanUsed ); 
       
  1029     return isWlanUsed;
       
  1030     }
       
  1031 
       
  1032 
       
  1033 // --------------------------------------------------------------------------
       
  1034 // TWsfAiController::HandleMskIfOfflineL
       
  1035 // --------------------------------------------------------------------------
       
  1036 //
       
  1037 void TWsfAiController::HandleMskIfOfflineL()
       
  1038     {
       
  1039     LOG_ENTERFN( "TWsfAiController::HandleMskIfOfflineL" );
       
  1040     
       
  1041     // create the dialog with options
       
  1042     TInt selectedMode( 0 );
       
  1043     CAknListQueryDialog* listQuery = new (ELeave) CAknListQueryDialog( 
       
  1044                                                            &selectedMode );
       
  1045     listQuery->PrepareLC( R_QTN_AIPLUGIN_OPTIONS_OFFLINE );
       
  1046 
       
  1047     if ( !listQuery->RunLD() )
       
  1048         {
       
  1049         // cancelled
       
  1050         return;
       
  1051         }
       
  1052     
       
  1053     CWsfWlanInfoArray* wlanArray = iAiModel->GetInfoArray(); 
       
  1054     
       
  1055     
       
  1056     switch ( selectedMode )
       
  1057         {
       
  1058         case EAiOfflineStartBrowsing:
       
  1059             {
       
  1060             // Start web browsing was selected
       
  1061             if ( !wlanArray->Count() ||
       
  1062                  !wlanArray->At( KFirstItemArrayIndex )->Known() )
       
  1063                 {
       
  1064                 // no known networks, let the user choose one
       
  1065                 TWsfWlanInfo info;
       
  1066                 
       
  1067                 if ( LaunchSearchDialogL( info ) )
       
  1068                     {
       
  1069                     StartBrowsingL( info );
       
  1070                     }
       
  1071                 }
       
  1072             else
       
  1073                 {
       
  1074                 // there are known networks
       
  1075                 StartBrowsingL( *wlanArray->At( KFirstItemArrayIndex ) );
       
  1076                 }
       
  1077             
       
  1078             break;
       
  1079             }
       
  1080             
       
  1081         case EAiOfflineConnect:
       
  1082             {
       
  1083             // Connect was selected
       
  1084             if ( !wlanArray->Count() ||
       
  1085                  !wlanArray->At( KFirstItemArrayIndex )->Known() )
       
  1086                 {
       
  1087                 // no known networks, let the user choose one
       
  1088                 TWsfWlanInfo info;
       
  1089                 
       
  1090                 if ( LaunchSearchDialogL( info ) )
       
  1091                     {
       
  1092                     ConnectL( info, ETrue );
       
  1093                     }
       
  1094                 }
       
  1095             else
       
  1096                 {
       
  1097                 // there are known networks
       
  1098                 ConnectL( *wlanArray->At( KFirstItemArrayIndex ), ETrue );
       
  1099                 }
       
  1100             
       
  1101             break;
       
  1102             }
       
  1103             
       
  1104         case EAiOfflineSearchWlans:
       
  1105             {
       
  1106             // Search for wlans was selected
       
  1107             if ( !wlanArray || !wlanArray->Count() )
       
  1108                 {
       
  1109                 // there are no available networks
       
  1110                 CConnectionUiUtilities* connUiUtils = CConnectionUiUtilities::NewL();        
       
  1111                 connUiUtils->NoWLANNetworksAvailableNote();
       
  1112                 delete connUiUtils;
       
  1113                 }
       
  1114 
       
  1115             // launch the search dialog
       
  1116             TWsfWlanInfo info;
       
  1117             
       
  1118             if ( LaunchSearchDialogL( info ) )
       
  1119                 {
       
  1120                 ConnectL( info, ETrue );
       
  1121                 }
       
  1122 
       
  1123             break;
       
  1124             }
       
  1125             
       
  1126         case EAiOfflineDisableScan:
       
  1127             {
       
  1128             // disable the scan
       
  1129             DisableScanL();
       
  1130             break;
       
  1131             }
       
  1132             
       
  1133         default:
       
  1134             {
       
  1135             }
       
  1136 
       
  1137         }
       
  1138     }
       
  1139 
       
  1140 
       
  1141 
       
  1142 // --------------------------------------------------------------------------
       
  1143 // TWsfAiController::HandleMskIfConnectedL
       
  1144 // --------------------------------------------------------------------------
       
  1145 //
       
  1146 void TWsfAiController::HandleMskIfConnectedL()
       
  1147     {
       
  1148     LOG_ENTERFN( "TWsfAiController::HandleMskIfConnectedL" );
       
  1149     
       
  1150     _ASS_D( iModel );
       
  1151     
       
  1152     TInt selectedMode( 0 );
       
  1153     CAknListQueryDialog* listQuery = new (ELeave) CAknListQueryDialog( 
       
  1154                                                            &selectedMode );
       
  1155     listQuery->PrepareLC( R_QTN_AIPLUGIN_OPTIONS_CONNECTED );
       
  1156     
       
  1157     if ( listQuery->RunLD() )
       
  1158         {
       
  1159         if ( selectedMode == EAiConnectedStartBrowsing )
       
  1160             {
       
  1161             StartBrowsingL( iConnectedWlan );
       
  1162             }
       
  1163         else if ( selectedMode == EAiConnectedDisconnect )
       
  1164             {
       
  1165             // disconnect wlan
       
  1166             iModel->DisconnectL();        
       
  1167             }
       
  1168         }
       
  1169     }
       
  1170 
       
  1171 
       
  1172 // --------------------------------------------------------------------------
       
  1173 // TWsfAiController::HandleMskIfConnectingL
       
  1174 // --------------------------------------------------------------------------
       
  1175 //
       
  1176 void TWsfAiController::HandleMskIfConnectingL()
       
  1177     {
       
  1178     LOG_ENTERFN( "TWsfAiController::HandleMskIfConnectingL" );
       
  1179     
       
  1180     _ASS_D( iModel );
       
  1181     
       
  1182     TInt selectedMode( 0 );
       
  1183     CAknListQueryDialog* listQuery = new (ELeave) CAknListQueryDialog( 
       
  1184                                                            &selectedMode );
       
  1185     listQuery->PrepareLC( R_QTN_AIPLUGIN_OPTIONS_CONNECTING );
       
  1186     
       
  1187     if ( listQuery->RunLD() )
       
  1188         {
       
  1189         if ( selectedMode == EAiConnectingDisconnect )
       
  1190             {
       
  1191             if ( iModel->IsConnectedL() )
       
  1192                 {
       
  1193                 // disconnect wlan
       
  1194                 iModel->DisconnectL();
       
  1195                 }
       
  1196             else
       
  1197                 {
       
  1198                 // disconnect wlan
       
  1199                 iModel->AbortConnectingL();  
       
  1200                 }
       
  1201             ConnectingFinishedL( KErrCancel );
       
  1202             }
       
  1203         }
       
  1204     }
       
  1205 
       
  1206 
       
  1207 // --------------------------------------------------------------------------
       
  1208 // TWsfAiController::HandleMskIfBrowsingL
       
  1209 // --------------------------------------------------------------------------
       
  1210 //
       
  1211 void TWsfAiController::HandleMskIfBrowsingL()
       
  1212     {
       
  1213     LOG_ENTERFN( "TWsfAiController::HandleMskIfBrowsingL" );
       
  1214     
       
  1215     _ASS_D( iModel );
       
  1216     
       
  1217     TInt selectedMode( KFirstItemArrayIndex );
       
  1218     CAknListQueryDialog* listQuery = new (ELeave) CAknListQueryDialog( 
       
  1219                                                            &selectedMode );
       
  1220     listQuery->PrepareLC( R_QTN_AIPLUGIN_OPTIONS_BROWSING );
       
  1221 
       
  1222     if ( listQuery->RunLD() )
       
  1223         {
       
  1224         if ( selectedMode == EAiBrowsingContinueBrowsing )
       
  1225             {
       
  1226             // launch the browser...
       
  1227             ContinueBrowsingL();
       
  1228             }
       
  1229         else if ( selectedMode == EAiBrowsingDisconnect )
       
  1230             {
       
  1231             // disconnect wlan
       
  1232             iModel->DisconnectL();
       
  1233             }
       
  1234         }
       
  1235     }
       
  1236 
       
  1237 // --------------------------------------------------------------------------
       
  1238 // TWsfAiController::RefreshRefreshingL
       
  1239 // --------------------------------------------------------------------------
       
  1240 //
       
  1241 void TWsfAiController::RefreshRefreshingL()
       
  1242 	{
       
  1243 	LOG_ENTERFN( "TWsfAiController::RefreshRefreshingL" );
       
  1244 	MDesCArray *data = iAiModel->FormatRefreshingL();
       
  1245     iUi->UpdateViewL( data );
       
  1246 	}
       
  1247 
       
  1248 // --------------------------------------------------------------------------
       
  1249 // TWsfAiController::RefreshConnectingL
       
  1250 // --------------------------------------------------------------------------
       
  1251 //
       
  1252 void TWsfAiController::RefreshConnectingL()
       
  1253     {
       
  1254     LOG_ENTERFN( "TWsfAiController::RefreshConnectingL" );
       
  1255     MDesCArray *data = iAiModel->FormatConnectingL();
       
  1256     iUi->UpdateViewL( data );
       
  1257     }
       
  1258 
       
  1259 // End of file