// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonListBoxControlL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonListBoxControlL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    CAknRadioButtonSettingPage* dialog =
    new (ELeave) CAknRadioButtonSettingPage( R_EXAMPLE_SETTING_PAGE,
        optin, mArr );
    CleanupStack::PushL( dialog );
    
    CAknSetStyleListBox* editorControl = dialog->ListBoxControl();
    STIF_ASSERT_NULL( editorControl );
    
    dialog->ConstructL();
    
    editorControl = dialog->ListBoxControl();
    STIF_ASSERT_NOT_NULL( editorControl );
    
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKGrids::TestGridsGridmSetStartCellsL
// -----------------------------------------------------------------------------
//
TInt CTestSDKGrids::TestGridsGridmSetStartCellsL( CStifItemParser& /*aItem*/ )
    {
    CAknGridM* grid = new( ELeave ) CAknGridM;
    CleanupStack::PushL( grid );

    CDesCArrayFlat* arr = new(ELeave)CDesCArrayFlat(KSize);
    CleanupStack::PushL( arr );

	HBufC* buf1 = KTom().AllocLC();

    arr->AppendL(*buf1);

    grid->SetItemTextArray( arr );

    TInt cells = grid->IndexOfFirstDataItem();
    STIF_ASSERT_EQUALS( KZero, cells );

    grid->SetStartCells( KThree );
    cells = grid->IndexOfFirstDataItem();
    STIF_ASSERT_EQUALS( KThree, cells );

    CleanupStack::PopAndDestroy( buf1 );
    CleanupStack::Pop( arr );
    CleanupStack::PopAndDestroy( grid );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKGrids::TestGridsGridmNumberOfDataL
// -----------------------------------------------------------------------------
//
TInt CTestSDKGrids::TestGridsGridmNumberOfDataL( CStifItemParser& /*aItem*/ )
    {
    CAknGridM* grid = new( ELeave ) CAknGridM;
    CleanupStack::PushL( grid );

    CDesCArrayFlat* arr = new(ELeave)CDesCArrayFlat(KSize);
    CleanupStack::PushL( arr );

    HBufC* buf1 = KTom().AllocLC();
    HBufC* buf2 = KJack().AllocLC();
    HBufC* buf3 = KMary().AllocLC();

    arr->AppendL(*buf1);
    arr->AppendL(*buf2);
    arr->AppendL(*buf3);

    grid->SetItemTextArray( arr );

    TInt numberofdata = grid->NumberOfData();
    STIF_ASSERT_EQUALS( KThree, numberofdata );

    CleanupStack::PopAndDestroy( buf3 );
    CleanupStack::PopAndDestroy( buf2 );
    CleanupStack::PopAndDestroy( buf1 );
    CleanupStack::Pop( arr );
    CleanupStack::PopAndDestroy( grid );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonSelectCurrentItemLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonSelectCurrentItemLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CTestRadioButtonSettingPage* dialog =
    new (ELeave) CTestRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    
    dialog->ConstructL();
    dialog->DoSelectCurrentItemL();
    
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonWriteInternalStateLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonWriteInternalStateLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CTestRadioButtonSettingPage* dialog =
    new (ELeave) CTestRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    dialog->ConstructL();
    
    RDesWriteStream stream;
    CleanupClosePushL( stream );
    HBufC8* hbuf = HBufC8::NewL( KHBufSize );
    CleanupStack::PushL( hbuf );
    TPtr8 ptr = hbuf->Des();
    stream.Open( ptr );
    dialog->DoWriteInternalStateL( stream );
    stream.CommitL();
    stream.Close();  
    CleanupStack::PopAndDestroy( KFour );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonHandlePointerEventLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonHandlePointerEventLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CAknRadioButtonSettingPage* dialog =
    new (ELeave) CAknRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    
    dialog->ConstructL();
    TPointerEvent event;
    event.iType = TPointerEvent::EButton1Down;
    event.iModifiers = 0;
    TPoint eventPos( 10, 30 );
    event.iPosition = eventPos;
    event.iParentPosition = eventPos;
    dialog->HandlePointerEventL( event );
    
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonHandleListBoxEventLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonHandleListBoxEventLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CAknRadioButtonSettingPage* dialog =
    new (ELeave) CAknRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    
    dialog->ConstructL();
    dialog->HandleListBoxEventL( dialog->ListBoxControl(), MEikListBoxObserver::EEventItemActioned );
    dialog->HandleListBoxEventL( dialog->ListBoxControl(), MEikListBoxObserver::EEventItemClicked );
    dialog->HandleListBoxEventL( dialog->ListBoxControl(), MEikListBoxObserver::EEventPenDownOnItem );
    
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// ----------------------------------------------------------------------------------------------------------
// Remove an item from the collection database using the given path
// ----------------------------------------------------------------------------------------------------------
//
void CTestCollectionPlugin::RemoveL (const CMPXCollectionPath& aPath)
{
    LOG1(_L("CTestCollectionPlugin::RemoveL"));
    LogPath( aPath );
    CDesCArrayFlat* fp = new (ELeave) CDesCArrayFlat(8);
    CleanupStack::PushL( fp );
    switch( aPath.Levels() )
    {
    case 2:
        if(aPath.Id() == 14)
        {   // Test0091
            iObs->HandleRemove( *fp, KErrNotFound );
        }
        break;
    case 3:
        if(aPath.Id() == 212)
        {   // Test0090
            fp->AppendL( _L("\\song3121.ts") );
            fp->AppendL( _L("\\song3122.ts") );
            fp->AppendL( _L("\\song3123.tp") );
            iObs->HandleRemove( *fp, KErrNone );
        }
        break;
    case 4:
        if(aPath.Id() == 3111)
        {   // Test0088
            fp->AppendL( _L("\\song3111.ts") );
            iObs->HandleRemove( *fp, KErrNone );
        }
        break;
    default:
        User::Panic(_L("CTestCollectionPlugin::RemoveL panic"), 1); // magic number
    }
    CleanupStack::PopAndDestroy( fp );
}
Exemplo n.º 9
0
// ---------------------------------------------------------
// TXdmSettingsApi::CollectionNamesL
//
// ---------------------------------------------------------
//
EXPORT_C CDesCArray* TXdmSettingsApi::CollectionNamesLC( RArray<TInt>& aSettingIds )
{
#ifdef _DEBUG
    WriteToLog( _L8( "TXdmSettingsApi::CollectionNamesL()" ) );
#endif
    TInt error = KErrNone;
    CDesCArrayFlat* propertySet = new ( ELeave ) CDesCArrayFlat( 10 );
    CleanupStack::PushL( propertySet );
    CRepository* repository = CRepository::NewL( KCRUidXdmEngine );
    CleanupStack::PushL( repository );
    RArray<TUint32> nameKeys = FindByTypeL( repository, EXdmPropName );
    CleanupClosePushL( nameKeys );
    RArray<TUint32> idKeys = FindByTypeL( repository, EXdmPropSettingsId );
    CleanupClosePushL( idKeys );
#ifdef _DEBUG
    WriteToLog( _L8( "  ID key count: %d" ), idKeys.Count() );
    WriteToLog( _L8( "  Name key count: %d" ), nameKeys.Count() );
#endif
    TInt count = nameKeys.Count();
    if( count > 0 )
    {
        TInt numId = 0;
        HBufC* name = NULL;
        TBuf<10> identifier;
        for( TInt i = 0; i < count; i++ )
        {
            identifier.Zero();
            name = HBufC::NewLC( NCentralRepositoryConstants::KMaxUnicodeStringLength );
            TPtr desc( name->Des());
            error = repository->Get( nameKeys[i], desc );
            error = repository->Get( idKeys[i], identifier );
            if( error == KErrNone && desc.Length() > 0 && identifier.Length() > 0 )
            {
#ifdef _DEBUG
                HBufC8* eightName = HBufC8::NewLC( desc.Length() );
                TPtr8 eightDesc( eightName->Des() );
                eightDesc.Copy( desc );
                WriteToLog( _L8( " Collection no. %d - Name: %S  ID: %S" ), i, &eightDesc, &identifier );
                CleanupStack::PopAndDestroy();  //eightName
#endif
                propertySet->AppendL( desc );
                TLex id( identifier );
                error = id.Val( numId );
                aSettingIds.Append( error == KErrNone ? numId : error );
            }
            else
            {
#ifdef _DEBUG
                WriteToLog( _L8( " Fetching of the name no. %d failed with: %d" ), i, error );
#endif
            }
            CleanupStack::PopAndDestroy();  //name
        }
    }
    CleanupStack::PopAndDestroy( 3 );   //idKeys, nameKeys, repository
    return propertySet;
}
void CDefaultNumbersPopupList::PopulateListbox()
{
	CALLSTACKITEM_N(_CL("CDefaultNumbersPopupList"), _CL("PopulateListbox"));


	TBuf<200> phone;
	phone.Append(*iPhoneDefault);
	phone.Append(_L("\t"));
	if( aItem->DefaultPhoneNumberField() != 0)
	{
		phone.Append(aItem->DefaultPhoneNumberField()->Label());
	}
	else
	{
		phone.Append(*iNoDefault);
	}
	iArrayItems->AppendL(phone);

	TBuf<200> sms;
	sms.Append(*iSmsDefault);
	sms.Append(_L("\t"));
	if( aItem->DefaultSmsField() != 0)
	{
		sms.Append(aItem->DefaultSmsField()->Label());
	}
	else
	{
		sms.Append(*iNoDefault);
	}
	iArrayItems->AppendL(sms);

	TBuf<200> mms;
	mms.Append(*iMmsDefault);
	mms.Append(_L("\t"));
	if( aItem->DefaultMmsField() != 0)
	{
		mms.Append(aItem->DefaultMmsField()->Label());
	}
	else
	{
		mms.Append(*iNoDefault);
	}
	iArrayItems->AppendL(mms);

	TBuf<200> email;
	email.Append(*iEmailDefault);
	email.Append(_L("\t"));
	if( aItem->DefaultEmailField () != 0)
	{
		email.Append(aItem->DefaultEmailField()->Label());
	}
	else
	{
		email.Append(*iNoDefault);
	}
	iArrayItems->AppendL(email);
}
void CDefaultNumbersPopupList::Refresh()
{
	CALLSTACKITEM_N(_CL("CDefaultNumbersPopupList"), _CL("Refresh"));

	iArrayItems->Reset();
	iArrayItems->Compress();
	PopulateListbox();
	iListbox->HandleItemRemovalL();
}
/** Creates a CDesCArray property
@return CDesCArray parser Property value
*/
CParserPropertyValue* CContactsPBAPExportUtilityClass::CreateCDesCArrayL()
{
    CDesCArrayFlat* desArray = new (ELeave)CDesCArrayFlat(4);
    CleanupStack::PushL(desArray);
    desArray->AppendL(KAddr1);
    desArray->AppendL(KAddr2);
    desArray->AppendL(KAddr3);
    CParserPropertyValue* propertyValue = new (ELeave) CParserPropertyValueCDesCArray(desArray);
    CleanupStack::Pop();	// desArray
    return propertyValue;
}
// -----------------------------------------------------------------------------
void CPresenceCacheBuddyInfo::GetFieldKeysL( 
    CDesCArrayFlat& aKeys )
    {
    aKeys.Reset();
    THashMapIter<TDesC*, TInt> iter(iHashMap);    
    TDesC* const* nextKey = iter.NextKey();
    while (nextKey)
        {
        aKeys.AppendL( **nextKey );
        nextKey = iter.NextKey();
        }    
    }
TBool CPingController::DecodeRespL()
{
	// Reply from %S: bytes=%D time=%Dms TTL=%D
	// time
	TUint32 triptime = User::NTickCount() - iTimestamp;//icmpHdr->timestamp;
	
	const TUint8* reply = iReplyBuf.Ptr();
	const TIpHdr* ipHdr = (const TIpHdr*)reply;
	const TIcmpHdr* icmpHdr = (const TIcmpHdr*)(reply + ipHdr->ip_hl * 4);
	if (ntohs(icmpHdr->icd_id) != ICMP_ID)
	{
		iReplyText = StringLoader::LoadL(R_PKTPING_SOMEONE_ELSE_PACKET_RECEIVED);
		return EFalse;
	}
	if (icmpHdr->icmp_type != ICMP_ECHOREPLY)
	{
		iReplyText = StringLoader::LoadL(R_PKTPING_NONE_ECHO_TYPE_RECEIVED_FORMAT, icmpHdr->icmp_type);
		return ETrue;
	}
	if (ntohs(icmpHdr->icd_seq) != iIcmpPacket->SeqNo())
	{
		iReplyText = StringLoader::LoadL(R_PKTPING_OUT_OF_ORDER_PACKET_RECEIVED);
		return EFalse;
	}
	// from
	iRecv.Zero();
	iRecvAddr.Output(iRecv);	
	// bytes
	TUint16 bytes = ntohs(ipHdr->ip_len) - ipHdr->ip_hl * 4 - ICMP_HDR_LEN;
	// TTL
	TUint8 ttl = ipHdr->ip_ttl;
	
	CDesCArrayFlat* strings = new (ELeave) CDesCArrayFlat( 1 );
	CleanupStack::PushL( strings );
	strings->AppendL(iRecv);
	CArrayFix<TInt>* vals = new (ELeave) CArrayFixFlat<TInt>(3);
	CleanupStack::PushL( vals );
	vals->AppendL(bytes);
	vals->AppendL(triptime);
	vals->AppendL(ttl);

	iReplyText = StringLoader::LoadL(R_PKTPING_REPLY_TEXT_FORMAT, *strings, *vals);
	CleanupStack::PopAndDestroy(2); // strings, vals
	
	//stat
	iStat.sum += triptime;
	++(iStat.received);
	iStat.min = Min(iStat.min, triptime);
	iStat.max = Max(iStat.max, triptime);
	return ETrue;
}
// ----------------------------------------------------
// CAlfExCalendarEngine::ConstructL
// ----------------------------------------------------
void CAlfExCalendarEngine::ConstructL()
    {
    TReal   randomNumber;
    TInt    randomNumberInt;
    TInt64  seed=0;
    
    CDesCArrayFlat* array = new(ELeave) CDesCArrayFlat(KAlfExCalendarEngineArrayGranularity);
    CleanupStack::PushL( array );
    
    CEikonEnv* coeEnv = CEikonEnv::Static();
    TResourceReader reader;
    coeEnv->CreateResourceReaderLC(reader, R_ALFEXCALENDAR_CALENDAR_EVENTS_ARRAY);
    
    const TInt count = reader.ReadInt16();
    for(TInt loop = 0; loop < count; loop++)
        {
        HBufC* txt = reader.ReadHBufCL();
        CleanupStack::PushL(txt);
        array->AppendL(*txt);
        CleanupStack::PopAndDestroy(txt);
        }
    CleanupStack::PopAndDestroy(); //reader2

    TAlfExCalendarEngineListItem event;
    event.iItemDay.HomeTime();
    seed = event.iItemDay.Int64();
    randomNumber = count * Math::FRand(seed);
    randomNumberInt = (TInt) randomNumber;
    
    TTimeIntervalDays days(KAlfExCalendarEngineDayTenDays);
    event.iItemDay -= days; // lets start 10 days before present
    
    for(TInt i=0; i<KAlfExCalendarEngineDayRandomizeLoopCount; i++)
        {
        for(TInt loop = 0; loop < count; loop++)
            {
            randomNumber = Math::FRand(seed);
            if(randomNumber < KAlfExCalendarEngineChangeDay)
                {
                randomNumber *= KAlfExCalendarEngineDayRandomize;
                randomNumberInt = (TInt) randomNumber;
                days = TTimeIntervalDays(randomNumberInt);
                event.iItemDay += days;
                }
            event.iItemText.Copy((*array)[loop]);
            iCalendarEventArray.AppendL(event);
            }
        }
    CleanupStack::PopAndDestroy(array);
    }
Exemplo n.º 16
0
// -----------------------------------------------------------------------------
// CActiveExample::ShowTheListMsgQueryL
// -----------------------------------------------------------------------------
//
void CActiveExample::ShowTheListMsgQueryL()
    {
    
    _LIT( KHead, "Message" );
    _LIT( KText, "Item" ); 
    
    TBufC<20> tempString( KText );
    CDesCArrayFlat* arrayItem = new( ELeave ) CDesCArrayFlat( 20 );
    arrayItem->AppendL( tempString );
    iGlobalListMsgQuery->ShowListMsgQueryL( arrayItem, iStatus, KHead, KText );
    SetActive();
    
    CActiveScheduler::Start();
    
    }
Exemplo n.º 17
0
void T_CSPSettings::T_CSPSettings_FindServiceNamesLL(  )
    {
    RIdArray ids;
    CleanupClosePushL( ids );
    iCSPSettings->FindServiceIdsL( ids );
    
    CDesCArrayFlat* names = new ( ELeave ) CDesCArrayFlat( 10 );
    CleanupStack::PushL( names );
    EUNIT_ASSERT( KErrNone == iCSPSettings->FindServiceNamesL( ids, *names ) );
    TInt count = names->MdcaCount();
    EUNIT_ASSERT( count );
    
    CleanupStack::PopAndDestroy( names );
    CleanupStack::PopAndDestroy( &ids );
    }
Exemplo n.º 18
0
void CRpsMsg::ConstructL(const TDesC8& aMsgType, const TDesC8& aOpCode, const TUint aMsgNum, const CDesCArrayFlat& aArgArray) 
	{
	
	TUint numArgs(aArgArray.Count());
	iMsgDataArray = new (ELeave)CDesC8ArrayFlat(1);
	
	// Calc the total msg length
	TUint msgLen(KRqstLengthNoOpCodeNoArgsNoCommas + aOpCode.Length());
	for(TInt i(0); i < numArgs; ++i)
		{
		msgLen += aArgArray.MdcaPoint(i).Length();
		}
	// add commas to calculation
	msgLen += KRqstMsgElementsNoArgs + numArgs - 1;
	
	// Msg Type
	iMsgDataArray->AppendL(aMsgType);
	iMsgDataArray->AppendL(KComma);
	
	// Msg Len
	TBuf8<KMaxMsgLenChars> mlenString;
	mlenString.NumFixedWidth(msgLen, EDecimal, KMaxMsgLenChars);
	iMsgDataArray->AppendL(mlenString);
	iMsgDataArray->AppendL(KComma);
	
	// Msg Seq Num
	TBuf8<KMaxMsgNumChars> msnString;
	//msnString.Num(NextMsgNum());
	msnString.NumFixedWidth(aMsgNum, EDecimal, KMaxMsgNumChars);
	iMsgDataArray->AppendL(msnString);
	iMsgDataArray->AppendL(KComma);
	
	// OpCode
	iMsgDataArray->AppendL(aOpCode);
	iMsgDataArray->AppendL(KComma);
	
	// Arguments. Convert aArgArray data to 8-bit as we go.
	for(TInt i(0); i < numArgs; ++i)
		{
		TBuf8<KMaxElementSize> buf;
		buf.Copy(aArgArray.MdcaPoint(i));
		iMsgDataArray->AppendL(buf);
		iMsgDataArray->AppendL(KComma);
		}
		
	// EOM
	iMsgDataArray->AppendL(KEOM);
    }
// Set data to the listbox.
void CContactsSubScreenView::SetData()
{
	TBuf<50> titlename;
	TBuf<50> formatBuf;

	titlename.Copy(_L(""));
	formatBuf.Copy(_L(""));
	formatBuf.Append(*(iEikonEnv->AllocReadResourceL(R_STATUSTEXT_CONTACTS_UPLOADED)));
	titlename.Format(formatBuf, iContactsArray->MdcaCount());

    iAppTitle->SetTextL(titlename, CCknAppTitle::EMainTitle);

	iListbox->HandleItemRemovalL();

	CDesCArrayFlat* listItems = new (ELeave) CDesCArrayFlat(1);

	if(iContactsArray->MdcaCount() > 0)
	{
		listItems->Reset();
		CDesCArrayFlat* listItems = new (ELeave) CDesCArrayFlat(iContactsArray->MdcaCount());
	}
    CleanupStack::PushL(listItems);

	TBuf<500> item;
    
	for (TInt i = 0; i < iContactsArray->MdcaCount() ; i++)
	{
		item.Copy(_L(""));
		item.Append((*iContactsArray)[i]);
		item.Append(_L(","));
		item.Append((*iMobileArray)[i]);

		listItems->AppendL(item);	
	}
        
	CleanupStack::Pop(listItems);
	
    CTextListBoxModel* model = iListbox->Model();
    model->SetItemTextArray(listItems);

    // Set ListBox model responsible for deleting the listItems array
    model->SetOwnershipType(ELbmOwnsItemArray);
    
    iListbox->HandleItemAdditionL();
    DrawDeferred();
}
// Creates text string for the settings list box
HBufC* CDirectPrintFloatCapability::ListBoxTextL()
    {   
    const TInt KGranularity( 4 );
    TRealFormat format( KMaxTRealCharNum, KDecimals );
    TBuf<KMaxTRealCharNum> numStr;
    
    numStr.Zero();
    numStr.AppendNum( iRealValue, format );

    CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( KGranularity );
    CleanupStack::PushL( strings );
    strings->AppendL( iTitle );
    strings->AppendL( numStr );

    HBufC* buf = StringLoader::LoadL( R_QTN_LBOX_FORMAT, *strings ); 
    CleanupStack::PopAndDestroy();  // strings
    
    return buf;
    }
Exemplo n.º 21
0
void CFormatOptionsDialog::TUintChoiceList(TInt aResourceId, const RArray<TUint>& aArray)
	{
	CEikChoiceList* list = static_cast<CEikChoiceList*>(Control(aResourceId));
	if (aArray.Count()==0) 
		{
		list->MakeVisible(EFalse);
		return;
		}
	TBuf <10> buf;
	CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(4);
	CleanupStack::PushL(array);
	for (TInt i=0; i<aArray.Count(); i++)
		{
		buf.Num(aArray[i]);
		array->AppendL(buf);
		}
	list->SetArrayL(array);	
	CleanupStack::Pop(); //array
	}
Exemplo n.º 22
0
void CPlaylistMgr::EventOpenDefault()
{
    iControlMgr->CleanList();

    //返回
    iBackIndex = KPlaylistBackStateRoot;
    AddBackItem();

    CDesCArrayFlat* files = CUIViewData::GetInstance()->GetSelectFileList();

    for (TInt i=0; i<files->Count(); i++)
    {
        pListItemStruct back = new (ELeave) ListItemStruct;
        back->iIconIndex = 0;
        back->iShowName = (*files)[i].AllocL();
        back->iType = KPlaylistItemTypeNode;
        iControlMgr->AddListItem(back);
    }
}
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonConstructorL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonConstructorL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    
    TInt optin( KZero );
    CAknRadioButtonSettingPage* dialog =
        new (ELeave) CAknRadioButtonSettingPage( R_EXAMPLE_SETTING_PAGE,
        optin, mArr );
    CleanupStack::PushL( dialog );
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
Exemplo n.º 24
0
void CPlaylistMgr::EventOpenFavorite()
{
    iControlMgr->CleanList();

    //返回
    iBackIndex = KPlaylistBackStateRoot;
    AddBackItem();

    CDesCArrayFlat* files = iDataMgr->GetPlaylistFiles();

    for (TInt i=0; i<files->Count(); i++)
    {
        pListItemStruct back = new (ELeave) ListItemStruct;
        back->iIconIndex = 0;
        back->iHideInfo = (*files)[i].AllocL();
        back->iShowName = (*files)[i].AllocL();
        back->iType = KPlaylistItemTypePlaylist;
        iControlMgr->AddListItem(back);
    }
}
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestLqdlgSetIconArrayL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestLqdlgSetIconArrayL( CStifItemParser& /*aItem*/ )
    {
    TInt selectedOption( KZero );
        
    CDesCArrayFlat* mArray = new (ELeave) CDesCArrayFlat( KTen );
    CleanupStack::PushL( mArray );
     
    TBuf< KTen > palabra;
    for (TInt num = KZero; num< KTen; num++)
        {
       palabra.Format(_L("option %d"), num);
       mArray->AppendL(palabra);
        }
     
    CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &selectedOption );
    dlg->PrepareLC( R_UPDATE_QUERY_DIALOG );
    dlg->SetItemTextArray( mArray );
    dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
    
    TFileName file( KTestMbmFile );
    User::LeaveIfError( CompleteWithAppPath( file ) ); 
    
    CArrayPtr<CGulIcon>* mIcons = new(ELeave) CAknIconArray( KFive ); 
    CleanupStack::PushL(mIcons); 
    
    CFbsBitmap* bitmap = NULL;
    CFbsBitmap* mask = NULL;

    AknIconUtils::CreateIconLC( bitmap, mask, file, EMbmAvkonQgn_indi_mic, EMbmAvkonQgn_indi_mic_mask );
    CGulIcon* mIcon = CGulIcon::NewL( bitmap, mask );
    CleanupStack::PushL( mIcon );
    mIcons->AppendL( mIcon );
    
    dlg->SetIconArrayL( mIcons );
    
    CleanupStack::Pop( mIcon );
    CleanupStack::Pop( KThree );
    CleanupStack::PopAndDestroy( dlg );
    CleanupStack::Pop( KOne );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKGrids::TestGridsGridmIndexContainsDataL
// -----------------------------------------------------------------------------
//
TInt CTestSDKGrids::TestGridsGridmIndexContainsDataL( CStifItemParser& /*aItem*/ )
    {
    CAknGridM* grid = new( ELeave ) CAknGridM;
    CleanupStack::PushL( grid );

    CDesCArrayFlat* arr = new(ELeave)CDesCArrayFlat(KSize);
    CleanupStack::PushL( arr );

    HBufC* buf1 = KTom().AllocLC();
    HBufC* buf2 = KJack().AllocLC();
    HBufC* buf3 = KMary().AllocLC();

    arr->AppendL(*buf1);
    arr->AppendL(*buf2);
    arr->AppendL(*buf3);

    grid->SetItemTextArray( arr );

    TBool flag = grid->IndexContainsData( KThree );
    STIF_ASSERT_FALSE( flag );

    flag = grid->IndexContainsData( KSix );
    STIF_ASSERT_FALSE( flag );

    grid->SetStartCells( KThree );
    flag = grid->IndexContainsData( KSix );
    STIF_ASSERT_FALSE( flag );

    flag = grid->IndexContainsData( KThree );
    STIF_ASSERT_TRUE( flag );

    flag = grid->IndexContainsData( KFour );
    STIF_ASSERT_TRUE( flag );

    CleanupStack::PopAndDestroy( buf3 );
    CleanupStack::PopAndDestroy( buf2 );
    CleanupStack::PopAndDestroy( buf1 );
    CleanupStack::Pop( arr );
    CleanupStack::PopAndDestroy( grid );
    return KErrNone;
    }
Exemplo n.º 27
0
//
// NEW
//
void CHlpView::PopulateCategoryListL()
	{
	// First get a category listing, then get the list of topics
	// for each specified category.
	// Get and print the category listing
	CDesCArrayFlat* array = new(ELeave) CDesCArrayFlat(5);
	CleanupStack::PushL(array);
	iHelpModel.CategoryListL(array);

	if	(!array->Count())
		User::Leave(KErrArgument); // ??

	iHelpCategories->SetArrayExternalOwnership(EFalse);
	iHelpCategories->SetArrayL(array);
	iHelpCategories->SetArrayExternalOwnership(EFalse);
	iHelpCategories->SetCurrentItem(0);

	PopulateTopicListL(iHelpCategories->Array()->MdcaPoint(iHelpCategories->CurrentItem()));

	CleanupStack::Pop();
	}
Exemplo n.º 28
0
// ----------------------------------------------------------------------------
// Read array of menu items, leave on cleanup stack
// ----------------------------------------------------------------------------
//
EXPORT_C CDesCArrayFlat* CMPXResource::ReadMenuArrayLC(TInt aResourceId, RArray<TInt>& aIdArray)
    {
    //MPX_DEBUG1("CMPXResource::ReadMenuArrayLC");
    TResourceReader resReader;
    HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
    resReader.SetBuffer(readBuffer);
    TInt count(resReader.ReadInt16());
    CDesCArrayFlat* descArray = new (ELeave) CDesCArrayFlat(count);
    for (TInt k = 0; k < count; k++)
              {
              aIdArray.AppendL (resReader.ReadInt32());
              HBufC* hbuf = resReader.ReadHBufCL();
              CleanupStack::PushL(hbuf);
              descArray->AppendL (*hbuf);
              CleanupStack::PopAndDestroy(hbuf);
        }
    CleanupStack::PopAndDestroy(readBuffer);
    //MPX_DEBUG1("CMPXResource::ReadDesCArrayLC End");
    CleanupStack::PushL(descArray);
    return descArray;
    }
Exemplo n.º 29
0
// -----------------------------------------------------------------------------
// X509CertNameParser::GetFullNameL
// 
// -----------------------------------------------------------------------------
TInt X509CertNameParser::GetFullNameL( 
                              const CX500DistinguishedName& aDN, 
                              const CX509CertExtension* aExtension,
                              HBufC*& aName,
                              const TDesC& aLabel )
    {
    CDesCArrayFlat* nameArray = new( ELeave ) CDesCArrayFlat(3);
    CleanupStack::PushL( nameArray );
    // Add label to array. It is used for comparing.
    nameArray->AppendL( aLabel );

    // Collect name parts to array
    GetNamePartsL( aDN, aExtension, *nameArray, EX509CNPFullName);
    
    // Count length of the aName.
    TInt length = 0;
    TInt i = 1; // Pass label
    for ( ; i < nameArray->MdcaCount(); i++ )
        { 
        length += (*nameArray)[i].Length();
        length += KX509CNPComma.iTypeLength;
        }
    
    // Add elements of the array to aName.
    // First element is label, so it is passed.
    aName = HBufC::NewLC( length );
    for ( i = 1; i < nameArray->MdcaCount(); i++ )
        {
        if ( i != 1 )
            {
            aName->Des().Append( KX509CNPComma );
            }
        aName->Des().Append( (*nameArray)[i] );   
        }

    CleanupStack::Pop( aName ); 
    CleanupStack::PopAndDestroy( nameArray ); 

    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingPagesArrayDecoratorSetArrayL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingPagesArrayDecoratorSetArrayL( CStifItemParser& /*aItem*/ )
    {
    TAknDesCArrayDecorator* decorator = new( ELeave ) TAknDesCArrayDecorator();
    CleanupStack::PushL( decorator );
    
    CDesCArrayFlat* arr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( arr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    
    arr->AppendL( tom );
    arr->AppendL( jack );
    arr->AppendL( mary );
    
    decorator->SetArray( arr );
    TBuf<KBufSize> buffer( KTestString );
    decorator->SetDecorationText( buffer );
    
    TInt count = decorator->MdcaCount();
    STIF_ASSERT_EQUALS( KThree, count );
    
    TInt numberofarray( KZero );
    TBool flag = decorator->DecoratedIndex( numberofarray );
    STIF_ASSERT_EQUALS( KThree, numberofarray );
    STIF_ASSERT_FALSE( flag );
    
    decorator->SetActive( ETrue );
    count = decorator->MdcaCount();
    STIF_ASSERT_EQUALS( KFour, count );
    
    TPtrC returnText = decorator->MdcaPoint( KZero );
    STIF_ASSERT_TRUE( returnText == tom );
    
    CleanupStack::PopAndDestroy( arr );
    CleanupStack::PopAndDestroy( decorator );
    return KErrNone;
    }