connectionutilities/ConnectionDialogs/cconndlg/src/ActiveIapPlugin.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:  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 // CONSTANTS
       
    39 
       
    40 // Panic string
       
    41 #if defined(_DEBUG)
       
    42 _LIT( KErrNullPointer, "NULL pointer" );
       
    43 #endif
       
    44 
       
    45 
       
    46 ///////////////////////////////////////////////////////////////////////////////
       
    47 
       
    48 // ---------------------------------------------------------
       
    49 // CActiveCConnDlgIapPlugin::CActiveCConnDlgIapPlugin()
       
    50 // ---------------------------------------------------------
       
    51 //
       
    52 CActiveCConnDlgIapPlugin::CActiveCConnDlgIapPlugin( 
       
    53                                             CConnDlgIapPlugin* aPlugin,
       
    54                                             const TConnectionPrefs& aPrefs )
       
    55 : CActiveIAPListing( aPrefs ),
       
    56   iPlugin( aPlugin ), 
       
    57   isDialogDeleting( EFalse )
       
    58     {
       
    59     }
       
    60 
       
    61     
       
    62 // ---------------------------------------------------------
       
    63 // CActiveCConnDlgIapPlugin* CActiveCConnDlgIapPlugin::NewL()
       
    64 // ---------------------------------------------------------
       
    65 //
       
    66 CActiveCConnDlgIapPlugin* CActiveCConnDlgIapPlugin::NewL( 
       
    67                                               CConnDlgIapPlugin* aPlugin,              
       
    68                                               const TConnectionPrefs& aPrefs )
       
    69     {
       
    70     CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::NewL " );  
       
    71     
       
    72     CActiveCConnDlgIapPlugin* self = 
       
    73                          new ( ELeave ) CActiveCConnDlgIapPlugin( aPlugin,                                                                  
       
    74                                                                   aPrefs );
       
    75     CleanupStack::PushL( self );
       
    76     self->ConstructL();
       
    77     CleanupStack::Pop( self );
       
    78     
       
    79     CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::NewL " );      
       
    80 
       
    81     return self;        
       
    82     }
       
    83 
       
    84 
       
    85 // ---------------------------------------------------------
       
    86 // CActiveCConnDlgIapPlugin::ConstructL()
       
    87 // ---------------------------------------------------------
       
    88 //
       
    89 void CActiveCConnDlgIapPlugin::ConstructL()
       
    90     {
       
    91     BaseConstructL();
       
    92     }
       
    93 
       
    94 // ---------------------------------------------------------
       
    95 // CActiveCConnDlgIapPlugin::~CActiveCConnDlgIapPlugin()
       
    96 // ---------------------------------------------------------
       
    97 //    
       
    98 CActiveCConnDlgIapPlugin::~CActiveCConnDlgIapPlugin()
       
    99     {
       
   100     CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::~CActiveCConnDlgIapPlugin" );      
       
   101 
       
   102     Cancel();
       
   103 
       
   104     CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::~CActiveCConnDlgIapPlugin" );      
       
   105     }
       
   106 
       
   107 
       
   108 // ---------------------------------------------------------
       
   109 // CActiveCConnDlgIapPlugin::Cancel()
       
   110 // ---------------------------------------------------------
       
   111 // 
       
   112 void CActiveCConnDlgIapPlugin::Cancel()
       
   113     {
       
   114     CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::Cancel" );      
       
   115 
       
   116     CActiveIAPListing::Cancel();
       
   117 
       
   118     CLOG_WRITE( "Returned from CActiveIAPListing::Cancel" );
       
   119 
       
   120     if( iDialog  && !( iDialog->GetOkToExit() ) )
       
   121         {
       
   122         CLOG_WRITEF( _L( "iDialog->GetOkToExit() : %b" ), iDialog->GetOkToExit() );
       
   123         delete iDialog;
       
   124         iDialog = NULL;
       
   125         }
       
   126 
       
   127     CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::Cancel" );      
       
   128     }
       
   129 
       
   130 
       
   131 // ---------------------------------------------------------
       
   132 // CActiveCConnDlgIapPlugin::DoCancel()
       
   133 // ---------------------------------------------------------
       
   134 // 
       
   135 void CActiveCConnDlgIapPlugin::DoCancel()
       
   136     {
       
   137     CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::DoCancel " );  
       
   138     
       
   139     if( isDialogDeleting )
       
   140         {
       
   141         CLOG_WRITE( "isDialogDeleting" );
       
   142         
       
   143         delete iDialog;
       
   144         iDialog = NULL;   
       
   145         
       
   146         isDialogDeleting = EFalse;         
       
   147         }
       
   148         
       
   149     CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::DoCancel " );          
       
   150     }
       
   151 
       
   152     
       
   153 // ---------------------------------------------------------
       
   154 // CActiveCConnDlgIapPlugin::RunL()
       
   155 // ---------------------------------------------------------
       
   156 //     
       
   157 void CActiveCConnDlgIapPlugin::RunL()
       
   158     {
       
   159     CLOG_ENTERFN( "CActiveCConnDlgIapPlugin::RunL " );  
       
   160     
       
   161     CLOG_WRITEF( _L( "iStatus.Int() : %d" ), iStatus.Int() );
       
   162     CLOG_WRITEF( _L( "&iStatus : %d" ), &iStatus );
       
   163     
       
   164     if( iStatus == KErrNone )
       
   165         {
       
   166         
       
   167         if( iIAPs ) // if iIAPs has been created
       
   168             {            
       
   169             // merge arrays and sort
       
   170             MergeArraysL( R_WLAN_SEARCH_FOR_NETWORKS );
       
   171             
       
   172             if ( iDialog )  // if dialog has been created
       
   173                 {
       
   174                 iDialog->RefreshDialogL( iActIAPs, ETrue );
       
   175                 }
       
   176             else
       
   177                 {
       
   178                 TInt interval = 0;
       
   179                 if ( iIsWLANFeatureSupported )
       
   180                     {                                    
       
   181                     interval = GetRefreshInterval(); 
       
   182                     CLOG_WRITEF( _L( "interval : %d" ),  interval );
       
   183 
       
   184                     if ( iWaitDialog )
       
   185                         {
       
   186                         iWaitDialog->ProcessFinishedL();     
       
   187                         delete iWaitDialog;
       
   188                         iWaitDialog = NULL;    
       
   189                         }
       
   190                     }
       
   191 
       
   192                 iDialog = CIapDialog::NewL( iPlugin );
       
   193                 iDialog->PrepareLC( R_LIST_QUERY );
       
   194                 iDialog->RefreshDialogL( iActIAPs, EFalse );
       
   195                 iDialog->RunLD();
       
   196 
       
   197                 if ( iIsWLANFeatureSupported )
       
   198                     {                                           
       
   199                     if( interval )
       
   200                         {
       
   201                         StartTimerL( interval );
       
   202                         }     
       
   203                     }
       
   204                 }   // else
       
   205             } // if iIAPs
       
   206         else
       
   207             {            
       
   208             CreateArraysL( R_WLAN_SEARCH_FOR_NETWORKS, EFalse, 0 );
       
   209             }            
       
   210         }     
       
   211     
       
   212     CLOG_LEAVEFN( "CActiveCConnDlgIapPlugin::RunL " );      
       
   213         
       
   214     }
       
   215 
       
   216     
       
   217 // ---------------------------------------------------------
       
   218 // CActiveCConnDlgIapPlugin::StartSearchIAPsL()
       
   219 // ---------------------------------------------------------
       
   220 //    
       
   221 void CActiveCConnDlgIapPlugin::StartSearchIAPsL()
       
   222     {    
       
   223     CActiveIAPListing::BaseStartSearchIAPsL( R_SEARCHING_WAIT_NOTE );
       
   224     }
       
   225    
       
   226  
       
   227 // ---------------------------------------------------------
       
   228 // CActiveCConnDlgIapPlugin::GetRefreshInterval()
       
   229 // ---------------------------------------------------------
       
   230 //    
       
   231 TInt CActiveCConnDlgIapPlugin::GetRefreshInterval()
       
   232     {
       
   233     return CActiveIAPListing::GetRefreshInterval( KCRUidCConnDlg,
       
   234                                                   KCConnDlgScanInterval );
       
   235     }
       
   236             
       
   237    
       
   238 // End of File