Playing a message with the native message reader on Symbian
hamishwillee
(Talk | contribs) m (Hamishwillee - Bot update - Merge KB into wiki) |
hamishwillee
(Talk | contribs) m (moved CS001119 - Playing a message with the native message reader to Playing a message with the native message reader on Symbian) |
Latest revision as of 04:03, 14 June 2012
Article Metadata
Tested with
Compatibility
Article
Contents |
Overview
With AIW you can easily tell the preinstalled native message reader application to read any message stored in your messaging folders.
This snippet can be self-signed.
Preconditions (optional)
This API works only in devices that have a preinstalled native message reader application.
MMP file
The following library is required:
LIBRARY servicehandler.lib
0
In the resource file
Add the following headers:
#include <AiwCommon.hrh>
#include <AiwCommon.rh>
Next, in the MENU_PANE resource, define a menu item as follows:
MENU_ITEM
{
command = EAIWPlaceHolder1;
txt = "";
}
And define the AIW menu interest item as follows:
RESOURCE AIW_INTEREST R_AIWTEST_MSG
{
items =
{
AIW_CRITERIA_ITEM
{
id = EAIWPlaceHolder1;
serviceCmd = KAiwCmdView; //from aiwcommon.hrh
serviceClass = KAiwClassMenu; //from aiwcommon.hrh
contentType = "message/*";
}
};
}
Source file
Add the following header
#include <AiwServiceHandler.h>Construct the CAiwServiceHandler and attach the menu interest to it. Note that the code assumes that the iEntry is member variable of the class, its type is TMsvEntry, and it is for a valid message.
iServiceHandler = CAiwServiceHandler::NewL();
iServiceHandler->AttachMenuL(R_AIWTEST_MENU, R_AIWTEST_MSG);
Then add the actual menu item into the menu when it is shown:
void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane *aMenuPane )
{
if(aResourceId == R_AIWTEST_MENU)
{
CAiwGenericParamList* params = CAiwGenericParamList::NewLC();
TPckgC<TMsvEntry> packedEntry(iEntry);
TAiwGenericParam mailParam( EGenericParamMessageItem);
mailParam.Value().Set(packedEntry);
params->AppendL( mailParam );
// Let AIW provider add its menu items to the menu.
iServiceHandler->InitializeMenuPaneL(
*aMenuPane,
aResourceId,
EAIWExampleCmdLast,
*params);
}
}
To play the message, the user selects the added menu item. You can handle it as follows in the command handlers default block:
CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
TPckgC<TMsvEntry> packedEntry(iEntry);
TAiwGenericParam mailParam( EGenericParamMessageItem);
mailParam.Value().Set(packedEntry);
paramList->AppendL( mailParam );
iServiceHandler->ExecuteMenuCmdL(
aCommand,
*paramList,
iServiceHandler->OutParamListL(),
0,
this);
CleanupStack::PopAndDestroy(paramList);
Postconditions
The selected message should now be played with the native message reader.

