Writing a UI MTM

This section explains the initial set up steps to be performed to write a UI MTM. It does not explain the implementation of all UI MTM functionality, however, you can see the UI MTM examplefor detailed implementation steps.

Context

The most basic functionality required in a UI MTM is to open a message (for viewing or editing) and close it again. The CBaseMtmUi::OpenL() function opens the current context; the actual behaviour is dependent on the entry that the context points at.

The base class of UI MTM, CBaseUiMtm, defines functions that return CMsvOperation objects for control of asynchronous operations. Implementers of these functions are required to provide suitable classes that are derived from CMsvOperation. For example, if CBaseUiMtm::EditL() is implemented to provide message editing, a derived CMsvOperation class must be provided that completes when the editing operation is complete.

Steps

  1. Derive a class from the CBaseMtmUi class.
  2. Register it using the CRegisteredMtmDll parameter.
  3. Create the CMsvOperation -based classes for performing the different operations that are required for your Messaging protocol.

UI MTM example

//
// CTextMtmUi: User Interface MTM
//

CTextMtmUi* CTextMtmUi::NewL(CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll)
    {
    CTextMtmUi* self=new(ELeave) CTextMtmUi(aBaseMtm, aRegisteredMtmDll);
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::Pop();
    return self;
    }

CTextMtmUi::CTextMtmUi(CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll)
    :   CBaseMtmUi(aBaseMtm, aRegisteredMtmDll)
    {
 
   }

For more details on implementing all the UI MTM functions, see example code.

Related concepts