diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp --- a/memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewKernelContainers.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewKernel.h" -#include "MemSpyContainerObserver.h" -#include "MemSpyViewKernelObjects.h" - -// Literal constants - - - -CMemSpyViewKernelContainers::CMemSpyViewKernelContainers( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aSession, aObserver ) - { - } - - -CMemSpyViewKernelContainers::~CMemSpyViewKernelContainers() - { - //delete iModel; - } - - -void CMemSpyViewKernelContainers::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Kernel Objects" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -void CMemSpyViewKernelContainers::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewKernelContainers::ViewType() const - { - return EMemSpyViewTypeKernelContainers; - } - - -CMemSpyViewBase* CMemSpyViewKernelContainers::PrepareParentViewL() - { - CMemSpyViewKernel* parent = new(ELeave) CMemSpyViewKernel( iMemSpySession, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewKernelContainers::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - const TInt index = iListBox->CurrentItemIndex(); - //child = new(ELeave) CMemSpyViewKernelObjects( iEngine, iObserver, iModel->At( index ).Type() ); - child = new(ELeave) CMemSpyViewKernelObjects( iMemSpySession, iObserver, iKernelObjects[index]->Type() ); - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewKernelContainers::SetListBoxModelL() - { - iMemSpySession.GetKernelObjects( iKernelObjects ); - - CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( iKernelObjects.Count() ); //array for formated items - - for( TInt i=0 ; iCount(); - TInt size = iKernelObjects[i]->Size(); - const TMemSpySizeText sizeText( MemSpyUiUtils::FormatSizeText( size, 0 ) ); - - HBufC* tempName = HBufC::NewL( iKernelObjects[i]->Name().Length() + 32 ); - - CleanupStack::PushL( tempName ); - TPtr tempNamePtr( tempName->Des() ); - tempNamePtr.Copy( iKernelObjects[i]->Name() ); - - _LIT(KNameFormat, "\t%S\t\t%d item"); - TPtr pName( tempName->Des() ); - // - const TPtrC pType( MemSpyUiUtils::TypeAsString( iKernelObjects[i]->Type() ) ); - // - pName.Format( KNameFormat, &pType, count ); - // - if ( count == 0 || count > 1 ) - { - pName.Append( _L("s") ); - } - - pName.AppendFormat( _L(", %S"), &sizeText ); - - model->AppendL( pName ); - - CleanupStack::PopAndDestroy( tempName); //--- - } - - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -TBool CMemSpyViewKernelContainers::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdKernelContainersOutput: - OnCmdOutputAllContainerContentsL(); - break; - - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewKernelContainers::OnCmdOutputAllContainerContentsL() - { - iMemSpySession.OutputAllContainerContents(); - }