void CUploadContainer::GetFieldsLC(HBufC*& Tag, HBufC*& Description)
{
	CALLSTACKITEM_N(_CL("CUploadContainer"), _CL("GetFieldsLC"));

	const TDesC& tag=iTagEdit->Text()->Read(0);
	delete Tag; Tag=0;
	if (tag.Length()>0 && tag.Left(tag.Length()-1).CompareF(KTag)) Tag=tag.Left(tag.Length()-1).AllocLC();
	else Tag=HBufC::NewLC(0);

	delete Description; Description=0;
	if (iDescriptionEdit) {
		const TDesC& desc=iDescriptionEdit->Text()->Read(0);
	
		if (desc.Length()>0 && desc.Left(desc.Length()-1).CompareF(KDescription)) 
			Description=desc.Left(desc.Length()-1).AllocLC();
		else
			Description=HBufC::NewLC(0);
	} else {
		Description=HBufC::NewLC(0);
	}
}
void CSymellaConsoleView::HandleLogWriteL(const TDesC& aText)
{
	/*if (aText.Length() < KMaxConsoleBufferSize)
	{
		// Checks the new text length
		TInt diff = iTextBuffer->DocumentLength() + 
			aText.Length() - KMaxConsoleBufferSize;

		// If it's longer than the maximum then deletes from
		// the beginning
		if ( diff > 0)
		{
			iTextBuffer->DeleteL(0, diff);
			if (iContainer)
				iContainer->Edwin()->Text()->DeleteL(0, diff);
		}

		iTextBuffer->InsertL(iTextBuffer->DocumentLength(), aText);*/

		if (iContainer)
		{
			CEikEdwin* edwin = iContainer->Edwin();

			TInt diff = edwin->Text()->DocumentLength() + 
				aText.Length() - KMaxConsoleBufferSize;

			if (diff > edwin->Text()->DocumentLength()) 
				diff = edwin->Text()->DocumentLength();

			if ( diff > 0)			
				edwin->Text()->DeleteL(0, diff);

			
			edwin->Text()->InsertL(edwin->Text()->DocumentLength(), aText);
			edwin->HandleTextChangedL();
			edwin->SetCursorPosL(edwin->Text()->DocumentLength(), EFalse);		
		}
/*	}
	else
	{
		TPtrC ptr = aText.Right(KMaxConsoleBufferSize);

		iTextBuffer->DeleteL(0, iTextBuffer->DocumentLength());
		iTextBuffer->InsertL(0, ptr);
		if (iContainer)
		{
			CEikEdwin* edwin = iContainer->Edwin();
			edwin->Text()->DeleteL(0, edwin->Text()->DocumentLength());
			edwin->Text()->InsertL(0, ptr);
			edwin->HandleTextChangedL();
			edwin->SetCursorPosL(edwin->Text()->DocumentLength(), EFalse);		
		}		
	}*/
}
Exemple #3
0
void CEikListBoxTextEditor::UseFontL( CEikEdwin& aEditor, const CFont& aFont )
	{
	_AKNTRACE_FUNC_ENTER;
	CGlobalText* globalText;

    TCharFormatMask defaultCharFormatMask;
	defaultCharFormatMask.SetAttrib(EAttFontTypeface);
	defaultCharFormatMask.SetAttrib(EAttFontHeight);
	TFontSpec fontspec = aFont.FontSpecInTwips();
    TCharFormat defaultCharFormat( fontspec.iTypeface.iName, fontspec.iHeight );

	iParaFormatLayer=CParaFormatLayer::NewL();
	iCharFormatLayer=CCharFormatLayer::NewL(defaultCharFormat,defaultCharFormatMask);
	globalText=CGlobalText::NewL(iParaFormatLayer,iCharFormatLayer,CEditableText::ESegmentedStorage,5);
	CleanupStack::PushL(globalText);

	TCharFormat charFormat;
	TCharFormatMask charMask;
	iCharFormatLayer->Sense(charFormat,charMask);
	if ( fontspec.iFontStyle.Posture()==EPostureItalic )
		{
		charMask.SetAttrib(EAttFontPosture);
		charFormat.iFontSpec.iFontStyle.SetPosture(EPostureItalic);
		}
	if ( fontspec.iFontStyle.StrokeWeight()==EStrokeWeightBold )
		{
		charMask.SetAttrib(EAttFontStrokeWeight );
		charFormat.iFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
		}
	iCharFormatLayer->SetL(charFormat,charMask);

	CPlainText* old=aEditor.Text();
	CleanupStack::Pop(); // globalText
	CleanupStack::PushL(old);	// old is pushed because we're using EUseText in the subsequent call
	aEditor.SetDocumentContentL(*globalText,CEikEdwin::EUseText);
	CleanupStack::PopAndDestroy();	// old
	_AKNTRACE_FUNC_EXIT;
	}