connectionutilities/ConnectionDialogs/cconndlg/src/ActiveIapPlugin.cpp
changeset 20 9c97ad6591ae
parent 18 fcbbe021d614
child 21 b8e8e15e80f2
child 23 7ec726f93df1
child 28 860702281757
equal deleted inserted replaced
18:fcbbe021d614 20:9c97ad6591ae
     1 /*
       
     2 * Copyright (c) 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:  Implementation of plugins (base & all derived).
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "ActiveIapPlugin.h"
       
    21 #include "IAPDialog.h"
       
    22 #include "ConnectionInfo.h"
       
    23 #include "ConnectionInfoArray.h"
       
    24 #include "CConnDlgPrivateCRKeys.h"
       
    25 #include "ConnectionDialogsLogger.h"
       
    26 
       
    27 #include <commdb.h>
       
    28 #include <StringLoader.h>
       
    29 #include <wlanmgmtcommon.h>
       
    30 #ifndef __WINS__
       
    31 #include <wlanmgmtclient.h>
       
    32 #endif
       
    33 #include <AknWaitDialog.h>
       
    34 
       
    35 #include <CConnDlgPlugin.rsg>
       
    36 
       
    37 
       
    38 ///////////////////////////////////////////////////////////////////////////////
       
    39 
       
    40 // ---------------------------------------------------------
       
    41 // CActiveCConnDlgIapPlugin::CActiveCConnDlgIapPlugin()
       
    42 // ---------------------------------------------------------
       
    43 //
       
    44 CActiveCConnDlgIapPlugin::CActiveCConnDlgIapPlugin( 
       
    45                                             CConnDlgIapPlugin* aPlugin,
       
    46                                             const TConnectionPrefs& aPrefs )
       
    47 : CActiveIAPListing( aPrefs ),
       
    48   iPlugin( aPlugin ), 
       
    49   isDialogDeleting( EFalse )
       
    50     {
       
    51     }
       
    52 
       
    53     
       
    54 // ---------------------------------------------------------
       
    55 // CActiveCConnDlgIapPlugin* CActiveCConnDlgIapPlugin::NewL()
       
    56 // ---------------------------------------------------------
       
    57 //
       
    58 CActiveCConnDlgIapPlugin* CActiveCConnDlgIapPlugin::NewL( 
       
    59                                               CConnDlgIapPlugin* aPlugin,              
       
    60                                               const TConnectionPrefs& aPrefs )
       
    61     {
       
    62     CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::NewL " );  
       
    63     
       
    64     CActiveCConnDlgIapPlugin* self = 
       
    65                          new ( ELeave ) CActiveCConnDlgIapPlugin( aPlugin,                                                                  
       
    66                                                                   aPrefs );
       
    67     CleanupStack::PushL( self );
       
    68     self->ConstructL();
       
    69     CleanupStack::Pop( self );
       
    70     
       
    71     CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::NewL " );      
       
    72 
       
    73     return self;        
       
    74     }
       
    75 
       
    76 
       
    77 // ---------------------------------------------------------
       
    78 // CActiveCConnDlgIapPlugin::ConstructL()
       
    79 // ---------------------------------------------------------
       
    80 //
       
    81 void CActiveCConnDlgIapPlugin::ConstructL()
       
    82     {
       
    83     BaseConstructL();
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------
       
    87 // CActiveCConnDlgIapPlugin::~CActiveCConnDlgIapPlugin()
       
    88 // ---------------------------------------------------------
       
    89 //    
       
    90 CActiveCConnDlgIapPlugin::~CActiveCConnDlgIapPlugin()
       
    91     {
       
    92     CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::~CActiveCConnDlgIapPlugin" );      
       
    93 
       
    94     Cancel();
       
    95 
       
    96     CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::~CActiveCConnDlgIapPlugin" );      
       
    97     }
       
    98 
       
    99 
       
   100 // ---------------------------------------------------------
       
   101 // CActiveCConnDlgIapPlugin::Cancel()
       
   102 // ---------------------------------------------------------
       
   103 // 
       
   104 void CActiveCConnDlgIapPlugin::Cancel()
       
   105     {
       
   106     CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::Cancel" );      
       
   107 
       
   108     CActiveIAPListing::Cancel();
       
   109 
       
   110     CLOG_WRITE( "Returned from CActiveIAPListing::Cancel" );
       
   111 
       
   112     if( iDialog  && !( iDialog->GetOkToExit() ) )
       
   113         {
       
   114         CLOG_WRITEF( _L( "iDialog->GetOkToExit() : %b" ), iDialog->GetOkToExit() );
       
   115         delete iDialog;
       
   116         iDialog = NULL;
       
   117         }
       
   118 
       
   119     CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::Cancel" );      
       
   120     }
       
   121 
       
   122 
       
   123 // ---------------------------------------------------------
       
   124 // CActiveCConnDlgIapPlugin::DoCancel()
       
   125 // ---------------------------------------------------------
       
   126 // 
       
   127 void CActiveCConnDlgIapPlugin::DoCancel()
       
   128     {
       
   129     CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::DoCancel " );  
       
   130     
       
   131     if( isDialogDeleting )
       
   132         {
       
   133         CLOG_WRITE( "isDialogDeleting" );
       
   134         
       
   135         delete iDialog;
       
   136         iDialog = NULL;   
       
   137         
       
   138         isDialogDeleting = EFalse;         
       
   139         }
       
   140         
       
   141     CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::DoCancel " );          
       
   142     }
       
   143 
       
   144     
       
   145 // ---------------------------------------------------------
       
   146 // CActiveCConnDlgIapPlugin::RunL()
       
   147 // ---------------------------------------------------------
       
   148 //     
       
   149 void CActiveCConnDlgIapPlugin::RunL()
       
   150     {
       
   151     CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::RunL " );  
       
   152     
       
   153     CLOG_WRITEF( _L( "iStatus.Int() : %d" ), iStatus.Int() );
       
   154     CLOG_WRITEF( _L( "&iStatus : %d" ), &iStatus );
       
   155     
       
   156     if( iStatus == KErrNone )
       
   157         {
       
   158         
       
   159         if( iIAPs ) // if iIAPs has been created
       
   160             {            
       
   161             // merge arrays and sort
       
   162             MergeArraysL( R_WLAN_SEARCH_FOR_NETWORKS );
       
   163             
       
   164             if ( iDialog )  // if dialog has been created
       
   165                 {
       
   166                 iDialog->RefreshDialogL( iActIAPs, ETrue );
       
   167                 }
       
   168             else
       
   169                 {
       
   170                 TInt interval = 0;
       
   171                 if ( iIsWLANFeatureSupported )
       
   172                     {                                    
       
   173                     interval = GetRefreshInterval(); 
       
   174                     CLOG_WRITEF( _L( "interval : %d" ),  interval );
       
   175 
       
   176                     if ( iWaitDialog )
       
   177                         {
       
   178                         iWaitDialog->ProcessFinishedL();     
       
   179                         delete iWaitDialog;
       
   180                         iWaitDialog = NULL;    
       
   181                         }
       
   182                     }
       
   183 
       
   184                 iDialog = CIapDialog::NewL( iPlugin );
       
   185                 iDialog->PrepareLC( R_LIST_QUERY );
       
   186                 iDialog->RefreshDialogL( iActIAPs, EFalse );
       
   187                 iDialog->RunLD();
       
   188 
       
   189                 if ( iIsWLANFeatureSupported )
       
   190                     {                                           
       
   191                     if( interval )
       
   192                         {
       
   193                         StartTimerL( interval );
       
   194                         }     
       
   195                     }
       
   196                 }   // else
       
   197             } // if iIAPs
       
   198         else
       
   199             {            
       
   200             CreateArraysL( R_WLAN_SEARCH_FOR_NETWORKS, EFalse, 0 );
       
   201             }            
       
   202         }     
       
   203     
       
   204     CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::RunL " );      
       
   205         
       
   206     }
       
   207 
       
   208     
       
   209 // ---------------------------------------------------------
       
   210 // CActiveCConnDlgIapPlugin::StartSearchIAPsL()
       
   211 // ---------------------------------------------------------
       
   212 //    
       
   213 void CActiveCConnDlgIapPlugin::StartSearchIAPsL()
       
   214     {    
       
   215     CActiveIAPListing::BaseStartSearchIAPsL( R_SEARCHING_WAIT_NOTE );
       
   216     }
       
   217    
       
   218  
       
   219 // ---------------------------------------------------------
       
   220 // CActiveCConnDlgIapPlugin::GetRefreshInterval()
       
   221 // ---------------------------------------------------------
       
   222 //    
       
   223 TInt CActiveCConnDlgIapPlugin::GetRefreshInterval()
       
   224     {
       
   225     return CActiveIAPListing::GetRefreshInterval( KCRUidCConnDlg,
       
   226                                                   KCConnDlgScanInterval );
       
   227     }
       
   228             
       
   229    
       
   230 // End of File