Exemplo n.º 1
0
TInt CCmdSetPrompt::ProcessL( const TDesC& aCommand )
{
// Complete the test machine - will then get the next cmd
Machine()->CompleteRequest();

TPtrC param;
TRAPD( error, param.Set( ParamsL( aCommand )) );
if ( error != KErrNone )
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );

TLex parse( param );
if ( !parse.Eos() && !parse.Peek().IsSpace() )
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );

// ParseOnly => not executed.
if ( Family()->Switch(CCmdFamily::EParseOnly) )
	return error;

// Alter prompt, back to the default one if no new one.
param.Set( TfrLex::TrimAndPeel( param ) );
if ( param.Length() == 0 ) 
	param.Set(THA_CommandPrompt);

if ( error = Machine()->SetPrompt( param ), error != KErrNone )
	// ### Failure
	Log( TFR_KFmtErrFailed, &Keyphrase(), error );

return error;
}
Exemplo n.º 2
0
TInt CCmdSetPath::ProcessL( const TDesC& aCommand )
{
// Complete the test machine - will then get the next cmd
Machine()->CompleteRequest();

TPtrC param;
TRAPD(error, param.Set(ParamsL(aCommand)));
if (error != KErrNone)
	return Error(error, TFR_KFmtErrBadCmd, &Keyphrase());

TLex parse( param );
if ( !parse.Eos() && !parse.Peek().IsSpace() )
	return Error(error, TFR_KFmtErrBadCmd, &Keyphrase());

// Set the command file path.
param.Set( TfrLex::TrimAndPeel(param));
error = Machine()->SetCmdPath(param);
switch (error)
	{
	// Bad argument
	case KErrArgument : Log(TFR_KFmtErrParams, &Keyphrase()); break;
	case KErrNone : break;
	// Other errors
	default : Log(TFR_KFmtErrFailed, &Keyphrase(), error); break;
	}

return error;
}
Exemplo n.º 3
0
TInt CCmdPause::ProcessL(const TDesC& aCommand)
{
TPtrC param;
TRAPD(error, param.Set(ParamsL(aCommand)));
if (error != KErrNone)
	{
	// Complete the test machine - will then get the next cmd
	Machine()->CompleteRequest();
	return Error(error, TFR_KFmtErrBadCmd, &Keyphrase());
	}

TLex parse( param );
if (!parse.Eos() && !parse.Peek().IsSpace())
	{
	// Complete the test machine - will then get the next cmd
	Machine()->CompleteRequest();
	return Error(error, TFR_KFmtErrBadCmd, &Keyphrase());
	}

// ParseOnly => not executed.
if (Family()->Switch(CCmdFamily::EParseOnly))
	{
	// Complete the test machine - will then get the next cmd
	Machine()->CompleteRequest();
	return error;
	}

// Ask any key, prompt is either param or a default.
param.Set( TfrLex::TrimAndPeel(param));
if (param.Length() == 0) 
	param.Set(TFR_KTxtMsgPressAnyKey);

Machine()->Pause(param);
return error;
}
Exemplo n.º 4
0
CASN1EncObjectIdentifier* CmsUtils::EncodeContentTypeLC(TInt aContentType)
	{
	TPtrC oidBuf;
	switch (aContentType)
		{
	case EContentTypeData:
		oidBuf.Set(KCmsDataOID());
		break;
		
	case EContentTypeSignedData:
		oidBuf.Set(KCmsSignedDataOID());
		break;
		
	case EContentTypeEnvelopedData:
		oidBuf.Set(KCmsEnvelopedDataOID());
		break;
	
	case EContentTypeDigestedData:
		oidBuf.Set(KCmsDigestedDataOID());
		break;
	
	case EContentTypeEncryptedData:
		oidBuf.Set(KCmsEncryptedDataOID());
		break;
	
	default:
		User::Leave(KErrArgument);
		}
	//Encode the OID		
	CASN1EncObjectIdentifier* oid=CASN1EncObjectIdentifier::NewLC(oidBuf);
	return oid;	
	}
Exemplo n.º 5
0
/**
Return a text (16 bit) descriptor to a text column identified by aColumnIndex.

@param aColumnIndex Column index
@param aPtr An output parameter which will be set to point to the column data.

@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, TPtrC& aPtr)
	{
	__ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex));
	__ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow));
	iColumnValBufIt.MoveTo(aColumnIndex);		
	if(iColumnValBufIt.IsPresent())
		{
		aPtr.Set(iColumnValBufIt.Text());
		return 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.
	//The column value is stored in a separate collection (iLongColumnColl), because if iColumnValueBuf gets reallocated,
	//the client can get a dangling pointer to some of the located in iColumnValueBuf text/binary column values.
	if(iColumnValBufIt.Type() != ESqlText)
		{
		aPtr.Set(KNullDesC);
		return KErrNone;
		}
	if(!iLongColumnColl.IsPresent(aColumnIndex))
		{
		TSqlLongColumnReader colReader(iSqlStmtSession);
		TInt err = iLongColumnColl.Append(colReader, aColumnIndex, iColumnValBufIt.Size() * sizeof(TUint16));
		if(err != KErrNone)
			{
			return err;	
			}
		}
	aPtr.Set(iLongColumnColl.Text(aColumnIndex));
	return KErrNone;
	}
Exemplo n.º 6
0
// ----------------------------------------------------------------------------
// MPXDbUtil::TableNameForCategoryL
// ----------------------------------------------------------------------------
//
TPtrC MPXDbUtil::TableNameForCategoryL(
    TMPXGeneralCategory aCategory)
    {
    MPX_FUNC("MPXDbUtil::TableNameForCategoryL");

    TPtrC ptr;
    switch (aCategory)
        {
        case EMPXArtist:
            ptr.Set(KMCAuthorTable);
            break;
        case EMPXAlbum:
            ptr.Set(KMCTitleTable);
            break;
        case EMPXGenre:
            ptr.Set(KMCCategoryTable);
            break;
        case EMPXComposer:
            ptr.Set(KMCComposerTable);
            break;
        default:
            User::Leave(KErrNotSupported);
        }

    return ptr;
    }
Exemplo n.º 7
0
TInt CCmdLogPath::ProcessL( const TDesC& aCommand )
{
// Complete the test machine - will then get the next cmd
Machine()->CompleteRequest();

TPtrC param;
TRAPD( error, param.Set( ParamsL( aCommand )) );
if ( error != KErrNone )
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );

TLex parse( param );
if ( !parse.Eos() && !parse.Peek().IsSpace() )
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );

// Set log file path.
param.Set( TfrLex::TrimAndPeel( param ) );

//	
if ( error = Machine()->SetLogPath( param ), error != KErrNone )
	{
	// Failed
	if ( error == KErrArgument )
		// Bad arguments
		Log( TFR_KFmtErrParams, &Keyphrase() );
	else
		// Other errors
		Log( TFR_KFmtErrFailed, &Keyphrase(), error );
	}

return error;
}
Exemplo n.º 8
0
// ----------------------------------------------------------------------------
// MPXDbUtil::PodcastFieldNameForCategoryL
// ----------------------------------------------------------------------------
//
TPtrC MPXDbUtil::PodcastFieldNameForCategoryL(
    TMPXGeneralCategory aCategory)
    {
    MPX_FUNC("MPXDbUtil::PodcastFieldNameForCategoryL");

    TPtrC ptr;
    switch (aCategory)
        {
        case EMPXArtist:
            ptr.Set(KMCPodcastAuthor);
            break;

        case EMPXAlbum:
            ptr.Set(KMCPodcastTitle);
            break;

        case EMPXGenre:
            ptr.Set(KMCPodcastGenre);
            break;

        case EMPXComposer:
            ptr.Set(KMCPodcastComposer);
            break;

        default:
            User::Leave(KErrNotSupported);
        }

    return ptr;
    }
Exemplo n.º 9
0
    void init()
    {
        _LIT(KLibName_3_1, "qts60plugin_3_1" QT_LIBINFIX_UNICODE L".dll");
        _LIT(KLibName_3_2, "qts60plugin_3_2" QT_LIBINFIX_UNICODE L".dll");
        _LIT(KLibName_5_0, "qts60plugin_5_0" QT_LIBINFIX_UNICODE L".dll");

        TPtrC libName;
        TInt uidValue;
        switch (QSysInfo::s60Version()) {
        case QSysInfo::SV_S60_3_1:
            libName.Set(KLibName_3_1);
            uidValue = 0x2001E620;
            break;
        case QSysInfo::SV_S60_3_2:
            libName.Set(KLibName_3_2);
            uidValue = 0x2001E621;
            break;
        case QSysInfo::SV_S60_5_0: // Fall through to default
        default:
            // Default to 5.0 version, as any unknown platform is likely to be newer than that
            libName.Set(KLibName_5_0);
            uidValue = 0x2001E622;
            break;
        }

        TUidType libUid(KDynamicLibraryUid, KSharedLibraryUid, TUid::Uid(uidValue));
        lib.Load(libName, libUid);

        // Duplicate lib handle to enable process wide access to it. Since Duplicate overwrites
        // existing handle without closing it, store original for subsequent closing.
        RLibrary origHandleCloser = lib;
        lib.Duplicate(RThread(), EOwnerProcess);
        origHandleCloser.Close();
    }
Exemplo n.º 10
0
TInt CCmdPrint::ProcessL(const TDesC& aCommand)
{
// Complete the test machine - will then get the next cmd
Machine()->CompleteRequest();

TPtrC param;
TRAPD(error, param.Set(ParamsL(aCommand)));
if (error != KErrNone)
	return Error(error, TFR_KFmtErrBadCmd, &Keyphrase());

TLex parse(param);
if ( !parse.Eos() && !parse.Peek().IsSpace() )
	return Error(error, TFR_KFmtErrBadCmd, &Keyphrase());

// ParseOnly => not executed.
if (Family()->Switch(CCmdFamily::EParseOnly))
	return error;

iCurEchoMode = Machine()->EchoMode();
Machine()->SetEchoMode(EFalse);

// Print out the param text.
param.Set(TfrLex::TrimAndPeel(param));
//Print(param, EFalse);
Print(param, ETrue);
//Print(param.Mid(6), EFalse);

//	reset the echo mode to that of before this command!
Machine()->SetEchoMode(iCurEchoMode);

return error;
}
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.º 12
0
    void init()
    {
#ifdef Q_WS_S60
        _LIT(KLibName_3_1, "qts60plugin_3_1" QT_LIBINFIX_UNICODE L".dll");
        _LIT(KLibName_3_2, "qts60plugin_3_2" QT_LIBINFIX_UNICODE L".dll");
        _LIT(KLibName_5_0, "qts60plugin_5_0" QT_LIBINFIX_UNICODE L".dll");

        TPtrC libName;
        TInt uidValue;
        switch (QSysInfo::s60Version()) {
        case QSysInfo::SV_S60_3_1:
            libName.Set(KLibName_3_1);
            uidValue = 0x2001E620;
            break;
        case QSysInfo::SV_S60_3_2:
            libName.Set(KLibName_3_2);
            uidValue = 0x2001E621;
            break;
        case QSysInfo::SV_S60_5_0: // Fall through to default
        default:
            // Default to 5.0 version, as any unknown platform is likely to be newer than that
            libName.Set(KLibName_5_0);
            uidValue = 0x2001E622;
            break;
        }

        TUidType libUid(KDynamicLibraryUid, KSharedLibraryUid, TUid::Uid(uidValue));
        lib.Load(libName, libUid);
#endif
    }
// Set aNumber to the relevant phone number based on the line type (either data, fax or voice line)
// If Using RPS then the number will be retrieved from RPS, otherwise it will read the number from the 
// ctsyintegration_data.ini file.
void CCTSYIntegrationTestSuiteStepBase::GetRPSNumber(TEtelLine aLine, TPtrC& aNumber) 
	{

	if (UsingRps())
		{
		 switch(aLine)
			{
			case EDataLine:
				aNumber.Set(iRPS->RpsSlaveTelNumData());
				break;
			case EFaxLine:
				aNumber.Set(iRPS->RpsSlaveTelNumFax());
				break;
			case EVoiceLine:
				default:
				aNumber.Set(iRPS->RpsSlaveTelNum());
			}		
		}
	else
		{
		 switch(aLine)
			{
			case EDataLine:
				GetStringFromConfig(KIniOwnNumSection,KIniOwnDataNumber,aNumber);
				break;
			case EFaxLine:
				GetStringFromConfig(KIniOwnNumSection,KIniOwnFaxNumber,aNumber);
				break;
			case EVoiceLine:
				default:
				GetStringFromConfig(KIniOwnNumSection, KIniOwnVoiceNumber1, aNumber);
			}		
		}
	}
Exemplo n.º 14
0
EXPORT_C TInt TEFparser::GetIniFileInfo(TDesC& aBuf, 
											  TPtrC& aIniFileName, 
											  TPtrC& aIniSectionName)
	{
	TInt pos =0;
	TInt startPos = 0, endPos = 0;
	
	
	TPtrC temp = aBuf.Mid(pos);
	
	endPos = temp.Find(KIniExtension);
	endPos += 4;
	
	if (endPos != KErrNotFound)
		{
		TInt len = endPos - startPos;
		TPtrC iniFileName = temp.Mid(startPos, len);
		aIniFileName.Set(iniFileName);
		
		TPtrC iniSectionName = temp.Mid(iniFileName.Length());
		aIniSectionName.Set(Trim(iniSectionName));
		
		return KErrNone;
		}
	else
		{
		return KErrNotFound;
		}
	
	}
Exemplo n.º 15
0
void PrintSystemServerSecurity(CPrinter* aPrinter, CPolicy *aPolicy)
/**
Prints the system server security configuration.
*/
	{

	TPtrC p;
	switch (aPolicy->SystemServerSecurity())
		{
	case CPolicy::ESystemServerSecurityPassedOrFailed:
		p.Set(_L("ESystemServerSecurityPassedOrFailed"));
		break;
	case CPolicy::ESystemServerSecurityPassed:
		p.Set(_L("ESystemServerSecurityPassed"));	
		break;
	case CPolicy::ESystemServerSecurityFailed:
		p.Set(_L("ESystemServerSecurityFailed"));
		break;
	default:
		p.Set(_L("*** UNKNOWN ***"));
		break;				
		}
	TBuf<80> buf;
	buf.AppendFormat(_L(" System Server Security: %S\n"), &p);
	aPrinter->PrintL(buf);
	}
Exemplo n.º 16
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.º 17
0
void CRichText::OverrideFormatForParsersIfApplicable(TPtrC& aText, TCharFormatX& aFormat, TInt aStartPos) const
	{
	if (aFormat.iParserTag && iParserData->iActiveParserList && iParserData->iEditObserver)
		{
		// Replace format
		TInt start = -1;
		TInt length = 0;
		TInt curPos = iParserData->iLastKnownCursor;
		if (curPos > DocumentLength())
			curPos = DocumentLength();  // This shouldn't be neccesary but it makes it more
										// bulletproof if the calls from outside are made in
										// the wrong order
		if (curPos != -1)
			{
			TCharFormatX format;
			TCharFormatXMask varies;
			MParser* parser;

			GetExtendedCharFormat(format, varies, curPos, 1);
			// If char at curpos has a tag then cursor is over that tag, get extents of tag
			if (CParserList::ReformatOnRollover(format.iParserTag))
				DoCursorOverTag(curPos, parser, start, length);
			else if (curPos)
				{
				GetExtendedCharFormat(format, varies, curPos - 1, 1);
				// Try the char "before" curpos
				if (CParserList::ReformatOnRollover(format.iParserTag))
					DoCursorOverTag(curPos - 1, parser, start, length);
				}
			}

		MParser* parser = iParserData->iActiveParserList->ParserWithThisTag(aFormat.iParserTag);
		
		if (length && (aStartPos >= start) && (aStartPos < start + length))
			{
			if (start + length < aStartPos + aText.Length())
				aText.Set(aText.Left(start + length - aStartPos));
			if (parser != NULL)
				{
				// Only accept the rollover format if the parser agrees 
				// with the framework match of a tag
				if (parser->ConfirmCursorOverTag(*this, start, length, curPos))
					parser->GetRolloverFormat(aFormat.iCharFormat);
				else 
					// Reset format to recognised format if parser disagrees
					// with the framework match as the tag is still in view
					// and must be formatted as in the else clause below.
					parser->GetRecogniseFormat(aFormat.iCharFormat);
				}
			}
		else
			{
			if (length && (start > aStartPos))
				aText.Set(aText.Left(start - aStartPos));
			if (parser != NULL)
				parser->GetRecogniseFormat(aFormat.iCharFormat);
			}
		}
	}
Exemplo n.º 18
0
 void GetChars(TPtrC& aView,TCharFormat& aFormat, TInt aStartPos)const
 {
     TCharFormat cf;
     aFormat = cf;
     if (aStartPos == LdDocumentLength())
         aView.Set(KEnd);
     else
         aView.Set(iDes->Mid(aStartPos));
 }
void CMemSpyEngineActiveObject::ConstructL( CMemSpyEngine& /*aEngine*/ )
    {
    TBuf<256> item;

    _LIT(KBasicFormat, "\t0x%08x\t\t");
    item.Format( KBasicFormat, VTable() );

    // Add modifiers
    _LIT( KModifiers, "%d" );
    _LIT( KBoxedCharFormat, " [%c]" );
    item.AppendFormat( KModifiers, RequestStatusValue() );
    if  ( IsActive() )
        {
        item.AppendFormat( KBoxedCharFormat, 'A' );
        }
    if  ( RequestIsPending() )
        {
        item.AppendFormat( KBoxedCharFormat, 'P' );
        }
    iCaption = item.AllocL();

    // Listbox items
    TPtrC value;

    // Address
    _LIT(KCaption1, "\tAddress\t\t0x%08x");
    item.Format( KCaption1, iAddress );
    AppendL( item );

    // vTable
    _LIT(KCaption2, "\tVTable\t\t0x%08x");
    item.Format( KCaption2, iVTable );
    AppendL( item );

    //
    _LIT(KCaption3, "\tStatus Value\t\t%d");
    item.Format( KCaption3, iRequestStatusValue );
    AppendL( item );

    //
    _LIT(KCaption5, "\tIs Active\t\t%S");
    value.Set( YesNoValue( IsActive() ) );
    item.Format( KCaption5, &value );
    AppendL( item );

    //
    _LIT(KCaption6, "\tRequest Pending\t\t%S");
    value.Set( YesNoValue( RequestIsPending() ) );
    item.Format( KCaption6, &value );
    AppendL( item );

    //
    _LIT(KCaption4, "\tPriority\t\t%d");
    item.Format( KCaption4, iPriority );
    AppendL( item );
    }
Exemplo n.º 20
0
TPtrC TfrLex::Peel( const TDesC& aText )
{
TPtrC result;
TInt  length = aText.Length();
if ( length >= 2 && (aText[0] == '"' && aText[length-1] == '"') )
	result.Set( aText.Mid(1,length-2) );
else
	result.Set( aText );

return result;
}
Exemplo n.º 21
0
inline TBool IsAdaptiveFindMatchClassic( const TDesC& aItemString, const TDesC& aSearchText )
    {
    TPtrC itemptr = aItemString;
    TPtrC searchptr = aSearchText;

    TBool match = EFalse;
    
    for(;;) 
        {
        // Loop invariant: itemptr is next character from ' ' or '-'
        // Loop invariant: seachptr is at beginning of searched item
    
        TInt val = MyFindC(itemptr,searchptr);
        if (val == 0)
            {
            match = ETrue;
            break;
            }
        if (val != KErrNotFound && IsFindWordSeparator(itemptr[val-1]))
            {
            match = ETrue;
            break;
            }

        // find the word separator characters from list item
        TInt spacepos = itemptr.LocateF(TChar(' '));
        TInt minuspos = itemptr.LocateF(TChar('-'));
        TInt tabpos = itemptr.LocateF(TChar('\t'));
        if (spacepos != KErrNotFound)
            {
            itemptr.Set(itemptr.Mid(spacepos+1));
            }
        else if (minuspos != KErrNotFound)
            {
            itemptr.Set(itemptr.Mid(minuspos+1));
            }
        else if (tabpos != KErrNotFound)
            {
            itemptr.Set(itemptr.Mid(tabpos+1));
            }
        else
            {
            match = EFalse;
            break;
            }
        if (itemptr.Length() == 0)
            {
            match = EFalse;
            break;
            }

        }
    return match;
    }	
Exemplo n.º 22
0
TInt CCmdCall::ProcessL( const TDesC& aCommand )
{
// Complete the test machine - will then get the next cmd
Machine()->CompleteRequest();

TPtrC param;
TRAPD( error, param.Set( ParamsL( aCommand )) );
if ( error != KErrNone )
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );

TLex parse( param );
if ( !parse.Peek().IsSpace() )
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );

// Extract command file name.
parse = TfrLex::Trim( param );
TPtrC file;
TRAP(error,file.Set(TfrLex::GetL(parse)));
if ( error != KErrNone )
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );

file.Set(TfrLex::PeelAndTrim(file));
if ( file.Length() == 0 )
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );

// The remainder contains optional arguments
TPtrC args = TfrLex::Trim(parse.Remainder());

// Before calling the command file, do check that the argument list
// is lexically correct and that there are not too many of them....
TPtrC argv;
TInt  argc = -1;
do
	{
	argc++;
	TRAP(error, argv.Set(TfrLex::GetL(parse)));
	} while ( error == KErrNone && argv.Length() > 0 );

// Well, how was it?
if ( error != KErrNone || argc > TFR_MAX_CALL_ARGUMENTS )
	{
	if ( error == KErrNone ) 
		error = KErrArgument;
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );
	}

// Call the command file with the argument list.
error = Machine()->CallCmdFile(file, args);
if (error != KErrNone )
	// ### Failure
	Log( TFR_KFmtErrFailed, &Keyphrase(), error );

return error;    
}
Exemplo n.º 23
0
/*!
    Retrieves date format from Symbian locale and
    transforms it to Qt format.

    When \a short_format is true the method returns
    short date format. Otherwise it returns the long format.
*/
static QString symbianDateFormat(bool short_format)
{
    TPtrC dateFormat;

    if (short_format) {
        dateFormat.Set(ptrGetShortDateFormatSpec(_s60Locale));
    } else {
        dateFormat.Set(ptrGetLongDateFormatSpec(_s60Locale));
    }

    return s60ToQtFormat(qt_TDesC2QString(dateFormat));
}
// ----------------------------------------------------------
// CBTEnterpriseItSecurityInfoNotifier::ShowNoteAndCompleteL
// Shows the notifier in backround 
// ----------------------------------------------------------
//
void CBTEnterpriseItSecurityInfoNotifier::ShowNoteAndCompleteL()
	{
	FLOG(_L("[BTNOTIF]\t CBTEnterpriseItSecurityInfoNotifier::ShowNoteAndComplete()"));
	
	//get full path to the DCMO resource file
	TParse* parser = new (ELeave) TParse;
	parser->Set(KDcmoResourceFileName(), &KDC_RESOURCE_FILES_DIR, NULL);
	CleanupStack::PushL(parser);
	TFileName* fileName = new (ELeave) TFileName;
	*fileName = parser->FullName();
	CleanupStack::PopAndDestroy(parser);
	CleanupStack::PushL(fileName);
	
	//create the resource reader object that we need to use several times
	CTulStringResourceReader* reader = CTulStringResourceReader::NewL(*fileName);
	CleanupStack::PushL(reader);
	
	//get pointer to the message part of the notifier
	TPtrC resourceString;
	resourceString.Set(reader->ReadResourceString(R_DM_RUN_TIME_VAR_DISABLE));

	//create descriptor with a max length to fit the localised "disabled" text + new line + "Bluetooth"
	RBuf content;
	content.CreateL(resourceString.Length() + KNewLine().Length() + KDefaultBluetoothStringLength);
	CleanupClosePushL(content);
	
	//add resource string and new line character to the content descriptor
	content.Append(resourceString);	
	content.Append(KNewLine());
	
	//get pointer to the Bluetooth name part of the notifier (can't assume this is actually "Bluetooth" in all languages)
	resourceString.Set(reader->ReadResourceString(R_DM_RUN_TIME_VAR_BLUETOOTH));
	
	//check that the resource string will fit into the content descriptor
	TInt requiredLength = content.Length() + resourceString.Length();
	if (requiredLength > content.MaxLength())
		{
		//allocate more space in the content descriptor
		content.ReAllocL(requiredLength);
		}
	
	//add resource string to the content descriptor
	content.Append(resourceString);	
	
	//display the notifier and complete
	iNotifUiUtil->ShowInfoNoteL(content, ECmdBTnotifUnavailable);
	CompleteMessage(KErrNone);
	
	//pop and destroy the content descriptor, resource reader and file name
	CleanupStack::PopAndDestroy(3, fileName);
	
	FLOG(_L("[BTNOTIF]\t CBTEnterpriseItSecurityInfoNotifier::ShowNoteAndComplete() complete"));
	}
// ---------------------------------------------------------------------------
// CPresenceCacheSession::GetServiceName()
// ---------------------------------------------------------------------------
//
TPtrC CPresenceCacheSession::GetServiceName(const TDesC& aXspId)
    {
    _LIT(KColon, ":");
    TInt pos = aXspId.Find(KColon);
    TPtrC serviceName;
    if(pos>0) // if colon found and there is something before colon, i.e. xsp id
        {
        serviceName.Set(aXspId.Left(pos));
        }
    else
        serviceName.Set(TPtrC());
    return serviceName;
    }
Exemplo n.º 26
0
void CSmtpClientMtm::RestoreEmailMessageL()
	{

	// Get a reference to TMsvEnhanceSearchSortUtil  instance set by CMsvSearchsortOpOnHeaderBody class
	// If advanced search and sort is being performed than do not load the message header and body.
	// These are loaded when the search criteria is known in DoFindL()
	// For API's other than CMsvSearchsortOpOnHeaderBody-> FindInHeaderBodyL(), a call to LoadMessageL()
	// loads the body and the header.

	TMsvEnhanceSearchSortUtil* searchsortutil = (TMsvEnhanceSearchSortUtil*)(GetExtensionData());
	if ( searchsortutil == NULL )
		{
		CMsvStore* msvStore = iMsvEntry->ReadStoreL();
		CleanupStack::PushL(msvStore);

		// message must have a CImHeader stream...if it's not there leave as there's something wrong
		iHeader->RestoreL(*msvStore);

		TPtrC subject = iHeader->Subject();
		TPtrC to;
		if (iHeader->ToRecipients().Count())
			to.Set(iHeader->ToRecipients()[0]);
		else if (iHeader->CcRecipients().Count())
			to.Set(iHeader->CcRecipients()[0]);
		else if (iHeader->BccRecipients().Count())
			to.Set(iHeader->BccRecipients()[0]);
	//else do nothing as there are no recipients!

		SetSubjectL(subject);
		SetAddresseeListL();

		// Get the attachments and the body text...
		TMsvEntry messageEntry=iMsvEntry->Entry();

		CleanupStack::PopAndDestroy(); // msvStore
		CImEmailMessage* emailMessage = CImEmailMessage::NewLC(*iMsvEntry);

		GetBodyTextL(*emailMessage, messageEntry.Id());
		TInt32 totalSizeOfAllAttachments = GetAttachmentSizeL(*emailMessage, messageEntry.Id());

		messageEntry.iSize = iHeader->DataSize() + Body().DocumentLength() + totalSizeOfAllAttachments;
		messageEntry.iDescription.Set(subject);
		messageEntry.iDetails.Set(to);

	// update the contents of the message entry
		iMsvEntry->ChangeL(messageEntry);
	
		CleanupStack::PopAndDestroy(); // emailMessage
	
		}
	}
// ---------------------------------------------------------------------------
// CVoiceMailboxEntry::GetVmbxName
// Get Name of the entry instance
// ---------------------------------------------------------------------------
//
EXPORT_C TInt CVoiceMailboxEntry::GetVmbxName( TPtrC& aVmbxName ) const
{
    qDebug("DummyVoiceMailboxEntry::GetVmbxName >");
    TInt result( KErrNotFound );
    if ( ivmbxName ){
        aVmbxName.Set( ivmbxName->Des() );
        result = KErrNone;
    }else{
        qDebug( "DummyVoiceMailboxEntry::GetVmbxName:KNullDesC" );
        aVmbxName.Set( KNullDesC );
    }      
    qDebug("DummyVoiceMailboxEntry::GetVmbxName <");
    return result;
}
Exemplo n.º 28
0
TInt CCmdConnect::ParseCmdArgs( const TDesC& aCommand, TPtrC& aFramework, TPtrC& aConName ) 
	{
	aFramework.Set(NULL, 0);
	aConName.Set(NULL, 0);
	TInt error = KErrNone;

	//	get the command into a local string
	TPtrC param;
	TRAP(error, param.Set(ParamsL(aCommand)));
	if (error != KErrNone)
		return Error(error, TFR_KFmtErrBadCmd, &Keyphrase());

	//	check its' valid
	TLex parse(param);
	if (!parse.Eos() && !parse.Peek().IsSpace())
		return Error(error, TFR_KFmtErrBadCmd, &Keyphrase());

	//	remove any spaces and see if its got params
	parse.SkipSpace();
	if ( parse.Eos() )	// no params
		return error;
	
	//	Get framework name, must not exceed 16 characters.
	//	should be http or wsp (currently)

	TRAP(error, aFramework.Set(TfrLex::GetL(parse)));
	if ( error != KErrNone) 
		return Error(KErrArgument, TFR_KFmtErrBadCmd, &aFramework);

	//	check is valid length
	aFramework.Set(TfrLex::Peel(aFramework));
	if ( aFramework.Length() > 16 ) 
		return Error(KErrArgument, THA_KErrParameterLong, &aFramework);

	//	check aFramework type valid (HTTP or WSP)
	//	Param shall be HTTP (True) or WSP (False)
	aFramework.Set( TfrLex::TrimAndPeel(aFramework) );
	TBool value = (aFramework.CompareF(THA_KTxtFrameworkHTTP) == 0);
	
	if ( !value && (aFramework.CompareF(THA_KTxtFrameworkWSP) != 0))
		return Error(KErrArgument, THA_KErrFrameworkErr, &aFramework);

	// Get connection/session name value.

	TRAP(error,aConName.Set(TfrLex::GetL(parse)));
	if ( error != KErrNone) 
		return Error(KErrArgument, TFR_KFmtErrBadCmd, &aConName);

	// There shall not be anything more.
	TPtrC remainder = TfrLex::Trim(parse.Remainder());
	if ( remainder.Length() > 0 ) 
		return Error(KErrArgument, TFR_KFmtErrBadCmd, &remainder);

	if (aConName.Length() <= 0)
		return Error(KErrArgument, THA_KErrInvalidConnect, &Keyphrase());

	aConName.Set(TfrLex::Peel(aConName));
	return (KErrNone);
	}
Exemplo n.º 29
0
// ---------------------------------------------------------------------------
// From MFSMBody.
// ---------------------------------------------------------------------------
//
TPtrC CPDEngine::CurrentStateName( TFSMId aFSMId )
    {
    FUNC_LOG;
    TPtrC currentStateName;
    currentStateName.Set( KNullDesC );
    if (    ( 0 <= aFSMId ) && 
            ( EPDEFSMIdFirstUnused > aFSMId ))
        {
        if (iFSMPtr[ aFSMId ])
            {
            currentStateName.Set(  iFSMPtr[ aFSMId ]->CurrentStateName() );
            }
        }
    return currentStateName;
    }
// ---------------------------------------------------------------------------
// From MFSMForBody.
// ---------------------------------------------------------------------------
//
TPtrC CCompositeCableStatusFSM::CurrentStateName()
    {
    FUNC_LOG;
    TPtrC currentStateName;
    currentStateName.Set( KNullDesC );
    if ( ( 0 <= iCurrentStateId ) && 
         ( ECompositeCableStateMaxValue > iCurrentStateId ))
        {
        if ( NULL != iStateArray[iCurrentStateId] )
             {
             currentStateName.Set( iStateArray[iCurrentStateId]->Name() );
             }
        }
    return currentStateName;
    }