connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiContainer.cpp
changeset 0 5a93021fdf25
child 4 77415202bfc8
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:  container control class
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <aknnavi.h>    //for CNaviPane
       
    22 #include <aknnavide.h>  //for CAknNavigationDecorator
       
    23 
       
    24 #include <AknIconArray.h>
       
    25 #include <aknlists.h>
       
    26 #include <StringLoader.h>
       
    27 #include <AknQueryDialog.h>
       
    28 #include <AknsUtils.h>
       
    29 #include <AknGlobalNote.h>
       
    30 
       
    31 #include "ConnectionArray.h"
       
    32 #include "ConnectionMonitorUiContainer.h"
       
    33 #include "FeatureManagerWrapper.h"
       
    34 #include "ActiveWrapper.h"
       
    35 
       
    36 #include <ConnectionMonitorUi.rsg>
       
    37 #include <ConnectionMonitorUi.mbg>
       
    38 #include <data_caging_path_literals.hrh>
       
    39 
       
    40 #include  <hlplch.h>
       
    41 #include <csxhelp/cmon.hlp.hrh>
       
    42 
       
    43 // CONSTANTS 
       
    44 /**
       
    45 * UID of ConnectionMonitorUi App.
       
    46 */
       
    47 LOCAL_D const TUid KUidConnMonUI = { 0x101F84D0 };
       
    48 
       
    49 
       
    50 // CONSTANTS
       
    51 // Granularity of the model array.
       
    52 /**
       
    53 * Granularity of icon array
       
    54 */
       
    55 LOCAL_D const TInt KGranularity = 5;
       
    56 
       
    57 
       
    58 _LIT( KEmpty, "");  ///< Empty string
       
    59 
       
    60 // ROM folder
       
    61 _LIT( KDriveZ, "z:" );
       
    62 
       
    63 // Name of the MBM file containing bitmaps
       
    64 _LIT( KConnectionMonitorUiMBMFile, "ConnectionMonitorUi.mbm" );
       
    65 
       
    66 // ================= MEMBER FUNCTIONS =======================
       
    67 // ---------------------------------------------------------
       
    68 // CConnectionMonitorUiContainer::CConnectionMonitorUiContainer
       
    69 // ---------------------------------------------------------
       
    70 //
       
    71 CConnectionMonitorUiContainer::CConnectionMonitorUiContainer(
       
    72                                   CConnectionArray* const aConnectionArray,
       
    73                                   RConnectionMonitor* aMonitor,
       
    74                                   CActiveWrapper* aActiveWrapper )
       
    75     : CCoeControl(), 
       
    76     iMonitor( aMonitor ),
       
    77     iConnectionArray( aConnectionArray ), 
       
    78     isWlanSupported( EFalse ),
       
    79     iActiveWrapper( aActiveWrapper )
       
    80     {
       
    81     }
       
    82 
       
    83 // ---------------------------------------------------------
       
    84 // CConnectionMonitorUiContainer::ConstructL
       
    85 // EPOC two phased constructor
       
    86 // ---------------------------------------------------------
       
    87 //
       
    88 void CConnectionMonitorUiContainer::ConstructL( TInt aSelectedItem, const TRect& aRect )
       
    89     {
       
    90     CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::ConstructL" );
       
    91 
       
    92     CreateWindowL(); 
       
    93     
       
    94     iListBox = new( ELeave ) CAknDoubleGraphicStyleListBox;
       
    95     TInt flags( EAknGenericListBoxFlags );
       
    96     iListBox->ConstructL( this, flags );
       
    97     iListBox->CreateScrollBarFrameL( ETrue );
       
    98     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
       
    99                                                CEikScrollBarFrame::EOff,
       
   100                                                CEikScrollBarFrame::EAuto );
       
   101     iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray
       
   102                                          /*ELbmDoesNotOwnItemArray*/ );
       
   103     iListBox->Model()->SetItemTextArray( iConnectionArray );
       
   104     iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   105     
       
   106     TInt actCount = iConnectionArray->MdcaCount() - 1;
       
   107 	
       
   108 	if ( actCount > KErrNotFound )
       
   109 		{
       
   110 		iListBox->SetCurrentItemIndex( aSelectedItem > actCount ? actCount : aSelectedItem );	    
       
   111 		}
       
   112 
       
   113     SetIconsL();
       
   114 
       
   115     HBufC* noConn = StringLoader::LoadLC( R_QTN_CMON_NO_ACTIVE_CONNECTIONS,
       
   116                                           iEikonEnv );
       
   117 
       
   118     CListBoxView *lbview = iListBox->View();
       
   119     lbview->SetListEmptyTextL( *noConn );
       
   120     CleanupStack::PopAndDestroy( noConn );
       
   121 
       
   122     GetPanesL();
       
   123     SetRect( aRect );    
       
   124     ActivateL();
       
   125 
       
   126     isWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); 
       
   127 
       
   128     CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::ConstructL" );
       
   129     }
       
   130 
       
   131 // ---------------------------------------------------------
       
   132 // CConnectionMonitorUiContainer::OfferKeyEventL
       
   133 // ---------------------------------------------------------
       
   134 //
       
   135 TKeyResponse CConnectionMonitorUiContainer::OfferKeyEventL(
       
   136                                                    const TKeyEvent& aKeyEvent,
       
   137                                                    TEventCode aType )
       
   138     {
       
   139     TKeyResponse result( EKeyWasNotConsumed );
       
   140     if ( aType == EEventKey )
       
   141         {
       
   142         TInt index = iListBox->CurrentItemIndex();
       
   143         if ( ( aKeyEvent.iCode == EKeyBackspace ) && ( index != -1 ) )
       
   144             {
       
   145             if ( !( *iConnectionArray )[index]->IsSuspended() )
       
   146                 {
       
   147                 EndConnectionL();
       
   148                 result = EKeyWasConsumed;
       
   149                 }
       
   150             }
       
   151         else
       
   152             {
       
   153             result = iListBox->OfferKeyEventL( aKeyEvent, aType );
       
   154             }
       
   155         }
       
   156     return result;
       
   157     }
       
   158 
       
   159 // ---------------------------------------------------------
       
   160 // CConnectionMonitorUiContainer::~CConnectionMonitorUiContainer
       
   161 // ---------------------------------------------------------
       
   162 //
       
   163 CConnectionMonitorUiContainer::~CConnectionMonitorUiContainer()
       
   164     {
       
   165     delete iListBox;
       
   166     delete iNaviDecorator;
       
   167     }
       
   168 
       
   169 // ---------------------------------------------------------
       
   170 // CConnectionMonitorUiContainer::SizeChanged()
       
   171 // Called by framework when the view size is changed
       
   172 // ---------------------------------------------------------
       
   173 //
       
   174 void CConnectionMonitorUiContainer::SizeChanged()
       
   175     {
       
   176     iListBox->SetRect( Rect() );
       
   177     }
       
   178 
       
   179 // ---------------------------------------------------------
       
   180 // CConnectionMonitorUiContainer::CountComponentControls
       
   181 // ---------------------------------------------------------
       
   182 //
       
   183 TInt CConnectionMonitorUiContainer::CountComponentControls() const
       
   184     {
       
   185     return 1; // only iListBox
       
   186     }
       
   187 
       
   188 // ---------------------------------------------------------
       
   189 // CConnectionMonitorUiContainer::ComponentControl( TInt aIndex ) const
       
   190 // ---------------------------------------------------------
       
   191 //
       
   192 CCoeControl* CConnectionMonitorUiContainer::ComponentControl(
       
   193                                                           TInt aIndex ) const
       
   194     {
       
   195     switch ( aIndex )
       
   196         {
       
   197         case 0:
       
   198             return iListBox;
       
   199         default:
       
   200             return NULL;
       
   201         }
       
   202     }
       
   203 
       
   204 // ---------------------------------------------------------
       
   205 // CConnectionMonitorUiContainer::OnEventL
       
   206 // ---------------------------------------------------------
       
   207 //
       
   208 void CConnectionMonitorUiContainer::OnEventL(
       
   209                                        const CConnMonEventBase& aConnMonEvent,
       
   210                                        const TInt aIndex )
       
   211     {
       
   212     CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::OnEventL" );
       
   213     CMUILOGGER_WRITE_F( "OnEventL type: %d", aConnMonEvent.EventType() );
       
   214     CMUILOGGER_WRITE_F( "OnEventL index: %d", aIndex );
       
   215 
       
   216     TBool validIndex =( iListBox->Model()->NumberOfItems() > KErrNotFound ) &&
       
   217                       ( aIndex > KErrNotFound ) &&
       
   218                       ( iListBox->Model()->NumberOfItems() >= aIndex );
       
   219 
       
   220     if ( aConnMonEvent.ConnectionId() )
       
   221         {
       
   222         switch ( aConnMonEvent.EventType() )
       
   223             {
       
   224             case EConnMonCreateConnection:
       
   225                 {
       
   226                 CMUILOGGER_WRITE( "OnEventL EConnMonCreateConnection" );
       
   227                 iListBox->HandleItemAdditionL();
       
   228                 break;
       
   229                 }
       
   230             case EConnMonDeleteConnection:
       
   231                 {
       
   232                 CMUILOGGER_WRITE( "OnEventL EConnMonDeleteConnection" );
       
   233     			CMUILOGGER_WRITE_F( "validIndex: %b", validIndex );
       
   234                 
       
   235                 if ( validIndex )
       
   236                     {
       
   237                     TBool current
       
   238                         ( aIndex == ( TUint )iListBox->CurrentItemIndex() );
       
   239                     AknListBoxUtils::HandleItemRemovalAndPositionHighlightL(
       
   240                                 iListBox, aIndex, ETrue );
       
   241                     }
       
   242                 iListBox->UpdateScrollBarsL();
       
   243                 break;
       
   244                 }
       
   245             case EConnMonConnectionStatusChange:
       
   246             case EConnMonCreateSubConnection:
       
   247             case EConnMonDeleteSubConnection:
       
   248                 {
       
   249                 CMUILOGGER_WRITE( "OnEventL StatusChange SubConnection" );
       
   250                 if ( validIndex )
       
   251                     {
       
   252                     iListBox->DrawItem( aIndex );
       
   253                     }
       
   254                 break;
       
   255                 }
       
   256             default:
       
   257                 {
       
   258                 CMUILOGGER_WRITE( "OnEventL default" );
       
   259                 break;
       
   260                 }
       
   261             }
       
   262         }
       
   263     PushAndRefreshNaviPaneL();
       
   264 
       
   265     CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::OnEventL" );
       
   266     }
       
   267 
       
   268 // ---------------------------------------------------------
       
   269 // CConnectionMonitorUiContainer::OnTimerEventL
       
   270 // ---------------------------------------------------------
       
   271 //
       
   272 void CConnectionMonitorUiContainer::OnTimerEventL()
       
   273     {
       
   274     iListBox->DrawNow();
       
   275     iListBox->UpdateScrollBarsL();
       
   276     PushAndRefreshNaviPaneL();
       
   277     }
       
   278 
       
   279 // ---------------------------------------------------------
       
   280 // CConnectionMonitorUiContainer::DrawFirstAllListBoxItem
       
   281 // ---------------------------------------------------------
       
   282 //
       
   283 void CConnectionMonitorUiContainer::DrawFirstAllListBoxItem()
       
   284     {
       
   285     TInt count = iListBox->Model()->NumberOfItems() - 1;
       
   286     for ( TInt i = count; i > -1; --i )
       
   287         {
       
   288         iListBox->DrawItem( i );
       
   289         }
       
   290     }
       
   291 
       
   292 // ---------------------------------------------------------
       
   293 // CConnectionMonitorUiContainer::SelectedConnection
       
   294 // ---------------------------------------------------------
       
   295 //
       
   296 TInt CConnectionMonitorUiContainer::SelectedConnection()
       
   297     {
       
   298     return iListBox->CurrentItemIndex();
       
   299     }
       
   300 
       
   301 // ---------------------------------------------------------
       
   302 // CConnectionMonitorUiContainer::EndConnectionL
       
   303 // ---------------------------------------------------------
       
   304 //
       
   305 void CConnectionMonitorUiContainer::EndConnectionL()
       
   306     {
       
   307     CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::EndConnectionL " );
       
   308     TInt index = iListBox->CurrentItemIndex();
       
   309     if ( ( index >= 0 ) && ( index < iConnectionArray->MdcaCount() ) )
       
   310         {
       
   311         CConnectionInfoBase* connection = ( *iConnectionArray )[index];
       
   312         TUint connectionId = connection->GetConnectionId();
       
   313         HBufC* connectionName = NULL;
       
   314         HBufC* promptConnectionName = NULL;
       
   315 
       
   316         // Get the bearertype of a single connection
       
   317         TConnMonBearerType bearer;
       
   318         bearer = connection->GetBearerType();
       
   319 
       
   320         if ( isWlanSupported ) // WLAN ON
       
   321             {
       
   322             if ( ( bearer == EBearerWLAN ) && connection->IsEasyWLAN() )
       
   323                 {
       
   324                 /* check and load the SSID for EasyWLAN */
       
   325                 connectionName = connection->GetWlanNetworkNameLC();
       
   326                 CMUILOGGER_WRITE_F( "GetWlanNetworkNameLC: %S",
       
   327                                     connectionName );
       
   328                 }
       
   329             else
       
   330                 {
       
   331                 connectionName = connection->GetNameLC();
       
   332                 CMUILOGGER_WRITE_F( "GetNameLC: %S", connectionName );
       
   333                 }
       
   334             }
       
   335         else // WLAN OFF
       
   336             {
       
   337             connectionName = connection->GetNameLC();
       
   338             CMUILOGGER_WRITE_F( "GetNameLC: %S", connectionName );
       
   339             }
       
   340 
       
   341         if ( bearer >= EBearerExternalCSD )
       
   342             {
       
   343             CMUILOGGER_WRITE( "R_QTN_CMON_CONF_END_MODEM_CONN" );
       
   344             promptConnectionName = StringLoader::LoadLC( 
       
   345                                             R_QTN_CMON_CONF_END_MODEM_CONN );
       
   346             }
       
   347         else
       
   348             {
       
   349             CMUILOGGER_WRITE( "R_QTN_CMON_CONF_END_SINGLE_CONN" );
       
   350             promptConnectionName = StringLoader::LoadLC( 
       
   351                                             R_QTN_CMON_CONF_END_SINGLE_CONN,
       
   352                                             *connectionName );
       
   353             }
       
   354 
       
   355         CAknQueryDialog* dlg = CAknQueryDialog::NewL();
       
   356         TInt ret = dlg->ExecuteLD( R_END_CONN_CONFIRMATION_QUERY,
       
   357                                    *promptConnectionName );
       
   358 
       
   359         CleanupStack::PopAndDestroy( promptConnectionName );
       
   360         CleanupStack::PopAndDestroy( connectionName );
       
   361         
       
   362         TInt connStatus;
       
   363         iActiveWrapper->StartGetIntAttribute( connectionId,
       
   364                                              iMonitor,
       
   365                                              KConnectionStatus,
       
   366                                              ( ( TInt& )( connStatus ) ) );
       
   367         CMUILOGGER_WRITE_F( "KConnectionStatus status.Int(): %d",
       
   368                             iActiveWrapper->iStatus.Int() );
       
   369         CMUILOGGER_WRITE_F( "KConnectionStatus connStatus: %d",
       
   370                             connStatus );
       
   371         CMUILOGGER_WRITE_F( "ret ret: %d", ret );
       
   372                            
       
   373         if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) )
       
   374             {
       
   375             if ( KErrNone == iActiveWrapper->iStatus.Int() )
       
   376                 {                
       
   377                 connection->SetDeletedFromCMUI();
       
   378                 
       
   379                 connection->RefreshConnectionListBoxItemTextL();
       
   380                 DrawFirstAllListBoxItem();
       
   381                 
       
   382                 iMonitor->SetBoolAttribute( connectionId, 0,
       
   383                                             KConnectionStop, ETrue );
       
   384                 CMUILOGGER_WRITE( "after SetBoolAttribute" );                                            
       
   385                 }
       
   386             }            
       
   387         else
       
   388             {
       
   389             if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
       
   390                 {
       
   391                 /* It is already closed */
       
   392                 /* An information note must be displayed */
       
   393                 CAknGlobalNote * note = CAknGlobalNote::NewL();
       
   394                 CleanupStack::PushL( note );
       
   395                 HBufC* informationText =
       
   396                     StringLoader::LoadLC( R_QTN_CMON_INFO_CONN_ALREADY_END );
       
   397 
       
   398                 note->ShowNoteL(EAknGlobalInformationNote, *informationText );
       
   399                 CleanupStack::PopAndDestroy( informationText );
       
   400                 CleanupStack::PopAndDestroy( note );
       
   401                 CMUILOGGER_WRITE( "It is already closed" );
       
   402                 }
       
   403             }
       
   404         }
       
   405     CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::EndConnectionL " );
       
   406     }
       
   407 
       
   408 // ---------------------------------------------------------
       
   409 // CConnectionMonitorUiContainer::EndAllConnectionL
       
   410 // ---------------------------------------------------------
       
   411 //
       
   412 void CConnectionMonitorUiContainer::EndAllConnectionL()
       
   413     {
       
   414     CMUILOGGER_ENTERFN( "EndAllConnectionL - start" );
       
   415 
       
   416     const TInt KOnlyOneConnection = 1;
       
   417     const TInt KFirstConnection = 0;
       
   418 	CConnectionArray* tempConnArray =  iConnectionArray->DeepCopyL();	
       
   419 	CleanupStack::PushL( tempConnArray );
       
   420 	
       
   421     TInt connectionCount = tempConnArray->MdcaCount();
       
   422     HBufC* promptTxt = NULL;
       
   423     if ( connectionCount == KOnlyOneConnection )
       
   424         {
       
   425         HBufC* temp = ( *tempConnArray )[KFirstConnection]->GetNameLC();
       
   426         TName iapName = *temp;
       
   427         CleanupStack::PopAndDestroy( temp );
       
   428         promptTxt = StringLoader::LoadLC( R_QTN_CMON_CONF_END_SINGLE_CONN,
       
   429                                        iapName );
       
   430         }
       
   431     else
       
   432         {
       
   433         promptTxt = StringLoader::LoadLC( R_QTN_CMON_CONF_END_ALL_CONNS,
       
   434                                        connectionCount );
       
   435         TPtr temp( promptTxt->Des() );
       
   436         AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
       
   437                                        
       
   438         }
       
   439     CAknQueryDialog* dlg = CAknQueryDialog::NewL();
       
   440     TInt ret = dlg->ExecuteLD( R_END_CONN_CONFIRMATION_QUERY, *promptTxt );
       
   441     CleanupStack::PopAndDestroy( promptTxt );
       
   442 
       
   443     CConnectionInfoBase* connection = NULL;
       
   444     TUint connectionId( 0 );
       
   445 
       
   446     CMUILOGGER_WRITE_F( "ret: %d", ret );
       
   447 
       
   448     /* End connections one by one, First CSD, after GPRS and WLAN. */
       
   449     if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) )
       
   450         {
       
   451         for ( TUint i = 0; i < iConnectionArray->MdcaCount(); ++i )
       
   452             {
       
   453             connection = ( *iConnectionArray )[i];
       
   454             connection->SetAllDeletedFromCMUI();
       
   455             connection->RefreshConnectionListBoxItemTextL();
       
   456             }
       
   457               
       
   458         DrawFirstAllListBoxItem();
       
   459         
       
   460         TConnMonBearerType bearer;
       
   461         for ( TUint i = 0; i < connectionCount; ++i )
       
   462             {
       
   463             CMUILOGGER_WRITE_F( "i: %d", i );
       
   464 
       
   465             connection = ( *tempConnArray )[i];
       
   466 
       
   467 			bearer = connection->GetBearerType();
       
   468 		    switch ( bearer )
       
   469 		        {
       
   470 		        case EBearerCSD:
       
   471 		        case EBearerExternalCSD:
       
   472 		        case EBearerWcdmaCSD:
       
   473 		        case EBearerExternalWcdmaCSD:
       
   474 		        case EBearerHSCSD:
       
   475 		        case EBearerExternalHSCSD:
       
   476 		            {
       
   477 		            connectionId = connection->GetConnectionId();
       
   478 	            	iMonitor->SetBoolAttribute( connectionId, 0,
       
   479 	                                        	KConnectionStop, ETrue );	
       
   480 		            CMUILOGGER_WRITE_F( "CSD i: %d", i );
       
   481 		            CMUILOGGER_WRITE_F( "connectionId: %d", connectionId );
       
   482 		            break;
       
   483 		            }		        
       
   484 		        default :
       
   485 		            {
       
   486 		            break;
       
   487 		            }
       
   488 		        }
       
   489             }
       
   490             
       
   491         for ( TUint i = 0; i < connectionCount; ++i )
       
   492             {
       
   493             CMUILOGGER_WRITE_F( "i: %d", i );
       
   494 
       
   495             connection = ( *tempConnArray )[i];
       
   496 
       
   497 			bearer = connection->GetBearerType();
       
   498 		    switch ( bearer )
       
   499 		        {
       
   500                 case EBearerGPRS:
       
   501                 case EBearerWCDMA:
       
   502                 case EBearerEdgeGPRS:
       
   503                 case EBearerExternalGPRS:
       
   504                 case EBearerExternalWCDMA:
       
   505                 case EBearerExternalEdgeGPRS:
       
   506                 case EBearerWLAN:
       
   507 		            {
       
   508 		            connectionId = connection->GetConnectionId();
       
   509 	            	iMonitor->SetBoolAttribute( connectionId, 0,
       
   510 	                                        	KConnectionStop, ETrue );	
       
   511 		            CMUILOGGER_WRITE_F( "GPRS i: %d", i );
       
   512 		            CMUILOGGER_WRITE_F( "connectionId: %d", connectionId );
       
   513 		            break;
       
   514 		            }		        
       
   515 		        default :
       
   516 		            {
       
   517 		            break;
       
   518 		            }
       
   519 		        }
       
   520             }
       
   521         }
       
   522      else
       
   523         {
       
   524         for ( TUint i = 0; 
       
   525              ( ( i < connectionCount ) && 
       
   526                ( KErrNotFound != iActiveWrapper->iStatus.Int() ) ); ++i )
       
   527             {
       
   528             connection = ( *tempConnArray )[i];
       
   529             connectionId = connection->GetConnectionId();
       
   530         	TInt connStatus;
       
   531         	iActiveWrapper->StartGetIntAttribute( connectionId,
       
   532                                                   iMonitor,
       
   533                                                   KConnectionStatus,
       
   534                                                   ( ( TInt& )( connStatus ) ) );
       
   535             }
       
   536             
       
   537         if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
       
   538             {
       
   539             /* It is already closed */
       
   540             /* An information note must be displayed */
       
   541             CAknGlobalNote * note = CAknGlobalNote::NewL();
       
   542             CleanupStack::PushL( note );
       
   543             HBufC* informationText =
       
   544                 StringLoader::LoadLC( R_QTN_CMON_INFO_CONN_ALREADY_END );
       
   545 
       
   546             note->ShowNoteL(EAknGlobalInformationNote, *informationText );
       
   547             CleanupStack::PopAndDestroy( informationText );
       
   548             CleanupStack::PopAndDestroy( note );
       
   549             CMUILOGGER_WRITE( "It is already closed in All" );
       
   550             }
       
   551         }
       
   552         
       
   553     CleanupStack::PopAndDestroy( tempConnArray );
       
   554         
       
   555     CMUILOGGER_LEAVEFN( "EndAllConnectionL - end" );
       
   556     }
       
   557 
       
   558 // ---------------------------------------------------------
       
   559 // CConnectionMonitorUiContainer::ListBox
       
   560 // ---------------------------------------------------------
       
   561 //
       
   562 CAknDoubleGraphicStyleListBox* CConnectionMonitorUiContainer::ListBox() const
       
   563     {
       
   564     return iListBox;
       
   565     }
       
   566 
       
   567 // ---------------------------------------------------------
       
   568 // CConnectionMonitorUiContainer::SetIconsL()
       
   569 // ---------------------------------------------------------
       
   570 //
       
   571 void CConnectionMonitorUiContainer::SetIconsL()
       
   572     {
       
   573     CMUILOGGER_ENTERFN( "SetIconsL" );
       
   574     
       
   575     TFileName iconsFileName;
       
   576 
       
   577     iconsFileName.Append( KDriveZ );
       
   578 
       
   579     iconsFileName.Append( KDC_APP_BITMAP_DIR );
       
   580 
       
   581     iconsFileName.Append( KConnectionMonitorUiMBMFile );
       
   582 
       
   583     CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( KGranularity );
       
   584     CleanupStack::PushL( icons );
       
   585 
       
   586     MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
       
   587 
       
   588     icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
       
   589                             KAknsIIDQgnPropWmlGprs,
       
   590                             iconsFileName,
       
   591                             EMbmConnectionmonitoruiQgn_prop_wml_gprs,
       
   592                             EMbmConnectionmonitoruiQgn_prop_wml_gprs_mask ) );
       
   593 
       
   594     icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
       
   595                             KAknsIIDQgnPropWmlCsd,
       
   596                             iconsFileName,
       
   597                             EMbmConnectionmonitoruiQgn_prop_wml_csd,
       
   598                             EMbmConnectionmonitoruiQgn_prop_wml_csd_mask ) );
       
   599 
       
   600     icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
       
   601                         KAknsIIDQgnPropWmlHscsd,
       
   602                         iconsFileName,
       
   603                         EMbmConnectionmonitoruiQgn_prop_wml_hscsd,
       
   604                         EMbmConnectionmonitoruiQgn_prop_wml_hscsd_mask ) );
       
   605 
       
   606     icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
       
   607                   KAknsIIDQgnPropEmpty,
       
   608                   iconsFileName,
       
   609                   EMbmConnectionmonitoruiQgn_prop_empty,
       
   610                   EMbmConnectionmonitoruiQgn_prop_empty_mask ) );
       
   611 
       
   612     icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
       
   613               KAknsIIDQgnPropWmlSms,
       
   614               iconsFileName,
       
   615               EMbmConnectionmonitoruiQgn_prop_cmon_gprs_suspended,
       
   616               EMbmConnectionmonitoruiQgn_prop_cmon_gprs_suspended_mask ) );
       
   617 
       
   618     icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
       
   619                   KAknsIIDQgnPropWlanBearer,
       
   620                   iconsFileName,
       
   621                   EMbmConnectionmonitoruiQgn_prop_wlan_bearer,
       
   622                   EMbmConnectionmonitoruiQgn_prop_wlan_bearer_mask ) );
       
   623 
       
   624     iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
       
   625     CleanupStack::Pop( icons ); // icons
       
   626     CMUILOGGER_LEAVEFN( "SetIconsL" );        
       
   627     
       
   628     }
       
   629 
       
   630 // ---------------------------------------------------------------------------
       
   631 // void CConnectionMonitorUiContainer::HandleResourceChange( TInt aType )
       
   632 // Handle resource change events.
       
   633 // ---------------------------------------------------------------------------
       
   634 //
       
   635 void CConnectionMonitorUiContainer::HandleResourceChange( TInt aType )
       
   636     {
       
   637     CMUILOGGER_ENTERFN( "HandleResourceChange" );
       
   638     CMUILOGGER_WRITE_F( "aType: %d", aType );            
       
   639     
       
   640     CCoeControl::HandleResourceChange( aType );
       
   641     
       
   642     if ( aType == KAknsMessageSkinChange )
       
   643         {
       
   644         TInt error( KErrNone );
       
   645         TRAP( error,  SetIconsL() );
       
   646         CMUILOGGER_WRITE_F( "KAknsMessageSkinChange error: %d", error );
       
   647         SizeChanged();
       
   648         }
       
   649         
       
   650     if ( aType == KEikDynamicLayoutVariantSwitch )
       
   651         {
       
   652         TRect mainPaneRect;
       
   653         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
       
   654                                            mainPaneRect );        
       
   655         SetRect( mainPaneRect );                
       
   656         DrawNow();                
       
   657         }        
       
   658     CMUILOGGER_LEAVEFN( "HandleResourceChange" );        
       
   659     }
       
   660 
       
   661 // ---------------------------------------------------------
       
   662 // CConnectionMonitorUiContainer::GetPanesL
       
   663 // ---------------------------------------------------------
       
   664 //
       
   665 void CConnectionMonitorUiContainer::GetPanesL()
       
   666     {
       
   667     CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
       
   668 
       
   669     iNaviPane =  STATIC_CAST( CAknNavigationControlContainer*,
       
   670                statusPane->ControlL( TUid::Uid(EEikStatusPaneUidNavi ) ) );
       
   671 
       
   672     PushAndRefreshNaviPaneL();
       
   673     }
       
   674 
       
   675 // ---------------------------------------------------------
       
   676 // CConnectionMonitorUiContainer::PushAndRefreshNaviPaneL
       
   677 // ---------------------------------------------------------
       
   678 //
       
   679 void CConnectionMonitorUiContainer::PushAndRefreshNaviPaneL()
       
   680     {
       
   681     CMUILOGGER_ENTERFN( "PushAndRefreshNaviPaneL - start" );
       
   682 
       
   683     HBufC* textOfNaviPane = NULL;
       
   684     TUint countOfConnection = iConnectionArray->NumberOfActiveConnections();
       
   685     CMUILOGGER_WRITE_F( "countOfConnection: %d", countOfConnection );
       
   686 
       
   687     if ( iNaviDecorator )
       
   688         {
       
   689         PopNaviPane();
       
   690         }
       
   691 
       
   692     if ( countOfConnection )
       
   693         {
       
   694         if ( countOfConnection == 1 )
       
   695             {
       
   696             textOfNaviPane = StringLoader::LoadLC(
       
   697                                          R_QTN_CMON_NAVI_ONE_ACTIVE_CONN );
       
   698             }
       
   699         else
       
   700             {
       
   701             textOfNaviPane = StringLoader::LoadLC(
       
   702                                             R_QTN_CMON_NAVI_MANY_ACTIVE_CONNS,
       
   703                                             countOfConnection );
       
   704             }
       
   705         }
       
   706     else
       
   707         {
       
   708         textOfNaviPane =  KEmpty().AllocLC();
       
   709         }
       
   710 
       
   711     TPtr temp( textOfNaviPane->Des() );
       
   712     AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
       
   713         
       
   714     iNaviDecorator = iNaviPane->CreateNavigationLabelL( *textOfNaviPane );
       
   715     CleanupStack::PopAndDestroy( textOfNaviPane );
       
   716 
       
   717     iNaviPane->PushL( *iNaviDecorator );
       
   718     CMUILOGGER_LEAVEFN( "PushAndRefreshNaviPaneL - end" );
       
   719     }
       
   720 
       
   721 // ---------------------------------------------------------
       
   722 // CConnectionMonitorUiContainer::PopNaviPane
       
   723 // ---------------------------------------------------------
       
   724 //
       
   725 void CConnectionMonitorUiContainer::PopNaviPane()
       
   726     {
       
   727     iNaviPane->Pop( iNaviDecorator );
       
   728     delete iNaviDecorator;
       
   729     iNaviDecorator = NULL;
       
   730     }   
       
   731     
       
   732 // ---------------------------------------------------------
       
   733 // CConnectionMonitorUiContainer::FocusChanged
       
   734 // ---------------------------------------------------------
       
   735 //
       
   736 void CConnectionMonitorUiContainer::FocusChanged( TDrawNow aDrawNow )
       
   737     {
       
   738     CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::FocusChanged" );
       
   739     CCoeControl::FocusChanged( aDrawNow );    
       
   740     if ( iListBox )
       
   741         {
       
   742         iListBox->SetFocus( IsFocused() );
       
   743         }        
       
   744     CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::FocusChanged" );    
       
   745     }
       
   746 
       
   747 // ---------------------------------------------------------
       
   748 // CConnectionMonitorUiContainer::GetHelpContext()
       
   749 // ---------------------------------------------------------
       
   750 //
       
   751 void CConnectionMonitorUiContainer::GetHelpContext( TCoeHelpContext& aContext) const
       
   752     {
       
   753     aContext.iMajor = KUidConnMonUI;
       
   754     aContext.iContext = KCMON_HLP_CMON_MAIN_VIEW;
       
   755     }
       
   756 
       
   757 
       
   758 // End of File