现在的位置: 首页 > 综合 > 正文

知道一条信息的TMsvId,如何打开信息浏览视图

2012年12月04日 ⁄ 综合 ⁄ 共 818字 ⁄ 字号 评论关闭

 知道一条信息的TMsvId,想打开信息浏览视图,主要用如下代码实现:

void CMtmEngine::OpenMessage(TMsvId aId)
{

   TMsvEntry msgEntry; // class that represents the entry (a local cache)
   TMsvId ownerServiceId;
   
   if( iSession->GetEntry( aId,ownerServiceId, msgEntry )
         != KErrNone )
	   return;
   CClientMtmRegistry *cltReg = CClientMtmRegistry::NewL( *iSession );
   CleanupStack::PushL( cltReg );

   CBaseMtm *mtm = cltReg->NewMtmL( msgEntry.iMtm );
   CleanupStack::PushL( mtm );

   CMtmUiRegistry *reg = CMtmUiRegistry::NewL( *iSession );
   CleanupStack::PushL( reg );

   CBaseMtmUi *ui = reg->NewMtmUiL( *mtm );
   CleanupStack::PushL( ui );

   mtm->SwitchCurrentEntryL( msgEntry.Id() );
   //Editor are embedded.
   ui->SetPreferences( EMtmUiFlagEditorPreferEmbedded );

   CMsvOperationActiveSchedulerWait *waiter = CMsvOperationActiveSchedulerWait::NewLC();

   CMsvOperation* op = ui->ViewL( waiter->iStatus );

   waiter->Start();

   delete op;
   CleanupStack::PopAndDestroy( 5, cltReg );

}

抱歉!评论已关闭.