TFileName CDiscussion::GetFileName(RFs& aSession) { TFileName aFilePath; TPtr pId(iDiscussionId->Des()); TInt aLocate; aFilePath.Append(pId.Left(aFilePath.MaxLength() - 24)); aFilePath.Append(_L(".xml")); while((aLocate = aFilePath.Locate('/')) != KErrNotFound) { aFilePath[aLocate] = TChar('~'); } CFileUtilities::CompleteWithApplicationPath(aSession, aFilePath); return aFilePath; }
QList<CContactItemField *> CntTransformAvatar::transformDetailL(const QContactDetail &detail) { if(detail.definitionName() != QContactAvatar::DefinitionName) User::Leave(KErrArgument); QList<CContactItemField *> fieldList; //cast to avatar const QContactAvatar &avatar(static_cast<const QContactAvatar&>(detail)); //create new field QString urlString = avatar.imageUrl().toString(); TPtrC fieldText(reinterpret_cast<const TUint16*>(urlString.utf16())); //copy filename and replace slash with a backslash TFileName filename; for(TInt i(0); i < fieldText.Length(); ++i) { if(i >= filename.MaxLength()) User::Leave(KErrTooBig); if(fieldText[i] == '/') { filename.Append('\\'); } else { filename.Append(fieldText[i]); } } if(filename.Length()) { TUid uid(KUidContactFieldCodImage); CContactItemField* newField = CContactItemField::NewLC(KStorageTypeText, uid); newField->SetMapping(KUidContactFieldVCardMapUnknown); newField->TextStorage()->SetTextL(filename); fieldList.append(newField); CleanupStack::Pop(newField); } return fieldList; }