本文整理汇总了C++中CMsvStore类的典型用法代码示例。如果您正苦于以下问题:C++ CMsvStore类的具体用法?C++ CMsvStore怎么用?C++ CMsvStore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CMsvStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __ASSERT_DEBUG
void CTextMtmClient::SaveMessageL()
// Store entry data
// If it is a service entry, store the current settings. Otherwise it has to be
// a message.
//
{
__ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ETxtcNoCMsvEntrySet));
// get an editable message store
CMsvStore* store = iMsvEntry->EditStoreL();
CleanupStack::PushL(store);
switch (iMsvEntry->Entry().iType.iUid)
{
case KUidMsvServiceEntryValue:
iSettings->SaveSettingsL(iMsvEntry->Entry().Id(), iTxtSettings);
break;
case KUidMsvMessageEntryValue:
StoreBodyL(*store);
break;
default:
__ASSERT_DEBUG(EFalse, gPanic(ETxtcEntryTypeNotSupported));
break;
}
store->CommitL();
CleanupStack::PopAndDestroy(); // store
}
示例2: 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
}
示例3: TestCase
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);
}
示例4: 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));
}
示例5: 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
}
示例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: 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 );
}
}
示例8: 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 );
}
示例9: UpdateEntryAfterSchedule
/**
Schedules aMessage on the schedule referred to by aRef.
Updates the message entry and the schedule data using the utility function
UpdateEntryAfterSchedule().
@see CMsvScheduleSend::UpdateEntryAfterSchedule
@param aMessage
The message to be scheduled.
@param aFinalState
The sending state to set to the messages to if the message is successfully
scheduled.
@param aFromTime
The time to schedule the messages for sending.
@param aRef
The ID of the schedule to add this task to.
@param aPendingConditions
A flag indicating whether this message is schedule for conditions.
*/
void CMsvScheduleSend::ScheduleEntryL(CMsvScheduledEntry& aMessage, const TInt aFinalState, const TTime& aStartTime, const TSchedulerItemRef& aRef, TBool aPendingConditions)
{
//Create a new task to associate with the schedule
TTaskInfo taskInfo;
iPackage.iId = aMessage.Id();
ScheduleEntryL(iScheduler, aRef, iPackage, taskInfo);
// Change the scheduled flag and sending state of the message
if( iServerEntry.SetEntry(aMessage.Id()) == KErrNone )
{
TMsvEntry entry(iServerEntry.Entry());
aMessage.Entry(entry);
UpdateEntryAfterSchedule(aRef, taskInfo, aStartTime, aFinalState, entry, aMessage.iData);
entry.SetPendingConditions(aPendingConditions);
SCHSENDLOG(FLog(_L8("\t\tScheduled msg %d (Mtm=%d, State=%d, Sch=%d, Task=%d, Pending=%d)"), entry.Id(), entry.iMtm.iUid, aFinalState, aMessage.iData.iRef.iHandle, aMessage.iData.iTaskId, entry.PendingConditions()));
User::LeaveIfError(iServerEntry.ChangeEntry(entry));
//Store the message data
CMsvStore* store = iServerEntry.EditStoreL();
CleanupStack::PushL(store);
aMessage.StoreL(*store);
store->CommitL();
CleanupStack::PopAndDestroy(store);
iServerEntry.SetEntry(KMsvNullIndexEntryId);
}
}
示例10: RestoreBccRecipientsToHeaderL
void CMsgImOutboxSend::RestoreBccRecipientsToHeaderL()
{
if (!iServerEntry.HasStoreL() || !iBccRcptArray || iBccRcptArray->Count()==0)
return; // no recipients to restore.
CMsvStore* store = iServerEntry.EditStoreL();
CleanupStack::PushL(store);
// Must have an rfc822 header.
CImHeader* header = CImHeader::NewLC();
if (store->IsPresentL( KUidMsgFileIMailHeader) )
{
header->RestoreL(*store);
header->BccRecipients().Reset();
TInt ii = iBccRcptArray->Count();
while (ii-- > 0)
header->BccRecipients().InsertL(0, (*iBccRcptArray)[ii]);
header->StoreL(*store);
store->CommitL();
}
// To stop the array growing, delete and recreate.
iBccRcptArray->Reset();
delete iBccRcptArray;
iBccRcptArray=0;
iBccRcptArray = new (ELeave) CDesCArrayFlat(KBccArraySegment);
CleanupStack::PopAndDestroy(header);
CleanupStack::PopAndDestroy(store);
}
示例11: FLOG
// -----------------------------------------------------------------------------
// CWPMessage::StoreMsgL
// -----------------------------------------------------------------------------
//
void CWPMessage::StoreMsgL()
{
FLOG( _L( "CWPMessage::StoreMsgL" ) );
// create an invisible blank entry
TMsvEntry entry;
PrepareEntryLC( entry ); // details on cleanup stack
entry.iBioType = iBioUID.iUid;
entry.iMtm = KUidBIOMessageTypeMtm;
// Look up and set the description
FLOG( _L( "CWPMessage::StoreMsgL 1" ) );
TInt index;
CBIODatabase* bioDB = CBIODatabase::NewLC( iSession->FileSession() );
FLOG( _L( "CWPMessage::StoreMsgL 2" ) );
TRAPD( err, bioDB->GetBioIndexWithMsgIDL( iBioUID, index ) );
if (err ==KErrNone)
{
FLOG( _L( "CWPMessage::StoreMsgL 3" ) );
HBufC* description = bioDB->BifReader(index).Description().AllocL();
FLOG( _L( "CWPMessage::StoreMsgL 4" ) );
entry.iDescription.Set(*description);
FLOG( _L( "CWPMessage::StoreMsgL 5" ) );
CleanupStack::PopAndDestroy(); // bioDB
CleanupStack::PushL( description );
}
else
{
FTRACE(RDebug::Print(_L(" CWPMessage::StoreMsgL err (%d)"), err));
CleanupStack::PopAndDestroy(); // bioDB
}
FLOG( _L( "CWPMessage::StoreMsgL 6" ) );
// Store entry in inbox
CMsvEntry* msvEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
FLOG( _L( "CWPMessage::StoreMsgL 7" ) );
CleanupStack::PushL(msvEntry);
msvEntry->CreateL(entry);
msvEntry->Session().CleanupEntryPushL(entry.Id());
msvEntry->SetEntryL(entry.Id());
FLOG( _L( "CWPMessage::StoreMsgL 8" ) );
// Save the message
CMsvStore* store = msvEntry->EditStoreL();
CleanupStack::PushL(store);
FLOG( _L( "CWPMessage::StoreMsgL 9" ) );
iMessage->StoreL( *store );
store->CommitL();
// Complete processing the message
PostprocessEntryL( *msvEntry, entry );
CleanupStack::PopAndDestroy(); //store
msvEntry->Session().CleanupEntryPop(); //entry
CleanupStack::PopAndDestroy(3); //description, details, msvEntry
FLOG( _L( "CWPMessage::StoreMsgL Done" ) );
}
示例12: INFO_PRINTF1
void CSmsReplyToStep::CreateMessageL()
{
INFO_PRINTF1(_L("Creating message..."));
TMsvEntry entry;
entry.SetVisible(ETrue);
entry.SetInPreparation(ETrue);
entry.iServiceId = iTestUtils->iSmsServiceId;
entry.iType = KUidMsvMessageEntry;
entry.iMtm = KUidMsgTypeSMS;
entry.iDate.HomeTime();
entry.iSize = 0;
entry.iDescription.Set(KNullDesC);
entry.iDetails.Set(KNullDesC);
entry.SetSendingState(KMsvSendStateScheduled);
// Create the SMS header object...
CSmsHeader* header = CSmsHeader::NewL(CSmsPDU::ESmsSubmit, *iTestUtils->iRichText);
CleanupStack::PushL(header);
// Set the body text...
iTestUtils->iRichText->Reset();
iTestUtils->iRichText->InsertL(0, KMessageData);
// Copy the message settings...
header->SetSmsSettingsL(*iTestUtils->iServiceSettings);
// Set the service centre
TInt defaultIndex = iTestUtils->iServiceSettings->DefaultServiceCenter();
header->SetServiceCenterAddressL(iTestUtils->iServiceSettings->GetServiceCenter(defaultIndex).Address());
// Set recipient - ask derived class
SetRecipientsL(*header);
// Update entry description and details...
CArrayPtrFlat<CSmsNumber>& recipient = header->Recipients();
entry.iDetails.Set(recipient[0]->Address());
entry.iDescription.Set(iTestUtils->iRichText->Read(0, iTestUtils->iServiceSettings->DescriptionLength()));
entry.SetInPreparation(EFalse);
// Create the entry - set context to the global outbox.
iTestUtils->iMsvEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryId);
iTestUtils->iMsvEntry->CreateL(entry);
// Create new store and save header information
iTestUtils->iMsvEntry->SetEntryL(entry.Id());
CMsvStore* store = iTestUtils->iMsvEntry->EditStoreL();
CleanupStack::PushL(store);
header->StoreL(*store);
store->StoreBodyTextL(*iTestUtils->iRichText);
store->CommitL();
CleanupStack::PopAndDestroy(2, header);
iMessageId = entry.Id();
}
示例13: qDebug
//---------------------------------------------------------------
// 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
}
示例14: 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);
}
}
示例15: 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;
}