// --------------------------------------------------------- // TDdParser::MediaObjAttribute() // for OMA v2 // --------------------------------------------------------- // TDdParser::TDdAttr TDdParser::MediaObjAttribute( const TDesC& aAttrName ) const { TDdAttr attr = EDdUnknownAttr; if ( !aAttrName.Compare( KDdUrl ) ) { attr = EDdUrl; } else if ( !aAttrName.Compare( KDdSize ) ) { attr = EDdSize; } else if ( !aAttrName.Compare( KDdType ) ) { attr = EDdType; } else if ( !aAttrName.CompareF( KDdProgressiveDl ) ) { attr = EDdProgressiveDl; } else if ( !aAttrName.CompareF( KDdSuppressUserConfirmation ) ) { attr = EDdSuppressUserConfirmation; } else if ( !aAttrName.Compare( KDdMeta ) ) { attr = EDdMeta; } return attr; }
void CAknFileSettingPage::SetFolderL(const TDesC& aFolder) { TParse parse; TFileName file; TDesC* pos=NULL; parse.SetNoWild(iFileValue,NULL,NULL); if(aFolder.CompareF(KFolderUp)==0) { if(iFileValue.Length()) { if(parse.PopDir()==KErrNone) { TParse parse2; parse2.SetNoWild(iFileValue,NULL,NULL); TPtrC ptr=parse2.DriveAndPath(); file=ptr.Left(ptr.Length()-1); parse2.SetNoWild(file,NULL,NULL); file=parse2.NameAndExt(); pos=&file; iFileValue=parse.DriveAndPath(); } else iFileValue.Zero(); } } else { iFileValue=parse.DriveAndPath(); iFileValue.Append(aFolder); iFileValue.Append('\\'); } ReadFilesL(pos); }
// ----------------------------------------------------------------------------- // CHttpCacheEntry::Externalize // // ----------------------------------------------------------------------------- // void CHttpCacheEntry::ExternalizeL( RWriteStream& aWriteStream, const TDesC& aDirectory ) { // check directory matches filename ASSERT(aDirectory.CompareF(iFileName->Left(aDirectory.Length())) == 0); // url length aWriteStream.WriteInt32L( iUrl->Length() ); // url aWriteStream.WriteL( iUrl->Des() ); // filename // know that filenames are 8 chars and no extension. Can reconstruct on // import from directory and last char. See HttpCacheUtil::GenerateNameLC. aWriteStream.WriteL( iFileName->Des().Right( KFilenameLength ) ); // la aWriteStream.WriteReal64L( iLastAccessed ); // ref aWriteStream.WriteUint32L( iRef ); // size aWriteStream.WriteUint32L( iBodySize ); // size aWriteStream.WriteUint32L( iHeaderSize ); // protected aWriteStream.WriteInt32L( iProtected ); // header data length aWriteStream.WriteInt32L( iHeaderBuffer->Length() ); // header data aWriteStream.WriteL( iHeaderBuffer->Des() ); }
// ============================================================================ // Get the property descriptiont by finding entry for name. // // @param aPropName The name of the prop: <prop>propName</prop> // @since 5.0 // @return prop type. // ============================================================================ // TInt CWidgetBackupRegistryXml::GetPropertyId( const TDesC& aPropName ) { TInt i = 0; for (; i < iProperties.Count(); ++i ) { // use case insensitive match for property names if ( 0 == aPropName.CompareF( iProperties[i].name ) ) { return iProperties[i].id; } } TUint16* name = NULL; name = new TUint16 [aPropName.Length()]; if (name) { TPtr namePtr(name, aPropName.Length()); namePtr.Copy(aPropName); TWidgetProperty property; property.id = iProperties.Count(); property.name.Set( namePtr ); property.type = EWidgetPropTypeUnknown; TInt err = iProperties.Append(property); if (err == KErrNone) { return iProperties.Count() - 1; } delete name; } return EWidgetPropertyIdInvalid; }
void CEmailNotificationParser::AddParsedFieldL(const TDesC& aFieldName, const TDesC& aFieldValue, TBool aMandatory) { // This method is responsible for adding field values found // by the parser to the array of parsed fields. It also // enforces the "each field once only" rule (see Nokia Smart // Messaging spec, 2.0.0pre, 3-34). for (TInt i = 0; i < iParsedFieldArray->Count(); i++) { // Use CompareF() to perform case-insensitive match if (aFieldName.CompareF(iParsedFieldArray->At(i)->FieldName()) == 0) { // Field name exists, so insert a value iParsedFieldArray->At(i)->SetFieldValueL(aFieldValue); iParsedFieldArray->At(i)->SetMandatoryField(aMandatory); iExtendedNotification = ETrue; return; } } // This has been added to fix defect INC38950 // If we have got here, then we have a new field, not specified by one of the fields in iParseFieldArray CParsedField* parsedField = new (ELeave) CParsedField; CleanupStack::PushL(parsedField); parsedField->SetFieldNameL(aFieldName); parsedField->SetFieldValueL(aFieldValue); parsedField->SetMandatoryField(EFalse); iParsedFieldArray->AppendL(parsedField); CleanupStack::Pop(parsedField); }
/* Releases the file if it is being held open by this object. @param Filename of Agenda file */ void CAgnPermanentData::ReleaseFileL(const TDesC& aFilename) { if (iFile && (aFilename.CompareF(iFile->FileName()) == 0)) { Close(); } }
// ============================================================================ // Get the key type out of the keyname // // @param aKeyName The name of the key: <key>KeyName</key> // @since 3.1 // @return Key type. // ============================================================================ // TWidgetPropertyId CWidgetUIConfigHandler::GetPropertyId( const TDesC& aKeyName, DtdType aDtdType, TWidgetPropertyDescriptionId& aPropertyDescriptionId ) { aPropertyDescriptionId = EPropertyDescriptionIdInvalid; TInt i = 0; for (; i < EPropertyDescriptionIdCount; ++i ) { if ( (EDtdTypeApple == aDtdType) && ( iProperties[i].flags & ENokia ) ) { continue; } if ( (EDtdTypeNokia == aDtdType) && ( iProperties[i].flags & EApple ) ) { continue; } // we use case insensitive match for property names if ( 0 == aKeyName.CompareF( iProperties[i].name ) ) { aPropertyDescriptionId = static_cast<TWidgetPropertyDescriptionId>(i); if ( iProperties[i].flags & ESpecial ) { return EWidgetPropertyIdInvalid; } return iProperties[i].id; } } return EWidgetPropertyIdInvalid; }
EXPORT_C TBool CMMFPluginImplementationInformation::SupportsSupplier(const TDesC& aSupplier) const { if (iSupplier) { if (aSupplier.CompareF(*iSupplier) == KErrNone) return ETrue; } return EFalse; }
/** Converts a descriptor containing TRUE or FALSE to its respective TBool @param aString String which contains true or false. */ TBool CTestCalInterimApiSuiteStepBase::ConvertStringToBool(const TDesC& aString) { _LIT(KTrue, "TRUE"); if(aString.CompareF(KTrue) == KErrNone) { return ETrue; } return EFalse; }
/** * Compares the given passwords. * Supports folding matching. */ EXPORT_C TInt CAknAlphaPasswordSettingPage::ComparePasswords( const TDesC& aRefPassword, const TDesC& aCandidatePassword, enum CAknPasswordSettingPage::TAknPasswordMatchingMode aMode) const { TBool retVal(EFalse); if ( aMode == ECaseSensitive ) retVal = aRefPassword.Compare( aCandidatePassword ); else retVal = aRefPassword.CompareF( aCandidatePassword ); return retVal; }
/** Return the index of the CCntDbManager instance which has a Contacts database filename equal to aCntFile. If no CCntDbManager instance has this filename then KErrNotFound is returned. @param aCntFile Contacts database filename. @return Index of CCntDbManager instance which has a Contacts database filename equal to aCntFile or KErrNotFound if no match. */ TInt CCntDbManagerController::FindExistingFileManager(const TDesC& aCntFile) const { for(TInt i=iManagers.Count()-1; i>=0; --i) { if(aCntFile.CompareF(iManagers[i]->CntFile()) == 0) { return i; } } return KErrNotFound; }
/* Checks whether this object is the only one that is currently using aFilename. @return ETrue if this is the only object referencing aFilename, EFalse otherwise. */ TBool CAgnPermanentData::IsOnlyClientOfFile(const TDesC& aFilename) { if (iFile) { if ((aFilename.CompareF(iFile->FileName()) == 0) && iFile->ReferenceCount() == 1) { return ETrue; } } return EFalse; }
//--------------------------------------------------------------- // SmilXmlReader::setCloseStateL // @see header //--------------------------------------------------------------- void SmilXmlReader::setCloseStateL( const TDesC& tagname ) { if ( tagname.CompareF( KSmilTag ) == 0 ) { iState = ESmilFinished; } else if ( tagname.CompareF( KHeadTag ) == 0 ) { iState = EHeadFinished; } else if ( tagname.CompareF( KLayoutTag ) == 0 ) { iState = ELayoutFinished; } else if ( tagname.CompareF( KBodyTag ) == 0 ) { iState = EBodyFinished; } return; }
// ----------------------------------------------------------------------------- TPtrC CPresenceCacheBuddyInfo::DoGet16BitValue(const TDesC& aKey ) { HBufC8* val = NULL; TInt* pos = iHashMap.Find( STRCNST( aKey ) ); TPtrC result( KNullDesC() ); if ( pos ) { val = iValues[*pos]; if ( val ) { HBufC* temp = NULL; // Convert Utf-8 to Unicode TRAPD( errx, temp = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *val ) ); if ( !errx && temp ) { // Avalibility text handled here if ( !aKey.CompareF( NPresenceCacheFieldName::KAvailability ) ) { delete iAvailabilityTextBuf; iAvailabilityTextBuf = NULL; iAvailabilityTextBuf = temp; result.Set( iAvailabilityTextBuf->Des() ); } // Status message handled here else if( !aKey.CompareF( NPresenceCacheFieldName::KStatusMessage ) ) { delete iStatusTextBuf; iStatusTextBuf = NULL; iStatusTextBuf = temp; result.Set( iStatusTextBuf->Des() ); } } } } return result; }
TBool CUpsClientStep::FindOpenSession(const TDesC& aServerName,TInt &position) { TBool sessionFound = EFalse; TInt sessionsCount = iArraySessionsInUse.Count(); for(TInt index = 0;index < sessionsCount; ++index) { if(!aServerName.CompareF(iArraySessionsInUse[index]->iServerName)) { position = index; sessionFound = ETrue; break; } } return sessionFound; } // End of function
TBool CIacSettingsParser::isMandatoryData(const TDesC& aFieldName) { __ASSERT_DEBUG(aFieldName.Length() > 0 ,User::Panic(KIACP,EIacpEmptyBuffer)); if(aFieldName.Length() == 5) { if(aFieldName.CompareF(SMS_ISP_M_NAME) == 0 || aFieldName.CompareF(SMS_ISP_I_NAME) ==0 || (aFieldName.CompareF(GPRSS_PDP_TYPE)) ) return ETrue; } else if(aFieldName.Length() == 4) { if(aFieldName.CompareF(SMS_MAILBOX_NAME) == 0 || aFieldName.CompareF(SMS_MAILBOX_PASS) == 0 || aFieldName.CompareF(SMS_RECEIVING_HOST) == 0 || aFieldName.CompareF(SMS_SENDING_HOST) == 0 || aFieldName.CompareF(SMS_USER_EMAIL_ADDR)== 0 || aFieldName.CompareF(SMS_MAIL_PROTOCOL)== 0 || aFieldName.CompareF(GPRSS_APN) == 0 || aFieldName.CompareF(GPRSS_PDP_ADDRESS) == 0) return ETrue; } return EFalse; }
TInt CSpecialLog::ParseLineNormalL(TInt /*aSection*/, TInt /*aLineNo*/, const TDesC & aKey, const TDesC & aValue) { TInt index; for (index = 0; index < KNumSpecialLogKeys; index ++) { TPtrC text((const TUint16 *) KSpecialLogKeyText[index]); if (0 == aKey.CompareF(text)) { if (0 == aValue.Length()) // Value is empty, treat as tag, eg. "Key=" { SpecialLogL(index); return 0; } TChar first = aValue[0]; TInt intValue; TLex lex(aValue); if (first >= '0' && first <= '9' && KErrNone != lex.Val(intValue)) // Integer { SpecialLogL(index, intValue); } else // Text { TInt textLength = aValue.Length(); // Remove quote marks if present. if ('"' == first && '"' == aValue[textLength - 1] && textLength > 2) { SpecialLogL(index, aValue.Mid(1, textLength - 2)); } else { SpecialLogL(index, aValue); } } return 0; } } return 0; }
/* ------------------------------------------------------------------------------- Class: CStifFileParser Method: PushFileToStack Description: Opens file and pushes it to stack Parameters: TDesc& aFileName in: name of file to open and add to stack Return Values: None Errors/Exceptions: None Status: Proposal ------------------------------------------------------------------------------- */ void CStifFileParser::PushFileToStackL(const TDesC& aFileName) { //First check if file is not already included for(TInt i = 0; i < iFileNames.Count(); i++) { if(aFileName.CompareF(iFileNames[i]->Des()) == KErrNone) { __TRACE(KError, (_L("File [%S] was already included. Ignoring"), &aFileName)); return; } } //Open and add file to stack RFile *nf = new RFile(); __TRACE(KInfo, (_L("Including file [%S]"), &aFileName)); TInt r = nf->Open(iFileServer, aFileName, EFileRead | EFileShareAny); if(r == KErrNone) { //Add to stack iFileStack->PushL(nf); //And add to file names array HBufC* newFile = aFileName.AllocLC(); User::LeaveIfError(iFileNames.Append(newFile)); CleanupStack::Pop(newFile); //Set valid pointer of current file iCurrentFile = nf; } else { __TRACE(KError, (_L("Could not open file [%S]. Error %d. Ignoring"), &aFileName, r)); } }
TBool CIacSettingsParser::IsValidToken(const TDesC& aToken) { __ASSERT_DEBUG(aToken.Length() > 0 ,User::Panic(KIACP,EIacpEmptyBuffer)); // case EBasicMail if(aToken.Length() == 5) { if (aToken.CompareF(SMS_ISP_M_NAME) ==0 ||aToken.CompareF(SMS_HOTLIST_ITEM_NAME) == 0) return ETrue; } else if(aToken.Length() == 4) { if (aToken.CompareF(SMS_MAILBOX_NAME) ==0 || aToken.CompareF(SMS_MAILBOX_PASS) ==0 || aToken.CompareF(SMS_USER_EMAIL_ADDR) ==0 || aToken.CompareF(SMS_RECEIVING_HOST) ==0 || aToken.CompareF(SMS_SENDING_HOST) ==0 || aToken.CompareF(SMS_MAIL_PROTOCOL) ==0 || aToken.CompareF(SMS_FOLDER_PATH)==0 || aToken.CompareF(SMS_HOTLIST_ITEM_URL) ==0 || aToken.CompareF(SMS_HOTLIST_AUTOSELECT_IAP) ==0 || aToken.CompareF(SMS_HOTLIST_ACCESS_POINT) ==0 || aToken.CompareF(SMS_HOTLIST_FOLDER) ==0) return ETrue; } //case EBasicIAP if(aToken.Length() == 5) { if (aToken.CompareF(SMS_ISP_I_NAME) ==0 || aToken.CompareF(SMS_IP_NAME_SERVER1) ==0 || aToken.CompareF(SMS_IP_NAME_SERVER2)==0) return ETrue; } else if(aToken.Length() == 4) { if (aToken.CompareF(SMS_INIT_STRING) ==0 || aToken.CompareF(SMS_DEFAULT_TEL_NUM) ==0 || aToken.CompareF(SMS_LOGIN_NAME) ==0 || aToken.CompareF(SMS_PROMPT_FOR_LOGIN) ==0 || aToken.CompareF(SMS_LOGIN_PASS) ==0 || aToken.CompareF(SMS_IP_NETMASK) ==0 || aToken.CompareF(SMS_IP_GATEWAY) ==0) return ETrue; } else if(aToken.Length() == 3) { if(aToken.CompareF(SMS_IP_ADDR) ==0) return ETrue; } //caes EExtendedIAP if(aToken.Length() == 4) { if (aToken.CompareF(SMS_PROXY_EXCEPTIONS) ==0 || aToken.CompareF(SMS_PROXY_PORT_NUMBER) ==0 || aToken.CompareF(SMS_PROXY_SERVER_NAME)==0 || aToken.CompareF(SMS_LOGIN_CUSTOMISATION)==0 || aToken.CompareF(SMS_ENABLE_SW_COMP) ==0 || aToken.CompareF(SMS_SECURE_PROXY) ==0 || aToken.CompareF(SMS_SECURE_PORT)==0) return ETrue; } // GPRS settings if(aToken.Length() == 4) { if (aToken.CompareF(GPRSS_APN)==0 || aToken.CompareF(GPRSS_PDP_ADDRESS)==0 || aToken.CompareF(GPRSS_IF_NAME)==0 || aToken.CompareF(GPRSS_LOGIN_NAME)==0 || aToken.CompareF(GPRSS_PROMPT_FOR_LOGIN)==0 || aToken.CompareF(GPRSS_LOGIN_PASS)==0 || aToken.CompareF(GPRSS_IP_ADDR)==0 || aToken.CompareF(GPRSS_DNS_FROM_SERVER)==0 || aToken.CompareF(GPRSS_IP_NETMASK)==0 ) return ETrue; } else if (aToken.Length() == 5) { if (aToken.CompareF(GPRSS_PDP_TYPE)==0 || aToken.CompareF(GPRSS_DNS_FROM_SERVER)==0 || aToken.CompareF(GPRSS_IP_NAME_SERVER1)==0 || aToken.CompareF(GPRSS_IP_NAME_SERVER2)==0 || aToken.CompareF(GPRSS_NAME)==0 ) return ETrue; } else if(aToken.Length() == 3) { if (aToken.CompareF(GPRSS_IP_ADDR)==0) return ETrue; } //case EExtScriptSettings if(aToken.Length() == 5) { if(aToken.CompareF(SMS_SCRIPT_NAME) ==0 || aToken.CompareF(SMS_SCRIPT_TYPE) ==0 || aToken.CompareF(SMS_SCRIPT_DATA) ==0 ) return ETrue; } else if(aToken.Length() == 4) { if(aToken.CompareF(SMS_SCRIPT_ADD) ==0) return ETrue; } //case EExtSmsSettings if(aToken.Length() == 5) { if(aToken.CompareF(SMS_SERVICE_CENTER_NAME) ==0 ) return ETrue; } else if(aToken.Length() == 4) { if(aToken.CompareF(SMS_SERVICE_CENTER_ADDRESS) ==0) return ETrue; } //case EExtTelephoneSettings if(aToken.Length() == 4) { if(aToken.CompareF(SMS_TEL_VOICE_MAILBOX_NUM) ==0) return ETrue; } return EFalse; //Token not valid }
TBool CIacSettingsParser::SetBioMsgTypeL(const TDesC& aLeftToken, TSmsType& aType) { // basic internet if(aLeftToken.CompareF(KINTERNET) == 0 ) { aType = IsSmsExtendedIAP() ? EExtendedIAP : EBasicIAP; if(iSmsType == ESmsTypeUndefined) iSmsType = aType; else if(iSmsType == EExtGprsSettings) iSmsType = EExtGprsIAP; else if(iSmsType == EBasicMail) iSmsType = EBasicMailIAP; else if(iSmsType == EBasicMailIAP) iSmsType = EBasicMailIAP; else iSmsType = ESmsMixedContent; } // gprs else if(aLeftToken.CompareF(KGPRS) == 0 ) { if(iSmsType == ESmsTypeUndefined) iSmsType = EExtGprsSettings; else if(iSmsType == EBasicMail) iSmsType = EExtGprsMail; else if(iSmsType == EBasicIAP) iSmsType = EExtGprsIAP; else if(iSmsType == EBasicMailIAP) iSmsType = EExtGprsIAPMail; else iSmsType = ESmsMixedContent; aType = EExtGprsSettings; } // basic email else if(aLeftToken.CompareF(KMAIL) == 0 ) { if(iSmsType == ESmsTypeUndefined) iSmsType = EBasicMail; else if(iSmsType == EExtGprsSettings) iSmsType = EExtGprsMail; else if(iSmsType == EBasicIAP) iSmsType = EBasicMailIAP; else if(iSmsType == EExtGprsIAP) iSmsType = EExtGprsIAPMail; else if(iSmsType == EBasicMailIAP) iSmsType = EBasicMailIAP; else iSmsType = ESmsMixedContent; aType = EBasicMail; } // script settings else if(aLeftToken.CompareF(KSCRIPT) == 0 ) //Script Settings { if(iSmsType == ESmsTypeUndefined) aType = iSmsType = EExtScriptSettings; else iSmsType = ESmsMixedContent; } // SMS settings else if(aLeftToken.CompareF(KSMS) == 0 ) //SMS Settings { if(iSmsType == ESmsTypeUndefined) aType = iSmsType = EExtSmsSettings; else iSmsType = ESmsMixedContent; } // voice telephone settings else if(aLeftToken.CompareF(KTELEPHONE) == 0 ) //Telephone Settings (voice mailbox number) { if(iSmsType == ESmsTypeUndefined) aType = iSmsType = EExtTelephoneSettings; else iSmsType = ESmsMixedContent; } // WWW Hotlist items else if(aLeftToken.CompareF(KWWWHotlist) == 0 ) { if(iSmsType == ESmsTypeUndefined) aType = iSmsType = EExtWWWHostListItem; else if(iSmsType == EExtWWWHostListItem) return EFalse; else iSmsType = ESmsMixedContent; } else return EFalse; return ETrue; }
// --------------------------------------------------------- // TDdParser::SetMetaAttrL() // --------------------------------------------------------- // void TDdParser::SetMetaAttrL( TDdAttr aAttr, const TDesC& aValue, CMediaObjectData *& aMediaObject ) { TInt ok( ETrue ); switch( aAttr ) { case EDdName: { if ( !aMediaObject->Name().Length() ) { ok = aMediaObject->SetNameL( aValue ); } break; } case EDdDescription: { if ( !aMediaObject->Description().Length() ) { ok = aMediaObject->SetDescriptionL( aValue ); } break; } case EDdInstallNotify: { if ( !aMediaObject->InstallNotify().Length() ) { ok = aMediaObject->SetInstallNotifyL( aValue ); } break; } case EDdInfoUrl: { if ( !aMediaObject->InfoUrl().Length() ) { ok = aMediaObject->SetInfoUrlL( aValue ); } break; } case EDdIcon: { if ( !aMediaObject->Icon().Length() ) { ok = aMediaObject->SetIconL( aValue ); } break; } case EDdOrder: { TBool isPostOrder( EFalse ); if ( !aValue.CompareF( KDdPost ) ) { isPostOrder = ETrue; } else if ( aValue.CompareF( KDdAny ) ) { // Expected 'post' or 'any' Error( KErrCodInvalidDescriptor ); break; } aMediaObject->SetOrderIsPost( isPostOrder ); break; } case EDdText: { //TODO for OMA2 /* if ( !iData->Text().Length() ) { ok = iData->SetTextL( aValue ); } */ break; } default: { // Unexpected value. CodPanic( ECodInternal ); } } if ( !ok ) { Error( KErrCodInvalidDescriptor ); } }
// ---------------------------------------------------------------------------- // Remove contacts that do not have exactly the correct email address // e.g. if [email protected] address is requested, the for example a contact with address [email protected] will be removed // from the result. // This filtering is done only in the syncronous version of MatchDataL // ---------------------------------------------------------------------------- void CContactMatcher::RemoveSimilarEmailAddressesL( const TDesC& aData, CVPbkContactLinkArray& aLinkArray, const MVPbkFieldTypeList& aFieldTypes ) { TVPbkFieldVersitProperty prop; prop.SetName( EVPbkVersitNameEMAIL ); // do extra checks for email addresses const MVPbkFieldType* foundType = NULL; // Continue only if at least one type is EVPbkVersitNameEMAIL TInt i; for ( i = 0 ; i < aFieldTypes.FieldTypeCount() ; i++ ) { foundType = &(aFieldTypes.FieldTypeAt( i )); if ( foundType->VersitProperties().Count() > 0 && foundType->VersitProperties()[0].Name() == prop.Name() ) { break; } } if ( i == aFieldTypes.FieldTypeCount() ) { // no email types return; } const MVPbkFieldTypeList& fieldTypeList = FieldTypes(); TInt index = 0; TBool isExactMatch; while( index < aLinkArray.Count() ) { MVPbkStoreContact* storeContact; GetStoreContactL( aLinkArray.At( index ), &storeContact ); storeContact->PushL(); isExactMatch = EFalse; for ( TInt i = 0; i < fieldTypeList.FieldTypeCount(); i++ ) { // find the email property foundType = &(fieldTypeList.FieldTypeAt( i )); if ( foundType->VersitProperties().Count() > 0 && foundType->VersitProperties()[0].Name() == prop.Name() ) { TPtrC src = GetFieldDataTextL(*storeContact, *foundType ); if ( aData.CompareF( src ) == 0 ) { isExactMatch = ETrue; } } } if ( isExactMatch ) { // go for the next contact index++; } else { // remove the contact, because the email address does not match the one queried. // the next one will take plce of this contact in the list (=do not increase index) aLinkArray.Delete( index ); } CleanupStack::PopAndDestroy( storeContact ); } }
//--------------------------------------------------------------- // SmilXmlReader::setOpenStateL // @see header //--------------------------------------------------------------- void SmilXmlReader::setOpenStateL( const TDesC& tagname ) { if ( tagname.CompareF( KSmilTag ) == 0 ) { if ( iState != EInitial ) User::Leave( KErrCorrupt ); iState = ESmil; } else if ( tagname.CompareF( KHeadTag ) == 0 ) { if (iState != ESmil) User::Leave( KErrCorrupt ); iState = EHead; } else if ( tagname.CompareF( KLayoutTag ) == 0 ) { if ( iState != EHead ) User::Leave( KErrCorrupt ); iState = ELayout; } else if ( tagname.CompareF( KBodyTag ) == 0 ) { if ( iState != ESmil && iState != EHeadFinished ) User::Leave( KErrCorrupt ); iState = EBody; } else if ( tagname.CompareF( KImageTag ) == 0 || tagname.CompareF( KTextTag ) == 0 || tagname.CompareF( KAudioTag ) == 0 || tagname.CompareF( KRefTag ) == 0 || tagname.CompareF( KTextStreamTag ) == 0 || tagname.CompareF( KAnimationTag ) == 0 || tagname.CompareF( KVideoTag ) == 0 ) { if ( iState != EBody ) User::Leave(KErrCorrupt); } return; }
//fix for DEF017686: EMail notification parser leaves when field data is empty void CEmailNotificationParser::LeaveIfEmptyFieldsL(const TDesC& aFieldName, const TLex& aTokenLex) { /* The following checks for an empty field value. The only fields allowed to be empty are the subject and extension fields. Hence, the check is done when aFieldName is not a subject field and an extension field. However, it is not possible to explicitly check for an extension field as we don't know which strings to compare. Therefore, a comparison with all the known field names must be performed instead. The risk is fairly small as the change is localised and it can be easily tested. */ if ((aFieldName.CompareF(KHeaderFrom)==KErrNone) || (aFieldName.CompareF(KHeaderSize)==KErrNone) || (aFieldName.CompareF(KHeaderUidImap)==KErrNone) || (aFieldName.CompareF(KHeaderUidPop)==KErrNone) || (aFieldName.CompareF(KHeaderServerId)==KErrNone) || (aFieldName.CompareF(KHeaderAttachments)==KErrNone) || (aFieldName.CompareF(KHeaderTo)==KErrNone) || (aFieldName.CompareF(KHeaderCc)==KErrNone) || (aFieldName.CompareF(KHeaderDate)==KErrNone) || (aFieldName.CompareF(KHeaderFolder)==KErrNone) || (aFieldName.CompareF(KHeaderSender)==KErrNone) || (aFieldName.CompareF(KHeaderReplyTo)==KErrNone) || (aFieldName.CompareF(KHeaderUidValidity)==KErrNone) //not sure if this actually exists*/ ) if (aTokenLex.Eos()) User::Leave(KBspSmartMessageInvalidToken); }
// ----------------------------------------------------------------------------- // CSensorDataCompensatorItem::Parse // ----------------------------------------------------------------------------- // TBool CSensorDataCompensatorItem::Parse( const TDesC& aValueType, const TDesC& aValue ) { FUNC_LOG; TBool ret( EFalse ); TInt valueType( DesToValueType( aValueType ) ); if ( valueType >= 0 ) { TInt value = 0; if ( valueType == ETappingAxisX || valueType == ETappingAxisY || valueType == ETappingAxisZ ) { // Parse enum value if( !aValue.CompareF( KDeg0 ) ) { value = TCompensationTypeDirectionData::ECw0; } else if( !aValue.CompareF( KDeg90 ) ) { value = TCompensationTypeDirectionData::ECw90; } else if( !aValue.CompareF( KDeg180 ) ) { value = TCompensationTypeDirectionData::ECw180; } else if( !aValue.CompareF( KDeg270 ) ) { value = TCompensationTypeDirectionData::ECw270; } else { INFO_1( "CSensorDataCompensatorItem::ParseItem() - Unknown text value: [%S]", &aValue ); value = TCompensationTypeDirectionData::ECw0; } } else { ParseInt( value, aValue ); } // Update value if it has changed TInt previousValue = iValues[ valueType ]; if ( previousValue != value ) { INFO_3( "CSensorDataCompensatorItem::ParseItem() - ValueType %S changed [%D, %D]", &aValueType, previousValue, value ); iValues[ valueType ] = value; ret = ETrue; } else { INFO_2( "CSensorDataCompensatorItem::ParseItem() - ValueType %S not changed [%D]", &aValueType, previousValue ); } } else { INFO_1( "CSensorDataCompensatorItem::ParseItem() - Unknown value type: %S", &aValueType ); } return ret; }
static THelperOp TaskType(const TDesC& aCmdLine) { THelperOp task = EOpNotDefined; if(aCmdLine.CompareF(_L("-delete_db1")) == 0) { task = EDeleteDatabase1; } else if(aCmdLine.CompareF(_L("-delete_db2")) == 0) { task = EDeleteDatabase2; } else if(aCmdLine.CompareF(_L("-db_is_open")) == 0) { task = EIsDatabaseOpen; } else if(aCmdLine.CompareF(_L("-db_size")) == 0) { task = EDatabaseSize; } else if(aCmdLine.CompareF(_L("-copy_corrupt")) == 0) { task = ECopyCorruptDbFile; } else if(aCmdLine.CompareF(_L("-copy_corrupt_damaged")) == 0) { task = ECopyCorruptDamagedDbFile; } else if(aCmdLine.CompareF(_L("-copy_old")) == 0) { task = ECopyOldDbFile; } else if(aCmdLine.CompareF(_L("-add_event")) == 0) { task = EAddEvent; } else if(aCmdLine.CompareF(_L("-add_view_test_events")) == 0) { task = EAddTestEvents; } else if(aCmdLine.CompareF(_L("-add_event_type")) == 0) { task = EAddEventType; } else if(aCmdLine.CompareF(_L("-invalid_schema")) == 0) { task = EInvalidSchema; } else if(aCmdLine.CompareF(_L("-is_matching_enabled")) == 0) { task = EIsMatchingEnabled; } else { RDebug::Print(_L("** t_logHiCapHelper, ** Bad command line argument: %S\r\n"), &aCmdLine); User::Panic(KLogHiCapHelperPanic, KErrArgument); } return task; }
// --------------------------------------------------------- // TDdParser::SetMediaObjAttrL() // --------------------------------------------------------- // void TDdParser::SetMediaObjAttrL( TDdAttr aAttr, const TDesC& aValue, CMediaObjectData *& aMediaObject ) { TInt ok( ETrue ); switch( aAttr ) { case EDdSize: { if ( !aMediaObject->Size() ) { // Parse as TUint - negative not allowed. TUint size; TLex lex( aValue ); if ( !lex.Val( size ) ) { aMediaObject->SetSize( size ); } else { ok = EFalse; } } break; } case EDdType: { ok = aMediaObject->AddTypeL( aValue ); break; } case EDdProgressiveDl: { TBool pd( EFalse ); if ( !aValue.CompareF( KDdTrue ) ) { pd = ETrue; } else if ( aValue.CompareF( KDdFalse ) ) { // Expected 'true' or 'false' Error( KErrCodInvalidDescriptor ); break; } aMediaObject->SetProgressiveDownload( pd ); break; } case EDdSuppressUserConfirmation: { TInt confirm = CCodData::ENever; if ( !aValue.CompareF(KDdNever) ) { confirm = CCodData::ENever; } else if ( aValue.CompareF(KDdUserConfirmStepOnly) ) { confirm = CCodData::EUserConfirmStepOnly; } else if ( aValue.CompareF(KDdAlways) ) { confirm = CCodData::EAlways; } else { Error( KErrCodInvalidDescriptor ); } iData->SetSuppressConfirm( confirm ); break; } case EDdUpdatedDDURI: { if(!iData->UpdatedDDUriL().Length()) { iData->SetUpdatedDDURI( aValue ); } break; } default: { // Unexpected value. CodPanic( ECodInternal ); } } if ( !ok ) { Error( KErrCodInvalidDescriptor ); } }
TInt64 CFileEngine::GetFreeSpace(const TDesC& aDriveName) { TVolumeInfo info; RFs iFs; User::LeaveIfError(iFs.Connect()); info.iFree = 0; if (aDriveName.CompareF(_L("A")) == 0) { iFs.Volume(info, EDriveA); } else if(aDriveName.CompareF(_L("B")) == 0) { iFs.Volume(info, EDriveB); } else if(aDriveName.CompareF(_L("C")) == 0) { iFs.Volume(info, EDriveC); } else if(aDriveName.CompareF(_L("D")) == 0) { iFs.Volume(info, EDriveD); } else if(aDriveName.CompareF(_L("E")) == 0) { iFs.Volume(info, EDriveE); } else if(aDriveName.CompareF(_L("F")) == 0) { iFs.Volume(info, EDriveF); } else if(aDriveName.CompareF(_L("G")) == 0) { iFs.Volume(info, EDriveG); } else if(aDriveName.CompareF(_L("H")) == 0) { iFs.Volume(info, EDriveH); } else if(aDriveName.CompareF(_L("I")) == 0) { iFs.Volume(info, EDriveI); } else if(aDriveName.CompareF(_L("J")) == 0) { iFs.Volume(info, EDriveJ); } else if(aDriveName.CompareF(_L("K")) == 0) { iFs.Volume(info, EDriveK); } else if(aDriveName.CompareF(_L("L")) == 0) { iFs.Volume(info, EDriveL); } else if(aDriveName.CompareF(_L("M")) == 0) { iFs.Volume(info, EDriveM); } else if(aDriveName.CompareF(_L("N")) == 0) { iFs.Volume(info, EDriveN); } else if(aDriveName.CompareF(_L("O")) == 0) { iFs.Volume(info, EDriveO); } else if (aDriveName.CompareF(_L("P")) == 0) { iFs.Volume(info, EDriveP); } else if(aDriveName.CompareF(_L("Q")) == 0) { iFs.Volume(info, EDriveQ); } else if(aDriveName.CompareF(_L("R")) == 0) { iFs.Volume(info, EDriveR); } else if(aDriveName.CompareF(_L("S")) == 0) { iFs.Volume(info, EDriveS); } else if(aDriveName.CompareF(_L("T")) == 0) { iFs.Volume(info, EDriveT); } else if(aDriveName.CompareF(_L("U")) == 0) { iFs.Volume(info, EDriveU); } else if(aDriveName.CompareF(_L("V")) == 0) { iFs.Volume(info, EDriveV); } else if(aDriveName.CompareF(_L("W")) == 0) { iFs.Volume(info, EDriveW); } else if(aDriveName.CompareF(_L("X")) == 0) { iFs.Volume(info, EDriveX); } else if(aDriveName.CompareF(_L("Y")) == 0) { iFs.Volume(info, EDriveY); } else if(aDriveName.CompareF(_L("Z")) == 0) { iFs.Volume(info, EDriveZ); } else { return 0; } iFs.Close(); return (TInt64)info.iFree/1024; }
void CAMPreInstallApp::ListPreInstalledAppL(const TDesC& installDocPath) { RDEBUG("Clist_PreInstallAppUi: ListPreInstalledApp: <<<<"); CDir* dir= NULL; TInt err = iFs.GetDir(installDocPath, KEntryAttNormal, ESortByName, dir); // _LIT(KInstallpath,"C:\\private\\10202dce\\"); //TInt err = iFs.GetDir(KInstallpath, KEntryAttNormal, ESortByName, dir); RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: err in getting dir list : %d",err); if (err==KErrNone) { CleanupStack::PushL(dir); RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: no of dir's : %d",dir->Count()); for (TInt i(0); i < dir->Count(); i++) { RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: <<<< dir entry %d", i); TEntry entry; entry = (*dir)[i]; HBufC* pathAndName = HBufC::NewLC(installDocPath.Length() + entry.iName.Length() ); TPtr ptrPathAndName = pathAndName->Des(); ptrPathAndName.Append(installDocPath); ptrPathAndName.Append(entry.iName); HBufC* mimeType = HBufC::NewLC(KMaxDataTypeLength); //Recognize if (!RecognizeL(*pathAndName, mimeType)) { CleanupStack::PopAndDestroy(mimeType); CleanupStack::PopAndDestroy(pathAndName); continue; } #ifdef RD_MULTIPLE_DRIVE if (TParsePtrC(installDocPath).Path().CompareF(KPreInstallPath) == 0) #else if (installDocPath.CompareF(iPreInstallPath) == 0) #endif { RDEBUG("Clist_PreInstallAppUi: ListPreInstalledApp: <<<< Entered installDocPath.CompareF(iPreInstallPath)"); Swi::RSisRegistrySession regSession; CleanupClosePushL(regSession); User::LeaveIfError(regSession.Connect() ); RArray<TUid> uids; CleanupClosePushL(uids); regSession.InstalledUidsL(uids); RFile temp; User::LeaveIfError(temp.Open(iFs, *pathAndName, EFileShareReadersOnly | EFileRead) ); CleanupClosePushL(temp); TUid appUid; TInt uidLen = sizeof(TInt32); TInt seekLen = sizeof(TInt32) + sizeof(TInt32); User::LeaveIfError(temp.Seek(ESeekStart, seekLen)); TPckg<TInt32> uid1(appUid.iUid); User::LeaveIfError(temp.Read(uid1, uidLen)); if (uid1.Length() != uidLen) { User::Leave(KErrUnderflow); } //checking whether this is installed or not TBool installed = regSession.IsInstalledL(appUid); Swi::RSisRegistryEntry registryEntry; TInt regEntryError = registryEntry.Open(regSession, appUid); RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: RegEntryError : %d",regEntryError); //User::LeaveIfError(regEntryError); if (regEntryError == KErrNone) { CleanupClosePushL(registryEntry); TBool isPreInstalled = registryEntry.PreInstalledL(); // TBool isPreInstalled = ETrue; RDEBUG_4("Clist_PreInstallAppUi: ListPreInstalledApp: UID is : '0x%X', installed:, preinstalled %d %d",appUid,installed,isPreInstalled); for (TInt i(0); isPreInstalled && i < uids.Count(); i++) { if (appUid == uids[i]) { RDEBUG("Clist_PreInstallAppUi: appUid == uids[i]"); Swi::CSisRegistryPackage* sisRegistry = NULL; TRAPD( err, sisRegistry = regSession.SidToPackageL( uids[i] ) ) ; //User::LeaveIfError(err); if(err == KErrNone) { RDEBUG("Clist_PreInstallAppUi: err == KErrNone"); TPreInstalledAppParams *params = new (ELeave) TPreInstalledAppParams; params->iPreInstalledAppame.Copy(sisRegistry->Name()); params->iPreInstalledAppVendorName.Copy( sisRegistry->Vendor()); params->iPreInstalledAppUid = sisRegistry->Uid(); params->iMimeType.Copy(*mimeType); //Get version TVersion version = registryEntry.VersionL(); TBuf8<KVersionLength> pkgDes; pkgDes.AppendNum(version.iMajor); pkgDes.Append(KLiteralPeriod); pkgDes.AppendNum(version.iMinor); params->iVersion.Copy(pkgDes); iPreInstalledAppParams.AppendL(params); RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: Installed App UID is : '0x%X'",appUid); RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: Installed App Name is: %S",&(sisRegistry->Name())); RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: Installed App Vendor is: %S",&(sisRegistry->Vendor())); RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: Installed App UID is : '0x%X'",sisRegistry->Uid()); delete sisRegistry; } continue; } } CleanupStack::PopAndDestroy(®istryEntry); } CleanupStack::PopAndDestroy(&temp); CleanupStack::PopAndDestroy(&uids); CleanupStack::PopAndDestroy(®Session); CleanupStack::PopAndDestroy(mimeType); CleanupStack::PopAndDestroy(pathAndName); } } CleanupStack::PopAndDestroy(dir); } }