// --------------------------------------------------------- // CUniObjectList::EnsureAllObjectsHaveContentLocationL // // EnsureAllObjectsHaveContentLocationL // --------------------------------------------------------- // EXPORT_C void CUniObjectList::EnsureAllObjectsHaveContentLocationL() { CMsvStore* store = iMtm.Entry().EditStoreL(); CleanupStack::PushL( store ); MMsvAttachmentManager& manager = store->AttachmentManagerL(); MMsvAttachmentManagerSync& managerSync = store->AttachmentManagerExtensionsL(); TBool commit( EFalse ); TInt a = iObjectArray->Count(); while ( a-- ) { CUniObject* obj = iObjectArray->At( a ); if ( !obj->MimeInfo()->ContentLocation().Length() && obj->AttachmentId( ) ) { CMsvAttachment* attachment = manager.GetAttachmentInfoL( obj->AttachmentId() ); CleanupStack::PushL( attachment ); TParsePtrC parse( obj->MediaInfo()->FullFilePath() ); TPtrC nameAndExt( parse.NameAndExt() ); obj->MimeInfo()->EnsureContentLocationL( manager, *attachment, nameAndExt ); managerSync.ModifyAttachmentInfoL( attachment ); CleanupStack::Pop( attachment ); commit = ETrue; } } if ( commit ) { store->CommitL(); } CleanupStack::PopAndDestroy( store ); }
// // Look for aFileName in all available drives in order // TInt TFindFile::DoFindNextInDriveList() { TInt found; TDriveInfo driveInfo; const TUint matchedFlags= iMatchMask & KDriveAttMatchedFlags; //KDriveAttMatchedFlags = 0xFFF const TUint matchedAtt = iMatchMask & KDriveAttMatchedAtt; //KDriveAttMatchedAtt = 0x0FFF0000 if (iMatchMask == (KDriveAttExclude | KDriveAttMatchedFlags ) ) //If all drives are excluded. return KErrNotFound; FOREVER { found =0; TInt currentDrive=iCurrentDrive; if (iCurrentDrive==-1) currentDrive=EDriveZ; if (currentDrive<=-2) return(KErrNotFound); iCurrentDrive--; if (!iDrvList[currentDrive]) continue; TInt err = iFs->Drive(driveInfo,currentDrive); if(iMatchMask == 0) { if (iDrvList[currentDrive] & KDriveAttRemote) continue; // NOT allowed on REMOTE DRIVE if ((iDrvList[currentDrive] & (KDriveAttLocal|KDriveAttRom))==0) continue; } else { if(matchedFlags != 0 ) { switch(matchedAtt) { //found ==0 means that this drive attributes didn't match the flags case KDriveAttExclude : found = (driveInfo.iDriveAtt & matchedFlags ) ? 0:iDrvList[currentDrive] ; break; case 0: found = (driveInfo.iDriveAtt & matchedFlags) ? iDrvList[currentDrive]:0 ; break; case KDriveAttExclusive : if(matchedFlags != KDriveAttLogicallyRemovable) { found = ((TUint8)(driveInfo.iDriveAtt) == matchedFlags) ?iDrvList[currentDrive]:0; } else { found = (driveInfo.iDriveAtt == (matchedFlags | KDriveAttRemovable) ) ?iDrvList[currentDrive]:0; } break; case KDriveAttExclude | KDriveAttExclusive: if(matchedFlags != KDriveAttLogicallyRemovable) { found = ((TUint8)(driveInfo.iDriveAtt) == matchedFlags) ?0:iDrvList[currentDrive]; } else { found = (driveInfo.iDriveAtt == (matchedFlags | KDriveAttRemovable)) ?0:iDrvList[currentDrive]; } break; default: Panic(EFindFileIllegalAttribute); } } else //matchedFlags == 0. { if (matchedAtt== KDriveAttAll) found= iDrvList[currentDrive]; else Panic(EFindFileIllegalAttribute); } if( found == 0) continue; } // Don't scan a locked drive if( err == KErrNone) { if(driveInfo.iMediaAtt & KMediaAttLocked) continue; } TParse fileName; TChar driveLetter; RFs::DriveToChar(currentDrive,driveLetter); TBuf<4> drive; drive.SetLength(2); drive[0]=(TText)driveLetter; drive[1]=':'; TPtrC nameAndExt(iFile.NameAndExt()); TPtrC path(iFile.Path()); fileName.Set(nameAndExt,&path,&drive); iFile=fileName; TInt r=DoFindInDir(); if (r==KErrNone) return(KErrNone); if (r!=KErrNotFound) return(r); } }