// UniBioMessageDataPlugin::attachmentList() // @see header //--------------------------------------------------------------- UniMessageInfoList UniBioMessageDataPlugin::attachmentList() { RFile file; QT_TRAP_THROWING(file = d_ptr->attachmentL()); if(attachmentCount() == 0) { file.Close(); return QList<UniMessageInfo*> (); } UniMessageInfoList attlist; QString path; QString mimetype; int size = 0; TFileName fullName; qt_symbian_throwIfError(file.FullName(fullName)); qt_symbian_throwIfError(file.Size(size)); path = XQConversions::s60DescToQString(*fullName.AllocL()); UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype); attlist << msgobj; file.Close(); return attlist; }
void CNcdNodeActivate::SetContentFileL( MNcdInstalledFile& aFile, CNcdNodeInstallProxy& aInstall, MNcdDeviceService& aService ) { DLTRACEIN(("")); RBuf fileName; fileName.CreateL( KMaxFileName ); CleanupClosePushL( fileName ); // Get the file handle to the file that will be activated. RFile file = aFile.OpenFileL(); CleanupClosePushL( file ); // Get the filename from the handle. // The name will be used for the activation file.FullName( fileName ); CleanupStack::PopAndDestroy( &file ); if ( aInstall.IsPurpose( ENcdItemPurposeRingtone ) ) { aService.SetAsRingingToneL( fileName ); } else if( aInstall.IsPurpose( ENcdItemPurposeWallpaper ) ) { aService.SetAsWallpaperL( fileName ); } else { User::Leave( KErrNotSupported ); } CleanupStack::PopAndDestroy ( &fileName ); DLTRACEOUT(("All is well")); }
void TestVFATCase2() { test.Next(_L("Test With VFAT entry, and DOS entry using CP932 Japanese file's access")); __UHEAP_MARK; // logging for failure gTCType = ESymbianFATSpecific; RBuf failedOnBuf; failedOnBuf.CreateL(gLogFailureData.iFuncName); gTCId = 0; RBuf tcUniquePath; tcUniquePath.CreateL(KNone()); QuickFormat(); CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\")); TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions); test_KErrNone(r); r = UserSvr::ChangeLocale(KTestLocale); test_KErrNone(r); r=TheFs.SetSessionPath(gSessionPath); testAndLog(r==KErrNone); _LIT(KTestNormalFileName, "\x65B0\x6587\x4EF6.TXT"); _LIT(KTestNormalFileShortName, "\x65B0\x6587\x4EF6.TXT"); test.Printf(_L("Create a file with the DLL installed, and get the shortname")); r=TheFile.Create(TheFs,KTestNormalFileName,EFileRead|EFileWrite); testAndLog(r==KErrNone); TFileName sn; r = TheFs.GetShortName(KTestNormalFileName, sn); testAndLog(r==KErrNone); r = sn.Compare(KTestNormalFileShortName); testAndLog(r==0); TheFile.Close(); test.Printf(_L("Access the file with the DLL installed")); r=TheFile.Open(TheFs,KTestNormalFileName,EFileWrite); testAndLog(r==KErrNone); TBuf<50> name; r=TheFile.FullName(name); testAndLog(r==KErrNone); TheFile.Close(); r=TheFile.Open(TheFs,KTestNormalFileShortName,EFileWrite); testAndLog(r==KErrNone); TheFile.Close(); r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions); testAndLog(r==KErrNone); test.Printf(_L("Access the file without the DLL installed")); r=TheFile.Open(TheFs,KTestNormalFileName,EFileWrite); testAndLog(r==KErrNone); r=TheFile.FullName(name); testAndLog(r==KErrNone); TheFile.Close(); r=TheFile.Open(TheFs,KTestNormalFileShortName,EFileWrite); testAndLog(r==KErrNone); TheFile.Close(); r=TheFs.Delete(KTestNormalFileName); failedOnBuf.Close(); tcUniquePath.Close(); __UHEAP_MARKEND; }
void CBtMsgViewerUtils::GetMessagePathL(TPtr aMsgPath, const TInt aMessageId ) { CMsvEntry* messageEntry = iMsvSession->GetEntryL(aMessageId); CleanupStack::PushL(messageEntry); TMsvEntry entry = messageEntry->Entry(); if(entry.MtmData1() == KUidMsgTypeBtTInt32) { CMsvStore* store = messageEntry->ReadStoreL(); CleanupStack::PushL(store); TInt attachmentCount = store->AttachmentManagerL().AttachmentCount(); RFile attachmentFile; if(attachmentCount != 0) { //get file handle for the attachment & the complete path of the file attachmentFile = store->AttachmentManagerL().GetAttachmentFileL(0); CleanupClosePushL(attachmentFile); User::LeaveIfError(attachmentFile.FullName(aMsgPath)); CleanupStack::PopAndDestroy(&attachmentFile); StoreMessageMimeTypeL(aMsgPath); //mark attachment as Read TMsvEntry attachEntry = messageEntry->Entry(); attachEntry.SetUnread(EFalse); messageEntry->ChangeL(attachEntry); } else { CClientMtmRegistry* mtmReg = CClientMtmRegistry::NewL(*iMsvSession); CleanupStack::PushL(mtmReg); //1st Push CBIOClientMtm* bioClientMtm = (CBIOClientMtm*) mtmReg->NewMtmL(KBioUidValueUid); CleanupStack::PushL(bioClientMtm); //2nd Push bioClientMtm->SwitchCurrentEntryL(aMessageId); CMsvEntry* attachmentEntry = CMsvEntry::NewL(bioClientMtm->Session(), aMessageId, TMsvSelectionOrdering()); CleanupStack::PushL(attachmentEntry); //3rd Push bioClientMtm->LoadMessageL(); CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; CleanupStack::PushL(selection); //4th Push selection->AppendL(aMessageId); TBuf8<1> aParameter; CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC(); //5th Push CMsvOperation* operation = bioClientMtm->InvokeAsyncFunctionL(KBiosMtmParse, *selection, aParameter, wait->iStatus); wait->Start(); CMsvStore* store = attachmentEntry->ReadStoreL(); CleanupStack::PushL(store); //6th Push MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); attachmentFile = attachMan.GetAttachmentFileL(0); CleanupClosePushL(attachmentFile); //7th Push User::LeaveIfError(attachmentFile.FullName(aMsgPath)); CleanupStack::PopAndDestroy(&attachmentFile); StoreMessageMimeTypeL(aMsgPath); //mark attachment as Read TMsvEntry attachEntry = attachmentEntry->Entry(); attachEntry.SetUnread(EFalse); attachmentEntry->ChangeL(attachEntry); delete operation; CleanupStack::PopAndDestroy(6); } CleanupStack::PopAndDestroy(store); } else { CMsvEntry* attachmentEntry = iMsvSession->GetEntryL((*messageEntry)[0].Id()); CleanupStack::PushL(attachmentEntry); //1st push CMsvStore* store = attachmentEntry->ReadStoreL(); CleanupStack::PushL(store); //2nd push TBuf<KMaxPath> attachmentName(store->AttachmentManagerL().GetAttachmentInfoL(0)->AttachmentName()); RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); TEntry entry; User::LeaveIfError(fs.Entry(attachmentName, entry)); CleanupStack::PopAndDestroy(&fs); //get file handle for the attachment & the complete path of the file RFile attachmentFile; attachmentFile = store->AttachmentManagerL().GetAttachmentFileL(0); CleanupClosePushL(attachmentFile); //3rd Push User::LeaveIfError(attachmentFile.FullName(aMsgPath)); CleanupStack::PopAndDestroy(&attachmentFile); StoreMessageMimeTypeL(aMsgPath); //mark attachment as Read TMsvEntry attachEntry = attachmentEntry->Entry(); attachEntry.SetUnread(EFalse); attachmentEntry->ChangeL(attachEntry); CleanupStack::PopAndDestroy(store); CleanupStack::PopAndDestroy(attachmentEntry); } CleanupStack::PopAndDestroy(messageEntry); }