Example #1
0
EXPORT_C TInt FontUtils::GetAvailableHeightsInTwipsAndPointsL(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName,CArrayFix<TInt>& aTwipsList,CDesCArray& aPointsList)
/** Gets a list of all heights in twips, available for the named typeface and the 
graphics device specified.

Also gets a list of heights in points, represented as character strings.

@param aDevice The graphics device.
@param aTypefaceName The name of the typeface.
@param aTwipsList On return, contains all available heights for the typeface, 
in twips.
@param aPointsList On return, the heights in points, represented as character 
strings.
@return KErrNotSupported if the named typeface is not supported by the graphics 
device, otherwise KErrNone. */
	{ // static
	aTwipsList.Reset();
	aPointsList.Reset();
	TInt err=GetAvailableHeightsInTwipsL(aDevice,aTypefaceName,aTwipsList);
	if (err==KErrNotSupported)
		return err;
	const TInt count=aTwipsList.Count();
	for (TInt ii=0;ii<count;ii++)
		{
		const TInt points=PointsFromTwips(aTwipsList[ii]);
		if (points<EMinFontHeight)
			continue;
		TBuf<8> num;
		num.Num(points);
		aPointsList.AppendL(num);
		}
	return KErrNone;
	}
// -----------------------------------------------------------------------------
// CPIMAgnToDoAdapter::ExportItemL
// (other items were commented in a header)
// -----------------------------------------------------------------------------
//
void CPIMAgnToDoAdapter::ExportItemL(const MPIMToDoItem& aItem,
                                     CCalEntry& aEntry, TBool aResetEntry)
{
    JELOG2(EPim);
    if (aResetEntry)
    {
        // Reset native entry for exporting new data
        aEntry.SetSummaryL(KNullDesC());
        aEntry.SetDescriptionL(KNullDesC());
        aEntry.SetPriorityL(0);
        aEntry.SetCompletedL(EFalse, aEntry.CompletedTimeL());
    }

    // Export item data to the native ToDo calendar entry
    const MPIMItemData& itemData = aItem.ItemData();
    CArrayFix<TPIMField>* fields = itemData.FieldsLC();

    // Add default values to the calendar entry
    AddDefaultValuesToEntryL(itemData, aEntry);

    // Convert each field to the native ToDo calendar entry
    TInt count = fields->Count();
    for (TInt i = 0; i < count; i++)
    {
        TPIMToDoField field = static_cast<TPIMToDoField>(fields->At(i));
        ConvertToAgnL(field, aEntry, itemData);
    }
    CleanupStack::PopAndDestroy(fields);
}
/**
 Retrieves the SIM lanugages list.
 
 This will retrieve the SIM languages list in a dynamic array, the list was prepared by a previous successful call to @c PrepareSimLanguages().
 
 @param aSimLanguageCount   The count of the languages as prepared in a previous call to @c PrepareSimLanguages().
                            This count is used to allocate and expand the size of the flat buffer. 
                                                
 @return A pointer to the fixed length array CArrayFix<TInt32> of language codes.
 
 @note This API can only be called by processes with the SecureID of the System State Manager.
 
 @see RSsmMiscAdaptation::PrepareSimLanguages
 
 @publishedPartner
 @released
*/
EXPORT_C CArrayFix<TInt32>* RSsmMiscAdaptation::SimLanguagesArrayL(TInt aSimLanguageCount)
	{
	if(! Handle())
		{
		User::Leave(KErrDisconnected);
		}
	CArrayFix<TInt32>* clientArray = new (ELeave) CArrayFixFlat<TInt32>(2);
	CleanupStack::PushL(clientArray);

	CBufFlat* buffer=CBufFlat::NewL(aSimLanguageCount);
	CleanupStack::PushL(buffer);
	const TInt length = aSimLanguageCount * sizeof(TInt32);
	buffer->ExpandL(0,length);
	TPtr8 bufPtr = buffer->Ptr(0);
	User::LeaveIfError(SendReceive(EGetSimLanguagesArray, TIpcArgs(&bufPtr, aSimLanguageCount)));

	RBufReadStream readStream(*buffer);
	CleanupClosePushL(readStream);
	
	TInt32 langId = 0; //Initialized with value 0 because this value is not a language id 
	for (TInt i=0; i < aSimLanguageCount; ++i)
		{
		langId = readStream.ReadInt32L();
		clientArray->AppendL(langId);  
		}
	
	CleanupStack::PopAndDestroy(2); //readStream, buffer
	CleanupStack::Pop(clientArray);
	return clientArray;
	}
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVSetQueryModeL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVDCreateEditorL( CStifItemParser& /*aItem*/ )
    {
    CAknQueryValueDate* date = CAknQueryValueDate::NewL();
    CleanupStack::PushL( date );
    
    CAknQueryValueDateArray* dateArray = CAknQueryValueDateArray::NewL( R_TESTQUERY_DATE_FORMAT );
    CleanupStack::PushL( dateArray );
    
    CArrayFix<TTime>* timeArray = new( ELeave ) CArrayFixFlat<TTime>( 4 );
    CleanupStack::PushL( timeArray );
    
    TTime time1;
    time1.HomeTime();
    TTime time2;
    time2 = time1 + TTimeIntervalDays( 3 );
    
    timeArray->AppendL( time1 );
    timeArray->AppendL( time2 );
    
    dateArray->SetArray( *timeArray );
    
    date->SetArrayL( dateArray );

    date->SetCurrentValueIndex( KZero );
    
    TBool flag = date->CreateEditorL();
    STIF_ASSERT_TRUE( flag );
    
    CleanupStack::Pop( KTwo );
    CleanupStack::PopAndDestroy( date );
    return KErrNone;
    }
Example #5
0
EXPORT_C TInt FontUtils::GetAvailableHeightsInTwipsL(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName,CArrayFix<TInt>& aHeightList)
/** Gets a list of all heights in twips, available for the named typeface and the 
graphics device specified.

@param aDevice The graphics device.
@param aTypefaceName The name of the typeface.
@param aHeightList On return, contains all available heights for the typeface, 
in twips. 
@return KErrNotSupported if the named typeface is not supported by the graphics 
device, otherwise KErrNone. */
	{ // static
	aHeightList.Reset();
	const TInt numTypefaces=aDevice.NumTypefaces();
	TInt fontIndex;
	for (fontIndex=0;fontIndex<numTypefaces;fontIndex++)
		{
    	TTypefaceSupport typefaceInfo;
		aDevice.TypefaceSupport(typefaceInfo,fontIndex);
		if (typefaceInfo.iTypeface.iName==aTypefaceName)
			break;
		}
	if (fontIndex>=numTypefaces)
		return KErrNotSupported;
	TTypefaceSupport typefaceInfo;
	aDevice.TypefaceSupport(typefaceInfo,fontIndex);
	const TInt numHeights=typefaceInfo.iNumHeights;
	for (TInt ii=0;ii<numHeights;ii++)
		{
		const TInt height=aDevice.FontHeightInTwips(fontIndex,ii);
		if (PointsFromTwips(height)>=EMinFontHeight)
			aHeightList.AppendL(height);
		}
	return KErrNone;
	}
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVDAMdcaPointL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVDAMdcaPointL( CStifItemParser& /*aItem*/ )
    {
    CAknQueryValueDateArray* dateArray = CAknQueryValueDateArray::NewL( R_TESTQUERY_DATE_FORMAT );
    CleanupStack::PushL( dateArray );
    
    CArrayFix<TTime>* timeArray = new( ELeave ) CArrayFixFlat<TTime>( 4 );
    CleanupStack::PushL( timeArray );
    
    TTime time1;
    time1.HomeTime();
    TTime time2;
    time2 = time1 + TTimeIntervalDays( 3 );
    
    timeArray->AppendL( time1 );
    timeArray->AppendL( time2 );
    
    dateArray->SetArray( *timeArray );
    
    for ( TInt mark = 0; mark < dateArray->MdcaCount(); mark++ )
        {
        TPtrC text = dateArray->MdcaPoint( mark );
        STIF_ASSERT_NOT_NULL( &text );
        }
    
    CleanupStack::Pop( timeArray );
    CleanupStack::PopAndDestroy( dateArray );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVDAFormattedStringSizeTwoL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVDAFormattedStringSizeTwoL( CStifItemParser& /*aItem*/ )
    {
    CAknQueryValueDateArray* dateArray = CAknQueryValueDateArray::NewL( R_TESTQUERY_DATE_FORMAT );
    CleanupStack::PushL( dateArray );
    
    CArrayFix<TTime>* timeArray = new( ELeave ) CArrayFixFlat<TTime>( 4 );
    CleanupStack::PushL( timeArray );
    
    TTime time1;
    time1.HomeTime();
    TTime time2;
    time2 = time1 + TTimeIntervalDays( 3 );
    
    timeArray->AppendL( time1 );
    timeArray->AppendL( time2 );
    
    dateArray->SetArray( *timeArray );
    
    TInt size = dateArray->FormattedStringSize();
    STIF_ASSERT_NOT_EQUALS( KZero, size );
    
    CleanupStack::Pop( timeArray );
    CleanupStack::PopAndDestroy( dateArray );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVNumberSetArrayL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVNumberSetArrayL( CStifItemParser& /*aItem*/ )
    {
    CAknQueryValueNumber* number = CAknQueryValueNumber::NewLC();
    
    const MDesCArray* returnArray = number->MdcArray();
    STIF_ASSERT_NULL( returnArray );
    
    CArrayFix<TInt>* mArray = new( ELeave ) CArrayFixFlat<TInt>( 2 );
    CleanupStack::PushL( mArray );
    
    mArray->AppendL( KNumber1 );
    mArray->AppendL( KNumber2 );
    
    CAknQueryValueNumberArray* numberArray = 
        CAknQueryValueNumberArray::NewL( R_TESTQUERY_NUMBER_FORMAT );
    CleanupStack::PushL( numberArray );
    
    numberArray->SetArray( *mArray );
    
    number->SetArrayL( numberArray );
    
    returnArray = number->MdcArray();
    STIF_ASSERT_EQUALS( numberArray, ( CAknQueryValueNumberArray* )returnArray );
    
    CleanupStack::Pop( KTwo );
    CleanupStack::PopAndDestroy( number );
    return KErrNone;
    }
Example #9
0
LOCAL_C void test3(CArrayFix<TInt>& aFix)
	{

	test.Next(_L("InsertIsqL"));
	TKeyArrayFix kk(0,ECmpTInt);

	TInt pos=0;
	TInt mod=47;
	TInt inc=23;
	TInt i=0;

	FOREVER
		{
		TInt ret;
		if (i&1)
			TRAP(ret,aFix.InsertIsqL(i,kk))
		else
			{
			TRAP(ret,pos=aFix.InsertIsqL(i,kk))
			if (ret==KErrNone)
				test(aFix[pos]==i);
			}
		if (ret==KErrAlreadyExists)
			break;
		i=(i+inc)%mod;
		}

	for(i=0;i<mod;i++)
		{
		test(aFix.FindIsq(i,kk,pos)==0);
		test(pos==i);
		TRAPD(r,aFix.InsertIsqL(i,kk))
		test(r==KErrAlreadyExists);
		}
	}
// ---------------------------------------------------------------------------
// CXIMPContextEventFilter::InternalizeL()
// ---------------------------------------------------------------------------
//
EXPORT_C void CXIMPContextEventFilter::InternalizeL( 
    RReadStream& aStream )
    {
    TInt count = aStream.ReadInt32L();
    if( count )
        {
        //We are internalizing data which we have previously externalized 
        // => Internalized array can be directly set as current array
        
        CArrayFix< TInt32 >* events = 
                new (ELeave) CArrayFixFlat< TInt32 >( KXIMPEventListGranurality );
        CleanupStack::PushL( events );

        for( TInt ix = 0; ix < count; ++ix )
            {
            events->AppendL( aStream.ReadInt32L() );
            }
        delete iAcceptedEvents;
        iAcceptedEvents = events;

        CleanupStack::Pop( events );
        }

    else
        {
        delete iAcceptedEvents;
        iAcceptedEvents = NULL;
        }        
    }
EXPORT_C TBool AknPhoneNumberTextUtils::WrapPhoneNumberToArrayL( 
    const TDesC& aPhoneNumberToWrap,
    TInt aLineWidthInPixels,
    TInt aMaxLines,
    const CFont& aFont,
    CArrayFix<TPtrC>& aWrappedArray )
    {
    TBool retVal( EFalse ); // Not truncated
 
    HBufC* reversedText = aPhoneNumberToWrap.AllocLC();
    TPtr revPtr = reversedText->Des();

    ReverseDescriptor( revPtr );

    CArrayFix<TInt>* lineWidthArray = new (ELeave) CArrayFixFlat<TInt>(KLineArrayGranularity);
    CleanupStack::PushL( lineWidthArray );

    lineWidthArray->AppendL( aLineWidthInPixels, aMaxLines );

    // Perform the wrap on the reversed text
    AknTextUtils::WrapToArrayL( revPtr, *lineWidthArray, aFont, aWrappedArray );

    // Now rearrange the TPtrCs to point to the original array
    TInt totalLen = reversedText->Length();
    TInt count = aWrappedArray.Count();
    TInt usedLen = 0; // Accumulates the length actually used
    for ( TInt index = 0; index < count; index++)
        {
        TPtrC& currentPtr = aWrappedArray.At(index);
        // The TPtrCs have to be moved. The reversing is taken into effect, but not purely reversed
        // because their otherwise they would have negative lengths.  That is, {a,b} does not go to
        // { final - a, final - b }, but rather to {final - b, final - a}; they are flipped, to get
        // their start points before the end points
        //
        // Now, representing the start position by pos, and the end by pos+len-1 we have the TPtrC at
        // {pos, pos+len-1} inclusive, in reversed array. 
        // The TPtrC must be modified to point to {total_len-1 - (pos+len-1), total_len-1 - pos} 
        // in the unreversed array:
        TInt len = currentPtr.Length();
        usedLen += len;
        TInt pos = currentPtr.Ptr() - reversedText->Ptr(); // pointer arithmetic
        TInt newPos = totalLen - pos - len;
        // If the TPtr is zero length then it must get special treatment, as the normal
        // calculations give an end point before the start point! i.e. {pos, pos-1}
        // We handle this by NOT flipping in this case.
        // { pos, pos-1 } -> {totalLen-1-pos, totalLen-1 - (pos-1)}
        // Note that a zero length wrapped line is completely possible amoung a bunch of other 
        // lines with characters on them, as the line lengths may be of wildly different lengths.
        if ( len == 0 ) 
            newPos--;
        currentPtr.Set( aPhoneNumberToWrap.Mid(newPos, len) );
        }

    // If the accumulated length is less than that in the entire input descriptor, then text does not fit
    if ( usedLen < totalLen )
        retVal = ETrue;

    CleanupStack::PopAndDestroy(2); // lineWidthArray first, and then reversedText
    return retVal;
    }
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVNumberCreateEditorL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVNumberCreateEditorL( CStifItemParser& /*aItem*/ )
    {
    CAknQueryValueNumber* number = CAknQueryValueNumber::NewLC();
    
    CArrayFix<TInt>* mArray = new( ELeave ) CArrayFixFlat<TInt>( 2 );
    CleanupStack::PushL( mArray );
    
    mArray->AppendL( KNumber1 );
    mArray->AppendL( KNumber2 );
    
    CAknQueryValueNumberArray* numberArray = 
        CAknQueryValueNumberArray::NewL( R_TESTQUERY_NUMBER_FORMAT );
    CleanupStack::PushL( numberArray );
    
    numberArray->SetArray( *mArray );
    
    number->SetArrayL( numberArray );
    
    number->SetCurrentValueIndex( KZero );
    
    TBool flag = number->CreateEditorL();
    STIF_ASSERT_TRUE( flag );
    
    CleanupStack::Pop( KTwo );
    CleanupStack::PopAndDestroy( number );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVNumberCurrentValueTextLCL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVNumberCurrentValueTextLCL( CStifItemParser& /*aItem*/ )
    {
    CAknQueryValueNumber* number = CAknQueryValueNumber::NewLC();
    
    CArrayFix<TInt>* mArray = new( ELeave ) CArrayFixFlat<TInt>( 2 );
    CleanupStack::PushL( mArray );
    
    mArray->AppendL( KNumber1 );
    mArray->AppendL( KNumber2 );
    
    CAknQueryValueNumberArray* numberArray = 
        CAknQueryValueNumberArray::NewL( R_TESTQUERY_NUMBER_FORMAT );
    CleanupStack::PushL( numberArray );
    
    numberArray->SetArray( *mArray );
    
    number->SetArrayL( numberArray );
    
    HBufC* text = number->CurrentValueTextLC();
    STIF_ASSERT_NOT_NULL( text );
    
    CleanupStack::Pop( KThree );
    CleanupStack::PopAndDestroy( number );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CPIMEventPropertyConverter::ConvertExceptionDatesL
// Inserts exceptiondates to a parser.
// -----------------------------------------------------------------------------
//
void CPIMEventPropertyConverter::ConvertExceptionDatesL(const CArrayFix<
        TPIMDate>& aDates, CParserVCalEntity& aParser)
{
    JELOG2(EPim);
    TInt exDateCount = aDates.Count();
    if (exDateCount > 0)
    {
        CArrayPtrFlat<TVersitDateTime>* versitExDates =
            new(ELeave) CArrayPtrFlat<TVersitDateTime> (exDateCount);
        CleanupStack::PushL(versitExDates);
        CleanupResetAndDestroyPushL(*versitExDates);
        for (TInt i = 0; i < exDateCount; i++)
        {
            TVersitDateTime
            * versitDateTime =
                new(ELeave) TVersitDateTime(aDates.At(i).DateTime(), TVersitDateTime::EIsUTC);
            CleanupDeletePushL(versitDateTime);
            versitExDates->AppendL(versitDateTime);
            CleanupStack::Pop(versitDateTime); // versitDateTime
        }
        CParserPropertyValue* propertyValue =
            new(ELeave) CParserPropertyValueMultiDateTime(versitExDates);
        CleanupStack::Pop(2); // versitExDates is now owned by propertyValue
        AddPropertyToParserL(propertyValue, KVersitTokenEXDATE(), aParser);
        // Needed cleanup stack items are popped out in the AddPropretyToParserL
    }
}
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVSetQueryModeL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVDCurrentValueTextLCL( CStifItemParser& /*aItem*/ )
    {
    CAknQueryValueDate* date = CAknQueryValueDate::NewL();
    CleanupStack::PushL( date );
    
    CAknQueryValueDateArray* dateArray = CAknQueryValueDateArray::NewL( R_TESTQUERY_DATE_FORMAT );
    CleanupStack::PushL( dateArray );
    
    CArrayFix<TTime>* timeArray = new( ELeave ) CArrayFixFlat<TTime>( 4 );
    CleanupStack::PushL( timeArray );
    
    TTime time1;
    time1.HomeTime();
    TTime time2;
    time2 = time1 + TTimeIntervalDays( 3 );
    
    timeArray->AppendL( time1 );
    timeArray->AppendL( time2 );
    
    dateArray->SetArray( *timeArray );
    
    date->SetArrayL( dateArray );
    
    HBufC* text = date->CurrentValueTextLC();
    STIF_ASSERT_NOT_NULL( text );
    
    CleanupStack::Pop( KThree );
    CleanupStack::PopAndDestroy( date );
    return KErrNone;
    }
// ---------------------------------------------------------
// FavouritesUtil::ExternalizeL
// ---------------------------------------------------------
//
void FavouritesUtil::ExternalizeL
( const CArrayFix<TInt>& aArray, RWriteStream& aStream )
{
    aStream.WriteInt32L( aArray.Count() );
    for ( TInt i = 0; i < aArray.Count(); i++ )
    {
        aStream.WriteInt32L( aArray[ i ] );
    }
}
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;
}
// -----------------------------------------------------------------------------
// CPIMAgnEventAdapter::ConvertFieldsToAgnL
// Reads PIM Item fields and converts them into Agenda entry's fields.
// -----------------------------------------------------------------------------
//
void CPIMAgnEventAdapter::ConvertFieldsToAgnL(const MPIMEventItem& aItem,
        CCalEntry& aEntry)
{
    JELOG2(EPim);
    CArrayFix<TPIMField>* fields = aItem.ItemData().FieldsLC();
    TInt amount = fields->Count();

    for (int i = 0; i < amount; i++)
    {
        TPIMEventField field = static_cast<TPIMEventField>(fields->At(i));
        switch (field)
        {
        case EPIMEventSummary: // Fallthrough
        case EPIMEventLocation: // Fallthrough
        case EPIMEventNote:
        {
            ConvertStringFieldToAgnL(aItem, aEntry, field);
            break;
        }
        case EPIMEventAlarm:
        {
            ConvertAlarmToAgnL(aItem, aEntry);
            break;
        }
        case EPIMEventStart: // Fallthrough
        case EPIMEventEnd:
        {
            ConvertDateFieldToAgnL(aItem, aEntry, field);
            break;
        }
        case EPIMEventClass:
        {
            ConvertClassToAgnL(aItem, aEntry);
            break;
        }
        case EPIMEventRevision: // fallthrough
        case EPIMEventUid:
        {
            // nothing
            break;
        }
        default:
        {
            User::Leave(KErrArgument);
        }
        }
    }
    CleanupStack::PopAndDestroy(fields);
}
Example #19
0
EXPORT_C void LafScrollThumb::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList)
	{ // static
	TInt commonAttributes = TCoeColorUse::ESurrounds|TCoeColorUse::ENormal|TCoeColorUse::ENeutral;
	TCoeColorUse colorUse;

	colorUse.SetLogicalColor(EColorScrollThumbDimmed);
	colorUse.SetUse(TCoeColorUse::EBack|TCoeColorUse::EDimmed|commonAttributes);
	aColorUseList.AppendL(colorUse);

	colorUse.SetLogicalColor(EColorScrollButtonThumbBackgroundPressed);
	colorUse.SetUse(TCoeColorUse::EFore|TCoeColorUse::EPressed|commonAttributes);
	aColorUseList.AppendL(colorUse);

	colorUse.SetLogicalColor(EColorScrollButtonThumbBackground);
	colorUse.SetUse(TCoeColorUse::EBack|TCoeColorUse::EActive|commonAttributes);
	aColorUseList.AppendL(colorUse);
	}
Example #20
0
EXPORT_C void LafMenuPane::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList)
	{ // static
	TInt commonAttributes = TCoeColorUse::ENormal|TCoeColorUse::ENeutral;
	TCoeColorUse colorUse;

	colorUse.SetLogicalColor(EColorMenuPaneText);
	colorUse.SetUse(TCoeColorUse::EFore|TCoeColorUse::EActive|TCoeColorUse::ESurrounds|commonAttributes);
	aColorUseList.AppendL(colorUse);

	colorUse.SetLogicalColor(EColorMenuPaneBackground);
	colorUse.SetUse(TCoeColorUse::EBack|TCoeColorUse::EActive|TCoeColorUse::ESurrounds|commonAttributes);
	aColorUseList.AppendL(colorUse);

	colorUse.SetLogicalColor(EColorMenuPaneTextHighlight);
	colorUse.SetUse(TCoeColorUse::EFore|TCoeColorUse::EActive|TCoeColorUse::EHighlights|commonAttributes);
	aColorUseList.AppendL(colorUse);

	colorUse.SetLogicalColor(EColorMenuPaneHighlight);
	colorUse.SetUse(TCoeColorUse::EBack|TCoeColorUse::EActive|TCoeColorUse::EHighlights|commonAttributes);
	aColorUseList.AppendL(colorUse);

	colorUse.SetLogicalColor(EColorMenuPaneDimmedTextHighlight);
	colorUse.SetUse(TCoeColorUse::EBack|TCoeColorUse::EDimmed|TCoeColorUse::EHighlights|commonAttributes);
	aColorUseList.AppendL(colorUse);

	colorUse.SetLogicalColor(EColorMenuPaneDimmedHighlight);
	colorUse.SetUse(TCoeColorUse::EFore|TCoeColorUse::EDimmed|TCoeColorUse::EHighlights|commonAttributes);
	aColorUseList.AppendL(colorUse);

	colorUse.SetLogicalColor(EColorMenuPaneDimmedText);
	colorUse.SetUse(TCoeColorUse::EBack|TCoeColorUse::EDimmed|TCoeColorUse::ESurrounds|commonAttributes);
	aColorUseList.AppendL(colorUse);
	}
// ---------------------------------------------------------
// FavouritesUtil::InternalizeL
// ---------------------------------------------------------
//
void FavouritesUtil::InternalizeL
( CArrayFix<TInt>& aArray, RReadStream& aStream )
{
    TInt count = aStream.ReadInt32L();
    for ( TInt i = 0; i < count; i++ )
    {
        aArray.AppendL( aStream.ReadInt32L() );
    }
}
/**
 * Set text and font into labels.
 *
 * SetBufferReserveLengthL causes a reallocation but this should never
 * be called unless somebody decides to change the font after the label
 * has been created and with this new font you can fit more characters 
 * in the same width

 */
void CAknTextControl::SetWrappedTextIntoLabelsL(const CArrayFix<TPtrC>& aWrappedArray, TInt aNumLines, const CFont* aFont)
	{
	__ASSERT_DEBUG(aNumLines == iNumberOfLines, Panic(EAknPanicSelfCheckFailure));

	for (TInt i=0; i < iNumberOfLines; i++)
		{
		
		if (Line(i)->BufferReserveLength() < aWrappedArray.At(i).Length())
			Line(i)->SetBufferReserveLengthL(aWrappedArray.At(i).Length());

		if (*(Line(i)->Text()) != aWrappedArray.At(i) )
			{
			Line(i)->SetTextL(aWrappedArray.At(i));
			Line(i)->SetFont(aFont);
			iLines[i]->iModified = ETrue;
			}
		}
	}
// ---------------------------------------------------------------------------
// CPIMContactFieldInfo::MatchPIMField
// (other items were commented in a header)
// ---------------------------------------------------------------------------
//
CArrayFix<TInt>* CPIMContactFieldInfo::MatchPIMFieldL(
    TPIMContactField aContactField) const
{
    JELOG2(EPim);
    CArrayFix<TInt>* fieldArray = new(ELeave) CArrayFixFlat<TInt> (7);
    CleanupStack::PushL(fieldArray);
    TInt count = iFieldsInfo->Count();
    for (TInt i = 0; i < count; i++)
    {
        const TPIMFieldInfo& fieldInfo = (*iFieldsInfo)[i];
        if (fieldInfo.iPIMField == aContactField)
        {
            fieldArray->AppendL(fieldInfo.iContactsModelField);
        }
    }
    CleanupStack::Pop(fieldArray);
    return fieldArray;
}
// -----------------------------------------------------------------------------
// CPIMEventPropertyConverter::GetRepeatRuleFieldsL
// Gets the fields from a repeat rule
// -----------------------------------------------------------------------------
//
void CPIMEventPropertyConverter::GetRepeatRuleFieldsL(
    const MPIMRepeatRuleData* aRepeat, // Fields are read from this
    TInt* aInterval, // interval is stored here
    TInt* aFrequency, // frequency is stored here
    TVersitDateTime** aVersitEndDate) // end date is stored here
{
    JELOG2(EPim);
    TBool endExists = EFalse;
    CArrayFix<TPIMField>* repeatFields = aRepeat->GetFieldsL();
    CleanupStack::PushL(repeatFields);
    TInt fieldCount = repeatFields->Count();
    for (TInt i = 0; i < fieldCount; i++)
    {
        switch (repeatFields->At(i))
        {
        case EPIMRepeatRuleFrequency:
        {
            *aFrequency = aRepeat->GetIntL(EPIMRepeatRuleFrequency);
            break;
        }
        case EPIMRepeatRuleInterval:
        {
            *aInterval = aRepeat->GetIntL(EPIMRepeatRuleInterval);
            break;
        }
        case EPIMRepeatRuleEnd:
        {
            endExists = ETrue;
            break;
        }
        default:
        {
            // We ignore other fields
        }
        }
    }
    CleanupStack::PopAndDestroy(repeatFields);
    if (endExists)
    {
        TPIMDate endDate = aRepeat->GetDateL(EPIMRepeatRuleEnd);
        *aVersitEndDate
        = new(ELeave) TVersitDateTime(endDate.DateTime(), TVersitDateTime::EIsUTC);
    }
}
Example #25
0
TInt TDmAdUtil::FindLargestLocallyCreated(const CArrayFix<TSmlDmMappingInfo>& aPreviousUriSegmentList)
    {
    TRACE("TDmAdUtil::FindLargestLocallyCreated");
    TInt largest = 0;
    for (TInt i=0; i < aPreviousUriSegmentList.Count(); i++)
        {
        const TSmlDmMappingInfo& mappingInfo = aPreviousUriSegmentList.At(i);        
        if (mappingInfo.iURISeg.Find(KDmAdLocallyCreatedRtNodeUriSegPrefix) == 0)
            {            
            TPtrC8 numberPart(mappingInfo.iURISeg.Mid(KDmAdLocallyCreatedRtNodeUriSegPrefix().Length()));
            TInt number = TDmAdUtil::DesToInt(numberPart);
            if (number > largest)
                {
                largest = number;
                }
            }
        }
    return largest;
    }
Example #26
0
TBool CDataWrapperBase::GetPointListFromConfigL(const TDesC& aSectName, const TDesC& aKeyName, CArrayFix<TPoint>& aResult)
	{
	TBuf<KMaxTestExecuteCommandLength>	tempStore;
	TPoint								point;

	aResult.Reset();
	TBool	ok=ETrue;
	for ( TInt index=0; ok; )
		{
		tempStore.Format(KFormatFieldNumber, &aKeyName, ++index);
		ok=GetPointFromConfig(aSectName, tempStore, point);
		if ( ok )
			{
			aResult.AppendL(point);
			}
		}

	return aResult.Count()>0;
	}
// ---------------------------------------------------------------------------
// CXIMPContextEventFilter::FindEventPosition()
// ---------------------------------------------------------------------------
//
TBool CXIMPContextEventFilter::FindEventPosition( 
    const TInt32 aEvent, const CArrayFix< TInt32 >& aEvents, TInt& aPos ) const
    {
    TKeyArrayFix key( 0, ECmpTInt32 );
    if( aEvents.FindIsq( aEvent, key, aPos ) == 0 )
        {
        //FindIsq() returns zero, if element is found => this is mapped to ETrue
        return ETrue;        
        }
    
    return EFalse;
    }
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVNArrayFormatStringL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVNArrayFormatStringL( CStifItemParser& /*aItem*/ )
    {
    CAknQueryValueNumberArray* numberArray = 
        CAknQueryValueNumberArray::NewL( R_TESTQUERY_NUMBER_FORMAT );
    CleanupStack::PushL( numberArray );
    
    CArrayFix<TInt>* mArray = new( ELeave ) CArrayFixFlat<TInt>( 2 );
    CleanupStack::PushL( mArray );
    
    mArray->AppendL( KNumber1 );
    mArray->AppendL( KNumber2 );
    
    numberArray->SetArray( *mArray );
    
    const HBufC* text = numberArray->FormatString();
    STIF_ASSERT_NOT_NULL( text );
    
    CleanupStack::Pop( mArray );
    CleanupStack::PopAndDestroy( numberArray );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVNArrayFormattedStringSizeTwoL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVNArrayFormattedStringSizeTwoL( CStifItemParser& /*aItem*/ )
    {
    CAknQueryValueNumberArray* numberArray = 
        CAknQueryValueNumberArray::NewL( R_TESTQUERY_NUMBER_FORMAT );
    CleanupStack::PushL( numberArray );
    
    CArrayFix<TInt>* mArray = new( ELeave ) CArrayFixFlat<TInt>( 2 );
    CleanupStack::PushL( mArray );
    
    mArray->AppendL( KNumber1 );
    mArray->AppendL( KNumber2 );
    
    numberArray->SetArray( *mArray );
    
    TInt size = numberArray->FormattedStringSize();
    STIF_ASSERT_NOT_EQUALS( KZero, size );
    
    CleanupStack::Pop( mArray );
    CleanupStack::PopAndDestroy( numberArray );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestQVDASetArrayL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestQVDASetArrayL( CStifItemParser& /*aItem*/ )
    {
    CAknQueryValueDateArray* dateArray = CAknQueryValueDateArray::NewL( R_TESTQUERY_DATE_FORMAT );
    CleanupStack::PushL( dateArray );
    
    CArrayFix<TTime>* timeArray = new( ELeave ) CArrayFixFlat<TTime>( 4 );
    CleanupStack::PushL( timeArray );
    
    TTime time1;
    time1.HomeTime();
    TTime time2;
    time2 = time1 + TTimeIntervalDays( 3 );
    
    timeArray->AppendL( time1 );
    timeArray->AppendL( time2 );
    
    dateArray->SetArray( *timeArray );
    
    CleanupStack::Pop( timeArray );
    CleanupStack::PopAndDestroy( dateArray );
    return KErrNone;
    }