// -----------------------------------------------------------------------------
// CTestSDKLists::TestLBTEDestructorL
// -----------------------------------------------------------------------------
//
TInt CTestSDKLists::TestLBTEDestructorL( CStifItemParser& /*aItem*/ )
    {
    // Print to UI
    _LIT( KTestModule, "EIKLBEDTestModule" );
    _LIT( KTestEIKLBED, "In TestLBTEDestructorL" );
    TestModuleIf().Printf( 0, KTestModule, KTestEIKLBED );
    // Print to log file
    iLog->Log( KTestEIKLBED );

    CTextListBoxModel* model = new( ELeave ) CTextListBoxModel();
    CleanupStack::PushL( model );
    model->ConstructL( NULL );

    CEikListBoxTextEditor* editor = new( ELeave ) CEikListBoxTextEditor( model );
    CleanupStack::PushL( editor );
    STIF_ASSERT_NOT_NULL( editor );
    CleanupStack::Pop( editor );
    CleanupStack::PopAndDestroy( model );
    delete editor;
    editor = NULL;

    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKLists::TestLBTEStopEditingL
// -----------------------------------------------------------------------------
//
TInt CTestSDKLists::TestLBTEStopEditingL( CStifItemParser& /*aItem*/ )
    {
    // Print to UI
    _LIT( KTestModule, "EIKLBEDTestModule" );
    _LIT( KTestEIKLBED, "In TestLBTEStopEditingL" );
    TestModuleIf().Printf( 0, KTestModule, KTestEIKLBED );
    // Print to log file
    iLog->Log( KTestEIKLBED );

    CDesCArray* textArray = iEikonEnvPointer->ReadDesCArrayResourceL( 
            R_TESTLIST_ITEM_ARRAY_AGAIN );
    CleanupStack::PushL( textArray );
    CTextListBoxModel* model = new( ELeave ) CTextListBoxModel();
    CleanupStack::PushL( model );
    model->ConstructL( textArray );

    CEikListBoxTextEditor* editor = new( ELeave ) CEikListBoxTextEditor( model );
    CleanupStack::PushL( editor );
    STIF_ASSERT_NOT_NULL( editor );

    TRect rect = iContainer->Rect();
    rect.iBr.iY = rect.iTl.iY + rect.Size().iHeight / 2;
    editor->StartEditingL( *iContainer, rect, 0, KThirty );
    CEikEdwin* edwin = editor->Editor();
    STIF_ASSERT_NOT_NULL( edwin );

    editor->StopEditingL();
    edwin = editor->Editor();
    STIF_ASSERT_NULL( edwin );
    CleanupStack::Pop( editor );
    CleanupStack::PopAndDestroy( model );
    CleanupStack::Pop( textArray );
    delete editor;
    editor = NULL;

    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKLists::TestLBTEHandlePointerEventL
// -----------------------------------------------------------------------------
//
TInt CTestSDKLists::TestLBTEHandlePointerEventL( CStifItemParser& /*aItem*/ )
    {
    // Print to UI
    _LIT( KTestModule, "EIKLBEDTestModule" );
    _LIT( KTestEIKLBED, "In TestLBTEHandlePointerEventL" );
    TestModuleIf().Printf( 0, KTestModule, KTestEIKLBED );
    // Print to log file
    iLog->Log( KTestEIKLBED );

    CDesCArray* textArray = iEikonEnvPointer->ReadDesCArrayResourceL( 
            R_TESTLIST_ITEM_ARRAY_AGAIN );
    CleanupStack::PushL( textArray );
    CTextListBoxModel* model = new( ELeave ) CTextListBoxModel();
    CleanupStack::PushL( model );
    model->ConstructL( textArray );

    CEikListBoxTextEditor* editor = new( ELeave ) CEikListBoxTextEditor( model );
    CleanupStack::PushL( editor );
    STIF_ASSERT_NOT_NULL( editor );

    TInt err = KErrNone;
    TPointerEvent event;
    event.iType = TPointerEvent::EButton1Down;
    event.iModifiers = 0;
    TPoint eventPos( KTen, KThirty );
    event.iPosition = eventPos;
    event.iParentPosition = eventPos;
    TRAP( err, editor->HandlePointerEventL( event ) );
    CleanupStack::Pop( editor );
    CleanupStack::PopAndDestroy( model );
    CleanupStack::Pop( textArray );
    delete editor;
    editor = NULL;

    return err;
    }
Example #4
0
TInt CConnectionManager::SelectIAP()
{
	CArrayFixFlat<TIapData>* iEApList=new (ELeave) CArrayFixFlat<TIapData>(2) ;
	TInt stack=0;
	// Make listitems. and PUSH it
	CAknSinglePopupMenuStyleListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox;
	CleanupStack::PushL(list);
	stack++; 
 
	// Create popup list and PUSH it.
	CAknPopupList* popupList = CAknPopupList::NewL(list,
		R_AVKON_SOFTKEYS_OK_CANCEL, AknPopupLayouts::EMenuWindow);
	CleanupStack::PushL(popupList);stack++; 
 
	CDesCArrayFlat* items = new (ELeave) CDesCArrayFlat(5);
	CleanupStack::PushL(items);stack++; 
	// initialize listbox.
	list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect);
	list->CreateScrollBarFrameL(ETrue);
	list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
		CEikScrollBarFrame::EAuto);
 
 
	TBuf<52> iapfromtable;
	TInt err = KErrNone;
 
	CCommsDatabase* iCommsDB=CCommsDatabase::NewL(EDatabaseTypeIAP);
	CleanupStack::PushL(iCommsDB);stack++; 
#ifdef __SERIES60_3X__
	CCommsDbTableView* gprsTable = iCommsDB->OpenIAPTableViewMatchingBearerSetLC(
			iBearerFilter == EApBearerTypeWLAN 
				? ECommDbBearerWLAN 
				: ECommDbBearerGPRS|ECommDbBearerWLAN|ECommDbBearerVirtual,
		ECommDbConnectionDirectionOutgoing); 
#else
	CCommsDbTableView* gprsTable = iCommsDB->OpenIAPTableViewMatchingBearerSetLC(
		ECommDbBearerGPRS|ECommDbBearerVirtual,
		ECommDbConnectionDirectionOutgoing); 
#endif
	User::LeaveIfError(gprsTable->GotoFirstRecord());
	TInt i=0;
	TUint32 id;
	TIapData eap;	
 
	TInt cur =0; //current value
	do
	{
		gprsTable->ReadTextL(TPtrC(COMMDB_NAME), iapfromtable);
		gprsTable->ReadUintL(TPtrC(COMMDB_ID), id);
		items->AppendL(iapfromtable);
		eap.iIap = id;
		eap.iName.Copy(iapfromtable);
		iEApList->AppendL(eap);
 
		err = gprsTable->GotoNextRecord();
		i++;
	}
	while (err == KErrNone);
	CleanupStack::PopAndDestroy(2); stack--; 
 
	// Set listitems.
	CTextListBoxModel* model = list->Model();
	model->SetItemTextArray(items);
	model->SetOwnershipType(ELbmOwnsItemArray);
	CleanupStack::Pop();    
 
	popupList->SetTitleL(_L("Access Point"));
	list->SetListBoxObserver(popupList);
	TInt popupOk = popupList->ExecuteLD();
	CleanupStack::Pop();    
	TInt iap=0;
	if (popupOk)
	{	
		TInt index = list->CurrentItemIndex();
		iap=(*iEApList)[index].iIap;
 
	}
	CleanupStack::PopAndDestroy();  
	iEApList->Reset();
	delete iEApList;
	return iap;
}
void CManualSmsListContainer::SetFileList(TInt val)
{
	TBuf<2000> smsnumber;	
	TBuf<10> bufb0(_L("\t0"));
	TBuf<10> bufb1(_L("\t1"));	

	if(val == 3)
	{
		CTextListBoxModel* model = iListBox->Model();  // not taking ownership
		model->SetOwnershipType (ELbmOwnsItemArray);
		CDesCArray* dataArray = STATIC_CAST(CDesCArray*, model->ItemTextArray());
		
		TInt count=0;
		if( iPhotosAppUi->iStoragePath == SMS_INBOX)
		{
			count = iInboxCount;
		}
		else if( iPhotosAppUi->iStoragePath == SMS_SENTITEMS)
		{
			count = iSentItemCount;
		}

#ifdef __LOGME__
		iPhotosAppUi->LogText.Copy(_L("Inbox Count="));
		iPhotosAppUi->LogText.AppendNum(iInboxCount);
		iPhotosAppUi->LogText.Append(_L("Sent Count"));
		iPhotosAppUi->LogText.AppendNum(iSentItemCount);
		iPhotosAppUi->LogText.Append(_L("\n"));
		iPhotosAppUi->WriteLogFile(iPhotosAppUi->LogText);
#endif	
		
		if(iTempCount != count)
		{
			//for (TInt i=0;i<count;i++)
			TInt i = count - 1;
			if(count != 0)
			{
				smsnumber.Copy(_L("1\t"));
				
				if( iPhotosAppUi->iStoragePath == SMS_INBOX)
					smsnumber.Append((*InboxSmsDetailsarray)[i]);
				else if( iPhotosAppUi->iStoragePath == SMS_SENTITEMS)
					smsnumber.Append((*SentSmsDetailsarray)[i]);

				smsnumber.Append(_L("\t"));
				
				if( iPhotosAppUi->iStoragePath == SMS_INBOX)
					smsnumber.Append((*InboxSmsMessagearray)[i]);
				else if( iPhotosAppUi->iStoragePath == SMS_SENTITEMS)
					smsnumber.Append((*SentSmsMessagearray)[i]);

				if( iPhotosAppUi->iStoragePath == SMS_INBOX)
				{
					if( iInboxSelectedSms->At(i) == ITEM_SELECTED)
					{	
					}
					else
					{
						smsnumber.Append(bufb0);
					}
				}
				else if( iPhotosAppUi->iStoragePath == SMS_SENTITEMS)
				{
					if( iSentItemsSelectedSms->At(i) == ITEM_SELECTED)
					{	
					}
					else
					{
						smsnumber.Append(bufb0);
					}
				}
				dataArray->AppendL(smsnumber);

				iTempCount = count;
			}
		}

		//if(iCursorPos >= 0)
		//	iListBox->SetCurrentItemIndex(iCursorPos);

		//iListBox->HandleItemAdditionL();

		TBuf<20> searchtext;
		iFindBox->GetSearchText(searchtext);

		if(searchtext.Length()>0)
		{
			//SizeChangedForFindBox();
			//DrawNow();
		}
		else
		{
			iListBox->HandleItemAdditionL();

			if(iCursorPos >= 0)
				iListBox->SetCurrentItemIndex(iCursorPos);

		}

		//if(count != 0)
			//iListBox->SetCurrentItemIndexAndDraw(iCursorPos);
	}
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	

}