memana/analyzetoolclient/configurationappgui/src/atconfigurationappguiprocesscontainer.cpp
changeset 0 f0f2b8682603
equal deleted inserted replaced
-1:000000000000 0:f0f2b8682603
       
     1 /*
       
     2 * Copyright (c) 2009 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 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include <barsread.h>
       
    21 #include <stringloader.h>
       
    22 #include <aknlists.h>
       
    23 #include <eikenv.h>
       
    24 #include <akniconarray.h>
       
    25 #include <eikclbd.h>
       
    26 #include <aknviewappui.h>
       
    27 #include <eikappui.h>
       
    28 #include <utf.h>
       
    29 #include <atconfigurationappgui.rsg>
       
    30 #include <analyzetool/atstorageserverclnt.h>
       
    31 
       
    32 #include "atconfigurationappguiprocesscontainer.h"
       
    33 #include "atconfigurationappguiprocessview.h"
       
    34 #include "atconfigurationappgui.hrh"
       
    35 #include "atconfigurationappguiprocesscontainer.hrh"
       
    36 #include "atconfigurationappguiappui.h"
       
    37 #include "atlog.h"
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CATConfigurationAppGuiProcessContainer::CATConfigurationAppGuiProcessContainer()
       
    41 // First phase of Symbian two-phase construction.
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 CATConfigurationAppGuiProcessContainer::CATConfigurationAppGuiProcessContainer()
       
    45     {
       
    46     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::CATConfigurationAppGuiProcessContainer()" );
       
    47     
       
    48     iListBox = NULL;
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CATConfigurationAppGuiProcessContainer::~CATConfigurationAppGuiProcessContainer()
       
    53 // Destructor.
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CATConfigurationAppGuiProcessContainer::~CATConfigurationAppGuiProcessContainer()
       
    57     {
       
    58     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::~CATConfigurationAppGuiProcessContainer()" );
       
    59     
       
    60     delete iListBox;
       
    61     iListBox = NULL;
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CATConfigurationAppGuiProcessContainer::NewL()
       
    66 // Construct the control (first phase).
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CATConfigurationAppGuiProcessContainer* CATConfigurationAppGuiProcessContainer::NewL( 
       
    70     const TRect& aRect, CATConfigurationAppGuiProcessView* aParent, 
       
    71     MEikCommandObserver* aCommandObserver, TUint aProcessId, 
       
    72     TInt64 aProcessStartTime )
       
    73     {
       
    74     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::NewL()" );
       
    75     
       
    76     CATConfigurationAppGuiProcessContainer* self = 
       
    77 		CATConfigurationAppGuiProcessContainer::NewLC( 
       
    78             aRect, 
       
    79             aParent, 
       
    80             aCommandObserver, aProcessId, aProcessStartTime );
       
    81     CleanupStack::Pop( self );
       
    82     return self;
       
    83     }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CATConfigurationAppGuiProcessContainer::NewLC()
       
    87 // Construct the control (first phase).
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 CATConfigurationAppGuiProcessContainer* CATConfigurationAppGuiProcessContainer::NewLC( 
       
    91     const TRect& aRect, CATConfigurationAppGuiProcessView* aParent, 
       
    92     MEikCommandObserver* aCommandObserver, TUint aProcessId, 
       
    93     TInt64 aProcessStartTime )
       
    94     {
       
    95     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::NewLC()" );
       
    96     
       
    97     CATConfigurationAppGuiProcessContainer* self = 
       
    98 		new ( ELeave ) CATConfigurationAppGuiProcessContainer();
       
    99     CleanupStack::PushL( self );
       
   100     self->ConstructL( aRect, 
       
   101 				      aParent, 
       
   102 				      aCommandObserver, 
       
   103 				      aProcessId, aProcessStartTime );
       
   104     return self;
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CATConfigurationAppGuiProcessContainer::ConstructL()
       
   109 // Construct the control (second phase).
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 void CATConfigurationAppGuiProcessContainer::ConstructL( 
       
   113     const TRect& aRect, CATConfigurationAppGuiProcessView* aParent, 
       
   114     MEikCommandObserver* aCommandObserver, TUint aProcessId, 
       
   115     TInt64 aProcessStartTime )
       
   116     {
       
   117     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::ConstructL()" );
       
   118     
       
   119     //if ( aParent == NULL )
       
   120         //{
       
   121     CreateWindowL();
       
   122         //}
       
   123     /*else
       
   124         {
       
   125         SetContainerWindowL( *aParent );
       
   126         }*/
       
   127     iFocusControl = NULL;
       
   128     iParent = aParent;
       
   129     iCommandObserver = aCommandObserver;
       
   130     iProcessId = aProcessId;
       
   131     iProcessStartTime = aProcessStartTime;
       
   132     InitializeControlsL();
       
   133     SetRect( aRect );
       
   134     ActivateL();
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CATConfigurationAppGuiProcessContainer::CountComponentControls()
       
   139 // Returns the number of controls in the container.
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 TInt CATConfigurationAppGuiProcessContainer::CountComponentControls() const
       
   143     {
       
   144     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::CountComponentControls()" );
       
   145     return ( int ) ELastControl;
       
   146     }
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // CATConfigurationAppGuiProcessContainer::ComponentControl()
       
   150 // Get the control with the given index.
       
   151 // -----------------------------------------------------------------------------
       
   152 //
       
   153 CCoeControl* CATConfigurationAppGuiProcessContainer::ComponentControl( 
       
   154 	TInt aIndex ) const
       
   155     {
       
   156     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::ComponentControl()" );
       
   157     
       
   158     switch ( aIndex )
       
   159         {
       
   160     case EListBox:
       
   161         return iListBox;
       
   162         }
       
   163     return NULL;
       
   164     }
       
   165 
       
   166 // -----------------------------------------------------------------------------
       
   167 // CATConfigurationAppGuiProcessContainer::SizeChanged()
       
   168 // Handle resizing of the container.
       
   169 // -----------------------------------------------------------------------------
       
   170 //
       
   171 void CATConfigurationAppGuiProcessContainer::SizeChanged()
       
   172     {
       
   173     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::SizeChanged()" );
       
   174     
       
   175     CCoeControl::SizeChanged();
       
   176     LayoutControls();
       
   177     }
       
   178 
       
   179 // -----------------------------------------------------------------------------
       
   180 // CATConfigurationAppGuiProcessContainer::LayoutControls()
       
   181 // Layout components.
       
   182 // -----------------------------------------------------------------------------
       
   183 //
       
   184 void CATConfigurationAppGuiProcessContainer::LayoutControls()
       
   185     {
       
   186     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::LayoutControls()" );
       
   187     
       
   188     iListBox->SetExtent( TPoint( 0, 0 ), iListBox->MinimumSize() );
       
   189     }
       
   190     
       
   191 // -----------------------------------------------------------------------------
       
   192 // CATConfigurationAppGuiProcessContainer::OfferKeyEventL()
       
   193 // Handle key events.
       
   194 // -----------------------------------------------------------------------------
       
   195 //
       
   196 TKeyResponse CATConfigurationAppGuiProcessContainer::OfferKeyEventL( 
       
   197         const TKeyEvent& aKeyEvent, 
       
   198         TEventCode aType )
       
   199     {
       
   200     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::OfferKeyEventL()" );
       
   201     
       
   202     if ( aKeyEvent.iCode == EKeyLeftArrow 
       
   203         || aKeyEvent.iCode == EKeyRightArrow )
       
   204         {
       
   205         // Listbox takes all events even if it doesn't use them
       
   206         return EKeyWasNotConsumed;
       
   207         }
       
   208         
       
   209     if ( iFocusControl != NULL
       
   210         && iFocusControl->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed )
       
   211         {
       
   212         return EKeyWasConsumed;
       
   213         }
       
   214     return CCoeControl::OfferKeyEventL( aKeyEvent, aType );
       
   215     }
       
   216 
       
   217 // -----------------------------------------------------------------------------
       
   218 // CATConfigurationAppGuiProcessContainer::InitializeControlsL()
       
   219 // Initialize each control upon creation.
       
   220 // -----------------------------------------------------------------------------
       
   221 //
       
   222 void CATConfigurationAppGuiProcessContainer::InitializeControlsL()
       
   223     {
       
   224     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::InitializeControlsL()" );
       
   225     
       
   226     iListBox = new ( ELeave ) CAknDoubleStyleListBox;
       
   227     iListBox->SetContainerWindowL( *this );
       
   228         {
       
   229         TResourceReader reader;
       
   230         iEikonEnv->CreateResourceReaderLC( reader, R_ATCONFIGURATION_APP_GUI_LIST_BOX );
       
   231         iListBox->ConstructFromResourceL( reader );
       
   232         CleanupStack::PopAndDestroy(); // Reader internal state
       
   233         }
       
   234     // The listbox owns the items in the list and will free them
       
   235     iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
       
   236 
       
   237     iListBox->CreateScrollBarFrameL( ETrue );
       
   238     iListBox->ScrollBarFrame()->
       
   239          SetScrollBarVisibilityL( CEikScrollBarFrame::EOn, CEikScrollBarFrame::EOn );
       
   240 
       
   241     // Enable marquee
       
   242     iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
       
   243         
       
   244     HBufC* noInfo = StringLoader::LoadLC( R_ATCONFIGURATION_APP_GUI_LBX_NO_INFO );
       
   245     iListBox->View()->SetListEmptyTextL( noInfo->Des() );
       
   246     CleanupStack::PopAndDestroy( noInfo );
       
   247 
       
   248     // Setup the icon array so graphics-style boxes work
       
   249     SetupListBoxIconsL();
       
   250 
       
   251     // Add list items
       
   252     AddListBoxResourceArrayItemL( R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM1 );
       
   253     AddListBoxResourceArrayItemL( R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM2 );
       
   254     AddListBoxResourceArrayItemL( R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM3 );
       
   255     AddListBoxResourceArrayItemL( R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM4 );
       
   256     AddListBoxResourceArrayItemL( R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM5 );
       
   257     AddListBoxResourceArrayItemL( R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM6 );
       
   258 
       
   259     iListBox->SetFocus( ETrue );
       
   260     iFocusControl = iListBox;
       
   261     }
       
   262 
       
   263 // -----------------------------------------------------------------------------
       
   264 // CATConfigurationAppGuiProcessContainer::HandleResourceChange()
       
   265 // Handle global resource changes.
       
   266 // -----------------------------------------------------------------------------
       
   267 //
       
   268 void CATConfigurationAppGuiProcessContainer::HandleResourceChange( TInt aType )
       
   269     {
       
   270     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::HandleResourceChange()" );
       
   271     
       
   272     CCoeControl::HandleResourceChange( aType );
       
   273     SetRect( iAvkonViewAppUi->View( TUid::Uid( EATConfigurationAppGuiProcessViewId ) )->ClientRect() );
       
   274     }
       
   275 
       
   276 // -----------------------------------------------------------------------------
       
   277 // CATConfigurationAppGuiProcessContainer::Draw()
       
   278 // Draw container contents.
       
   279 // -----------------------------------------------------------------------------
       
   280 //
       
   281 void CATConfigurationAppGuiProcessContainer::Draw( const TRect& aRect ) const
       
   282     {
       
   283     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::Draw()" );
       
   284     
       
   285     CWindowGc& gc = SystemGc();
       
   286     gc.Clear( aRect );
       
   287     }
       
   288 
       
   289 // -----------------------------------------------------------------------------
       
   290 // CATConfigurationAppGuiProcessContainer::AddListBoxItemL()
       
   291 // Add a list box item to a list.
       
   292 // -----------------------------------------------------------------------------
       
   293 //
       
   294 void CATConfigurationAppGuiProcessContainer::AddListBoxItemL( 
       
   295     CEikTextListBox* aListBox, const TDesC& aString )
       
   296     {
       
   297     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::AddListBoxItemL()" );
       
   298     
       
   299     CTextListBoxModel* model = aListBox->Model();
       
   300     CDesCArray* itemArray = static_cast< CDesCArray* > ( model->ItemTextArray() );
       
   301     itemArray->AppendL( aString );
       
   302     aListBox->HandleItemAdditionL();
       
   303     }
       
   304 
       
   305 // -----------------------------------------------------------------------------
       
   306 // CATConfigurationAppGuiProcessContainer::GetSelectedListBoxItemsLC()
       
   307 // Get the array of selected item indices.
       
   308 // -----------------------------------------------------------------------------
       
   309 //
       
   310 RArray< TInt >* CATConfigurationAppGuiProcessContainer::GetSelectedListBoxItemsLC( 
       
   311 	CEikTextListBox* aListBox )
       
   312     {
       
   313     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::GetSelectedListBoxItemsLC()" );
       
   314     
       
   315     CAknFilteredTextListBoxModel* model = 
       
   316         static_cast< CAknFilteredTextListBoxModel *> ( aListBox->Model() );
       
   317     if ( model->NumberOfItems() == 0 )
       
   318         return NULL;
       
   319         
       
   320     // Get currently selected indices
       
   321     const CListBoxView::CSelectionIndexArray* selectionIndexes =
       
   322         aListBox->SelectionIndexes();
       
   323     TInt selectedIndexesCount = selectionIndexes->Count();
       
   324     if ( selectedIndexesCount == 0 )
       
   325         return NULL;
       
   326         
       
   327     // Copy the indices and sort numerically
       
   328     RArray<TInt>* orderedSelectedIndices = 
       
   329         new (ELeave) RArray< TInt >( selectedIndexesCount );
       
   330 
       
   331     // Push the allocated array
       
   332     CleanupStack::PushL( orderedSelectedIndices );
       
   333 
       
   334     // Dispose the array resource
       
   335     CleanupClosePushL( *orderedSelectedIndices );
       
   336 
       
   337     // See if the search field is enabled
       
   338     CAknListBoxFilterItems* filter = model->Filter();
       
   339     if ( filter != NULL )
       
   340         {
       
   341         // When filtering enabled, translate indices back to underlying model
       
   342         for ( TInt idx = 0; idx < selectedIndexesCount; idx++ )
       
   343             {
       
   344             TInt filteredItem = ( *selectionIndexes ) [ idx ];
       
   345             TInt actualItem = filter->FilteredItemIndex ( filteredItem );
       
   346             orderedSelectedIndices->InsertInOrder( actualItem );
       
   347             }
       
   348         }
       
   349     else
       
   350         {
       
   351         // The selection indices refer directly to the model
       
   352         for ( TInt idx = 0; idx < selectedIndexesCount; idx++ )
       
   353             orderedSelectedIndices->InsertInOrder( ( *selectionIndexes ) [ idx ] );
       
   354         }
       
   355         
       
   356     return orderedSelectedIndices;
       
   357     }
       
   358 
       
   359 // -----------------------------------------------------------------------------
       
   360 // CATConfigurationAppGuiProcessContainer::DeleteSelectedListBoxItemsL()
       
   361 // Delete the selected item or items from the list box.
       
   362 // -----------------------------------------------------------------------------
       
   363 //
       
   364 void CATConfigurationAppGuiProcessContainer::DeleteSelectedListBoxItemsL( 
       
   365 	CEikTextListBox* aListBox )
       
   366     {
       
   367     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::DeleteSelectedListBoxItemsL()" );
       
   368     
       
   369     CAknFilteredTextListBoxModel* model = 
       
   370         static_cast< CAknFilteredTextListBoxModel *> ( aListBox->Model() );
       
   371     if ( model->NumberOfItems() == 0 )
       
   372         return;
       
   373 
       
   374     RArray< TInt >* orderedSelectedIndices = GetSelectedListBoxItemsLC( aListBox );
       
   375     if ( !orderedSelectedIndices )
       
   376         return;
       
   377         
       
   378     // Delete selected items from bottom up so indices don't change on us
       
   379     CDesCArray* itemArray = static_cast< CDesCArray* > ( model->ItemTextArray() );
       
   380     TInt currentItem = 0;
       
   381 
       
   382     for ( TInt idx = orderedSelectedIndices->Count(); idx-- > 0; ) 
       
   383         {
       
   384         currentItem = ( *orderedSelectedIndices )[ idx ];
       
   385         itemArray->Delete ( currentItem );
       
   386         }
       
   387 
       
   388     // Dispose the array resources
       
   389     CleanupStack::PopAndDestroy();
       
   390 
       
   391     // Dispose the array pointer
       
   392     CleanupStack::PopAndDestroy( orderedSelectedIndices );
       
   393 
       
   394     // Refresh listbox's cursor now that items are deleted
       
   395     AknListBoxUtils::HandleItemRemovalAndPositionHighlightL(
       
   396         aListBox, currentItem, ETrue );
       
   397     }
       
   398 
       
   399 // -----------------------------------------------------------------------------
       
   400 // CATConfigurationAppGuiProcessContainer::ListBox()
       
   401 // Get the listbox.
       
   402 // -----------------------------------------------------------------------------
       
   403 //
       
   404 CAknDoubleStyleListBox* CATConfigurationAppGuiProcessContainer::ListBox()
       
   405     {
       
   406     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::ListBox()" );
       
   407     
       
   408     return iListBox;
       
   409     }
       
   410 
       
   411 // -----------------------------------------------------------------------------
       
   412 // CATConfigurationAppGuiProcessContainer::CreateListBoxItemL()
       
   413 // Create a list box item with the given column values.
       
   414 // -----------------------------------------------------------------------------
       
   415 //
       
   416 void CATConfigurationAppGuiProcessContainer::CreateListBoxItemL( TDes& aBuffer, 
       
   417     const TDesC& aMainText, const TDesC& aSecondaryText )
       
   418     {
       
   419     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::CreateListBoxItemL()" );
       
   420     
       
   421     _LIT ( KStringHeader, "\t%S\t%S" );
       
   422 
       
   423     aBuffer.Format( KStringHeader(), &aMainText, &aSecondaryText );
       
   424     } 
       
   425 
       
   426 // -----------------------------------------------------------------------------
       
   427 // CATConfigurationAppGuiProcessContainer::AddListBoxResourceArrayItemL()
       
   428 // Add an item to the list by reading the text items from the array resource.
       
   429 // -----------------------------------------------------------------------------
       
   430 //
       
   431 void CATConfigurationAppGuiProcessContainer::AddListBoxResourceArrayItemL( 
       
   432 	TInt aResourceId )
       
   433     {
       
   434     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::AddListBoxResourceArrayItemL()" );
       
   435     
       
   436     CDesCArray* array = iCoeEnv->ReadDesCArrayResourceL( aResourceId );
       
   437     CleanupStack::PushL( array );
       
   438     _LIT( KSpace, " " );
       
   439     TBuf<KATHundred> main;
       
   440     TBuf<KMaxFileName + 1> secondary;
       
   441     // Get handle to appUi
       
   442     CATConfigurationAppGuiAppUi* appUi = ( CATConfigurationAppGuiAppUi* )iEikonEnv->AppUi();
       
   443 
       
   444     switch ( aResourceId )
       
   445         {
       
   446         case R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM1:
       
   447             {
       
   448             TUint32 number( KErrNone );
       
   449             TUint32 size( KErrNone );
       
   450             TInt currErr = appUi->StorageServer().GetCurrentAllocsL( iProcessId, number, size );
       
   451             if ( currErr == KErrNone )
       
   452                 {
       
   453                 main.Copy( KSpace );
       
   454                 main.AppendNum( number );
       
   455                 if ( size >= KATThousand && size < KATMillion ) // kiloByte range
       
   456                     {
       
   457                     TReal value( size );
       
   458                     value = value / KATThousand;
       
   459                     secondary.Format( _L(" %.1f"), value );
       
   460                     secondary.Append( KSpace );
       
   461                     secondary.Append( KATKB );  
       
   462                     }
       
   463                 else if ( size >= KATMillion ) // megaByte range
       
   464                     {
       
   465                     TReal value( size );
       
   466                     value = value / KATMillion;
       
   467                     secondary.Format( _L(" %.1f"), value );
       
   468                     secondary.Append( KSpace );
       
   469                     secondary.Append( KATMB );
       
   470                     }
       
   471                 else
       
   472                     {
       
   473                     secondary.Copy( KSpace );
       
   474                     secondary.AppendNum( size );
       
   475                     secondary.Append( KSpace );
       
   476                     secondary.Append( KATB );
       
   477                     }
       
   478                 }
       
   479             else
       
   480                 {
       
   481                 main.Copy( KSpace );
       
   482                 main.Append( _L("unavailable") );
       
   483                 secondary.Copy( KSpace );
       
   484                 secondary.Append( _L("unavailable") );
       
   485                 }
       
   486             break;
       
   487             }
       
   488         case R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM2:
       
   489             {
       
   490             TUint32 number( KErrNone );
       
   491             TUint32 size( KErrNone );
       
   492             TInt maxErr = appUi->StorageServer().GetMaxAllocsL( iProcessId, number, size );
       
   493             if ( maxErr == KErrNone )
       
   494                 {
       
   495                 main.Copy( KSpace );
       
   496                 main.AppendNum( number );
       
   497                 if ( size >= KATThousand && size < KATMillion ) // kiloByte range
       
   498                     {
       
   499                     TReal value( size );
       
   500                     value = value / KATThousand;
       
   501                     secondary.Format( _L(" %.1f"), value );
       
   502                     secondary.Append( KSpace );
       
   503                     secondary.Append( KATKB );  
       
   504                     }
       
   505                 else if ( size >= KATMillion ) // megaByte range
       
   506                     {
       
   507                     TReal value( size );
       
   508                     value = value / KATMillion;
       
   509                     secondary.Format( _L(" %.1f"), value );
       
   510                     secondary.Append( KSpace );
       
   511                     secondary.Append( KATMB );
       
   512                     }
       
   513                 else
       
   514                     {
       
   515                     secondary.Copy( KSpace );
       
   516                     secondary.AppendNum( size );
       
   517                     secondary.Append( KSpace );
       
   518                     secondary.Append( KATB );
       
   519                     }                   
       
   520                 }
       
   521             else
       
   522                 {
       
   523                 main.Copy( KSpace );
       
   524                 main.Append( _L("unavailable") );
       
   525                 secondary.Copy( KSpace );
       
   526                 secondary.Append( _L("unavailable") );
       
   527                 }
       
   528             break;
       
   529             }
       
   530         case R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM3:
       
   531             {
       
   532             secondary.Copy( KSpace );
       
   533             TTime time( iProcessStartTime );
       
   534             TBuf<50> dateString;
       
   535             _LIT( KDateString3,"%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B" );
       
   536             time.FormatL( dateString, KDateString3 );
       
   537             secondary.Append( dateString );
       
   538             break;
       
   539             }
       
   540         case R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM4:
       
   541             {
       
   542             secondary.Copy( KSpace );
       
   543             TATLogOption loggingMode;
       
   544             TInt loggingErr = appUi->StorageServer().GetLoggingModeL( iProcessId, loggingMode );
       
   545             if ( KErrNone == loggingErr )
       
   546                 {
       
   547                 if ( EATUseDefault == loggingMode )
       
   548                     {
       
   549                     HBufC* defaultLogging = StringLoader::LoadLC( R_ATCONFIGURATION_APP_XTI_LOGGING );
       
   550                     secondary.Append( defaultLogging->Des() );
       
   551                     CleanupStack::PopAndDestroy( defaultLogging );
       
   552                     }
       
   553                 else if ( EATLogToFile == loggingMode )
       
   554                     {
       
   555                     HBufC* fileLogging = StringLoader::LoadLC( R_ATCONFIGURATION_APP_FILE_LOGGING );
       
   556                     secondary.Append( fileLogging->Des() );
       
   557                     CleanupStack::PopAndDestroy( fileLogging );
       
   558                     }
       
   559                 else if ( EATLogToXti == loggingMode )
       
   560                     {
       
   561                     HBufC* xtiLogging = StringLoader::LoadLC( R_ATCONFIGURATION_APP_XTI_LOGGING );
       
   562                     secondary.Append( xtiLogging->Des() );
       
   563                     CleanupStack::PopAndDestroy( xtiLogging );
       
   564                     }
       
   565                 else if( EATLoggingOff == loggingMode )
       
   566                     {
       
   567                     HBufC* noneLogging = StringLoader::LoadLC( R_ATCONFIGURATION_APP_NONE_LOGGING );
       
   568                     secondary.Append( noneLogging->Des() );
       
   569                     CleanupStack::PopAndDestroy( noneLogging );
       
   570                     }
       
   571                 }
       
   572             else
       
   573                 {
       
   574                 secondary.Append( _L("unavailable") );
       
   575                 }
       
   576             break;
       
   577             }
       
   578         case R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM5:
       
   579             {
       
   580             secondary.Copy( KSpace );
       
   581             TUint32 isUdeb;
       
   582             TInt udebErr = appUi->StorageServer().GetUdebL( iProcessId, isUdeb );
       
   583             if ( KErrNone == udebErr )
       
   584                 {
       
   585                 if ( isUdeb > KErrNone )
       
   586                     {
       
   587                     _LIT( KUdeb, "UDEB" );
       
   588                     secondary.Append( KUdeb() );
       
   589                     }
       
   590                 else
       
   591                     {
       
   592                     _LIT( KUrel, "UREL" );
       
   593                     secondary.Append( KUrel() );   
       
   594                     }
       
   595                 }
       
   596             else
       
   597                 {
       
   598                 secondary.Append( _L("unavailable") );
       
   599                 }
       
   600             break;
       
   601             }
       
   602         case R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM6:
       
   603             {
       
   604             secondary.Copy( KSpace );
       
   605             TBuf8<KMaxFileName> fileName;
       
   606             TInt fileErr = appUi->StorageServer().GetLoggingFileL( iProcessId, fileName );
       
   607             if ( KErrNone == fileErr )
       
   608                 {
       
   609                 if ( fileName.Length() > KErrNone )
       
   610                     {
       
   611                     TBuf<KMaxFileName> unicodeFile;
       
   612                     CnvUtfConverter::ConvertToUnicodeFromUtf8( unicodeFile, fileName );
       
   613                     secondary.Append( unicodeFile );
       
   614                     }
       
   615                 else
       
   616                     {               
       
   617                     _LIT( KNone, "None" );
       
   618                     secondary.Append( KNone() );
       
   619                     }
       
   620                 }
       
   621             else
       
   622                 {
       
   623                 _LIT( KUnavail, "unavailable" );
       
   624                 secondary.Append( KUnavail() );
       
   625                 }
       
   626             break;
       
   627             }
       
   628         default:
       
   629             {
       
   630             break;
       
   631             }
       
   632         }
       
   633     HBufC* mainText = HBufC::NewLC( ( *array ) [ 0 ].Length() + main.Length() );
       
   634     HBufC* secondaryText = HBufC::NewLC(( *array ) [ 1 ].Length() + secondary.Length() );
       
   635     mainText->Des().Copy( ( *array ) [ 0 ] );
       
   636     mainText->Des().Append( main );
       
   637     secondaryText->Des().Copy( ( *array ) [ 1 ] );
       
   638     secondaryText->Des().Append( secondary );
       
   639     // This is intended to be large enough, but if you get 
       
   640     // a USER 11 panic, consider reducing string sizes.
       
   641     TBuf<512> listString; 
       
   642     CreateListBoxItemL( listString, mainText->Des(), secondaryText->Des() );
       
   643     AddListBoxItemL( iListBox, listString );
       
   644     CleanupStack::PopAndDestroy( secondaryText );
       
   645     CleanupStack::PopAndDestroy( mainText );
       
   646     CleanupStack::PopAndDestroy( array );
       
   647     } 
       
   648 
       
   649 // -----------------------------------------------------------------------------
       
   650 // CATConfigurationAppGuiProcessContainer::SetupListBoxIconsL()
       
   651 // Set up the list's icon array.
       
   652 // -----------------------------------------------------------------------------
       
   653 //
       
   654 void CATConfigurationAppGuiProcessContainer::SetupListBoxIconsL()
       
   655     {
       
   656     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::SetupListBoxIconsL()" );
       
   657     
       
   658     CArrayPtr< CGulIcon >* icons = NULL;
       
   659 
       
   660     if ( icons != NULL )
       
   661         {
       
   662         iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons );
       
   663         }
       
   664     }
       
   665 
       
   666 // -----------------------------------------------------------------------------
       
   667 // CATConfigurationAppGuiProcessContainer::HandleMarkableListCommandL()
       
   668 // Handle commands relating to markable lists.
       
   669 // -----------------------------------------------------------------------------
       
   670 //
       
   671 TBool CATConfigurationAppGuiProcessContainer::HandleMarkableListCommandL( 
       
   672 	TInt /*aCommand*/ )
       
   673     {
       
   674     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::HandleMarkableListCommandL()" );
       
   675     
       
   676     return EFalse;
       
   677     }
       
   678 
       
   679 // -----------------------------------------------------------------------------
       
   680 // CATConfigurationAppGuiProcessContainer::GetCurrentItemIndex()
       
   681 // Returns current listbox index.
       
   682 // -----------------------------------------------------------------------------
       
   683 //
       
   684 TInt CATConfigurationAppGuiProcessContainer::GetCurrentItemIndex()
       
   685     {
       
   686     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::GetCurrentItemIndex()" );
       
   687     
       
   688     return iListBox->CurrentItemIndex();
       
   689     }
       
   690 
       
   691 // -----------------------------------------------------------------------------
       
   692 // CATConfigurationAppGuiProcessContainer::UpdateViewL()
       
   693 // Update view's controls.
       
   694 // -----------------------------------------------------------------------------
       
   695 //
       
   696 void CATConfigurationAppGuiProcessContainer::UpdateViewL()
       
   697     {
       
   698     LOGSTR1( "ATCU CATConfigurationAppGuiProcessContainer::UpdateViewL()" );
       
   699     
       
   700     CTextListBoxModel* model = iListBox->Model();
       
   701     CDesCArray* itemArray = static_cast< CDesCArray* > ( model->ItemTextArray() );
       
   702     itemArray->Reset();
       
   703     
       
   704     // add list items
       
   705     AddListBoxResourceArrayItemL( R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM1 );
       
   706     AddListBoxResourceArrayItemL( R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM2 );
       
   707     AddListBoxResourceArrayItemL( R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM3 );
       
   708     AddListBoxResourceArrayItemL( R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM4 );
       
   709     AddListBoxResourceArrayItemL( R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM5 );
       
   710     AddListBoxResourceArrayItemL( R_ATCONFIGURATION_APP_GUI_PROCESS_LISTBOX_ITEM6 );
       
   711     
       
   712     iListBox->DrawNow();
       
   713     }
       
   714 
       
   715 // End of File