connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ActiveSelectWLanDlgPlugin.cpp
branchRCL_3
changeset 58 83ca720e2b9a
parent 57 05bc53fe583b
equal deleted inserted replaced
57:05bc53fe583b 58:83ca720e2b9a
    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 )
       
    92     {
    88     {
    93     }
    89     }
    94     
    90     
    95 // ---------------------------------------------------------
    91 // ---------------------------------------------------------
    96 // CActiveSelectWLanDlgPlugin::~CActiveSelectWLanDlgPlugin()
    92 // CActiveSelectWLanDlgPlugin::~CActiveSelectWLanDlgPlugin()
   109         CLOG_WRITEF( _L( "OkToExit %b" ), iResultsListDialog->GetOkToExit() );
   105         CLOG_WRITEF( _L( "OkToExit %b" ), iResultsListDialog->GetOkToExit() );
   110         delete iResultsListDialog;
   106         delete iResultsListDialog;
   111         iResultsListDialog = NULL;
   107         iResultsListDialog = NULL;
   112         }
   108         }
   113     
   109     
       
   110     DestroyAsyncWaitTrigger();
       
   111         
   114     delete iWlanDataProv;
   112     delete iWlanDataProv;
       
   113     iWlanDataProv = NULL;
   115 
   114 
   116     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::~CActiveSelectWLanDlgPlugin " );
   115     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::~CActiveSelectWLanDlgPlugin " );
   117     }
   116     }
   118 
   117 
   119 
   118 
   135     DestroyWaitDialog();
   134     DestroyWaitDialog();
   136 
   135 
   137     CLOG_WRITE( "deleting wlan data provider" );
   136     CLOG_WRITE( "deleting wlan data provider" );
   138     delete iWlanDataProv;
   137     delete iWlanDataProv;
   139     iWlanDataProv = NULL;
   138     iWlanDataProv = NULL;
       
   139 
       
   140     DestroyAsyncWaitTrigger();
   140 
   141 
   141     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::DoCancel " );
   142     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::DoCancel " );
   142     }
   143     }
   143     
   144     
   144 // ---------------------------------------------------------
   145 // ---------------------------------------------------------
   230 //     
   231 //     
   231 void CActiveSelectWLanDlgPlugin::RunL()
   232 void CActiveSelectWLanDlgPlugin::RunL()
   232     {
   233     {
   233     CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::RunL " );  
   234     CLOG_ENTERFN( "CActiveSelectWLanDlgPlugin::RunL " );  
   234     
   235     
       
   236     DestroyAsyncWaitTrigger();
       
   237 
   235     if ( iWaitDialog )
   238     if ( iWaitDialog )
   236         {
   239         {
   237         iWaitDialog->ProcessFinishedL();     
   240         iWaitDialog->ProcessFinishedL();     
   238         delete iWaitDialog;
   241         delete iWaitDialog;
   239         iWaitDialog = NULL;    
   242         iWaitDialog = NULL;    
   263                 iResultsListDialog = CSelectWLANDlg::NewL( iPlugin, 
   266                 iResultsListDialog = CSelectWLANDlg::NewL( iPlugin, 
   264                                                            networkArray );
   267                                                            networkArray );
   265 
   268 
   266                 iResultsListDialog->ExecuteLD( R_SELECT_WLAN_LIST_QUERY );
   269                 iResultsListDialog->ExecuteLD( R_SELECT_WLAN_LIST_QUERY );
   267 
   270 
   268                 TInt interval = GetRefreshInterval();
   271                 if( iRefreshInterval )
   269                 CLOG_WRITEF( _L( "interval : %d" ),  interval );
       
   270 
       
   271                 if( interval )
       
   272                     {
   272                     {
   273                     StartTimerL( interval );
   273                     StartTimerL( iRefreshInterval );
   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     
       
   335     SetActive();    
   329     SetActive();    
   336 
   330 
   337 #ifdef __WINS__
   331 #ifdef __WINS__
   338     TRequestStatus* clientStatus = &iStatus;
   332     TRequestStatus* clientStatus = &iStatus;
   339     User::RequestComplete( clientStatus, KErrNone );
   333     User::RequestComplete( clientStatus, KErrNone );
   340 #else
   334 #else
   341     iWlanDataProv->RefreshScanInfo( iStatus );
   335     iWlanDataProv->RefreshScanInfo( iStatus );
   342 #endif
   336 #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();
   343 
   351 
   344     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::StartSearchWlanNetworkL " );
   352     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::StartSearchWlanNetworkL " );
   345     }
   353     }
   346     
   354 
   347 // ---------------------------------------------------------
   355 // ---------------------------------------------------------
   348 // CActiveSelectWLanDlgPlugin::GetRefreshInterval()
   356 // CActiveSelectWLanDlgPlugin::GetRefreshInterval()
   349 // ---------------------------------------------------------
   357 // ---------------------------------------------------------
   350 //    
   358 //    
   351 TInt CActiveSelectWLanDlgPlugin::GetRefreshInterval()
   359 TInt CActiveSelectWLanDlgPlugin::GetRefreshInterval()
   418         }
   426         }
   419 
   427 
   420     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::DestroyResultsListDialog " );
   428     CLOG_LEAVEFN( "CActiveSelectWLanDlgPlugin::DestroyResultsListDialog " );
   421     }
   429     }
   422 
   430 
       
   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 
   423 // End of File
   463 // End of File
   424 
   464