// -----------------------------------------------------------------------------
// CContactSubscriber::RunL()
// Assyncronous request handler , on completion of notification
// -----------------------------------------------------------------------------
//
void CContactSubscriber::RunL()
{
    __TRACE_CALLSTACK;
    SubscribeChangeNotiFication();
    // property updated, get new value 
    TBuf8 <KBufferSize> value; 
    TPtrC8  id; 
    TPtrC8  sourceType; 
    TPtrC8  addressCount; 
    
    if ( KErrNone == iProperty.Get( value ) )
    { 
        TInt pos =  value.Locate(TChar('-')); 
        id.Set( value.Left(pos) ); 
        
        TPtrC8 ptr = value.Right(3); 
        sourceType.Set(ptr.Left(1)); 
        addressCount.Set(ptr.Right(1)); 
        
        TInt appId = -1, addressType = -1, addressTypeCount = -1; 
        TLex8 lex(id); 
        lex.Val(appId); 
        
        TLex8 lex1(sourceType); 
        lex1.Val( addressType ); 
        
        TLex8 lex2(addressCount); 
        lex2.Val(addressTypeCount); 
        
        iNotifyChange.GetChangeNotificationL( appId, addressType,addressTypeCount ); 
    } 
}
Example #2
0
void AsciiUnicode<R,S,L,B,T>::Test1()
// R == TReal32 or TReal64
// S == TText, TText8 or TText16
// L == TLex, TLex8 or TLex16
// B == TBuf, TBuf8 or TBuf16
// T == TPtr, TPtr8 or TPtr16
	{

	L lex1(_TL("123.456"));
	R real; // TReal32 or TReal64 
	test(lex1.Val(real)==KErrNone);							 
	test(Abs(real-123.456)<1E-5);
	test(lex1.TokenLength()==7);
	test((lex1.Remainder()).Compare(T(_TL(""),0,0))==0);
	test(lex1.Val(real)==KErrGeneral);

	L lex2(_TL("123.456abc"));
	test(lex2.Val(real)==KErrNone);
	test(Abs(real-123.456)<1E-5);
	test(lex2.TokenLength()==7);
	test((lex2.Remainder()).Compare(T(_TL("abc"),3,3))==0);
	test(lex2.Val(real)==KErrGeneral);

	L lex3;
	real=(R)0.5;
	test(lex3.Val(real)==KErrGeneral);
	test(real==((R)0.5));
	test(lex3.TokenLength()==0);

	L lex4(_TL("abc123.45"));
	real=(R)0.5;
	test(lex4.Val(real)==KErrGeneral);
	test(real==((R)0.5));

	L Lex5(_TL("1.2e37"));
	real=(R)0.5;
	test(Lex5.Val(real)==KErrNone);
	
	L Lex6(_TL("1.2e"));
	real=(R)0.5;
	test(Lex6.Val(real)==KErrNone);

	TRealFormat format(20,3); // first param width, 2nd decimals
	real=(R)12345.6789;
	B buf1;
	test(buf1.Num(real,format)==10);
	test(buf1.Compare(T(_TL("12,345.679"),10,10))==0);

	B buf2(_TL("abc"));
	test(buf2.AppendNum(real,format)==13);
	test(buf2.Compare(T(_TL("abc12,345.679"),13,13))==0); 

	B buf3;
	test(buf3.AppendNum(real,format)==10);
	test(buf3.Compare(T(_TL("12,345.679"),10,10))==0);
	}
/** Check the GEO Property value stored in entry, with expected GEO Property value
@param	aCalEntry Pointer to CCalEntry
@param	aGeoLat Expected GEO latitude value
@param	aGeoLong Expected GEO longitude value
*/
void CTestCalInterimApiFetchEntryAndCheckData::CheckGEOPropertyL(CCalEntry* aCalEntry, const TDesC& aGeoLat, const TDesC& aGeoLong)
	{
	CCalGeoValue* geoValue = NULL;
	
	TRAPD(err, geoValue = aCalEntry->GeoValueL());

	if (err != KErrNone)
		{
		ERR_PRINTF2(_L("GeoValuesL Error Code %d"), err);
		SetTestStepResult(EFail);
		SetTestStepError(err);
		}
	else
		{
		CleanupStack::PushL(geoValue);
		}
	
	TReal lat = 0.0;
	TReal longitude = 0.0;
	TBool hasGEO = geoValue->GetLatLong(lat,longitude);
	
	TESTL(hasGEO);

	TLex lex(aGeoLat);
	TReal expectLat = 0.0;
	lex.Val(expectLat);

	TLex lex1(aGeoLong);
	TReal expectLong = 0.0;
	lex1.Val(expectLong);

	INFO_PRINTF5(KExpectedAndFoundGEO, expectLat, lat, expectLong, longitude);

	TEST1(lat == expectLat, ETrue);
	TEST1(longitude == expectLong, ETrue);
	
	if (err == KErrNone)
		{
		CleanupStack::PopAndDestroy(geoValue);	
		}
	}
// ---------------------------------------------------------------------------
// CAtPhbkEnGetInfo::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtPhbkEnGetInfo::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if( iState==ESetEnStoreComplete )
		{
		if (CurrentLine().Match(KLtsyOkString) == 0)
			{
			iError = KErrNone;
			}
		else
			{
			iError = KErrGeneral;
			}
		}
	else if( iState==EGetEnStoreInfoComplete )
		{
		/**
		* Here is an Example 
		* +CPBS: "EN",2,16 
        * phonebooken is selected,2 locations are used and 
        * total 16 locations are available
		*/
		iError = KErrNone;
		RArray<TPtrC8> array;
		CleanupClosePushL(array);
		iParser->ParseRespondedBuffer(array,Buffer());
		//remove AT+CPBS
		if(array[0].MatchF(KAnyATCommand)!=KErrNotFound)
			{
			array.Remove(0);
			}
		TInt count = array.Count();
#ifdef _DEBUG			
		for( TInt i=0;i<count;i++ )
			{
		    LOGTEXT3(_L8("CAtPhbkEnGetInfo::ParseResponseL\tarray[%d]=%S"),
		    		      i,&array[i]);     
			}
#endif			
		if (count <= 1)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		if(array[0].MatchF(KCPBSResponseString)==KErrNotFound)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
				
		//parse used
		TLex8 lex(array[2]);
		TUint16 val;
		TInt ret=lex.Val(val,EDecimal);
		if(ret!=KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iUsed = val;
		
		//parse total
		TLex8 lex1(array[3]);
		ret=lex1.Val(val,EDecimal);
		if(ret!=KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iTotal = val;
	    LOGTEXT3(_L8("CAtPhbkEnGetInfo::ParseResponseL\tPreferred store used=%d, total=%d"), 
	    		                                iUsed,iTotal);
		CleanupStack::PopAndDestroy(&array);
		}
	}
// ---------------------------------------------------------------------------
// CAtPhbkStoreRead::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtPhbkStoreRead::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if( iState == ESetStoreNameComplete )
	    {
		if (CurrentLine().Match(KLtsyOkString) == 0)
			{
			iError = KErrNone;
			}
		else
			{
			iError = KErrGeneral;
			}
	    }
	else if( iState == EReadEntryComplete )
		{
		/**
		* +CPBR = <index>,<number>,<129/145>,<text> 
		* OK    
		*/
		RArray<TPtrC8> array;
		CleanupClosePushL(array);
		iParser->ParseRespondedBuffer(array,Buffer());
		// remove the string of AT+CPBR=..
		if(array[0].MatchF(KAnyATCommand) != KErrNotFound)
			{
			array.Remove(0);
			}
		TInt count = array.Count();
#ifdef _DEBUG		
		for( TInt i=0;i<count;i++ )
			{
			LOGTEXT3(_L8("CAtPhbkStoreRead::ParseResponseL\tarray[%d]=%S"),i,&array[i]); 
			}
#endif		
		if((array[1].Match(KLtsyOkString) == KErrNone))
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNone;
			iEndFlag = ETrue;
			return; 
			}
		else if((array[1].Match(KLtsyErrorString) == KErrNone))
			{
			CleanupStack::PopAndDestroy();
			iError = KErrGeneral;
			iEndFlag = ETrue;
			return; 
			}
	  
		iError = KErrNone;
		//remove number line if it has 
		if( array[0].MatchF(KCPBRSResponseString) == KErrNotFound )
			{
			array.Remove(0);
			}
		if( array[0].MatchF(KCPBRSResponseString) == KErrNotFound )
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		//parse index
		TLex8 lex(array[1]);
		TUint16 val;
		TInt ret = lex.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		//Index  
		iReadEntry.iIndex = val;             
		iReadEntry.iNumber.Copy(array[2]);   
		//Parse TON/NPI
		TLex8 lex1(array[3]);
		TUint16 val1;
		ret = lex1.Val(val1,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		 //TON/NPI
		iReadEntry.iTon = (TUint8)val1;  
		iReadEntry.iText.Copy(array[4]);
		CleanupStack::PopAndDestroy();
		} 
  	}
// ---------------------------------------------------------------------------
// CAtPhbkGetPhoneStoreInfo::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtPhbkGetPhoneStoreInfo::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if( iState == ESetPhoneStoreComplete )
		{
		if (CurrentLine().Match(KLtsyOkString) == 0)
			{
			iError = KErrNone;
			}
		else
			{
			iError = KErrGeneral;
			}
		}
	else if( iState == EGetPhoneStoreInfoComplete )
		{
		/**
		* Here is an Example 
		* +CPBS: "SM",6,250  
        * ADN phonebook is selected,6 locations are used and 
        * total 250 locations are available
		*/
		iError = KErrNone;
		RArray<TPtrC8> array;
		CleanupClosePushL(array);
		iParser->ParseRespondedBuffer(array,Buffer());
		//remove AT+CPBS
		if(array[0].MatchF(KAnyATCommand) != KErrNotFound)
			{
			array.Remove(0);
			}
		TInt count = array.Count();
#ifdef _DEBUG			
		for( TInt i=0;i<count;i++ )
			{
		    LOGTEXT3(_L8("CAtPhbkGetPhoneStoreInfo::ParseResponseL\tarray[%d]=%S"),
		    		      i,&array[i]);     
			}
#endif			
		if (count <= 1)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		if(array[0].MatchF(KCPBSResponseString) == KErrNotFound)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
				
		//parse used
		TLex8 lex(array[2]);
		TUint16 val;
		TInt ret = lex.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iPhoneStoreInfo.iUsedEntries = val;
		
		//parse total
		TLex8 lex1(array[3]);
		ret = lex1.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iPhoneStoreInfo.iTotalEntries = val;
		iPhoneStoreInfo.iType = RMobilePhoneStore::EPhoneBookStore;
	    LOGTEXT3(_L8("CAtPhbkGetPhoneStoreInfo::ParseResponseL\tPreferred store used=%d, total=%d"), 
	    		                                iPhoneStoreInfo.iUsedEntries,iPhoneStoreInfo.iTotalEntries);
		CleanupStack::PopAndDestroy(&array);
		}
	else 
		{
		/**
		* Parse result of AT+CPMS? 
		* Response:+CPMS:<mem1>,<used1>,<total1>,<mem2>,<used2>,<total2>
		* Here only the first mem is used. mem1 is SM
		*/
		iError = KErrNone;
		RArray<TPtrC8> array;
		CleanupClosePushL(array);
		iParser->ParseRespondedBuffer(array,Buffer());
		if(array[0].MatchF(KAnyATCommand) != KErrNotFound)
			{
			array.Remove(0);
			}
		TInt Count = array.Count();
		if (Count <= 1)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		if(array[0].MatchF(KCPMSResponseString) == KErrNotFound)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		//parse name 
		TPtrC8 name(array[1]);
		
		//parse used
		TLex8 lex(array[2]);
		TUint16 val;
		TInt ret = lex.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iPhoneStoreInfo.iUsedEntries = val;
		
		//parse total
		TLex8 lex1(array[3]);
		ret = lex1.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iPhoneStoreInfo.iTotalEntries = val;
		iPhoneStoreInfo.iType = RMobilePhoneStore::EShortMessageStore;
		LOGTEXT3(_L8("CAtPhbkGetPhoneStoreInfo::ParseResponseL\tPreferred store used=%d, total=%d"), 
			    		                        iPhoneStoreInfo.iUsedEntries,iPhoneStoreInfo.iTotalEntries);
		CleanupStack::PopAndDestroy(&array);
		}
	}
Example #7
0
void CPolicyTest::ProcessResultsL(TRequestStatus& aStatus)
	{
	_LIT8(KSummaryLine, " tests failed out of ");
	_LIT8(KNewLine, "\r\n");

	TInt failCount = KErrNotFound, runCount;
	
	// Read entire log file into memory to process
	RFile file;
	TDriveUnit sysDrive (RFs::GetSystemDrive());
	TBuf<128> logTmpFile (sysDrive.Name());
	logTmpFile.Append(KLogTmpPath);
	User::LeaveIfError(file.Open(iFs, logTmpFile, EFileShareReadersOnly | EFileRead));
	CleanupClosePushL(file);

	TInt size;
	User::LeaveIfError(file.Size(size));
	HBufC8* buffer = HBufC8::NewLC(size);
	TPtr8 ptr = buffer->Des();

	User::LeaveIfError(file.Read(ptr));

	iOut.writeString(_L("Child test output:\n"));

	TInt pos = 0;
	while (pos < size)
		{
		TInt nextNewline = buffer->Mid(pos).Find(KNewLine);

		// Split buffer into lines
		TPtrC8 line;
		if (nextNewline == KErrNotFound)
			{
			line.Set(buffer->Mid(pos));
			}
		else
			{
			line.Set(buffer->Mid(pos, nextNewline + KNewLine().Length()));
			}
		pos += line.Length();

		// Search for summary line
		TInt pos2 = line.Find(KSummaryLine);
		if (pos2 != KErrNotFound)
			{
			// Parse the summary line to work out if the test passed
			TLex8 lex1(line.Left(pos2));
			TInt err1 = lex1.Val(failCount);
			TLex8 lex2(line.Mid(pos2 + KSummaryLine().Length()));
			TInt err2 = lex2.Val(runCount);

			if (err1 != KErrNone || err2 != KErrNone)
				{
				iOut.writeString(_L("Failed to parse summary line\n"));
				User::LeaveIfError(err1);
				User::LeaveIfError(err2);
				}
			}
		else
			{
			// Don't print the summary line as this will confuse whatever parsed
			// the main log
			iOut.writeString(_L("> "));
			iOut.writeString(line);
			}		
		}
	
	if (failCount == KErrNotFound)
		{
		iOut.writeString(_L("Couldn't find summary line in test output\n"));
		User::Leave(KErrNotFound);
		}
	iFailCount += failCount;

	// Print results in different format
	iOut.write(_L("Tests run: %d\n"), runCount);
	iOut.write(_L("Tests failed: %d\n"), failCount);
	iOut.writeNewLine();
	
	CleanupStack::PopAndDestroy(2, &file);

	TRequestStatus* status = &aStatus;
	User::RequestComplete(status, KErrNone);
	}
//
// Draws the item, which might contain an icon and a text.
// The format of the item text shall look like one of the following formats:
//		- "\ttext"				(text only)
//		- "icon\ttext"			(icon and text)
//		- "\theading\ttext"		(heading and text)
//		- "icon\theading\ttext"	(icon, heading and text)
//		
void CMediaScreenListItemDrawer::DrawActualItem(TInt aItemIndex,
		const TRect& aActualItemRect, TBool aItemIsCurrent,
		TBool /*aViewIsEmphasized*/, TBool /*aViewIsDimmed*/,
		TBool aItemIsSelected) const
	{
	const MDesCArray* itemArray = iListBox.Model()->ItemTextArray();
	if ((!itemArray) || (itemArray->MdcaCount() <= aItemIndex))
		return;
    
	// Gets the item text if the conditions above are met.
	TPtrC itemText = itemArray->MdcaPoint(aItemIndex);

	// We have to find the position of tabs to decide the components
	// available in the item text (icon, heading and text).
	TInt tabPosition1 = itemText.Locate('\t');
	TInt tabPosition2 = itemText.Mid(tabPosition1 + 1).Locate('\t');
	if (tabPosition2 >= 0)
		{
		// We need to add tabPosition1 because the return value of
		// Locate() is relative to tabPosition1.
		tabPosition2 += tabPosition1 + 1;
		}
	TInt tabPosition3 = itemText.Mid(tabPosition2 + 1).Locate('\t');
	if (tabPosition3 >= 0)
		{
		// We need to add tabPosition2 because the return value of
		// Locate() is relative to tabPosition2.
		tabPosition3 += tabPosition2 + 1;
		}
	TInt tabPosition4 = itemText.Mid(tabPosition3 + 1).Locate('\t');
	if (tabPosition4 >= 0)
		{
		// We need to add tabPosition2 because the return value of
		// Locate() is relative to tabPosition2.
		tabPosition4 += tabPosition3 + 1;
		}

	// Sets the attributes to draw the icon.
	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
	if ((aItemIsCurrent) || (aItemIsSelected))
		{
		iGc->SetBrushColor(iHighlightedBackColor);
		}
	else
		{
		iGc->SetBrushColor(iBackColor);
		}

	// Gets the icon index, i.e. the number in the text item before
	// the first tab.
	TInt iconIndex = 0;
	if (tabPosition1 > 0)
		{
		TLex(itemText.Mid(0, tabPosition1)).Val(iconIndex);
		}

		TRect aActualItemRect2 = aActualItemRect;

		aActualItemRect2.iBr.iX = aActualItemRect2.iBr.iX + 0;
		aActualItemRect2.iBr.iY = aActualItemRect2.iBr.iY + 0;
		aActualItemRect2.iTl.iX = aActualItemRect2.iTl.iX + 0;
		aActualItemRect2.iTl.iY = aActualItemRect2.iTl.iY + 10;

	if ((iIconArray) && (iIconArray->Count() > iconIndex)
		&& (tabPosition1 > 0))
		{
		// Draws the icon.
		CFbsBitmap* bitmap = (*iIconArray)[iconIndex]->Bitmap();
		iGc->BitBltMasked(
			aActualItemRect2.iTl,
			bitmap,
			TRect(TPoint(0, 0), bitmap->Header().iSizeInPixels),
			(*iIconArray)[iconIndex]->Mask(),
			ETrue);

		// Draws the rectangle, just in case there are some icons that are
		// smaller than the height of item width and/or height.
		iGc->SetPenStyle(CGraphicsContext::ENullPen);
		if (bitmap->Header().iSizeInPixels.iHeight < aActualItemRect2.Height())
			{
			TRect rect(
				aActualItemRect2.iTl.iX,
				aActualItemRect2.iTl.iY + bitmap->Header().iSizeInPixels.iHeight,
				aActualItemRect2.iTl.iX + iMaxIconSize.iWidth,
				aActualItemRect2.iBr.iY);
			
			TRect rect1(
				aActualItemRect2.iTl.iX,
				aActualItemRect2.iTl.iY - 10,
				aActualItemRect2.iTl.iX + iMaxIconSize.iWidth,
				aActualItemRect2.iBr.iY - 40 );

			    iGc->DrawRect(rect);
			    iGc->DrawRect(rect1);
			}

		if (bitmap->Header().iSizeInPixels.iWidth < iMaxIconSize.iWidth)
			{
			TRect rect = TRect(
				aActualItemRect2.iTl.iX + bitmap->Header().iSizeInPixels.iWidth,
				aActualItemRect2.iTl.iY,
				aActualItemRect2.iTl.iX + iMaxIconSize.iWidth,
				aActualItemRect2.iBr.iY);
			iGc->DrawRect(rect);
			}
		}
	else
		{
		iGc->SetPenStyle(CGraphicsContext::ENullPen);
		TRect rect(
			aActualItemRect.iTl.iX,
			aActualItemRect.iTl.iY,
			aActualItemRect.iTl.iX + iMaxIconSize.iWidth,
			aActualItemRect.iBr.iY);
		iGc->DrawRect(rect);
		}

	// Sets the attributes to draw text, except the font.
	const CFont* font = Font(aItemIndex);
	iGc->SetPenStyle(CGraphicsContext::ESolidPen);
	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
	if ((aItemIsCurrent) || (aItemIsSelected))
		{
		iGc->SetPenColor(iHighlightedTextColor);
		iGc->SetBrushColor(iHighlightedBackColor);
		}
	else
		{
		iGc->SetPenColor(iTextColor);
		iGc->SetBrushColor(iBackColor);
		}

	// If there is only one tab, it means we have to display single line item
	if (tabPosition2 < 0)
		{		
		if (!font)
			{
			font = CEikonEnv::Static()->TitleFont();
			}
		iGc->UseFont(font);
		TRect textRect(
			TPoint(aActualItemRect.iTl.iX + iMaxIconSize.iWidth,
					aActualItemRect.iTl.iY),
			aActualItemRect.iBr);
		TInt baseline =
			(textRect.iBr.iY - textRect.iTl.iY - font->HeightInPixels()) / 2
				+ font->AscentInPixels();

		TBuf<2000> text;
		text.Copy(_L("   "));

		if (tabPosition1 < 0)
			{
			text.Append(itemText);
			iGc->DrawText(text, textRect, baseline,	CGraphicsContext::ELeft, 1);
			}
		else
			{
			text.Append(itemText.Mid(tabPosition1 + 1));
			iGc->DrawText(text, textRect, baseline,CGraphicsContext::ELeft, 1);
			}
		}
	else
		{
		// If there are more than one tab, then we have to display double line
		// item text
		TRect textRect(
			TPoint(aActualItemRect.iTl.iX + iMaxIconSize.iWidth,
				aActualItemRect.iTl.iY),
			aActualItemRect.iBr);
		textRect.iBr.iY -= aActualItemRect.Height() / 2;

		// Draws the first line.
		if (!font)
			{
			font = CEikonEnv::Static()->LegendFont();
			}
		iGc->UseFont(font);
		TInt baseline =
			(textRect.iBr.iY - textRect.iTl.iY - font->HeightInPixels()) / 2
				+ font->AscentInPixels();

		TBuf<2000> text;
		text.Copy(_L(" "));
		text.Append(itemText.Mid(tabPosition1 + 1, tabPosition2 - tabPosition1 - 1));

		iGc->DrawText(text,textRect, baseline, CGraphicsContext::ELeft, 1);

		// Draws the second line. For the second line, we use normal font.
		font = CCoeEnv::Static()->NormalFont();
		iGc->UseFont(font);
		textRect.Move(0, aActualItemRect.Height() / 2);
		baseline =
			(textRect.iBr.iY - textRect.iTl.iY - font->HeightInPixels()) / 2
				+ font->AscentInPixels();///
		
		text.Copy(_L(" "));
		//text.Append(itemText.Mid(tabPosition2 + 1));		
		text.Append(itemText.Mid(tabPosition2 + 1, tabPosition3 - tabPosition2 - 1));

		iGc->DrawText(text, textRect, baseline,	CGraphicsContext::ELeft, 1);
		
		//Loads 2nd bitmap
		TRect aActualItemRect1 = aActualItemRect;

		aActualItemRect1.iBr.iX = aActualItemRect1.iBr.iX + 0;
		aActualItemRect1.iBr.iY = aActualItemRect1.iBr.iY + 0;
		
		if (tabPosition4 >= 0)
			aActualItemRect1.iTl.iX = aActualItemRect1.iTl.iX + 160;
		else
			aActualItemRect1.iTl.iX = aActualItemRect1.iTl.iX + 180;

		aActualItemRect1.iTl.iY = aActualItemRect1.iTl.iY + 0;
		
		text.Copy(_L(""));
		text.Append(itemText.Mid((tabPosition3 + 1),1));
		
		TInt type;

		TLex lex(text);
		lex.Val(type);

		// Draws the icon.
		CFbsBitmap* bitmap = (*iIconArray)[type]->Bitmap();

		iGc->BitBltMasked(aActualItemRect1.iTl,
			bitmap,TRect(TPoint(0,0), bitmap->Header().iSizeInPixels),
			(*iIconArray)[type]->Mask(),
			ETrue);

		// Draws the rectangle, just in case there are some icons that are
		// smaller than the height of item width and/or height.
		iGc->SetPenStyle(CGraphicsContext::ENullPen);
		if (bitmap->Header().iSizeInPixels.iHeight < aActualItemRect1.Height())
			{
			TRect rect(
				aActualItemRect1.iTl.iX,
				aActualItemRect1.iTl.iY + bitmap->Header().iSizeInPixels.iHeight,
				aActualItemRect1.iTl.iX + iMaxIconSize.iWidth,
				aActualItemRect1.iBr.iY);
			iGc->DrawRect(rect);
			}

		if (bitmap->Header().iSizeInPixels.iWidth < iMaxIconSize.iWidth)
			{
			TRect rect = TRect(
				aActualItemRect1.iTl.iX + bitmap->Header().iSizeInPixels.iWidth,
				aActualItemRect1.iTl.iY,
				aActualItemRect1.iTl.iX + iMaxIconSize.iWidth,
				aActualItemRect1.iBr.iY);
			iGc->DrawRect(rect);
			}	

		if (tabPosition4 >= 0)
		{
			//load 3rd bitmap
			TRect aActualItemRect2 = aActualItemRect;

			aActualItemRect2.iBr.iX = aActualItemRect2.iBr.iX + 0;
			aActualItemRect2.iBr.iY = aActualItemRect2.iBr.iY + 0;
			aActualItemRect2.iTl.iX = aActualItemRect2.iTl.iX + 180;
			aActualItemRect2.iTl.iY = aActualItemRect2.iTl.iY + 0;
			
			text.Copy(_L(""));
			text.Append(itemText.Mid((tabPosition4 + 1),1));
			
			type = 0;

			TLex lex1(text);
			lex1.Val(type);

			// Draws the icon.
			CFbsBitmap* bitmap1 = (*iIconArray)[type]->Bitmap();
			iGc->BitBltMasked(aActualItemRect2.iTl,
				bitmap1,TRect(TPoint(0,0), bitmap1->Header().iSizeInPixels),
				(*iIconArray)[type]->Mask(),
				ETrue);

			// Draws the rectangle, just in case there are some icons that are
			// smaller than the height of item width and/or height.
			iGc->SetPenStyle(CGraphicsContext::ENullPen);
			if (bitmap1->Header().iSizeInPixels.iHeight < aActualItemRect2.Height())
				{
				TRect rect(
					aActualItemRect2.iTl.iX,
					aActualItemRect2.iTl.iY + bitmap1->Header().iSizeInPixels.iHeight,
					aActualItemRect2.iTl.iX + iMaxIconSize.iWidth,
					aActualItemRect2.iBr.iY);
				iGc->DrawRect(rect);
				}

			if (bitmap1->Header().iSizeInPixels.iWidth < iMaxIconSize.iWidth)
				{
				TRect rect = TRect(
					aActualItemRect2.iTl.iX + bitmap1->Header().iSizeInPixels.iWidth,
					aActualItemRect2.iTl.iY,
					aActualItemRect2.iTl.iX + iMaxIconSize.iWidth,
					aActualItemRect2.iBr.iY);
				iGc->DrawRect(rect);
				}
			}
		}
	}
// ---------------------------------------------------------------------------
// CATNetworkInfo::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CATNetworkInfo::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if (CurrentLine().Match(KLtsyOkString) != 0)
		{
		iError = KErrGeneral;
		return ;
		}
	RArray<TPtrC8> array;
	CleanupClosePushL(array);
	iParser->ParseRespondedBuffer(array,PrecedingLine());
	TInt Count = array.Count();
	if (Count < 1)
		{
		CleanupStack::PopAndDestroy();
		iError = KErrNotFound;
		return ;
		}
	
	if( array[0].MatchF(KGetCurrentNetworkInfoResponse)==KErrNotFound)
		{
		CleanupStack::PopAndDestroy();
		iError = KErrNotFound;
		return ;
		}
	TInt val = 0;
	TLex8 lex(array[1]);
	lex.Val(val);
	iPhoneGlobals.iPhoneStatus.iLocalNetworkSel.iMethod = RMobilePhone::TMobilePhoneSelectionMethod(val);
	if(Count > 2)
		{
		TLex8 lex1(array[2]);
		lex1.Val(iNameFormat);
		switch (iNameFormat)
			{
			case 0:
				if(array[3].Length() > iNetworkInfo.iLongName.MaxLength())
					iNetworkInfo.iLongName.Copy(array[3].Mid(0,iNetworkInfo.iLongName.MaxLength()));			
				else
					iNetworkInfo.iLongName.Copy(array[3]);
				break;
			case 1:
				if(array[2].Length() > iNetworkInfo.iShortName.MaxLength())
					iNetworkInfo.iShortName.Copy(array[3].Mid(0,iNetworkInfo.iShortName.MaxLength()));			
				else 
					iNetworkInfo.iShortName.Copy(array[3]);	
				break;
			case 2:
				/*if(array[2].Length() > iNetworkInfo.iShortName.MaxLength())
					iNetworkInfo.iShortName.Copy(array[3].Mid(0,iNetworkInfo.iShortName.MaxLength()));			
				else 
					iNetworkInfo.iShortName.Copy(array[3]);*/	
				User::LeaveIfError(NetworkIdL(array[3],iNetworkInfo.iCountryCode, iNetworkInfo.iNetworkId));
				break;
			default:
				User::Leave(KErrGeneral);
				break;
				}
		}
	else
		{
		iError = KErrGeneral;
		}
	iNetworkInfo.iStatus=RMobilePhone::ENetworkStatusCurrent;
	CleanupStack::PopAndDestroy();
	iError = KErrNone;
	}
// ---------------------------------------------------------------------------
// CAtSmsStoreReadAll::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtSmsStoreReadAll::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	/**
	* Response:+CMGR:<stat>,[<alpha>],<length><CR><LF><pdu>
	*/
	iError = KErrNone;	
	RArray<TPtrC8> array;
	CleanupClosePushL(array);
	iParser->ParseRespondedBuffer(array,Buffer());
	if(array[0].MatchF(KAnyATCommand)!=KErrNotFound)
		{
		array.Remove(0);
		}
	TInt count = array.Count();
#ifdef _DEBUG
	for( TInt i=0;i<count;i++ )
		{
        LOGTEXT3(_L8("CAtSmsStoreReadAll::ParseResponseL\tarray[%d]=%S"),i,&array[i]);  
		}
#endif   
	if (count <= 1)
		{
		CleanupStack::PopAndDestroy();
		iError = KErrNotFound;
		return;
		}
	if(array[0].MatchF(KCMGRResponseString)==KErrNotFound)
		{
		LOGTEXT(_L8("CAtSmsStoreReadAll::ParseResponseL\tFound +CMGR String!"));
		CleanupStack::PopAndDestroy();
		iError = KErrNotFound;
		return;
		}
	// parse the message status
	TLex8 lex(array[1]);
	TUint16 val;
	TInt ret=lex.Val(val,EDecimal);
	if(ret!=KErrNone)
		{
		CleanupStack::PopAndDestroy();
		iError = ret;
		return;
		}
	iSmsData.iMessageStatus = val;
	
	//parse the message length
	TLex8 lex1(array[3]);
	TUint msgLength;
	ret=lex1.Val(msgLength,EDecimal);
	if(ret!=KErrNone)
		{
		CleanupStack::PopAndDestroy();
		iError = ret;
		return;
		}
	LOGTEXT2(_L8("CAtSmsStoreReadAll::ParseResponseL\tMessage Length=%d"),msgLength);
	TBuf8<KMaxAsciiPduLength>  pdu;	   //Binary Message pdu
	SmsAtUtil::ConvertAsciiToBinary(array[4],pdu);
	TPtrC8 pduPtr(pdu);
	
	RMobilePhone::TMobileAddress gsmServiceCentre;   //messages's SCA
	if (msgLength*2 < array[4].Length())
		{
		// There is an SCA prepended so remove this and store it in iGsmServiceCentre
		SmsAtUtil::ReadAndRemoveAddressFromPdu(pduPtr,gsmServiceCentre);
		}
	iSmsData.iSmsMsg = pduPtr;
	iSmsData.iServiceCentre = gsmServiceCentre.iTelNumber;
	iSmsData.iMobileScNPI = gsmServiceCentre.iNumberPlan;
	iSmsData.iMobileScTON = gsmServiceCentre.iTypeOfNumber;
	LOGTEXT2(_L8("CAtSmsStoreReadAll::ParseResponseL\tMessage Status=%d"),
			                          iSmsData.iMessageStatus);
	LOGTEXT3(_L8("CAtSmsStoreReadAll::ParseResponseL\tSmsMsg=%S, ServiceCentre=%S"), 
			                          &iSmsData.iSmsMsg, &iSmsData.iServiceCentre);
	CleanupStack::PopAndDestroy(&array);
	}