homescreensrv_plat/sapi_actionhandler/actionhandlerplugins/src/ahpapplauncher.cpp
branchRCL_3
changeset 19 502e5d91ad42
parent 0 79c6a41cd166
child 59 a0713522ab97
--- a/homescreensrv_plat/sapi_actionhandler/actionhandlerplugins/src/ahpapplauncher.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreensrv_plat/sapi_actionhandler/actionhandlerplugins/src/ahpapplauncher.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -106,26 +106,37 @@
 
     if ( !ExtractUidL( aMap, appUid, KApplicationUid ) )
         {
-        RApaLsSession appSession;
-        CleanupClosePushL( appSession );
-        User::LeaveIfError( appSession.Connect( ) );
-
-        CApaCommandLine* cmd = CApaCommandLine::NewLC( );
-        cmd->SetCommandL( GetCommandL( aMap ) );
-        RBuf documentNameValue;
-        CleanupClosePushL( documentNameValue );
-        if( !ExtractDesL( aMap, documentNameValue, KDocumentName ) )
+        TApaTaskList taskList( iEnv->WsSession() );       
+        TApaTask task = taskList.FindApp( appUid );
+        if ( task.Exists( ) )
+            {
+            errCode = KErrNone;
+            task.BringToForeground();
+            }
+        else
             {
-            cmd->SetDocumentNameL( documentNameValue );
+            // app not yet running
+            RApaLsSession appSession;
+            CleanupClosePushL( appSession );
+            User::LeaveIfError( appSession.Connect( ) );
+    
+            CApaCommandLine* cmd = CApaCommandLine::NewLC( );
+            cmd->SetCommandL( GetCommandL( aMap ) );
+            RBuf documentNameValue;
+            CleanupClosePushL( documentNameValue );
+            if( !ExtractDesL( aMap, documentNameValue, KDocumentName ) )
+                {
+                cmd->SetDocumentNameL( documentNameValue );
+                }
+            TApaAppInfo appInfo;
+            appSession.GetAppInfo( appInfo, appUid );
+            cmd->SetExecutableNameL( appInfo.iFullName );
+            errCode = appSession.StartApp( *cmd );
+    
+            CleanupStack::PopAndDestroy( &documentNameValue );
+            CleanupStack::PopAndDestroy( cmd );
+            CleanupStack::PopAndDestroy( &appSession );
             }
-        TApaAppInfo appInfo;
-        appSession.GetAppInfo( appInfo, appUid );
-        cmd->SetExecutableNameL( appInfo.iFullName );
-        errCode = appSession.StartApp( *cmd );
-
-        CleanupStack::PopAndDestroy( &documentNameValue );
-        CleanupStack::PopAndDestroy( cmd );
-        CleanupStack::PopAndDestroy( &appSession );
         }
     return errCode;
     }