Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Assign contact images with Symbian AIW

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Tested with
Devices(s): Nokia N95
Compatibility
Platform(s): S60 3rd Edition
Article
Created: User:Technical writer 1 (09 Oct 2008)
Last edited: lpvalente (23 Sep 2014)


Contents

Overview

This code snipped shows how to assign images to contacts using the AIW handler.

This snippet can be self-signed.

Preconditions

Note.pngNote: :This API is not part of the public SDK. It can be found in the SDK API Plug-in.

MMP file

The following library is required:

LIBRARY servicehandler.lib

In the resource file

Add the following headers:

 #include <AiwCommon.hrh>
#include <AiwCommon.rh>

Then define a submenu item as follows in the MENU_PANE resource:

 MENU_ITEM
{
command=EAssignSub;
cascade=r_Assign_menu;
txt = "Assign";
}

Then define the actual submenu item as follows:

 RESOURCE MENU_PANE r_Assign_menu
{
items =
{
MENU_ITEM
{
command=EAIWPlaceHolder2;
txt = "";
}
};
}

After which you can define the AIW menu interest item as follows:

 RESOURCE AIW_INTEREST r_aiwmenutst_ASSIGN
{
items =
{
AIW_CRITERIA_ITEM
{
id = EAIWPlaceHolder2;
serviceCmd = KAiwCmdAssign;
contentType = "*";
serviceClass = KAiwClassMenu;
}
};
}


Source file

Add the following header:

 #include <AiwServiceHandler.h>

Construct the CAiwServiceHandler and attach the menu:

 iServiceHandler = CAiwServiceHandler::NewL();
iServiceHandler->AttachMenuL(R_ASSIGN_MENU, R_AIWMENUTST_ASSIGN);

Because the menu items for rotating were defined as submenus, you can handle adding the menu with the following code inside DynInitMenuPaneL:

 if ( iServiceHandler->HandleSubmenuL( *aMenuPane ) )
{
return;
}
 
if(iImageFileName.Length()
&& BaflUtils::Parse(iImageFileName) == KErrNone)
{
CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
 
TAiwVariant varFile(iImageFileName);
TAiwGenericParam paramFile( EGenericParamFile, varFile );
paramList.AppendL( paramFile );
 
TAiwVariant varMime(_L("image/jpeg"));
TAiwGenericParam paramMime( EGenericParamMIMEType, varMime );
paramList.AppendL( paramMime );
 
iServiceHandler->InitializeMenuPaneL(
*aMenuPane,
aResourceId,
EAIWExampleCmdLast1,
paramList);
 
}
else if(aResourceId == your Menu id goes here)
{
// Use aMenuPane->SetItemDimmed to dim out the menu item.
}

When the user selects the menu item, you just need to forward the command to CAiwServiceHandler in your command handler’s default block as follows:

 CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
 
TAiwGenericParam filePath( EGenericParamFile, iImageFileName );
paramList->AppendL( filePath );
 
TAiwVariant varMime(_L("image/jpeg"));
TAiwGenericParam paramMime( EGenericParamMIMEType, varMime );
paramList->AppendL( paramMime );
 
iServiceHandler->ExecuteMenuCmdL(
aCommand,
*paramList,
NULL,
0,
this);
 
CleanupStack::PopAndDestroy(paramList);
This page was last modified on 23 September 2014, at 19:55.
92 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×