TBool assert_equals_des16(CTestExecuteLogger& aLogger, const TText8* aFile, TInt aLine, TInt aSeverity,
	const TDesC& aRes, const TDesC& aExp, const TDesC& aMsg)
	{
	if(aRes != aExp)
		{
		TPtrC exp;
		TPtrC res;
		
		exp.Set(aExp.Ptr(), aExp.Length());
		res.Set(aRes.Ptr(), aRes.Length());
		
		//truncate to 20 characters, to avoid logging too big strings
		if(exp.Length() > KMaxLogCharLength)
			{
			exp.Set(exp.Ptr(), KMaxLogCharLength);
			}
		
		if(res.Length() > KMaxLogCharLength)
			{
			res.Set(res.Ptr(), KMaxLogCharLength);
			}
		
		aLogger.LogExtra(aFile, aLine, aSeverity, KAssertErrorEqualsTextDes, &res, &exp, &aMsg);
		return EFalse;
		}
	return ETrue;
	}
Exemplo n.º 2
0
TInt CIniData::OpenBlock(const TDesC &aSection)
/**
Reads in the entire table section of all ADD / SET blocks into 'section'

@param aSection Section to work with
@return ETrue if successful or EFalse
*/
	{
    if (BlockState != E_UNKNOWN)
		{
	    blockStart = 0;
	    blockEnd = 0;
	    scanStart = 0;

	    TPtr sectionToken = iToken->Des();
		_LIT(sectionTokenString,"[%S]");
		sectionToken.Format(sectionTokenString,&aSection);

	    // locate the section
		TInt sectionStart = iPtr.FindF(sectionToken);
	    if (sectionStart == KErrNotFound)
			{
	        return EFalse;
			}

		// step to the end of the section name
		TPtrC tempSection = iPtr.Mid(sectionStart);
        sectionStart += tempSection.Find(TPtrC(_S("]")));

		if (sectionStart == KErrNotFound)
			{
			return EFalse;
			}
		sectionStart++;

		// we are now at the start of the section data
        tempSection.Set(iPtr.Mid(sectionStart));

		// loop until we reach the end of the section
		TUint32 i=0;
		TUint32 lMaxLen = tempSection.Length();

        for (i=0;i<lMaxLen;i++)
			{
	        if (tempSection.Ptr()[i] == '[' &&
		        tempSection.Ptr()[i - 1] != '\\')
				{
			    i--;
			    break;
				}
			}
		
		// set the actual section to work with
        tempSection.Set(iPtr.Mid(sectionStart, i));
		section.Set((unsigned short *)tempSection.Ptr(), tempSection.Length(), tempSection.Size());
		}

	return StepToNextBlock();	// find the first block
	}
Exemplo n.º 3
0
// -----------------------------------------------------------------------------
// Cosmo4AppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void COsmo4AppUi::ConstructL()
{
    // Initialise app UI with standard value.
    BaseConstructL(CAknAppUi::EAknEnableSkin);

    /*Create display*/
    iAppView = COsmo4AppView::NewL( ClientRect() );
	AddToStackL(iAppView);

	/*create playlist*/
#ifndef GPAC_GUI_ONLY
	iPlaylist = CPlaylist::NewL( ClientRect(), iAppView->GetUser() );

	iPlaylist->MakeVisible(EFalse);
#endif
	
	iAppView->MakeVisible(ETrue);
	view_mode = 0;

	m_title = NULL;

	//StatusPane ()->SwitchLayoutL ( R_AVKON_STATUS_PANE_LAYOUT_SMALL );

	nb_keys = 0;
	CaptureKeys(1);



	CCommandLineArguments *args = CCommandLineArguments::NewL();
#ifndef GPAC_GUI_ONLY
	if (args->Count() > 1) {
		TPtrC url = args->Arg(1);
#if defined(_UNICODE)
		char szURL[1024];
		u16 szURLUTF16[1024];
		size_t len;
		len = url.Size();
		memcpy(szURLUTF16, url.Ptr(), sizeof(u8)*len);
		szURLUTF16[len/2] = 0;
		const u16 *sptr = szURLUTF16;
		len = gf_utf8_wcstombs(szURL, 512, &sptr);
		if (len != (size_t) -1) {
			szURL[len] = 0;
			iAppView->Connect((const char *)szURL);
		}
#else
		iAppView->Connect((const char *)url.Ptr());
#endif
	}
#endif
	delete args;
}
TInt CTS_MultiHomingStep::GetResolverConfig(const TInt aIndex, TName &aHostName, TInt& aProtocol,																				 
										TBool& aExpectSuccess, TBool& aExpectTimeout, TBool& aExpectNotReady, 
										TBool& aExplicitResolve, TConnDetails **aConnDetails)
/**
 * Gets resolver configuration from file, using defaults if necessary
 * @param aIndex The index for the socket configkey
 * @param aHostName The host to be resolved
 * @param aProtocol The protocol to be used
 * @param aExpectSuccess Flag indicating if name should be resolved ok
 * @param aExpectTimeout Flag indicating if name resolution should timeout
 * @param aConnDetails The connection for an explicit resolver
 * @return System wide error code
 */
	{
	TInt err=KErrNone;	
	TName resolverName;		// Create the Key for the config lookup
	resolverName = KResolver;
	resolverName.AppendNum(aIndex);
	
	TPtrC ptrBuf;
	err = GetStringFromConfig(resolverName, KDestName, ptrBuf);
	if (!err)
		{
		LogExtra((TText8*)__FILE__, __LINE__, ESevrWarn, KEConfigFile);
		iTestStepResult= EInconclusive;
		return KErrNotFound;
		}
	aHostName.Copy(ptrBuf.Ptr(), ptrBuf.Length());
		
	
	aExpectSuccess = ETrue;
	GetBoolFromConfig(resolverName, KExpectSuccess, aExpectSuccess);
	
	aExpectTimeout = EFalse;
	GetBoolFromConfig(resolverName, KExpectTimeout, aExpectTimeout);

	aExpectNotReady = EFalse;
    GetBoolFromConfig(resolverName, KExpectNoDnsServer, aExpectNotReady);

	aExplicitResolve = EFalse;
	GetBoolFromConfig(resolverName, KExplicitResolve, aExplicitResolve);
		

	err = GetStringFromConfig(resolverName, KProtocol, ptrBuf);
	if (err && (ptrBuf.Compare(KTcp)==0))
		aProtocol = KProtocolInetTcp;
	else
		aProtocol = KProtocolInetUdp;	
		
	
	err = GetStringFromConfig(resolverName, KConnName, ptrBuf);
	if (!err)
		{
		return KErrNotFound;
		}		

	*aConnDetails = iOwnerSuite->GetTConnection(ptrBuf);								

	return KErrNone;
	}
EXPORT_C void AknPhoneNumberTextUtils::ClipLineOnLeft( 
    TPtrC& aLine, TDes& aOriginalBuffer, TInt aWidth, const CFont& aFont )
    {
    // Main work of this routine is to make a TPtr of the input TPtrC, then we can clip using existing
    // utils.
 
    // But first check if the line points to the provided modifiable buffer
    TText* linePtr = (TText*)aLine.Ptr();
    TInt lineLen = aLine.Length();
    TText* pastEndOfLine = linePtr + lineLen; // pointer arithmetic

    TText* modBufPtr = (TText*)aOriginalBuffer.Ptr();
    TInt len = aOriginalBuffer.Length(); // length actually with text in it (not maxlength)
    TText* pastEndOfModBufPtr = modBufPtr + len; // pointer arithmetic

    // This Panics if the input aLine is not encompassed within the modifiable buffer ->Programmer error
    __ASSERT_ALWAYS( (modBufPtr <= linePtr && pastEndOfLine <= pastEndOfModBufPtr ), Panic( EAknPanicInconsistentDescriptors ) );

    // Set the TPtr now to extend from the start of the original buffer to the end of the input aLine
    TInt enlargedLength = (pastEndOfLine - modBufPtr);//  Pointer arithmetic; 
    TPtr ptr( modBufPtr, enlargedLength, enlargedLength );

    // Should have a safe modifiable buffer now.
    AknTextUtils::ClipToFit( ptr, aFont, aWidth, AknTextUtils::EClipFromBeginning );
    aLine.Set( ptr );
    }
Exemplo n.º 6
0
void TwtCamera::openCamera()
{
#ifdef Q_OS_SYMBIAN
    qDebug() << "TwtCamera::openCamera";
    CDesCArray* selectedFiles = new (ELeave) CDesCArrayFlat(1);
    CleanupStack::PushL(selectedFiles);

    CNewFileServiceClient* fileClient = NewFileServiceFactory::NewClientL();
    CleanupStack::PushL(fileClient);
    bool result = fileClient->NewFileL(KUidCamera, *selectedFiles, NULL,
                                       ENewFileServiceImage, EFalse);
    if(result)
    {
        TPtrC address = selectedFiles->MdcaPoint(0);
        QString filename = QString::fromUtf16(address.Ptr(), address.Length());
        qDebug() << "TwtCamera::openCamera name = " << filename;
        emit imgCaptured(filename);
    }
    else
    {
        qDebug() << "TwtCamera::openCamera file capture failed";
        emit imgCaptured("");
    }
    CleanupStack::PopAndDestroy( 2 ); // selectedFiles, fileClient
#else
    // for develop on simulator
    emit imgCaptured("");
#endif
}
Exemplo n.º 7
0
void CWordTest::ToggleCaseL(CEikRichTextEditor* aEditor)
{
    TCursorSelection sel = aEditor->Selection();
    int start = sel.LowerPos();
    int end = start;
    TBool to_upper = TRUE;
    while (end < sel.HigherPos())
    {
        TPtrC text;
        TCharFormat f;
        aEditor->RichText()->GetChars(text,f,start);
        int length = text.Length();
        if (start + length > sel.HigherPos())
            length = sel.HigherPos() - start;
        end = start + length;
        if (start == sel.LowerPos() && end > start)
        {
            if (TChar(text[0]).IsUpper())
                to_upper = FALSE;
        }
        TText* p = (TText*)text.Ptr();
        TText* q = p + length;
        while (p < q)
        {
            if (to_upper)
                *p = (TText)(TChar(*p).GetUpperCase());
            else
                *p = (TText)(TChar(*p).GetLowerCase());
            p++;
        }

        start = end;
    }
    aEditor->TextView()->HandleRangeFormatChangeL(sel);
}
Exemplo n.º 8
0
/**
Refine the field content and add the refined content to the given view contact object.
 
@param aViewContact     reference to the retrieved view contact object.
@param aFieldPtrC    	The actual field content read from database.
@param aViewPreferences The view preferences for how to format the content. 
*/
void CCntPplViewSession::AddFieldInViewContactL(CViewContact& aViewContact, TPtrC& aFieldPtrC, const TContactViewPreferences& aViewPreferences)
	{
	_LIT(KBlank," ");
	
	// Truncate to 64 if necessary.
	TPtr ptr(const_cast<TUint16*>(aFieldPtrC.Ptr()), KTextFieldMinimalLength);
	if(aFieldPtrC.Length() > KTextFieldMinimalLength) 
		{
		ptr.SetLength(KTextFieldMinimalLength); 
		}
	else
		{
		ptr.SetLength(aFieldPtrC.Length());
		}
		
	// Add the field to the view.
	if((ptr.Length() == 0) ||
	   (ptr.Length() == 1 && (aViewPreferences & ESingleWhiteSpaceIsEmptyField) && ptr.Compare(KBlank)==KErrNone))
		{
		/* empty field */
		aViewContact.AddFieldL(KNullDesC);
		} 
	else
		{
		aViewContact.AddFieldL(ptr);
		}
	}
void ProfileListModel::syncProfiles()
{
    beginResetModel();

    mNameList.clear();
    mIdList.clear();

#ifdef Q_OS_SYMBIAN
    MProEngEngine* engine(0);
    TRAPD(err, engine = ProEngFactory::NewEngineL());
    if(err == KErrNone)
    {
        TRAP_IGNORE(
            MProEngProfileNameArray* array(engine->ProfileNameArrayLC());
            for(TInt i(0); i < array->MdcaCount(); ++i)
            {
                const TPtrC name(array->MdcaPoint(i));
                const TInt id(array->ProfileId(i));

                mNameList.append(QString::fromUtf16(name.Ptr(), name.Length()));
                mIdList.append(id);
            }

            CleanupStack::PopAndDestroy(array);
        );
Exemplo n.º 10
0
jobjectArray CPIMSerializer::supportedSerialFormats(TPIMListType aPimListType,
        JNIEnv* aJniEnv, jintArray aError)
{
    JELOG2(EPim);
    const CDesCArray* desArray = NULL;
    TInt error = KErrNone;
    TRAP(error, desArray = &(SupportedSerialFormatsL(aPimListType)));
    if (error != KErrNone)
    {
        SetJavaErrorCode(aJniEnv, aError, error);
        return NULL;
    }

    if (!desArray)
    {
        SetJavaErrorCode(aJniEnv, aError, KErrNoMemory);
        return NULL;
    }

    TInt desCount = desArray->Count();
    jobjectArray retVal = aJniEnv->NewObjectArray(desCount, aJniEnv->FindClass(
                              "java/lang/String"), NULL);
    if (retVal == NULL)
    {
        SetJavaErrorCode(aJniEnv, aError, KErrNoMemory);
        return NULL;
    }

    for (TInt i = 0; i < desCount; i++)
    {
        TPtrC epocString = (*desArray)[i];
        jstring javaString = aJniEnv->NewString(epocString.Ptr(),
                                                epocString.Length());
        if (javaString == NULL)
        {
            SetJavaErrorCode(aJniEnv, aError, KErrNoMemory);
            return NULL;
        }
        aJniEnv->SetObjectArrayElement(retVal, i, javaString);

        // Avoid exceeding max local references (5)
        aJniEnv->DeleteLocalRef(javaString);
    }
    // note that desArray is owned by the adapter, and not deleted here
    SetJavaErrorCode(aJniEnv, aError, KErrNone);
    return retVal;
}
Exemplo n.º 11
0
TInt CIniData::StepToNextBlock()
/**
Locates the next available block of data within a section

@return ETrue if successful or EFalse
*/
	{
	if (BlockState != E_UNKNOWN)
		{
		// get unscanned portion of the section
		TPtrC temp = section.Mid(scanStart);

		// find the start of the next block
		if (BlockState == E_SET)
			{
			blockStart = temp.FindF(TPtrC(BEGIN_SET));
			blockEnd = temp.FindF(TPtrC(END_SET));
			}
		else if (BlockState == E_TEMPLATE)
			{
			blockStart = temp.FindF(TPtrC(BEGIN_TEMPLATE));
			blockEnd = temp.FindF(TPtrC(END_TEMPLATE));
			}
		else if (BlockState == E_ADD)
			{
			blockStart = temp.FindF(TPtrC(BEGIN_ADD));
			blockEnd = temp.FindF(TPtrC(END_ADD));
			}

		if (blockStart != KErrNotFound && blockEnd != KErrNotFound)
			{
			// set the start point for the next block search
			scanStart += blockEnd;
			scanStart++;

			// set the actual block to work with
			blockEnd -= blockStart;
			TPtrC tempBlock = temp.Mid(blockStart,blockEnd);
			block.Set((unsigned short *)tempBlock.Ptr(), tempBlock.Length(), tempBlock.Size());
			return ETrue;
			}
		}

	return EFalse;
	}
Exemplo n.º 12
0
void NotifyProvider::GotSMSMessageL(QString txt, const TPtrC aSender,TInt32 id)
{
    // new sms
    QString number=QString::fromRawData(reinterpret_cast<const QChar*>(aSender.Ptr()),aSender.Length());
    //QString txt=QString::fromRawData(reinterpret_cast<const QChar*>(aMessage.Ptr()),aMessage.Length());;
    QDateTime dt=QDateTime::currentDateTime();
    dt=dt.toLocalTime();
    TNotifyInfo info;
    info.time=dt.toString("dd.M.yy hh:ss");
    info.timeStamp=dt;
    info.sender=findContact(number);
    info.text=txt;
    info.type=ESMS;
    info.id=id;
    iNotifiers.insert(0,info);
    qDebug()<<"store sms from"<<info.sender<<info.text;
    qDebug()<<"id"<<id;
    prepareNotifier(ESMS);
}
Exemplo n.º 13
0
/**
Return the end of the paragraph - after the paragraph separator if any.
*/
EXPORT_C TInt MTmSource::ParagraphEnd(TInt aPos) const
	{
	TInt doc_end = DocumentLength();
	TPtrC text;
	TTmCharFormat format;
	while (aPos < doc_end)
		{
		GetText(aPos,text,format);
		const TText *p = text.Ptr();
		const TText *q = p + text.Length();
		while (p < q)
			if (*p == CEditableText::EParagraphDelimiter)
				return aPos + 1;
			else
				{
				p++;
				aPos++;
				}
		}
	return doc_end + 1;
	}
Exemplo n.º 14
0
/**
Copies the content of a text column, identified by aColumnIndex, to the place refered by aDest parameter.

If the destination buffer is not big enough, the function will copy as much data as possible and will
return KErrOverflow.

@param aColumnIndex Column index
@param aDest Refers to the place where the column data will be copied.

@return KErrNone, if the function completes successfully,
                  otherwise one of the other system-wide error codes.

@panic SqlDb 5 Column index out of bounds.
@panic SqlDb 11 Statement cursor not positioned on a row
*/	
TInt CSqlStatementImpl::ColumnText(TInt aColumnIndex, TDes& aDest)
	{
	__ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex));
	__ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow));
	iColumnValBufIt.MoveTo(aColumnIndex);		
	TInt err = KErrNone;
	//The text column value has not been transferred to the client side if its length is >= KSqlMaxDesLen characters.
	//In this case an additional call to the server is made to get the column value.
	if(!iColumnValBufIt.IsPresent())
		{
		if(iColumnValBufIt.Type() != ESqlText)
			{
			aDest.Zero();
			return err;
			}
		TPtr8 ptr(reinterpret_cast <TUint8*> (const_cast <TUint16*> (aDest.Ptr())), aDest.MaxLength() * sizeof(TUint16));
		err = iSqlStmtSession.ReadColumnValue(aColumnIndex, ptr);
		switch(err)
		    {
	        case KErrNone:
	        case KErrOverflow:
	            aDest.SetLength(ptr.Length() / sizeof(TUint16));
	            break;
	        default:
	            break;
		    }
		}
	else
		{
		TPtrC src = iColumnValBufIt.Text();
		TInt len = src.Length();
		if(len > aDest.MaxLength())
			{
			len = aDest.MaxLength();
			err = KErrOverflow;
			}
		aDest.Copy(src.Ptr(), len);
		}
	return err;
	}
void StartPSYCRTesterL() 
	{

	// Read the Process Arguments
	TInt psyIDValue;

    // PSY Tester sends the UID of the PSY as an argument
	CCommandLineArguments *args = CCommandLineArguments::NewL();
	CleanupStack::PushL(args);
	if(args->Count() <= 1)
	{
			User::Leave(KErrArgument);
	}
	TPtrC ptr = args->Arg(1);
	
	TLex lex(ptr.Ptr());
	TInt err = lex.Val(psyIDValue);

	if(KErrNone == err)
	{
		
		CPosPSYCRTestHandler* psyCRTestHandler = CPosPSYCRTestHandler::NewL();
		CleanupStack::PushL(psyCRTestHandler);

		TUid psyID;
		psyID.iUid = psyIDValue;
	
	    // Start the test	
		psyCRTestHandler->StartPSYCRTesterL(psyID);
		
		CleanupStack::PopAndDestroy(psyCRTestHandler);
	}
	
	CleanupStack::PopAndDestroy(args);
		
	RProcess::Rendezvous(KErrNone);

	}
Exemplo n.º 16
0
/**
 * See JNI method __1close.
 * This is an internal wrapper method for handling Leaves.
 */
jint CloseL(JNIEnv *aEnv, jclass aClass, jint aHandle, jobject aOutputFilename)
{
    // Convert handle to pointer.
    CImportFile *file = reinterpret_cast<CImportFile*>(aHandle<<2);

    // Complete writing and get output filename from the agent.
    TInt err = file->WriteDataComplete();
    // Initialize output filename to aOutputFilename parameter.
    if (KErrNone == err)
    {
        // Get class handle to StringBuffer
        aClass = aEnv->GetObjectClass(aOutputFilename);
        // Get method ID to StringBuffer StringBuffer.append(String)
        jmethodID methodID = aEnv->GetMethodID(
                                 aClass, "append", "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
        if (0 == methodID)
        {
            ELOG(EJavaInstaller,
                 "FileWriter__1close: StringBuffer.append not found");
            err = KErrGeneral;
        }
        else
        {
            CSupplierOutputFile &output = file->OutputFileL(0);
            TPtrC outputFilename = output.FileName();
            // Create new Java String.
            jstring jOutputFilename =
                aEnv->NewString(outputFilename.Ptr(), outputFilename.Length());
            aEnv->CallObjectMethod(aOutputFilename, methodID, jOutputFilename);
        }
    }

    // Delete the CImportFile instance which is no longer used.
    delete file;
    return err;
}
Exemplo n.º 17
0
/**
 * Wraps the text and sets it into the labels.
 */
void CAknTextControl::ParseTextL(const CFont* aFont, CArrayFixFlat<TInt>* aLineWidths,const TWrapMethod& aWrapMethod)
    { 
	if ( aWrapMethod == ENoAllocation && iWrappedArray )
		{
		// We preallocate text required in construction of alert win, so we just replace the texts in labels.
        TPtrC remainder = Text();
		TChar endlchar('\n');
		TInt linebreak = remainder.LocateReverse(endlchar);
        
		TBuf<17 + KAknBidiExtraSpacePerLine> temp; //KEikAlertMaxMsgLength not declared in this scope

        if ( linebreak == KErrNotFound )
            {
            AknBidiTextUtils::ConvertToVisualAndClip(remainder, temp, *aFont, KMaxTInt, KMaxTInt );
            Line(0)->SetTextL(temp); // won't leave as there is enough space in buffer
            iLines[0]->iModified = ETrue;
            Line(1)->SetTextL(KNullDesC);
            iLines[1]->iModified = ETrue;
            }
        else
            {
            AknBidiTextUtils::ConvertToVisualAndClip(
                remainder.Left(linebreak), temp, *aFont, KMaxTInt, KMaxTInt );
            Line(0)->SetTextL(temp);
            iLines[0]->iModified = ETrue;
            if ( remainder.Length()-1 == linebreak) // Line break is the last character
                {
                Line(1)->SetTextL(KNullDesC);
                }
            else
                {
                AknBidiTextUtils::ConvertToVisualAndClip( 
                    remainder.Right(remainder.Length()-linebreak-1), temp, *aFont, KMaxTInt, KMaxTInt );
                Line(1)->SetTextL(temp); // we don't want new line to label, thus -1
                }
            iLines[1]->iModified = ETrue;		
			}
		return;
		}
	if (iTextIsAlreadyInLabel || !iWrappedArray)
		return;

    TInt maxLines = aLineWidths->Count();

    // user handles all text processing
    if ( aWrapMethod == ENoProcessing )
        {
        iWrappedArray->Reset();

        TPtrC remainder = Text();

        while ( remainder.Length() && iWrappedArray->Count() < maxLines )
            {
            const TText* textArray = remainder.Ptr();
            TInt textLength = remainder.Length();

            TInt i = 0;

            for ( ; i < textLength ; i++ )
                {
                TText t = textArray[i];

                if ( t == KLineFeed ||
                     t == KLineSeparator ||
                     t == KParagraphSeparator ||
                     t == KCarriageReturn )
                    {
                    break;
                    }
                }

            iWrappedArray->AppendL( remainder.Left( i ) );

            // After a CR, skip also possible matching LF
            if ( i < textLength - 1 &&
                 textArray[i] == KCarriageReturn &&
                 textArray[i + 1] == KLineFeed )
                {
                i++;
                }

            i++;

            if ( i >= textLength )
                {
                break;
                }
            remainder.Set( remainder.Right( textLength - i ) );
            }
        }

    else
        {
        TPtr text = Text();

        HBufC* visualBuffer = HBufC::NewLC( 
            text.Length() + maxLines * KAknBidiExtraSpacePerLine );
        *visualBuffer = text;
        TPtr ptr = visualBuffer->Des();

        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr);

	    if (aWrapMethod == EWord)
            {
            AknBidiTextUtils::ConvertToVisualAndWrapToArrayL(
                ptr, *aLineWidths, *aFont, *iWrappedArray, ETrue );
            }
	    else if (aWrapMethod == ELine)
            {
		    AknBidiTextUtils::ConvertToVisualAndChopToArrayL(
                ptr, *aLineWidths, *aFont, *iWrappedArray );
            }
	    else
            {
		    __ASSERT_DEBUG(0,Panic(EAknPanicNotSupported));
            }
        }

    TInt numLines = iWrappedArray->Count();

	UpdateLabelsL(numLines,aFont,aLineWidths);	
	SetWrappedTextIntoLabelsL(*iWrappedArray, numLines, aFont);

    if ( aWrapMethod != ENoProcessing )
        {
        CleanupStack::PopAndDestroy(); // visualBuffer
        }
    }
/** 
 * Reads test configuration data from ini file
 * Leaves if expected data not found
 */
TVerdict CWServTestStep::doTestStepPreambleL()
	{
	TVerdict ret=CTestStep::doTestStepPreambleL();
	if (!GetIntFromConfig(KDefaultSectionName, KT_WservStressInit, iData.initPeriod)||
		!GetIntFromConfig(KDefaultSectionName, KT_WservStressPeriod, iData.period)||
		!GetIntFromConfig(KDefaultSectionName, KT_WservStressMaxRunCycles, iData.maxRunCycles))
		{
		INFO_PRINTF1(_L("Error reading ini file"));
		User::Leave(KErrNotFound);
		}
	
	//random_seed is not a mandatory parameter
	iData.randomSeed = -1;
	TPtrC strSeed;
	GetStringFromConfig(KDefaultSectionName, KT_WservStressRandomSeed, strSeed);
	if (strSeed.Ptr())
		{
		TLex seed;
		seed.Assign(strSeed);
		seed.Val(iData.randomSeed);
		}
	iData.minNumWindows = 0;	//unlimited
	GetIntFromConfig(KDefaultSectionName, KT_WservStressMinNumWindows, iData.minNumWindows);
	
	iData.windowWidth = 400;
	GetIntFromConfig(KDefaultSectionName, KT_WservStressWindowWidth, iData.windowWidth);
	iData.windowHeight = 400;
	GetIntFromConfig(KDefaultSectionName, KT_WservStressWindowHeight, iData.windowHeight);
	
	iData.compareBitmaps = ETrue;
	GetBoolFromConfig(KDefaultSectionName, KT_WservStressCompareBitmaps, iData.compareBitmaps);

	iData.saveOnlyDifferent = ETrue;
	GetBoolFromConfig(KDefaultSectionName, KT_WservStressSaveOnlyDifferent, iData.saveOnlyDifferent);

	iData.saveDifferenceBitmap = EFalse;
	GetBoolFromConfig(KDefaultSectionName, KT_WservStressSaveDifferenceBitmap, iData.saveDifferenceBitmap);

	iData.clearAllBackground = ETrue;
	GetBoolFromConfig(KDefaultSectionName, KT_WservStressClearAllBackground, iData.clearAllBackground);

	TPtrC path;
	GetStringFromConfig(KDefaultSectionName, KT_WservStressLoggingPath, path);
	RBuf loggingPath;
	loggingPath.CleanupClosePushL();
	loggingPath.CreateL(path.Length() + 16);
	if (path.Length())
		{
		loggingPath.Copy(path);
		if (path[path.Length()-1] != '\\')
			{
			loggingPath.Append('\\');
			}
		}
	else
		{
		loggingPath = _L("C:\\StressLog\\");
		}
	iData.loggingPath = loggingPath;
	CleanupStack::PopAndDestroy(&loggingPath);
	return ret;
	}
Exemplo n.º 19
0
void CCommandInfoFile::ReadDetailsL(TLex& aLex, RFs& aFs, const TDesC& aFileName)
	{
	SkipToNextCommand(aLex); // Ignore everything before the first '==' command.

	while (!aLex.Eos())
		{
		TLexMark mark;
		aLex.Mark(mark);
		TPtrC command(NextCommand(aLex));
		if (command == KNullDesC)
			{
			// Do nothing - we're at the end of the string.
			}
		else if (command == KCmndName)
			{
			aLex.SkipSpaceAndMark();
			aLex.SkipCharacters();
			iName.Set(aLex.MarkedToken());
			}
		else if (command == KCmndShortDescription)
			{
			iShortDescription.Set(TextToNextCommand(aLex));
			}
		else if (command == KCmndLongDescription)
			{
			iLongDescription.Set(TextToNextCommand(aLex));
			}
		else if (command == KCmndSeeAlso)
			{
			iSeeAlso.Set(TextToNextCommand(aLex));
			}
		else if (command == KCmndCopyright)
			{
			iCopyright.Set(TextToNextCommand(aLex));
			}
		else if (command == KCmndSmokeTest)
			{
			// Hmm no easy way to get the line number we're currently on
			iSmokeTestLineNumber = 1;
			TLex lex(aLex);
			lex.Inc(-aLex.Offset()); // Only way to put a TLex back to the beginning!
			TPtrC preceding = lex.Remainder().Left(aLex.Offset());
			const TUint16* ptr = preceding.Ptr();
			const TUint16* end = ptr + preceding.Length();
			while (ptr != end)
				{
				if (*ptr++ == '\n') iSmokeTestLineNumber++;
				}
			// At this point iSmokeTestLineNumber points to the "==smoketest" line - add 2 to skip this line and the blank line below it
			iSmokeTestLineNumber += 2;
			iSmokeTest.Set(TextToNextCommand(aLex));
			}
		else if (command == KCmndArgument)
			{
			ReadArgumentL(aLex, aFileName);
			}
		else if (command == KCmndOption)
			{
			ReadOptionL(aLex, aFileName);
			}
		else if (command == KCmndInclude)
			{
			if (iParent == NULL)
				{
				iProcessInclude = EFalse;
				TLex lineLex(LineRemainder(aLex));
				TPtrC fileName(NextWord(lineLex));
				TFileName2* fullFileName = new(ELeave) TFileName2(aFileName);
				CleanupStack::PushL(fullFileName);
				fullFileName->SetNameAndExtL(fileName);
				ReadFileL(aFs, *fullFileName);
				CleanupStack::PopAndDestroy(fullFileName);
				break;
				}
			else
				{
				// We're a sub-command. Let control return to the root to handle the include.
				aLex.UnGetToMark(mark);
				iParent->ProcessInclude(*this);
				break;
				}
			}
		else if (command == KCmndSubCommand)
			{
			if (iParent == NULL)
				{
				TLex lineLex(LineRemainder(aLex));
				AddSubCommandL(lineLex, aLex, aFs, aFileName);
				}
			else
				{
				// We're a sub-command. Let control return to the root to handle the next sub-command.
				aLex.UnGetToMark(mark);
				iParent->ProcessNewChild();
				break;
				}
			}
		else
			{
			StaticLeaveIfErr(KErrArgument, _L("Unknown command \"%S\" in \"%S\""), &command, &aFileName);
			}
		}
	}
Exemplo n.º 20
0
TBool CTmLine::AppendChunkL(CTmFormatContext& aContext,TInt& aStartChar,TInt& aStartXPos,TInt aMaxChar,TInt aMaxXPos,
						    TBool aAllowSpaceForFinalInlineText,CTmLine::TEllipsisInfo& aEllipsisInfo)
	{
	/*
	Find any previous non-standard tab, so that we can adjust the measure to allow for characters pushed left.
	Accumulate the segment width (width of chunks between tabs), which will be used to
	adjust the width of the previous tab if necessary.

	Return TRUE if it was possible to append a new chunk of non-zero length. It will be impossible if
	aMaxChar is <= aStartChar or the chunk consists of a ligation that ends after aMaxChar, or the smallest thing
	that can be appended is wider than aMaxXPos - aStartXPos.
	*/
	int segment_width = 0;
	TTmChunk* prev_tab = NULL;

	if (iChunk.Length() > 0)
		{
		int i = iChunk.Length() - 1;
		TTmChunk* c = &iChunk[i];
		while (i >= 0 && !prev_tab)
			{
			if (c->iType & TTmChunk::ETabFlag)
				{
				if (c->iType != TTmChunk::EStandardTabChunk)
					{
					prev_tab = c;
					int avail = aMaxXPos - aStartXPos;
					if (prev_tab->iType == TTmChunk::ECenterTabChunk)
						aMaxXPos += Min(avail,prev_tab->iWidth);
					else
						aMaxXPos += prev_tab->iWidth;
					}
				break;
				}
			else
				segment_width += c->iWidth;
			c--;
			i--;
			}
		}

	//+ strip trailing whitespace when measuring centred segment?

	// Prepare to zero the metrics of the preceding chunk if it was a soft hyphen.
	int prev_soft_hyphen_width = 0;
	if (iChunk.Length() && iChunk[iChunk.Length() - 1].iType == TTmChunk::ESoftHyphenChunk)
		prev_soft_hyphen_width = iChunk[iChunk.Length() - 1].iWidth;

	// Create the new chunk.
	TTmChunk chunk;
	TTmChunk::TInfo chunkInfo;
	// If this is the first chunk of the line, then take the context  from the line. Otherwise, take
	// it form the previous chunk in this line.
	if (iChunk.Length() == 0)
		chunk.iContextChar = iContextChar;
	else
		chunk.iContextChar = iChunk[iChunk.Length() - 1].iContextChar;
	
	chunk.SetL(aContext,aStartChar,aStartXPos - prev_soft_hyphen_width,aMaxChar,aMaxXPos,aAllowSpaceForFinalInlineText,chunkInfo);
	// copy over info to be passed back
	aEllipsisInfo.iEllipsisWidth = chunkInfo.iEllipsisWidth;
	aEllipsisInfo.iAtLineEnd = chunkInfo.iAtLineEnd;
	aEllipsisInfo.iAtParEnd = chunkInfo.iAtParEnd;
	TBidirectionalState::TRunInfo run_info;
	run_info.iCategory = chunkInfo.iBdCat;
	run_info.iIndex = iChunk.Length();
	
	// Add the chunk and the bidirectional information to the arrays.
	if (chunk.iTextLength > 0)
		{
		if (prev_soft_hyphen_width)
			{
			TTmChunk& c = iChunk[iChunk.Length() - 1];
			c.iWidth = 0;
			c.iAscent = 0;
			c.iDescent = 0;
			c.iMaxCharHeight = 0;
			c.iMaxCharDepth = 0;
			aStartXPos -= prev_soft_hyphen_width;
			}

		iChunk.AppendL(chunk);
		int start = chunk.iDocPos;
		int end = chunk.iDocPos + chunk.iTextLength;
		TPtrC text;
		while (start < end)
			{
			aContext.iTextCache.GetText(start,end,text);
			iText.AppendL(text.Ptr(),text.Length());
			iTextWithoutChunkOverlaps.AppendL(text.Ptr(),text.Length() - chunk.iOverlappingChars);
			start += text.Length();
			}

		iRunInfo.AppendL(run_info);

		aStartChar += chunk.iTextLength;
		if (chunk.iOverlappingChars > 0 && ! chunkInfo.iAtLineEnd && ! chunkInfo.iAtParEnd)
			{
			aStartChar -= chunk.iOverlappingChars;
			if (aStartChar < 0)
			    {
			    OstTrace0( TRACE_DUMP, CTMLINE_APPENDCHUNKL, "EInvariant" );
			    }
			__ASSERT_DEBUG(aStartChar >= 0, TmPanic(EInvariant));
			}

		aStartXPos += chunk.iWidth;

		// Adjust the width of any previous centring or right-aligning tab unless the new chunk is itself a tab
		if (prev_tab && !(chunk.iType & TTmChunk::ETabFlag))
			{
			segment_width += chunk.iWidth;
			int old_chunk_width = prev_tab->iWidth;
			if (prev_tab->iType == TTmChunk::ECenterTabChunk)
				prev_tab->iWidth = Max(0,prev_tab->iStandardWidth - segment_width / 2);
			else
				prev_tab->iWidth = Max(0,prev_tab->iStandardWidth - segment_width);
			aStartXPos += prev_tab->iWidth - old_chunk_width;
			}
		if (chunkInfo.iTruncated)	// move test for truncation to here from loop around AppendChunkL
			return EFalse;
		return ETrue;
		}
	else
		return EFalse;
	}
TInt eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL()
	{

	EAP_TRACE_DEBUG(
		m_am_tools, 
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): m_index_type=%d, m_index=%d, m_tunneling_type=0xfe%06x%08x\n"),
		m_index_type,
		m_index,
		m_tunneling_type.get_vendor_id(),
		m_tunneling_type.get_vendor_type()));

	TInt status = KErrNone;
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
	TPtr sqlStatement = buf->Des();
	
	// Query all the relevant parameters
	_LIT(KSQLQuery, "SELECT %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
	
	sqlStatement.Format(
		KSQLQuery,
		&cf_str_EAP_GTC_passcode_prompt_literal,
		&cf_str_EAP_GTC_identity_literal,
		&cf_str_EAP_GTC_passcode_literal,
		&KGtcTableName,
		&KServiceType,
		m_index_type, 
		&KServiceIndex,
		m_index,
		&KTunnelingTypeVendorId,
		m_tunneling_type.get_vendor_id(),
		&KTunnelingType, 
		m_tunneling_type.get_vendor_type());
	

	EAP_TRACE_DEBUG(
		m_am_tools, 
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): Reads database\n")));

	RDbView view;
	// Evaluate view
	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
	CleanupClosePushL(view);
	
	User::LeaveIfError(view.EvaluateAll());
	
	// Get the first (and only) row
	view.FirstL();
	view.GetL();
	
	// Get column set so we get the correct column numbers
	CDbColSet* colSet = view.ColSetL();
	CleanupStack::PushL(colSet);

	EAP_TRACE_DEBUG(
		m_am_tools, 
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): Reads database\n")));

	TPtrC username = view.ColDes(colSet->ColNo( cf_str_EAP_GTC_identity_literal ) );

	EAP_TRACE_DATA_DEBUG(
		m_am_tools,
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): username"),
		username.Ptr(),
		username.Size()));

	TPtrC password = view.ColDes(colSet->ColNo( cf_str_EAP_GTC_passcode_literal ) );

	EAP_TRACE_DATA_DEBUG(
		m_am_tools,
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): password"),
		password.Ptr(),
		password.Size()));

	TUint prompt = view.ColUint(colSet->ColNo(cf_str_EAP_GTC_passcode_prompt_literal));

	EAP_TRACE_DEBUG(
		m_am_tools, 
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): prompt=%d\n"),
		prompt));


	if ((EEapDbFalse != prompt)
		 || (username.Size() == 0) 
		 || (password.Size() == 0))
		{

		if (username.Size() == 0)
			{
			m_dialog_data_ptr->iUsername.Zero();
			}
		else
			{
			m_dialog_data_ptr->iUsername.Copy(username);
			}

		status = KErrCancel;
		}
	else
		{
		status = KErrNone;	
		m_dialog_data_ptr->iUsername.Copy(username);
		m_dialog_data_ptr->iPassword.Copy(password);
		}
		
	CleanupStack::PopAndDestroy(colSet); // Delete colSet.
	CleanupStack::PopAndDestroy(&view); // Close view.
	CleanupStack::PopAndDestroy(buf); // Delete buf.
		
	EAP_TRACE_DEBUG(
		m_am_tools, 
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): status=%d\n"),
		status));

	return status;
	}