idlehomescreen/xmluicontroller/src/aieventhandler.cpp
branchRCL_3
changeset 12 9674c1a575e9
parent 2 08c6ee43b396
child 18 d05a55b217df
--- a/idlehomescreen/xmluicontroller/src/aieventhandler.cpp	Fri Mar 12 15:41:49 2010 +0200
+++ b/idlehomescreen/xmluicontroller/src/aieventhandler.cpp	Mon Mar 15 12:39:47 2010 +0200
@@ -41,7 +41,7 @@
 
 _LIT( KLaunchApplication, "launch_application" );
 _LIT( KViewActivation, "view_activation" );
-_LIT( KCmdLine, "cmd_line");
+_LIT( KCmdLine, "cmd_line" );
 
 _LIT8( KType, "type" );
 _LIT8( KLaunchMethod, "launch_method" );
@@ -107,7 +107,7 @@
 // ----------------------------------------------------------------------------
 //
 CAIEventHandler::CAIEventHandler( CXmlUiController& aUiController )
-    : iUiController( aUiController ) 
+    : iUiController( aUiController ), iMsgInterface ( NULL )
     {
     }
 
@@ -139,6 +139,12 @@
 //
 CAIEventHandler::~CAIEventHandler()
     {
+    if ( iMsgInterface )
+        {
+        iMsgInterface->Close();
+        iMsgInterface = NULL;
+        }
+    
     if( iServiceHandler )
         {
         iServiceHandler->Reset();
@@ -206,6 +212,7 @@
     
     CLiwDefaultMap* map = CLiwDefaultMap::NewL(); 
     map->PushL();
+    
     map->InsertL( KType, TLiwVariant( KLaunchApplication ));
     map->InsertL( KLaunchMethod, TLiwVariant( KCmdLine ));
     map->InsertL( KApplicationUid, TLiwVariant( uid ));
@@ -257,8 +264,12 @@
 //
 void CAIEventHandler::ExecuteAppLauncherL( CLiwDefaultMap& aMap )
     {
-    MLiwInterface* msgInterface = ActionHandlerInterfaceL( );
-    if( msgInterface && iServiceHandler )
+    if ( !iMsgInterface )
+        {
+        iMsgInterface = ActionHandlerInterfaceL();
+        }
+    
+    if( iMsgInterface && iServiceHandler )
         {
         CLiwGenericParamList& inparam = iServiceHandler->InParamListL();
         CLiwGenericParamList& outparam = iServiceHandler->OutParamListL();
@@ -269,8 +280,7 @@
         TLiwGenericParam data( KData, TLiwVariant( &aMap ));
         inparam.AppendL( data );
 
-        msgInterface ->ExecuteCmdL(KExecute, inparam, outparam);
-        msgInterface->Close();
+        iMsgInterface ->ExecuteCmdL(KExecute, inparam, outparam);
 
         outparam.Reset();
         inparam.Reset();