memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp
branchRCL_3
changeset 50 9b2cffad4b5e
parent 45 b3cee849fa46
equal deleted inserted replaced
49:f8280f3bfeb7 50:9b2cffad4b5e
       
     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 #include "MemSpyViewThreadInfoItemActiveObject.h"
       
    19 
       
    20 // Engine includes
       
    21 #include <memspy/engine/memspyengine.h>
       
    22 #include <memspy/engine/memspyengineobjectprocess.h>
       
    23 #include <memspy/engine/memspyengineobjectthread.h>
       
    24 #include <memspy/engine/memspyengineobjectcontainer.h>
       
    25 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
       
    26 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
       
    27 #include <memspy/engine/memspyenginehelperactiveobject.h>
       
    28 #include <memspysession.h>
       
    29 
       
    30 // User includes
       
    31 #include "MemSpyContainerObserver.h"
       
    32 
       
    33 
       
    34 CMemSpyViewThreadInfoItemActiveObjectBase::CMemSpyViewThreadInfoItemActiveObjectBase(RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
       
    35 :   CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeActiveObject )
       
    36     {
       
    37     }
       
    38 
       
    39 
       
    40 TBool CMemSpyViewThreadInfoItemActiveObjectBase::HandleCommandL( TInt aCommand )
       
    41     {
       
    42     TBool handled = ETrue;
       
    43     /*
       
    44     //
       
    45     switch ( aCommand )
       
    46         {
       
    47     case EMemSpyCmdActiveObjectListing:
       
    48         OnCmdWriteAOListingL();
       
    49         break;
       
    50     default:
       
    51         handled = CMemSpyViewBase::HandleCommandL( aCommand );
       
    52         break;
       
    53         }
       
    54     //
       
    55      * */
       
    56     return handled;
       
    57     }
       
    58 
       
    59 
       
    60 void CMemSpyViewThreadInfoItemActiveObjectBase::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
    61     {
       
    62     if  ( aResourceId == R_MEMSPY_MENUPANE )
       
    63         {
       
    64      //   aMenuPane->SetItemDimmed( EMemSpyCmdActiveObject, Thread().IsDead() );
       
    65         }
       
    66     }
       
    67 
       
    68 
       
    69 CMemSpyEngineActiveObjectArray& CMemSpyViewThreadInfoItemActiveObjectBase::ActiveObjectArray() const
       
    70     {
       
    71  //   CMemSpyThreadInfoActiveObjects* activeObjectArray = static_cast< CMemSpyThreadInfoActiveObjects* >( iInfoItem );
       
    72  //   return activeObjectArray->Array();
       
    73     }
       
    74     
       
    75     
       
    76 void CMemSpyViewThreadInfoItemActiveObjectBase::OnCmdWriteAOListingL()
       
    77     {
       
    78 	iMemSpySession.OutputAOListL( ThreadId(), EMemSpyThreadInfoItemTypeActiveObject );
       
    79 	
       
    80 	/*
       
    81     CMemSpyEngineActiveObjectArray& objects = ActiveObjectArray();
       
    82 
       
    83     // Begin a new data stream
       
    84     _LIT( KMemSpyContext, "Active Object List - " );
       
    85     _LIT( KMemSpyFolder, "Active Objects" );
       
    86     iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder );
       
    87 
       
    88     // Set prefix for overall listing
       
    89     iEngine.Sink().OutputPrefixSetLC( KMemSpyContext );
       
    90 
       
    91     // Create header
       
    92     CMemSpyEngineActiveObjectArray::OutputDataColumnsL( iEngine );
       
    93     
       
    94     // List items
       
    95     const TInt count = objects.Count();
       
    96     for(TInt i=0; i<count; i++)
       
    97         {
       
    98         const CMemSpyEngineActiveObject& object = objects.At( i );
       
    99         //
       
   100         object.OutputDataL( iEngine );
       
   101         }
       
   102 
       
   103     // Tidy up
       
   104     CleanupStack::PopAndDestroy(); // prefix
       
   105 
       
   106     // End data stream
       
   107     iEngine.Sink().DataStreamEndL();
       
   108     */
       
   109     }
       
   110 
       
   111 
       
   112 
       
   113 
       
   114 
       
   115 
       
   116 
       
   117 
       
   118 
       
   119 
       
   120 
       
   121 CMemSpyViewThreadInfoItemActiveObject::CMemSpyViewThreadInfoItemActiveObject( RMemSpySession& aSession, MMemSpyViewObserver& aObserver,  TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
       
   122 :   CMemSpyViewThreadInfoItemActiveObjectBase( aSession, aObserver, aProcId, aId, aType )
       
   123     {
       
   124     }
       
   125 
       
   126 
       
   127 void CMemSpyViewThreadInfoItemActiveObject::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
       
   128     {
       
   129     // Causes list of server's to be prepared
       
   130     CMemSpyViewThreadInfoItemActiveObjectBase::ConstructL( aRect, aContainer, aSelectionRune );
       
   131 
       
   132     _LIT( KTitle, "Active Objects" );
       
   133     SetTitleL( KTitle );
       
   134 
       
   135     // Try to select the correct server
       
   136     /* TODO: to consider this
       
   137     CMemSpyThreadInfoHandleObjectBase* infoItem = static_cast< CMemSpyThreadInfoHandleObjectBase* >( iInfoItem );
       
   138     TInt selectedIndex = 0;
       
   139     if  ( aSelectionRune )
       
   140         {
       
   141         CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray();
       
   142         const TInt index = activeObjectArray.ObjectIndexByAddress( aSelectionRune );
       
   143         if  ( index >= 0 && index < activeObjectArray.Count() )
       
   144             {
       
   145             selectedIndex = index + 1;
       
   146             }
       
   147         }
       
   148 
       
   149     // Select item
       
   150     if  ( infoItem->DetailsCount() > 0 )
       
   151         {
       
   152         */
       
   153         iListBox->SetCurrentItemIndex( 0 ); //selectedIndex
       
   154         HandleListBoxItemSelectedL( 0 ); //selectedIndex
       
   155         /*
       
   156         }
       
   157         */
       
   158     }
       
   159 
       
   160 
       
   161 TMemSpyViewType CMemSpyViewThreadInfoItemActiveObject::ViewType() const
       
   162     {
       
   163     return EMemSpyViewTypeThreadInfoItemActiveObject;
       
   164     }
       
   165 
       
   166 
       
   167 CMemSpyViewBase* CMemSpyViewThreadInfoItemActiveObject::PrepareChildViewL()
       
   168     {
       
   169     CMemSpyViewBase* child = NULL;
       
   170     /*
       
   171     // Get current entry address
       
   172     TInt index = iListBox->CurrentItemIndex();
       
   173     if  ( index > 0 )
       
   174         {
       
   175         --index;
       
   176         CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray();
       
   177         //
       
   178         if  ( index >= 0 && index < activeObjectArray.MdcaCount() )
       
   179             {
       
   180             CMemSpyEngineActiveObject& object = activeObjectArray.At( index );
       
   181             TAny* aoAddress = object.Address();
       
   182             //
       
   183             child = new(ELeave) CMemSpyViewThreadInfoItemActiveObjectDetails( iEngine, iObserver, iInfoItem->Container(), aoAddress );
       
   184             CleanupStack::PushL( child );
       
   185             child->ConstructL( Rect(), *Parent(), NULL );
       
   186             CleanupStack::Pop( child );
       
   187             }
       
   188         }
       
   189     //
       
   190      * 
       
   191      */
       
   192     return child;
       
   193     }
       
   194 
       
   195 
       
   196 
       
   197 
       
   198 
       
   199 
       
   200 
       
   201 
       
   202 
       
   203 
       
   204 /*
       
   205 CMemSpyViewThreadInfoItemActiveObjectDetails::CMemSpyViewThreadInfoItemActiveObjectDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, TAny* aObjectAddress )
       
   206 :   CMemSpyViewThreadInfoItemActiveObjectBase( aEngine, aObserver, aContainer ), iObjectAddress( aObjectAddress )
       
   207     {
       
   208     }
       
   209 
       
   210 
       
   211 void CMemSpyViewThreadInfoItemActiveObjectDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
       
   212     {
       
   213     CMemSpyViewThreadInfoItemActiveObjectBase::ConstructL( aRect, aContainer, aSelectionRune );
       
   214 
       
   215     _LIT( KTitle, "Active Object Details" );
       
   216     SetTitleL( KTitle );
       
   217     }
       
   218     
       
   219 
       
   220 TMemSpyViewType CMemSpyViewThreadInfoItemActiveObjectDetails::ViewType() const
       
   221     {
       
   222     return EMemSpyViewTypeThreadInfoItemActiveObjectDetails;
       
   223     }
       
   224 
       
   225 
       
   226 CMemSpyViewBase* CMemSpyViewThreadInfoItemActiveObjectDetails::PrepareParentViewL()
       
   227     {
       
   228     CMemSpyViewThreadInfoItemActiveObject* parent = new(ELeave) CMemSpyViewThreadInfoItemActiveObject( iEngine, iObserver, iInfoItem->Container() );
       
   229     CleanupStack::PushL( parent );
       
   230     parent->ConstructL( Rect(), *Parent(), iObjectAddress );
       
   231     CleanupStack::Pop( parent );
       
   232     return parent;
       
   233     }
       
   234 
       
   235 
       
   236 void CMemSpyViewThreadInfoItemActiveObjectDetails::SetListBoxModelL()
       
   237     {
       
   238     // Try to find the right entry
       
   239     CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray();
       
   240     const TInt index = activeObjectArray.ObjectIndexByAddress( iObjectAddress );
       
   241     User::LeaveIfError( index );
       
   242     CMemSpyEngineActiveObject& object = activeObjectArray.At( index );
       
   243     //
       
   244     CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
       
   245     listbox->Model()->SetItemTextArray( &object );
       
   246     listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   247     }
       
   248 */