本文整理汇总了C++中CMsvStore::AttachmentManagerL方法的典型用法代码示例。如果您正苦于以下问题:C++ CMsvStore::AttachmentManagerL方法的具体用法?C++ CMsvStore::AttachmentManagerL怎么用?C++ CMsvStore::AttachmentManagerL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMsvStore
的用法示例。
在下文中一共展示了CMsvStore::AttachmentManagerL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExecuteActionL
void CMtfTestActionCompareAttachment::ExecuteActionL()
{
TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCompareAttachment);
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
TMsvAttachmentId attachId = ObtainValueParameterL<TMsvAttachmentId>(TestCase(),ActionParameters().Parameter(2));
HBufC* dataFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(3));
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
CMsvStore* store = entry->ReadStoreL();
CleanupStack::PushL(store);
MMsvAttachmentManager& manager = store->AttachmentManagerL();
RFile fileAttachment = manager.GetAttachmentFileL(attachId);
CleanupClosePushL(fileAttachment);
CompareFileL(fileAttachment, *dataFilePath);
CleanupStack::PopAndDestroy(&fileAttachment);
CleanupStack::PopAndDestroy(2, entry); // store, entry
TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCompareAttachment);
TestCase().ActionCompletedL(*this);
}
示例2: EnsureAllObjectsHaveContentLocationL
// ---------------------------------------------------------
// 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 );
}
示例3: RunTestL
void CMtfTestActionAddAttachmentAsLink::RunTestL()
{
CMsvStore* paramStore = ObtainParameterReferenceL<CMsvStore>(TestCase(),ActionParameters().Parameter(0));
HBufC* paramFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(1));
HBufC8* paramMimeType = ObtainParameterReferenceL<HBufC8>(TestCase(),ActionParameters().Parameter(2));
CMtfAsyncWaiter* waiter = CMtfAsyncWaiter::NewL();
CleanupStack::PushL(waiter);
CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvLinkedFile);
CleanupStack::PushL(attachment);
attachment->SetMimeTypeL(*paramMimeType);
TParse fileNameParser;
User::LeaveIfError(fileNameParser.Set(*paramFilePath, NULL, NULL));
attachment->SetAttachmentNameL(fileNameParser.NameAndExt());
MMsvAttachmentManager& manager = paramStore->AttachmentManagerL();
manager.AddLinkedAttachmentL(*paramFilePath, attachment, waiter->iStatus);
CleanupStack::Pop(attachment); // ownership passed to manager
waiter->StartAndWait();
User::LeaveIfError(waiter->Result());
CleanupStack::PopAndDestroy(waiter);
TMsvAttachmentId attachmentId = attachment->Id();
paramStore->CommitL();
StoreParameterL<TMsvAttachmentId>(TestCase(),attachmentId,ActionParameters().Parameter(3));
}
示例4: RunTestActionL
void CMtfTestActionGetAttachmentFileFromIndex::RunTestActionL()
{
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
TInt attachIndex = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2));
HBufC* dataFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(3), NULL);
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
CMsvStore* store = entry->ReadStoreL();
CleanupStack::PushL(store);
MMsvAttachmentManager& manager = store->AttachmentManagerL();
RFile fileAttachment = manager.GetAttachmentFileL(attachIndex);
CleanupClosePushL(fileAttachment);
if( dataFilePath != NULL )
{
// check of contents of attachment file is requested
CompareFileL(fileAttachment, *dataFilePath);
}
CleanupStack::PopAndDestroy(3, entry); // fileAttachment, store, entry
}
示例5: CreateSmilAttachmentL
// ---------------------------------------------------------
// CUniSmilList::CreateSmilAttachmentL
//
// Create SMIL from DOM
// ---------------------------------------------------------
//
EXPORT_C void CUniSmilList::CreateSmilAttachmentL(
MUniSmilComposeObserver& aObserver,
CMsvStore& aEditStore,
CMDXMLDocument* aDom )
{
iDom = aDom;
iObserver = &aObserver;
//iSmilAttaId = KMsvNullIndexEntryId;
//iSmilAttaFullpath.Zero();
iManager = &( aEditStore.AttachmentManagerL() );
CMsvAttachment* attachment = CMsvAttachment::NewL( CMsvAttachment::EMsvFile );
CleanupStack::PushL( attachment );
//TODO: Set size(?) & complete flag(?)
//attachment->SetSize()
//attachment->SetComplete( EFalse );
iEditFile = new ( ELeave ) RFile;
CMuiuOperationWait* wait = CMuiuOperationWait::NewLC();
iManager->CreateAttachmentL( KPresentationFileName, *iEditFile, attachment, wait->iStatus );
wait->Start();
//manager.AddAttachmentL( aPath, attachment, iStatus );
CleanupStack::PopAndDestroy( wait );
CleanupStack::Pop( attachment );
iAttachment = attachment;
//Do self complete to trigger runL
RunL();
}
示例6: StartL
void CAddObexAttachmentAsEntryState::StartL(TRequestStatus& aStatus)
{
// Add an attachment as a child entry
CBaseMtm& clientMtm = iClientTest.ObexTestUtils().GetCurrentObexClientMtm();
CMsvEntry& entry = clientMtm.Entry();
CMsvStore* store = entry.EditStoreL();
CleanupStack::PushL(store);
CAsyncWaiter* waiter = CAsyncWaiter::NewL();
CleanupStack::PushL(waiter);
CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
CleanupStack::PushL(attachment);
TParse fileNameParser;
User::LeaveIfError(fileNameParser.Set(iFileName, NULL, NULL));
attachment->SetAttachmentNameL(fileNameParser.NameAndExt());
store->AttachmentManagerL().AddAttachmentL(iFileName, attachment, waiter->iStatus);
CleanupStack::Pop(attachment);
waiter->StartAndWait();
User::LeaveIfError(waiter->Result());
CleanupStack::PopAndDestroy(waiter);
store->CommitL();
CleanupStack::PopAndDestroy(store);
TRequestStatus* status = &aStatus;
User::RequestComplete(status, KErrNone);
}
示例7: CheckNoAttachmentsL
void CheckNoAttachmentsL()
{
CDummyObserver* ob1 = new(ELeave) CDummyObserver;
CleanupStack::PushL(ob1);
CMsvSession* session = CMsvSession::OpenSyncL(*ob1);
CleanupStack::PushL(session);
CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId,
TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue));
CleanupStack::PushL(cEntry);
CMsvEntrySelection* selection = cEntry->ChildrenL();
CleanupStack::PushL(selection);
test(selection->Count() == 1);
cEntry->SetEntryL((*selection)[0]);
if (cEntry->HasStoreL())
{
CMsvStore* store = cEntry->ReadStoreL();
CleanupStack::PushL(store);
MMsvAttachmentManager& attachmentMgr = store->AttachmentManagerL();
test(attachmentMgr.AttachmentCount() == 0);
CleanupStack::PopAndDestroy(store);
}
CleanupStack::PopAndDestroy(4, ob1); // selection, cEntry, session, ob1
}
示例8: RemoveAttachmentL
// ---------------------------------------------------------
//
// ---------------------------------------------------------
void CMmsAttachmentHandler::RemoveAttachmentL( TMsvAttachmentId aAttaId, CMsvStore& aStore )
{
MMsvAttachmentManager& attaMan = aStore.AttachmentManagerL();
MMsvAttachmentManagerSync& attaManSync = aStore.AttachmentManagerExtensionsL();
// can only remove synchronously if index is known.
TInt count = attaMan.AttachmentCount();
TInt i = count - 1;
TBool found = EFalse;
while ( i >= 0 && !found )
{
CMsvAttachment* attachmentInfo = attaMan.GetAttachmentInfoL( i );
CleanupStack::PushL( attachmentInfo );
if ( attachmentInfo->Id() == aAttaId )
{
found = ETrue;
}
else
{
i--;
}
CleanupStack::PopAndDestroy( attachmentInfo );
attachmentInfo = NULL;
}
if ( i >= 0 && found )
{
attaManSync.RemoveAttachmentL( i );
}
}
示例9: ConstructL
//---------------------------------------------------------------
// CNativeMmsUtility::ConstructL
// @see header
//---------------------------------------------------------------
void CNativeMmsUtility::ConstructL(const TMsvId& msgId, CMsvSession& session)
{
#ifdef _DEBUG_TRACES_
qDebug() << " Enter CNativeMmsUtility::ConstructL";
#endif
//Get message entry
imsventry = CMsvEntry::NewL(session, msgId, TMsvSelectionOrdering());
CleanupStack::PushL(imsventry);
//Read message store
CMsvStore* store = imsventry->ReadStoreL();
CleanupStack::PushL(store);
//Get message store's attachment manager
iattachmanager = &store->AttachmentManagerL();
//get the smil file from attachment manager
ismilfilepath = getSmilFileL();
if (!ismilfilepath.isEmpty())
{
//get smilfile's handle to parse
RFile smilfile;
HBufC* path = XQConversions::qStringToS60Desc(ismilfilepath);
RFs fsSession;
User::LeaveIfError(fsSession.Connect());
if (KErrNone == smilfile.Open(fsSession, *path, EFileRead))
{
CleanupClosePushL(smilfile);
//create an instance of smil reader
ireader = SmilXmlReader::NewL(smilfile);
//close smilfile
CleanupStack::PopAndDestroy();
}
else
{
//reset the smilfilepath
ismilfilepath.clear();
}
smilfile.Close();
//close file server session
fsSession.Close();
}
CleanupStack::Pop(2, imsventry);
#ifdef _DEBUG_TRACES_
qDebug() << " Exit CNativeMmsUtility::ConstructL";
#endif
}
示例10: GetAttachmentFileL
/*
-----------------------------------------------------------------------------
RFile GetAttachmentFileL(TMsvAttachmentId aId)
----------------------------------------------------------------------------
*/
void CMailBoxContainer::OpenFileL(TBool /*aOpenWith*/)
{
if(iSession && iSelectionBox)
{
TInt CurrItmIndex = iSelectionBox->CurrentItemIndex();
TMsvSelectionOrdering sort;
sort.SetShowInvisibleEntries(ETrue);
sort.SetSorting(EMsvSortByDate);
// Take a handle to the folder entry
CMsvEntry* parentEntry = CMsvEntry::NewL(*iSession,iCurrentMailBox,sort);
CleanupStack::PushL(parentEntry);
// A selection of all BT entries
CMsvEntrySelection* entries = parentEntry->ChildrenL();//ChildrenWithMtmL(KUidMsgTypeBt);
CleanupStack::PushL(entries);
//Process all entries
if(CurrItmIndex >= 0 && CurrItmIndex < iIDArray->Count())
{
//Get entry
CMsvEntry* btEntry = iSession->GetEntryL(iIDArray->At(CurrItmIndex).iEnt);
CleanupStack::PushL(btEntry);
//Then get entrys child
CMsvEntrySelection* btChildren = btEntry->ChildrenL();
CleanupStack::PushL(btChildren);
btEntry->SetEntryL(iIDArray->At(CurrItmIndex).iMsg);
if (btEntry->HasStoreL())
{
CMsvStore* store = btEntry->ReadStoreL();
CleanupStack::PushL(store);
MMsvAttachmentManager& attMngr = store->AttachmentManagerL();
CMsvAttachment* attachment = attMngr.GetAttachmentInfoL(iIDArray->At(CurrItmIndex).iAtt);
if(attachment)
{
RFile SourceFil(attMngr.GetAttachmentFileL(iIDArray->At(CurrItmIndex).iAtt));
iUtils.GetFileUtils().OpenFileWithHandler(SourceFil);
SourceFil.Close();
}
CleanupStack::PopAndDestroy(store);
}
CleanupStack::PopAndDestroy(2);
}
CleanupStack::PopAndDestroy(2);
}
}
示例11: TestReadOnlyDeletionL
LOCAL_C void TestReadOnlyDeletionL()
{
CDummyObserver* ob = new(ELeave)CDummyObserver;
CleanupStack::PushL(ob);
CMsvSession* session = CMsvSession::OpenSyncL(*ob);
CleanupStack::PushL(session);
CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId, TMsvSelectionOrdering());
CleanupStack::PushL(cEntry);
// Create an entry
TMsvEntry entry;
entry.iType = KUidMsvMessageEntry;
entry.iMtm = KUidMsvLocalServiceMtm;
entry.iServiceId = KMsvLocalServiceIndexEntryId;
cEntry->CreateL(entry);
// Generate name of attachment
cEntry->SetEntryL(entry.Id());
TFileName fileName;
fileName.Append(_L("Test"));
CMsvStore* store = cEntry->EditStoreL();
CleanupStack::PushL(store);
CAsyncWaiter* waiter = CAsyncWaiter::NewL();
CleanupStack::PushL(waiter);
CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
CleanupStack::PushL(attachment);
fileName.Append(_L("Test"));
attachment->SetAttachmentNameL(fileName);
RFile file;
store->AttachmentManagerL().CreateAttachmentL(fileName, file, attachment, waiter->iStatus);
CleanupStack::Pop(attachment); // ownership passed
waiter->StartAndWait();
User::LeaveIfError(waiter->Result());
CleanupStack::PopAndDestroy(waiter);
CleanupClosePushL(file);
User::LeaveIfError(file.Write(_L8("some text")));
User::LeaveIfError(file.SetAtt(KEntryAttReadOnly, KEntryAttNormal));
CleanupStack::PopAndDestroy(2, store); // file, store
// Now try and delete the file
cEntry->SetEntryL(entry.Parent());
cEntry->DeleteL(entry.Id());
CleanupStack::PopAndDestroy(3); // cEntry, session, ob
}
示例12: GetSmilFileByIndexL
// ---------------------------------------------------------
// CUniSmilList::GetSmilFullPathByIndex
//
// GetSmilFullPathByIndex.
// ---------------------------------------------------------
//
EXPORT_C RFile CUniSmilList::GetSmilFileByIndexL(
TInt aIndex )
{
if ( aIndex < 0 || aIndex >= iSmilAttachmentArray->Count() )
{
User::Leave( KErrArgument );
}
CMsvStore* store = iMtm.Entry().ReadStoreL();
CleanupStack::PushL( store );
MMsvAttachmentManager& manager = store->AttachmentManagerL();
RFile file = manager.GetAttachmentFileL( iSmilAttachmentArray->At( aIndex ) );
CleanupStack::PopAndDestroy( store );
return file;
}
示例13: ExecuteActionL
void CMtfTestActionRemoveAllAttachments::ExecuteActionL()
{
TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionRemoveAllAttachments);
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
TInt attachIdFlag = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2), 0);
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
CMsvStore* store = entry->EditStoreL();
CleanupStack::PushL(store);
MMsvAttachmentManager& manager = store->AttachmentManagerL();
TInt attachmentCount = manager.AttachmentCount();
for ( ; attachmentCount > 0 ; attachmentCount-- )
{
CMtfAsyncWaiter* waiter = CMtfAsyncWaiter::NewL();
CleanupStack::PushL(waiter);
if( attachIdFlag == 1 )
{
CMsvAttachment* attachInfo = manager.GetAttachmentInfoL(0);
CleanupStack::PushL(attachInfo);
manager.RemoveAttachmentL(attachInfo->Id(), waiter->iStatus);
CleanupStack::PopAndDestroy(attachInfo);
}
else
{
manager.RemoveAttachmentL(0, waiter->iStatus);
}
waiter->StartAndWait();
User::LeaveIfError(waiter->Result());
CleanupStack::PopAndDestroy(waiter);
}
store->CommitL();
CleanupStack::PopAndDestroy(2, entry); // store, entry
TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionRemoveAllAttachments);
TestCase().ActionCompletedL(*this);
}
示例14: SaveL
/**
Stores the Unknown Push message in the message store.
Saves the message data in a new attachment file. This makes it more efficient for the UI
to read the data.
@param aSession
Message server session
@param aParent
ID of the parent for the new entry. It is the caller's responsibility to ensure
that the parent ID is correct.
@return
ID of the new message server entry.
@see CPushMsgEntryBase::SaveL()
*/
EXPORT_C TMsvId CUnknownPushMsgEntry::SaveL(CMsvSession& aSession, TMsvId aParent)
{
CMsvEntry* entryPtr = aSession.GetEntryL(KMsvRootIndexEntryId);
CleanupStack::PushL(entryPtr);
// This tidies itself up
TMsvId newEntry = CPushMsgEntryBase::SaveL(aSession, aParent);
#ifdef __MESSAGING_API_V2__
TRAPD(
saveError,
TFileName fileName = ContentFileNameL();
entryPtr->SetEntryL(newEntry);
CMsvStore* store = entryPtr->EditStoreL();
CleanupStack::PushL(store);
SaveMessageBodyL(store->AttachmentManagerL(), fileName);
store->CommitL();
CleanupStack::PopAndDestroy(store);
)
示例15: ExecuteActionL
void CMtfTestActionRemoveFileAttachmentWithDestroy::ExecuteActionL()
{
TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionRemoveFileAttachmentWithDestroy);
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
TMsvAttachmentId attachId = ObtainValueParameterL<TMsvAttachmentId>(TestCase(),ActionParameters().Parameter(2));
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
CMsvStore* store = entry->EditStoreL();
CleanupStack::PushL(store);
MMsvAttachmentManager& manager = store->AttachmentManagerL();
CMsvAttachment* attachInfo = manager.GetAttachmentInfoL(attachId);
CleanupStack::PushL(attachInfo);
// First ensure that the attachment is a file attachment
if( attachInfo->Type() != CMsvAttachment::EMsvFile )
{
User::Leave(KErrGeneral);
}
CleanupStack::PopAndDestroy(attachInfo);
CMtfAsyncWaiter* waiter = CMtfAsyncWaiter::NewL();
CleanupStack::PushL(waiter);
manager.RemoveAttachmentL(attachId, waiter->iStatus);
waiter->StartAndWait();
User::LeaveIfError(waiter->Result());
CleanupStack::PopAndDestroy(waiter);
// destroy the store without commit
CleanupStack::PopAndDestroy(2, entry); // store, entry
TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionRemoveFileAttachmentWithDestroy);
TestCase().ActionCompletedL(*this);
}