--- a/taskswitcher/taskswitcherui/taskswitcherappecom/src/tsappecom.cpp Wed Sep 01 12:32:46 2010 +0100
+++ b/taskswitcher/taskswitcherui/taskswitcherappecom/src/tsappecom.cpp Tue Sep 14 20:58:58 2010 +0300
@@ -74,6 +74,7 @@
TSLOG_IN();
DefineTaskswitcherStateProperty();
+ User::LeaveIfError( iApaLsSession.Connect() );
TSLOG_OUT();
}
@@ -85,6 +86,7 @@
//
CTsEcomPlugin::~CTsEcomPlugin()
{
+ iApaLsSession.Close();
}
// ---------------------------------------------------------------------------
@@ -188,18 +190,11 @@
TSLOG_CONTEXT( CTsEcomPlugin::IsReady, TSLOG_LOCAL );
TSLOG_IN();
- TBool ret = EFalse;
- CEikonEnv* eikonEnv = CEikonEnv::Static();
+ TBool ret = ETrue;
- if ( eikonEnv )
+ if( !IsTaskSwitcherStarted() )
{
- TApaTaskList taskList( eikonEnv->WsSession() );
- TApaTask task = taskList.FindApp( KTaskswitcherAppUidValue );
-
- if ( task.Exists() )
- {
- ret = ETrue;
- }
+ ret = (KErrNone == StartTaskSwitcher()) ? ETrue : EFalse;
}
TSLOG1_OUT( "IsReady returns: %d", ret );
@@ -249,4 +244,72 @@
TSLOG_OUT();
}
+// -----------------------------------------------------------------------------
+// CTsEcomPlugin::IsTaskSwitcherStarted
+// -----------------------------------------------------------------------------
+//
+TBool CTsEcomPlugin::IsTaskSwitcherStarted()
+ {
+ TSLOG_CONTEXT( CTsEcomPlugin::IsTaskSwitcherStarted, TSLOG_LOCAL );
+ TSLOG_IN();
+
+ TBool ret(EFalse);
+ CEikonEnv* eikonEnv = CEikonEnv::Static();
+ if ( eikonEnv )
+ {
+ TApaTaskList taskList( eikonEnv->WsSession() );
+ TApaTask task = taskList.FindApp( KTaskswitcherAppUidValue );
+ if ( task.Exists() )
+ {
+ ret = ETrue;
+ }
+ }
+ TSLOG1( TSLOG_INFO, "TaskSwitcherStarted: %d", ret);
+ TSLOG_OUT();
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CTsEcomPlugin::StartTaskSwitcher
+// -----------------------------------------------------------------------------
+//
+TInt CTsEcomPlugin::StartTaskSwitcher()
+ {
+ TInt ret(0);
+ TRAPD(err, ret = StartTaskSwitcherL() );
+ if( KErrNone != err )
+ {
+ ret = err;
+ }
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CTsEcomPlugin::StartTaskSwitcherL
+// -----------------------------------------------------------------------------
+//
+TInt CTsEcomPlugin::StartTaskSwitcherL()
+ {
+ TSLOG_CONTEXT( CTsEcomPlugin::StartTaskSwitcher, TSLOG_LOCAL );
+ TSLOG_IN();
+ TInt ret(KErrNone);
+
+ TApaAppInfo appInfo;
+ TApaAppCapabilityBuf capabilityBuf;
+ ret = iApaLsSession.GetAppInfo( appInfo, KTaskswitcherAppUidValue );
+ if ( !ret )
+ {
+ TFileName appName = appInfo.iFullName;
+ CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
+ cmdLine->SetExecutableNameL( appName );
+ cmdLine->SetCommandL( EApaCommandRun );
+ ret = iApaLsSession.StartApp( *cmdLine );
+ CleanupStack::PopAndDestroy( cmdLine );
+ }
+
+ TSLOG1( TSLOG_INFO, "RApaLsSession::StartApp returned with: %d", ret );
+ TSLOG_OUT();
+ return ret;
+ }
+
// End of file