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