void CContextContactsDetailView::ConstructL()
{
	CALLSTACKITEM_N(_CL("CContextContactsDetailView"), _CL("ConstructL"));


	BaseConstructL( R_CONTEXTCONTACTS_DETAIL_VIEW );
#ifndef __S60V3__
//FIXME3RD
	iSendAppUi=CSendAppUi::NewL(ESendCmdId);
#endif

	pbkengine = CPbkContactEngine::Static();
	if (pbkengine) 	{ owns_engine=false;} 
	else 
	{
		pbkengine=CPbkContactEngine::NewL();
		owns_engine=true;
	}
	LoadIconsL();
}
// ---------------------------------------------------------------------------
// CAppMngr2ListContainer::HandleResourceChange()
// ---------------------------------------------------------------------------
//
void CAppMngr2ListContainer::HandleResourceChange( TInt aType )
    {
    CCoeControl::HandleResourceChange( aType );

    if( aType == KAknsMessageSkinChange )
        {
        TRAP_IGNORE( LoadIconsL() );
        }

    if( aType == KEikDynamicLayoutVariantSwitch )
        {
        TRect mainPaneRect;
        if( AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
                mainPaneRect ) )
            {
            SetRect( mainPaneRect );
            }
        DrawDeferred();
        }
    }
// ---------------------------------------------------------------------------
// CAppMngr2ListContainer::ConstructL()
// ---------------------------------------------------------------------------
//
void CAppMngr2ListContainer::ConstructL( const TRect& aRect )
    {
    CreateWindowL();
    SetRect( aRect );
    iListBox = new (ELeave) CAknDoubleLargeStyleListBox;
    iListBox->SetContainerWindowL( *this );
    iListBox->ConstructL( this, EAknListBoxSelectionList );
    iListBox->SetListBoxObserver( this );
    
    // Dont display default "(no data)" empty text
    iListBox->View()->SetListEmptyTextL( KNullDesC );

    LoadIconsL();
    CreateItemArrayL();
    PopulateItemArrayL();
    
    iListBox->CreateScrollBarFrameL();
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
            CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
    iListBox->SetRect( aRect.Size() );
    
    // Enable marquee effect
    iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
    }
// ---------------------------------------------------------------------------
// CAknMemorySelectionDialogMultiDrive::ExecuteL
// ---------------------------------------------------------------------------
//
EXPORT_C CAknCommonDialogsBase::TReturnKey
    CAknMemorySelectionDialogMultiDrive::ExecuteL(
        TDriveNumber& aSelectedDrive, TDes* aRootPath, TDes* aDefaultFolder )
    {
    __ASSERT_DEBUG( iTitle && iLeftSoftkey && iRightSoftkey,
        User::Panic( KCFDPanicText, ECFDPanicTitleOrSoftkeyNotSet ) );

    iModel->UpdateItemsL();
    TBool doubleStyle( AknCFDUtility::DirectoriesOnly( iDialogType ) );
    CEikFormattedCellListBox* listBox = NULL;
    if( doubleStyle )
        {
        listBox = new( ELeave ) CAknDoubleLargeGraphicPopupMenuStyleListBox();
        }
    else
        {
        listBox = new( ELeave ) CAknSingleGraphicPopupMenuStyleListBox();
        }
    CleanupStack::PushL( listBox );

    AknPopupLayouts::TAknPopupLayouts layout( doubleStyle ?
        AknPopupLayouts::EMenuDoubleLargeGraphicWindow :
        AknPopupLayouts::EMenuGraphicWindow );
    TBool isEndKeyPress = EFalse;
    CAknCommonDialogsPopupList* popupList =
        CAknCommonDialogsPopupList::NewL(
            *iEventHandler, listBox, layout, isEndKeyPress );
    CleanupStack::PushL( popupList );

    listBox->ConstructL( popupList, 0 );
    listBox->CreateScrollBarFrameL( ETrue ); // Create scroll indicator
    listBox->ScrollBarFrame()->SetScrollBarVisibilityL(
        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );

    listBox->Model()->SetItemTextArray( iModel );
    // Set model ownership type
    listBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );

    // Icons:
    // Granularity, 5 icons
    CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 5 );
    CleanupStack::PushL( iconArray );
    LoadIconsL( iconArray, doubleStyle );
    listBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( iconArray );
    CleanupStack::Pop(); // iconArray

    popupList->SetTitleL( *iTitle ); // Set title
    CEikButtonGroupContainer* cba = popupList->ButtonGroupContainer();
    MEikButtonGroup* buttonGroup = cba->ButtonGroup();
    cba->SetCommandL( buttonGroup->CommandId( 0 ), *iLeftSoftkey );
    cba->SetCommandL( buttonGroup->CommandId( 2 ), *iRightSoftkey );

    // Set listener for popuplist anytime.
    TBool hasRemoteDrive =
        ( iIncludedMedias & AknCommonDialogsDynMem::EMemoryTypeRemote );
    iEventHandler->StartNotifyDisk( popupList, hasRemoteDrive );

    TInt selectedIndex = FindIndexByDrive( aSelectedDrive );
    if( selectedIndex == KErrNotFound )
        {
        selectedIndex = 0; // The first index
        }
        
    listBox->View()->SetCurrentItemIndex( selectedIndex );

    // Update CAB show.
    iEventHandler->HandleEventL(
    		MAknCommonDialogsEventObserver::EFocusChange,
    		selectedIndex,
    		selectedIndex,
    		popupList->ButtonGroupContainer() );
    
    CleanupStack::Pop(); // popupList (deleted in ExecuteLD)
    // Execute the popup dialog
    TBool returnValue = EFalse;
    TRAPD( err, returnValue = popupList->ExecuteLD() );
    
    if ( iEventHandler )
        {        
        iEventHandler->StopNotifyDisk();
        }
    
    if( returnValue )
        {
        selectedIndex = listBox->CurrentItemIndex();
        GetDrivePaths( selectedIndex, aRootPath, aDefaultFolder );
        aSelectedDrive = FindDriveByIndex( selectedIndex );
        }
    else if ( err )
        {
        User::Leave( err );
        }
    
    CleanupStack::PopAndDestroy(); // listBox
    return TReturnKey( returnValue );
    }