// -----------------------------------------------------------------------------
// CSensorDataCompensatorItem::GetCompensationType
// -----------------------------------------------------------------------------
//
TInt CSensorDataCompensatorItem::GetCompensationType( const TDesC& aType )
    {
    FUNC_LOG;
    TInt ret( EUnknownCompensationItem );
    if ( aType.MatchF(KUiOrientationTypeText) != KErrNotFound )
        {
        ret = EUICompensationItem;
        }
    else if ( aType.MatchF(KDeviceOrientationTypeText) != KErrNotFound )
        {
        ret = EDeviceCompensationItem;
        }
    return ret;
    }
TInt CSwisExpressionEnvironment::ParsePackageUid(const TDesC& aUidString, TUid& aUid)
	{	
	// Check that the UID string matches the format
	_LIT(KVersionUidFormat,"0x????????");
	if(aUidString.MatchF(KVersionUidFormat) != 0)
		{
		return KErrNotFound;
		}
	 	
	/** 
	 *  Convert the string into a TUint32 representation and check that
	 *  the string is a valid hexadecimal value
	 */
	TLex lexUid(aUidString.Right(8));
	TUint32 uidValue = 0;
	
	if(lexUid.Val(uidValue,EHex) == KErrNone && lexUid.Eos())
		{
		aUid.iUid = uidValue;
		return KErrNone; 
		}
	
	// Return an error if the UID value is not parsed correctly
	return KErrNotFound;
	}
TBIOMessageType TestUniDataModelVCalPlugin::SetMessageType(
                                                           const TDesC& aFileName)
{

	if (aFileName.MatchF(KBIOvCalenderPrefix) == 0)
		{
			return EBiovCalenderMessage;
		}

    return ENoMessage;
}
示例#4
0
TInt StringToOptionL(const TDesC& aString)
	{
	if (aString.MatchF(_L("yes")))
		return CPolicy::EYes;
	else if (aString.MatchF(_L("no")))
		return CPolicy::ENo;
	else if (aString.MatchF(_L("session")))
		return CPolicy::ESessionYes;
	else if (aString.MatchF(_L("sessionyes")))
		return CPolicy::ESessionYes;
	else if (aString.MatchF(_L("sessionno")))
		return CPolicy::ESessionNo;
	else if (aString.MatchF(_L("always")))
		return CPolicy::EAlways;
	else if (aString.MatchF(_L("never")))
		return CPolicy::ENever;	
	
	User::Leave(KErrGeneral);
	/*lint -unreachable*/
	return 0;
	}
//---------------------------------------------------------------
// CNativeMmsUtility::getByUrlL
// @see header
//---------------------------------------------------------------
const QString CNativeMmsUtility::getByUrlL(const TDesC& url)
{
#ifdef _DEBUG_TRACES_
    qDebug() << " Enter CNativeMmsUtility::getByUrlL";
#endif

    CMsvAttachment* targetattachment = NULL;
    TBool found = EFalse;

    //newlc puts it on cleanupstack
    HBufC8* url8bit = HBufC8::NewLC(url.Length());

    CUri16* decodedUri = NULL;
    TUriParser8 parser;

    //get the uri in display format
    if (url.MatchF(KContentIdString) == 0)
    {
        //Remove "cid:" from the beginning
        url8bit->Des().Copy(url.Right(url.Length()
                - KContentIdString().Length() + 1));
        parser.Parse(*url8bit);
    }
    else
    {
        url8bit->Des().Copy(url);
        parser.Parse(*url8bit);
    }
    decodedUri = UriUtils::ConvertToDisplayFormL(parser);
    CleanupStack::PushL(decodedUri);

    //run through the attachements to check for a match
    TUint count = iattachmanager->AttachmentCount();
    for (int i = 0; i < count && !found; i++)
    {
        CMsvAttachment *attachment = iattachmanager->GetAttachmentInfoL(i);
        CleanupStack::PushL(attachment);

        //restore mimeheaders from the attachment
        CMsvMimeHeaders* mimeheaders = CMsvMimeHeaders::NewL();
        CleanupStack::PushL(mimeheaders);
        mimeheaders->RestoreL(*attachment);

        //check for a match with content-loc and then content-id
        if (resolvedByContentLocL(mimeheaders->ContentLocation(), *decodedUri)
                || resolvedByContentIdL(mimeheaders->ContentId(), *decodedUri))
        {
            targetattachment = CMsvAttachment::NewL(*attachment);
            found = ETrue;
        }

        CleanupStack::PopAndDestroy(2, attachment); //mimeheaders, attachment
    }

    CleanupStack::PopAndDestroy(decodedUri);
    if (url8bit)
        CleanupStack::PopAndDestroy(url8bit);

    if (targetattachment)
    {
#ifdef _DEBUG_TRACES_
        qDebug() << " Exit CNativeMmsUtility::getByUrlL";
#endif

        return XQConversions::s60DescToQString(targetattachment->FilePath());
    }
    else
    {
#ifdef _DEBUG_TRACES_
        qDebug() << " Exit CNativeMmsUtility::getByUrlL";
#endif

        return QString();
    }
}