connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ActiveSelectWLanDlgPlugin.cpp
branchRCL_3
changeset 24 05bc53fe583b
parent 10 ea6e024ea6f9
child 25 83ca720e2b9a
equal deleted inserted replaced
23:fc7b30ed2058 24:05bc53fe583b
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include <AknWaitDialog.h>
    20 #include <AknWaitDialog.h>
    21 #include <ConnUiUtilsNotif.rsg>
    21 #include <connuiutilsnotif.rsg>
    22 #include <AknGlobalNote.h>
    22 #include <AknGlobalNote.h>
    23 #include <StringLoader.h>
    23 #include <StringLoader.h>
    24 #include <centralrepository.h>
    24 #include <centralrepository.h>
    25 #include <AknSgcc.h>
    25 #include <AknSgcc.h>
    26 #include <AknCapServerClient.h>
    26 #include <AknCapServerClient.h>
    82 // ---------------------------------------------------------
    82 // ---------------------------------------------------------
    83 //
    83 //
    84 CActiveSelectWLanDlgPlugin::CActiveSelectWLanDlgPlugin( 
    84 CActiveSelectWLanDlgPlugin::CActiveSelectWLanDlgPlugin( 
    85                                                 CSelectWLanDlgPlugin* aPlugin )
    85                                                 CSelectWLanDlgPlugin* aPlugin )
    86 : CActive( EPriorityStandard ), 
    86 : CActive( EPriorityStandard ), 
    87   iPlugin( aPlugin )
    87   iPlugin( aPlugin ),
       
    88   iWlanDataProv( NULL ),
       
    89   iPeriodic( NULL),
       
    90   iResultsListDialog( NULL),
       
    91   iWaitDialog( NULL )
    88     {
    92     {
    89     }
    93     }
    90     
    94     
    91 // ---------------------------------------------------------
    95 // ---------------------------------------------------------
    92 // CActiveSelectWLanDlgPlugin::~CActiveSelectWLanDlgPlugin()
    96 // CActiveSelectWLanDlgPlugin::~CActiveSelectWLanDlgPlugin()
   105         CLOG_WRITEF( _L( "OkToExit %b" ), iResultsListDialog->GetOkToExit() );
   109         CLOG_WRITEF( _L( "OkToExit %b" ), iResultsListDialog->GetOkToExit() );
   106         delete iResultsListDialog;
   110         delete iResultsListDialog;
   107         iResultsListDialog = NULL;
   111         iResultsListDialog = NULL;
   108         }
   112         }
   109     
   113     
   110     DestroyAsyncWaitTrigger();
       
   111         
       
   112     delete iWlanDataProv;
   114     delete iWlanDataProv;
   113     iWlanDataProv = NULL;
       
   114 
   115 
   115     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::~CActiveSelectWLanDlgPlugin " );
   116     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::~CActiveSelectWLanDlgPlugin " );
   116     }
   117     }
   117 
   118 
   118 
   119 
   134     DestroyWaitDialog();
   135     DestroyWaitDialog();
   135 
   136 
   136     CLOG_WRITE( "deleting wlan data provider" );
   137     CLOG_WRITE( "deleting wlan data provider" );
   137     delete iWlanDataProv;
   138     delete iWlanDataProv;
   138     iWlanDataProv = NULL;
   139     iWlanDataProv = NULL;
   139 
       
   140     DestroyAsyncWaitTrigger();
       
   141 
   140 
   142     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::DoCancel " );
   141     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::DoCancel " );
   143     }
   142     }
   144     
   143     
   145 // ---------------------------------------------------------
   144 // ---------------------------------------------------------
   231 //     
   230 //     
   232 void CActiveSelectWLanDlgPlugin::RunL()
   231 void CActiveSelectWLanDlgPlugin::RunL()
   233     {
   232     {
   234     CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::RunL " );  
   233     CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::RunL " );  
   235     
   234     
   236     DestroyAsyncWaitTrigger();
       
   237 
       
   238     if ( iWaitDialog )
   235     if ( iWaitDialog )
   239         {
   236         {
   240         iWaitDialog->ProcessFinishedL();     
   237         iWaitDialog->ProcessFinishedL();     
   241         delete iWaitDialog;
   238         delete iWaitDialog;
   242         iWaitDialog = NULL;    
   239         iWaitDialog = NULL;    
   266                 iResultsListDialog = CSelectWLANDlg::NewL( iPlugin, 
   263                 iResultsListDialog = CSelectWLANDlg::NewL( iPlugin, 
   267                                                            networkArray );
   264                                                            networkArray );
   268 
   265 
   269                 iResultsListDialog->ExecuteLD( R_SELECT_WLAN_LIST_QUERY );
   266                 iResultsListDialog->ExecuteLD( R_SELECT_WLAN_LIST_QUERY );
   270 
   267 
   271                 if( iRefreshInterval )
   268                 TInt interval = GetRefreshInterval();
       
   269                 CLOG_WRITEF( _L( "interval : %d" ),  interval );
       
   270 
       
   271                 if( interval )
   272                     {
   272                     {
   273                     StartTimerL( iRefreshInterval );
   273                     StartTimerL( interval );
   274                     }
   274                     }
   275                 }
   275                 }
   276             }
   276             }
   277         else
   277         else
   278             {
   278             {
   323 // ---------------------------------------------------------
   323 // ---------------------------------------------------------
   324 //    
   324 //    
   325 void CActiveSelectWLanDlgPlugin::StartSearchWlanNetworkL()
   325 void CActiveSelectWLanDlgPlugin::StartSearchWlanNetworkL()
   326     {    
   326     {    
   327     CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::StartSearchWlanNetworkL " );  
   327     CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::StartSearchWlanNetworkL " );  
   328 
   328     
       
   329     DestroyWaitDialog();
       
   330 
       
   331     iWaitDialog = new( ELeave )CAknWaitDialog
       
   332                     ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ), ETrue );
       
   333     iWaitDialog->ExecuteLD( R_SEARCHING_WLAN_WAIT_NOTE ); 
       
   334     
   329     SetActive();    
   335     SetActive();    
   330 
   336 
   331 #ifdef __WINS__
   337 #ifdef __WINS__
   332     TRequestStatus* clientStatus = &iStatus;
   338     TRequestStatus* clientStatus = &iStatus;
   333     User::RequestComplete( clientStatus, KErrNone );
   339     User::RequestComplete( clientStatus, KErrNone );
   334 #else
   340 #else
   335     iWlanDataProv->RefreshScanInfo( iStatus );
   341     iWlanDataProv->RefreshScanInfo( iStatus );
   336 #endif
   342 #endif
   337  
       
   338     // Start wait dialog asynchronously with low priority.
       
   339     // The reason for this is that sometimes WLAN scan results
       
   340     // are already in the cache and returned fast.
       
   341     // When this happens there is no point in displaying wait note.
       
   342     iRefreshInterval = GetRefreshInterval();
       
   343     CLOG_WRITEF( _L( "interval : %d" ),  iRefreshInterval );
       
   344 
       
   345     if ( !iAsyncWaitTrigger )
       
   346         {
       
   347         TCallBack cb( StartWaitNoteL, this );
       
   348         iAsyncWaitTrigger = new( ELeave ) CAsyncCallBack( cb, CActive::EPriorityLow );
       
   349         }
       
   350     iAsyncWaitTrigger->CallBack();
       
   351 
   343 
   352     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::StartSearchWlanNetworkL " );
   344     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::StartSearchWlanNetworkL " );
   353     }
   345     }
   354 
   346     
   355 // ---------------------------------------------------------
   347 // ---------------------------------------------------------
   356 // CActiveSelectWLanDlgPlugin::GetRefreshInterval()
   348 // CActiveSelectWLanDlgPlugin::GetRefreshInterval()
   357 // ---------------------------------------------------------
   349 // ---------------------------------------------------------
   358 //    
   350 //    
   359 TInt CActiveSelectWLanDlgPlugin::GetRefreshInterval()
   351 TInt CActiveSelectWLanDlgPlugin::GetRefreshInterval()
   426         }
   418         }
   427 
   419 
   428     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::DestroyResultsListDialog " );
   420     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::DestroyResultsListDialog " );
   429     }
   421     }
   430 
   422 
   431 // ---------------------------------------------------------
       
   432 // CActiveSelectWLanDlgPlugin::DestroyAsyncWaitTrigger()
       
   433 // ---------------------------------------------------------
       
   434 //
       
   435 void CActiveSelectWLanDlgPlugin::DestroyAsyncWaitTrigger()
       
   436     {
       
   437     if ( iAsyncWaitTrigger )
       
   438         {
       
   439         iAsyncWaitTrigger->Cancel();
       
   440         delete  iAsyncWaitTrigger;
       
   441         iAsyncWaitTrigger= NULL;
       
   442         }
       
   443     }
       
   444 
       
   445 // ---------------------------------------------------------
       
   446 // CActiveSelectWLanDlgPlugin::StartWaitNoteL()
       
   447 // ---------------------------------------------------------
       
   448 //
       
   449 TInt CActiveSelectWLanDlgPlugin::StartWaitNoteL( TAny* aObject )
       
   450     {
       
   451     CActiveSelectWLanDlgPlugin* myself = 
       
   452             static_cast<CActiveSelectWLanDlgPlugin*>( aObject );
       
   453     
       
   454     myself->DestroyWaitDialog();
       
   455     
       
   456     myself->iWaitDialog = new( ELeave )CAknWaitDialog
       
   457                         ( REINTERPRET_CAST( CEikDialog**, &(myself->iWaitDialog) ), ETrue );
       
   458     myself->iWaitDialog->ExecuteLD( R_SEARCHING_WLAN_WAIT_NOTE );
       
   459         
       
   460     return 0;   
       
   461     }
       
   462 
       
   463 // End of File
   423 // End of File
   464 
   424