135 // CWsfAiPlugin::CWsfAiPlugin |
135 // CWsfAiPlugin::CWsfAiPlugin |
136 // -------------------------------------------------------------------------- |
136 // -------------------------------------------------------------------------- |
137 // |
137 // |
138 CWsfAiPlugin::CWsfAiPlugin() |
138 CWsfAiPlugin::CWsfAiPlugin() |
139 { |
139 { |
|
140 iEnv = CEikonEnv::Static(); |
140 } |
141 } |
141 |
142 |
142 |
143 |
143 // -------------------------------------------------------------------------- |
144 // -------------------------------------------------------------------------- |
144 // CWsfAiPlugin::ConstructL |
145 // CWsfAiPlugin::ConstructL |
158 |
159 |
159 // then model |
160 // then model |
160 iAiModel = CWsfAiModel::NewL(); |
161 iAiModel = CWsfAiModel::NewL(); |
161 iUi = CWsfAiView::NewL( *this ); |
162 iUi = CWsfAiView::NewL( *this ); |
162 |
163 |
|
164 iActiveWrappers = CWsfActiveWrappers::NewL( iModel, iController ); |
|
165 |
163 iDbObserver = CWsfDbObserver::NewL(); |
166 iDbObserver = CWsfDbObserver::NewL(); |
164 |
167 |
165 iActiveWrappers = CWsfActiveWrappers::NewL( iModel, iController ); |
|
166 |
|
167 iController.SetUi( *static_cast<CWsfAiView*>( iUi ) ); |
168 iController.SetUi( *static_cast<CWsfAiView*>( iUi ) ); |
168 |
169 |
169 iController.InitializeL( iModel, iAiModel, iDbObserver, |
170 iController.InitializeL( iEnv, iModel, iAiModel, iDbObserver, |
170 iActiveWrappers ); |
171 iActiveWrappers ); |
171 } |
172 } |
172 |
173 |
173 |
174 |
174 // -------------------------------------------------------------------------- |
175 // -------------------------------------------------------------------------- |
391 // |
392 // |
392 void CWsfAiPlugin::AllocateResourcesL() |
393 void CWsfAiPlugin::AllocateResourcesL() |
393 { |
394 { |
394 LOG_ENTERFN( "CWsfAiPlugin::AllocateResourcesL" ); |
395 LOG_ENTERFN( "CWsfAiPlugin::AllocateResourcesL" ); |
395 // create resourcefile |
396 // create resourcefile |
396 CCoeEnv* env = CCoeEnv::Static(); |
397 TFileName resourceFile; |
397 TFindFile finder( env->FsSession() ); |
398 resourceFile.Append( KResourceDrive ); |
398 CDir* fileEntries; |
399 resourceFile.Append( KDC_RESOURCE_FILES_DIR ); |
399 User::LeaveIfError( finder.FindWildByDir( KResourceFile, |
400 resourceFile.Append( KResourceFile ); |
400 KDC_RESOURCE_FILES_DIR, |
401 |
401 fileEntries ) ); |
402 BaflUtils::NearestLanguageFile( iEnv->FsSession(), resourceFile ); |
402 |
403 iResourceFileOffset = iEnv->AddResourceFileL( resourceFile ); |
403 TParse pathParse; |
|
404 pathParse.Set( (*fileEntries)[0].iName, &finder.File(), NULL ); |
|
405 |
|
406 TFileName resourceFile = pathParse.FullName(); |
|
407 delete fileEntries; |
|
408 |
|
409 BaflUtils::NearestLanguageFile( env->FsSession(), resourceFile ); |
|
410 iResourceFileOffset = env->AddResourceFileL( resourceFile ); |
|
411 } |
404 } |
412 |
405 |
413 // -------------------------------------------------------------------------- |
406 // -------------------------------------------------------------------------- |
414 // CWsfAiPlugin::Start |
407 // CWsfAiPlugin::Start |
415 // -------------------------------------------------------------------------- |
408 // -------------------------------------------------------------------------- |
728 CleanupClosePushL( appArcSession ); |
721 CleanupClosePushL( appArcSession ); |
729 |
722 |
730 |
723 |
731 // check if the app is already running ... and brings it to foreground. |
724 // check if the app is already running ... and brings it to foreground. |
732 TUid id( TUid::Uid( KUidSnifferApp.iUid ) ); |
725 TUid id( TUid::Uid( KUidSnifferApp.iUid ) ); |
733 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
726 TApaTaskList taskList( iEnv->WsSession() ); |
734 TApaTask task = taskList.FindApp( id ); |
727 TApaTask task = taskList.FindApp( id ); |
735 |
728 |
736 if ( task.Exists() ) |
729 if ( task.Exists() ) |
737 { |
730 { |
738 task.BringToForeground(); |
731 task.BringToForeground(); |