Exemplo n.º 1
0
// ---------------------------------------------------------------------------
// CBCTestPopupCase::TestPopupL
// ---------------------------------------------------------------------------
//
void CBCTestPopupCase::TestPopupL()
    {
    CEikFormattedCellListBox* listBox = 
        new( ELeave ) CAknSinglePopupMenuStyleListBox;
    CleanupStack::PushL( listBox );
    
    CAknPopupList* popupList = CAknPopupList::NewL( listBox, 
        R_AVKON_SOFTKEYS_SELECT_BACK, 
        AknPopupLayouts::EPopupSNotePopupWindow );
    CleanupStack::PushL( popupList );    
    AssertNotNullL( popupList, KAknPopupList );
    
    listBox->ConstructL( popupList, EAknListBoxMenuList );
    
    // Invoke CAknPopupList's SetTitleL()
    popupList->SetTitleL( KTitle );
    AssertTrueL( ETrue, KSetTitleL );
 
     // Invoke CAknPopupList's Heading()
    popupList->Heading();
    AssertTrueL( ETrue, KHeading ); 

     // Invoke CAknPopupList's ButtonGroupContainer()    
    popupList->ButtonGroupContainer();
    AssertTrueL( ETrue, KButtonGroupContainer ); 

     // Invoke CAknPopupList's EnableFind()
    popupList->EnableFind( EFalse );
    popupList->EnableFind( ETrue );
    AssertTrueL( ETrue, KEnableFind ); 

    // Invoke CAknPopupList's ListBox()
    popupList->ListBox();
    AssertTrueL( ETrue, KListBox ); 
    
    // Invoke CAknPopupList's FindBox()
    popupList->FindBox();
    AssertTrueL( ETrue, KFindBox ); 

    // Invoke CAknPopupList's HandlePointerEventL()
    TPointerEvent pointEvent;
    pointEvent.iType = TPointerEvent::EButton1Down;
    popupList->HandlePointerEventL( pointEvent );
    AssertTrueL( ETrue, KHandlePointerEventL ); 
    
    // Invoke CAknPopupList's SetMaximumHeight()
    popupList->SetMaximumHeight( KMaximumHeight );
    AssertTrueL( ETrue, KSetMaximumHeight );   
   
    CleanupStack::Pop( popupList );
    
    // Invoke CAknPopupList's ExecuteLD()
    popupList->ExecuteLD();
    AssertTrueL( ETrue, KExecuteLD );          
   
    // Invoke CAknPopupList's MinimumSize() 
    CCoeControl* pList = CAknPopupList::NewL( listBox, 
        R_AVKON_SOFTKEYS_SELECT_BACK, 
        AknPopupLayouts::EPopupSNotePopupWindow );
    CleanupStack::PushL( pList );
    pList->MinimumSize();
    AssertTrueL( ETrue, KMinimumSize );
    
    // Invoke CAknPopupList's OfferKeyEventL() 
    TKeyEvent keyEvent;
    keyEvent.iCode = EKeyCBA1;
    pList->OfferKeyEventL( keyEvent, EEventKey );
    AssertTrueL( ETrue, KOfferKeyEventL );
    
    CleanupStack::PopAndDestroy( pList );
    
    CleanupStack::PopAndDestroy( listBox );
    }
void CPhotoListView::GetFolder()
{
	TInt PopValue;	
	//TBuf<150> msg;
	TInt count=0;	
	
	CDesCArray* items = iPhotosAppUi->GetFolderList();	
    CDesCArray* foldernames = iPhotosAppUi->ReturnText();

	if (items == NULL)
	{
		Count = 0;
		items = new (ELeave) CDesCArrayFlat(1);
		items->AppendL(foldernames->MdcaPoint(0));
	}
	else
	{
		Count = items->MdcaCount();	
		items->AppendL(foldernames->MdcaPoint(0));
	}
	foldernames->Reset();

	CEikTextListBox* list = new( ELeave ) CAknSinglePopupMenuStyleListBox;
    CleanupStack::PushL( list );

    CAknPopupList* popupList = CAknPopupList::NewL(
       list,
       R_AVKON_SOFTKEYS_SELECT_CANCEL,
       AknPopupLayouts::EMenuWindow);

    CleanupStack::PushL( popupList );
    
    popupList->SetMaximumHeight(2);

    list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect );
    list->CreateScrollBarFrameL( ETrue );
    list->ScrollBarFrame()->SetScrollBarVisibilityL(
		   CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );

    CTextListBoxModel* model = list->Model();
    model->SetItemTextArray( items );
    model->SetOwnershipType( ELbmOwnsItemArray );
	
	count = GetPhotoCount();

//	TInt price;
//	TLex lex(iPhotosAppUi->iCharge);
//	lex.Val(price);
//	count = count * price;

//	TBuf<30> temp;
//	temp.AppendNum(count);	

//	msg.Copy(_L("Charge "));
//	msg.Append(temp);
//	msg.Append(_L(" pesos"));

	//msg.Copy(_L("Select Album:"));
	//msg.Copy(*(iEikonEnv->AllocReadResourceL(R_IMAGES_SELECT_ALBUM)));
	
	/*count = count / 3;
	temp.Copy(_L(""));
	temp.AppendNum(count);

	path = iPhotosAppUi->ImageFolderPath();
	if(path == 0 || path == 1)			
		msg.Append(_L(" Photos)"));
	else if(path == 2 || path == 3)
		msg.Append(_L(" Videos)"));*/

	popupList->SetTitleL(*(iEikonEnv->AllocReadResourceL(R_IMAGES_SELECT_ALBUM)));

	PopValue = popupList->ExecuteLD();		
	
	if(PopValue==0)
	{
		iFolderStatus=-1;
	}
	else if(PopValue==1)
	{
		PopValue=list->CurrentItemIndex();		
		iFolderStatus=PopValue;		
		TPtrC ptr1(items->MdcaPoint(PopValue));
		comment.Copy(ptr1);		
	}
	
	items->Reset();
	CleanupStack::Pop(); // popupList
    CleanupStack::PopAndDestroy(); // list	

}