×
Namespaces

Variants
Actions

Assign Image to contact using AIW service

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Compatibility
Platform(s):
Symbian
Article
Created: judith14 (29 Feb 2008)
Last edited: hamishwillee (27 Jul 2012)

Overview

Application Interworking (AIW) framework is a mechanism for dynamically adding features and functionality to applications without statically linking to the existing code. Contact application provides ‘Assign’ AIW service through which we can assign image or Ringtone to existing contact.

Here is the code to assign image to contact.


Header file

#include <AiwServiceHandler.h>
#include <aiwgenericparam.h>
class CContactAIWAssign31AppUi : public CAknAppUi
{
public:
 

 
// From MEikMenuObserver
void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
 
//For Passing parameters
void AiwParamListLC( CAiwGenericParamList& aParamList ) const;
 
public:
CAiwServiceHandler* iServiceHandler;
 
};

Source file

void CContactAIWAssign31AppUi::ConstructL()
{
iServiceHandler = CAiwServiceHandler::NewL();
//Attach menu services
iServiceHandler->AttachMenuL(R_CONTACTAIWASSIGN31_MENU,R_ASSIGN_INTEREST);
}
 
void CContactAIWAssign31AppUi::HandleCommandL(TInt aCommand)
{
switch(aCommand)
{
case EEikCmdExit:
case EAknSoftkeyExit:
Exit();
break;
default:
CAiwGenericParamList& inList = iServiceHandler->InParamListL();
AiwParamListLC(inList);
iServiceHandler->ExecuteMenuCmdL(aCommand,inList,iServiceHandler->OutParamListL(),0,NULL);
break;
}
}
 
void CContactAIWAssign31AppUi::DynInitMenuPaneL(
TInt aResourceId, CEikMenuPane* aMenuPane)
{
if (iServiceHandler -> IsAiwMenu(aResourceId))
{
//Create in param list
CAiwGenericParamList& inList = iServiceHandler->InParamListL();
AiwParamListLC(inList);
iServiceHandler->InitializeMenuPaneL(*aMenuPane,aResourceId,EAIWMenuPlaceHolder,inList);
}
}
 
void CContactAIWAssign31AppUi::AiwParamListLC(CAiwGenericParamList& aParamList) const
{
_LIT(KFilename,"C:\\Sample1.jpg");
_LIT(KFileMime,"image/jpeg");
 
// Append Filepath as parameter
TAiwVariant varFile(KFilename);
TAiwGenericParam paramFile( EGenericParamFile, varFile );
aParamList.AppendL( paramFile );
 
//Append Mime type(for Image - image/jpeg)
TAiwVariant varMime(KFileMime);
TAiwGenericParam paramMime( EGenericParamMIMEType, varMime );
aParamList.AppendL( paramMime );
 
}
This page was last modified on 27 July 2012, at 08:26.
34 page views in the last 30 days.
×