13 * |
13 * |
14 * Description: Native SISX SIF (Software Install Framework) plugin. |
14 * Description: Native SISX SIF (Software Install Framework) plugin. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "sisxsifpluginactiveimpl.h" // CSisxSifPluginActiveImpl |
18 #include "sisxsifpluginactiveimpl.h" // CSisxSifPluginActiveImpl |
19 #include "sisxsifpluginuihandler.h" // CSisxSifPluginUiHandler |
19 #include "sisxsifpluginuihandlerbase.h" // CSisxSifPluginUiHandlerBase |
20 #include "sisxsifpluginuihandlersilent.h" // CSisxSifPluginUiHandlerSilent |
20 #include "sisxsifpluginuihandler.h" // CSisxSifPluginUiHandler |
21 #include "sisxsifcleanuputils.h" // CleanupResetAndDestroyPushL |
21 #include "sisxsifpluginuihandlersilent.h" // CSisxSifPluginUiHandlerSilent |
22 #include "sisxsifplugin.pan" // Panic codes |
22 #include "sisxsifplugininstallparams.h" // CSisxSifPluginInstallParams |
23 #include <usif/sif/sifcommon.h> // Usif::CComponentInfo |
23 #include "sisxsifcleanuputils.h" // CleanupResetAndDestroyPushL |
24 #include <usif/scr/scr.h> // RSoftwareComponentRegistry |
24 #include "sisxsifplugin.pan" // Panic codes |
25 #include <usif/usiferror.h> // SIF error codes |
25 #include <usif/sif/sifcommon.h> // Usif::CComponentInfo |
26 #include <swi/sisinstallerrors.h> // SWI error codes |
26 #include <usif/scr/scr.h> // RSoftwareComponentRegistry |
27 #include <swi/asynclauncher.h> // Swi::CAsyncLauncher |
27 #include <usif/usiferror.h> // SIF error codes |
28 #include <swi/sisregistrysession.h> // RSisRegistrySession |
28 #include <swi/sisinstallerrors.h> // SWI error codes |
29 #include "sisregistrywritablesession.h" // RSisRegistryWritableSession |
29 #include <swi/asynclauncher.h> // Swi::CAsyncLauncher |
30 #include <e32property.h> // RProperty |
30 #include <swi/sisregistrysession.h> // RSisRegistrySession |
31 #include <sacls.h> // KUidSwiLatestInstallation |
31 #include "sisregistrywritablesession.h" // RSisRegistryWritableSession |
32 #include <featmgr.h> // FeatureManager |
32 #include <e32property.h> // RProperty |
|
33 #include <sacls.h> // KUidSwiLatestInstallation |
|
34 #include <featmgr.h> // FeatureManager |
33 |
35 |
34 // TODO: replace with proper logging |
36 // TODO: replace with proper logging |
35 #ifdef _DEBUG |
37 #ifdef _DEBUG |
36 #define FLOG(x) RDebug::Print(x); |
38 #define FLOG(x) RDebug::Print(x); |
37 #define FLOG_1(x,y) RDebug::Print(x, y); |
39 #define FLOG_1(x,y) RDebug::Print(x, y); |
58 // --------------------------------------------------------------------------- |
60 // --------------------------------------------------------------------------- |
59 // CSisxSifPluginActiveImpl::NewL() |
61 // CSisxSifPluginActiveImpl::NewL() |
60 // --------------------------------------------------------------------------- |
62 // --------------------------------------------------------------------------- |
61 // |
63 // |
62 CSisxSifPluginActiveImpl* CSisxSifPluginActiveImpl::NewL() |
64 CSisxSifPluginActiveImpl* CSisxSifPluginActiveImpl::NewL() |
63 { |
65 { |
64 FLOG( _L("Constructing CSisxSifPluginActiveImpl") ); |
66 FLOG( _L("Constructing CSisxSifPluginActiveImpl") ); |
65 CSisxSifPluginActiveImpl *self = new( ELeave ) CSisxSifPluginActiveImpl; |
67 CSisxSifPluginActiveImpl *self = new( ELeave ) CSisxSifPluginActiveImpl; |
66 CleanupStack::PushL( self ); |
68 CleanupStack::PushL( self ); |
67 self->ConstructL(); |
69 self->ConstructL(); |
68 CleanupStack::Pop( self ); |
70 CleanupStack::Pop( self ); |
69 return self; |
71 return self; |
70 } |
72 } |
71 |
73 |
72 // --------------------------------------------------------------------------- |
74 // --------------------------------------------------------------------------- |
73 // CSisxSifPluginActiveImpl::~CSisxSifPluginActiveImpl() |
75 // CSisxSifPluginActiveImpl::~CSisxSifPluginActiveImpl() |
74 // --------------------------------------------------------------------------- |
76 // --------------------------------------------------------------------------- |
75 // |
77 // |
76 CSisxSifPluginActiveImpl::~CSisxSifPluginActiveImpl() |
78 CSisxSifPluginActiveImpl::~CSisxSifPluginActiveImpl() |
77 { |
79 { |
78 FLOG( _L("Destructing CSisxSifPluginActiveImpl") ); |
80 FLOG( _L("Destructing CSisxSifPluginActiveImpl") ); |
79 Cancel(); |
81 Cancel(); |
80 delete iAsyncLauncher; |
82 delete iAsyncLauncher; |
81 delete iUiHandler; |
83 delete iUiHandler; |
82 delete iUiHandlerSilent; |
|
83 delete iInstallPrefs; |
84 delete iInstallPrefs; |
|
85 iInputParams = NULL; // not owned |
|
86 iOutputParams = NULL; // not owned |
|
87 delete iInstallParams; |
84 delete iComponentInfo; |
88 delete iComponentInfo; |
85 delete iFileName; |
89 delete iFileName; |
86 FeatureManager::UnInitializeLib(); |
90 FeatureManager::UnInitializeLib(); |
87 iFs.Close(); |
91 iFs.Close(); |
88 } |
92 } |
89 |
93 |
90 // --------------------------------------------------------------------------- |
94 // --------------------------------------------------------------------------- |
91 // CSisxSifPluginActiveImpl::DoCancel() |
95 // CSisxSifPluginActiveImpl::DoCancel() |
92 // --------------------------------------------------------------------------- |
96 // --------------------------------------------------------------------------- |
93 // |
97 // |
189 void CSisxSifPluginActiveImpl::GetComponentInfo( |
195 void CSisxSifPluginActiveImpl::GetComponentInfo( |
190 const TDesC& aFileName, |
196 const TDesC& aFileName, |
191 const TSecurityContext& /*aSecurityContext*/, |
197 const TSecurityContext& /*aSecurityContext*/, |
192 CComponentInfo& aComponentInfo, |
198 CComponentInfo& aComponentInfo, |
193 TRequestStatus& aStatus ) |
199 TRequestStatus& aStatus ) |
194 { |
200 { |
195 FLOG_1( _L("CSisxSifPluginActiveImpl::GetComponentInfo: %S"), &aFileName ); |
201 FLOG_1( _L("CSisxSifPluginActiveImpl::GetComponentInfo: %S"), &aFileName ); |
196 if( !IsActive() ) |
202 if( !IsActive() ) |
197 { |
203 { |
198 iOperation = EGetComponentInfo; |
204 CommonRequestPreamble( aStatus ); |
199 aStatus = KRequestPending; |
205 |
200 iClientStatus = &aStatus; |
206 TRAPD( err, iAsyncLauncher->GetComponentInfoL( *iUiHandler, aFileName, |
201 iPhase = ERunningOperation; |
|
202 |
|
203 TRAPD( err, iAsyncLauncher->GetComponentInfoL( UiHandlerL(), aFileName, |
|
204 *iInstallPrefs, aComponentInfo, iStatus ) ); |
207 *iInstallPrefs, aComponentInfo, iStatus ) ); |
205 if( err ) |
208 if( err ) |
206 { |
209 { |
207 FLOG_1( _L("CSisxSifPluginActiveImpl::GetComponentInfo ERROR %d"), err ); |
210 FLOG_1( _L("CSisxSifPluginActiveImpl::GetComponentInfo ERROR %d"), err ); |
208 CompleteClientRequest( err ); |
211 CompleteClientRequest( err ); |
209 return; |
212 return; |
210 } |
213 } |
211 |
214 |
|
215 iOperation = EGetComponentInfo; |
|
216 iPhase = ERunningOperation; |
212 SetActive(); |
217 SetActive(); |
213 } |
218 } |
214 else |
219 else |
215 { |
220 { |
216 FLOG( _L("CSisxSifPluginActiveImpl::GetComponentInfo KErrInUse") ); |
221 FLOG( _L("CSisxSifPluginActiveImpl::GetComponentInfo KErrInUse") ); |
217 CompleteClientRequest( KErrInUse ); |
222 CompleteClientRequest( KErrInUse ); |
218 } |
223 } |
219 } |
224 } |
220 |
225 |
221 // --------------------------------------------------------------------------- |
226 // --------------------------------------------------------------------------- |
222 // CSisxSifPluginActiveImpl::GetComponentInfo() |
227 // CSisxSifPluginActiveImpl::GetComponentInfo() |
223 // --------------------------------------------------------------------------- |
228 // --------------------------------------------------------------------------- |
224 // |
229 // |
225 void CSisxSifPluginActiveImpl::GetComponentInfo( |
230 void CSisxSifPluginActiveImpl::GetComponentInfo( |
226 RFile& aFileHandle, |
231 RFile& aFileHandle, |
227 const TSecurityContext& /*aSecurityContext*/, |
232 const TSecurityContext& /*aSecurityContext*/, |
228 CComponentInfo& aComponentInfo, |
233 CComponentInfo& aComponentInfo, |
229 TRequestStatus& aStatus ) |
234 TRequestStatus& aStatus ) |
230 { |
235 { |
231 FLOG( _L("CSisxSifPluginActiveImpl::GetComponentInfo(RFile)") ); |
236 FLOG( _L("CSisxSifPluginActiveImpl::GetComponentInfo(RFile)") ); |
232 if( !IsActive() ) |
237 if( !IsActive() ) |
233 { |
238 { |
234 iOperation = EGetComponentInfo; |
239 CommonRequestPreamble( aStatus ); |
235 aStatus = KRequestPending; |
240 |
236 iClientStatus = &aStatus; |
241 TRAPD( err, iAsyncLauncher->GetComponentInfoL( *iUiHandler, aFileHandle, |
237 iPhase = ERunningOperation; |
|
238 |
|
239 TRAPD( err, iAsyncLauncher->GetComponentInfoL( UiHandlerL(), aFileHandle, |
|
240 *iInstallPrefs, aComponentInfo, iStatus ) ); |
242 *iInstallPrefs, aComponentInfo, iStatus ) ); |
241 if( err ) |
243 if( err ) |
242 { |
244 { |
243 FLOG_1( _L("CSisxSifPluginActiveImpl::GetComponentInfo ERROR %d"), err ); |
245 FLOG_1( _L("CSisxSifPluginActiveImpl::GetComponentInfo ERROR %d"), err ); |
244 CompleteClientRequest( err ); |
246 CompleteClientRequest( err ); |
245 return; |
247 return; |
246 } |
248 } |
247 |
249 |
|
250 iOperation = EGetComponentInfo; |
|
251 iPhase = ERunningOperation; |
248 SetActive(); |
252 SetActive(); |
249 } |
253 } |
250 else |
254 else |
251 { |
255 { |
252 FLOG( _L("CSisxSifPluginActiveImpl::GetComponentInfo KErrInUse") ); |
256 FLOG( _L("CSisxSifPluginActiveImpl::GetComponentInfo KErrInUse") ); |
253 CompleteClientRequest( KErrInUse ); |
257 CompleteClientRequest( KErrInUse ); |
254 } |
258 } |
255 } |
259 } |
256 |
260 |
257 // --------------------------------------------------------------------------- |
261 // --------------------------------------------------------------------------- |
258 // CSisxSifPluginActiveImpl::Install() |
262 // CSisxSifPluginActiveImpl::Install() |
259 // --------------------------------------------------------------------------- |
263 // --------------------------------------------------------------------------- |
260 // |
264 // |
262 const TDesC& aFileName, |
266 const TDesC& aFileName, |
263 const TSecurityContext& aSecurityContext, |
267 const TSecurityContext& aSecurityContext, |
264 const COpaqueNamedParams& aInputParams, |
268 const COpaqueNamedParams& aInputParams, |
265 COpaqueNamedParams& aOutputParams, |
269 COpaqueNamedParams& aOutputParams, |
266 TRequestStatus& aStatus ) |
270 TRequestStatus& aStatus ) |
267 { |
271 { |
268 FLOG_1( _L("CSisxSifPluginActiveImpl::Install: %S"), &aFileName ); |
272 FLOG_1( _L("CSisxSifPluginActiveImpl::Install: %S"), &aFileName ); |
269 if( !IsActive() ) |
273 if( !IsActive() ) |
270 { |
274 { |
271 CommonRequestPreamble( aInputParams, aOutputParams, aStatus ); |
275 CommonRequestPreamble( aInputParams, aOutputParams, aStatus ); |
272 FLOG_1( _L("CSisxSifPluginActiveImpl::Install, iUseSilentMode=%d"), iUseSilentMode ); |
276 FLOG_1( _L("CSisxSifPluginActiveImpl::Install, IsSilentMode=%d"), IsSilentMode() ); |
273 |
277 |
274 if( iUseSilentMode ) |
278 if( IsSilentMode() ) |
275 { |
279 { |
276 if( !aSecurityContext.HasCapability( ECapabilityTrustedUI ) ) |
280 if( !aSecurityContext.HasCapability( ECapabilityTrustedUI ) ) |
277 { |
281 { |
278 FLOG( _L("CSisxSifPluginActiveImpl::Install, missing ECapabilityTrustedUI") ); |
282 FLOG( _L("CSisxSifPluginActiveImpl::Install, missing ECapabilityTrustedUI") ); |
279 CompleteClientRequest( KErrPermissionDenied ); |
283 CompleteClientRequest( KErrPermissionDenied ); |
284 { |
288 { |
285 iUiHandler->DisplayPreparingInstallL( aFileName ); |
289 iUiHandler->DisplayPreparingInstallL( aFileName ); |
286 } |
290 } |
287 SetInstallFileL( aFileName ); |
291 SetInstallFileL( aFileName ); |
288 |
292 |
289 TRAPD( err, iAsyncLauncher->GetComponentInfoL( UiHandlerL( iUseSilentMode ), |
293 TRAPD( err, iAsyncLauncher->GetComponentInfoL( *iUiHandler, aFileName, |
290 aFileName, *iInstallPrefs, *iComponentInfo, iStatus ) ); |
294 *iInstallPrefs, *iComponentInfo, iStatus ) ); |
291 if( err ) |
295 if( err ) |
292 { |
296 { |
293 FLOG_1( _L("CSisxSifPluginActiveImpl::Install, GetComponentInfoL ERROR %d"), err ); |
297 FLOG_1( _L("CSisxSifPluginActiveImpl::Install, GetComponentInfoL ERROR %d"), err ); |
294 CompleteClientRequest( err ); |
298 CompleteClientRequest( err ); |
295 return; |
299 return; |
314 RFile& aFileHandle, |
318 RFile& aFileHandle, |
315 const TSecurityContext& aSecurityContext, |
319 const TSecurityContext& aSecurityContext, |
316 const COpaqueNamedParams& aInputParams, |
320 const COpaqueNamedParams& aInputParams, |
317 COpaqueNamedParams& aOutputParams, |
321 COpaqueNamedParams& aOutputParams, |
318 TRequestStatus& aStatus ) |
322 TRequestStatus& aStatus ) |
319 { |
323 { |
320 TFileName fileName; |
324 TFileName fileName; |
321 aFileHandle.Name( fileName ); |
325 aFileHandle.Name( fileName ); |
322 FLOG_1( _L("CSisxSifPluginActiveImpl::Install(RFile): %S"), &fileName ); |
326 FLOG_1( _L("CSisxSifPluginActiveImpl::Install(RFile): %S"), &fileName ); |
323 if( !IsActive() ) |
327 if( !IsActive() ) |
324 { |
328 { |
325 CommonRequestPreamble( aInputParams, aOutputParams, aStatus ); |
329 CommonRequestPreamble( aInputParams, aOutputParams, aStatus ); |
326 FLOG_1( _L("CSisxSifPluginActiveImpl::Install, iUseSilentMode=%d"), iUseSilentMode ); |
330 FLOG_1( _L("CSisxSifPluginActiveImpl::Install, IsSilentMode=%d"), IsSilentMode() ); |
327 |
331 |
328 if( iUseSilentMode ) |
332 if( IsSilentMode() ) |
329 { |
333 { |
330 if( !aSecurityContext.HasCapability( ECapabilityTrustedUI ) ) |
334 if( !aSecurityContext.HasCapability( ECapabilityTrustedUI ) ) |
331 { |
335 { |
332 FLOG( _L("CSisxSifPluginActiveImpl::Install, missing ECapabilityTrustedUI") ); |
336 FLOG( _L("CSisxSifPluginActiveImpl::Install, missing ECapabilityTrustedUI") ); |
333 CompleteClientRequest( KErrPermissionDenied ); |
337 CompleteClientRequest( KErrPermissionDenied ); |
338 { |
342 { |
339 iUiHandler->DisplayPreparingInstallL( fileName ); |
343 iUiHandler->DisplayPreparingInstallL( fileName ); |
340 } |
344 } |
341 SetInstallFile( aFileHandle ); |
345 SetInstallFile( aFileHandle ); |
342 |
346 |
343 TRAPD( err, iAsyncLauncher->GetComponentInfoL( UiHandlerL( iUseSilentMode ), |
347 TRAPD( err, iAsyncLauncher->GetComponentInfoL( *iUiHandler, aFileHandle, |
344 aFileHandle, *iInstallPrefs, *iComponentInfo, iStatus ) ); |
348 *iInstallPrefs, *iComponentInfo, iStatus ) ); |
345 if( err ) |
349 if( err ) |
346 { |
350 { |
347 FLOG_1( _L("CSisxSifPluginActiveImpl::Install, GetComponentInfoL ERROR %d"), err ); |
351 FLOG_1( _L("CSisxSifPluginActiveImpl::Install, GetComponentInfoL ERROR %d"), err ); |
348 CompleteClientRequest( err ); |
352 CompleteClientRequest( err ); |
349 return; |
353 return; |
368 TComponentId aComponentId, |
372 TComponentId aComponentId, |
369 const TSecurityContext& aSecurityContext, |
373 const TSecurityContext& aSecurityContext, |
370 const COpaqueNamedParams& aInputParams, |
374 const COpaqueNamedParams& aInputParams, |
371 COpaqueNamedParams& aOutputParams, |
375 COpaqueNamedParams& aOutputParams, |
372 TRequestStatus& aStatus ) |
376 TRequestStatus& aStatus ) |
373 { |
377 { |
374 FLOG_1( _L("CSisxSifPluginActiveImpl::Uninstall, aComponentId %d"), aComponentId ); |
378 FLOG_1( _L("CSisxSifPluginActiveImpl::Uninstall, aComponentId %d"), aComponentId ); |
375 if( !IsActive() ) |
379 if( !IsActive() ) |
376 { |
380 { |
377 CommonRequestPreamble( aInputParams, aOutputParams, aStatus ); |
381 CommonRequestPreamble( aInputParams, aOutputParams, aStatus ); |
378 |
382 |
400 else |
403 else |
401 { |
404 { |
402 FLOG( _L("CSisxSifPluginActiveImpl::Uninstall KErrInUse") ); |
405 FLOG( _L("CSisxSifPluginActiveImpl::Uninstall KErrInUse") ); |
403 CompleteClientRequest( KErrInUse ); |
406 CompleteClientRequest( KErrInUse ); |
404 } |
407 } |
405 } |
408 } |
406 |
409 |
407 // --------------------------------------------------------------------------- |
410 // --------------------------------------------------------------------------- |
408 // CSisxSifPluginActiveImpl::Activate() |
411 // CSisxSifPluginActiveImpl::Activate() |
409 // --------------------------------------------------------------------------- |
412 // --------------------------------------------------------------------------- |
410 // |
413 // |
411 void CSisxSifPluginActiveImpl::Activate( |
414 void CSisxSifPluginActiveImpl::Activate( |
412 TComponentId aComponentId, |
415 TComponentId aComponentId, |
413 const TSecurityContext& /*aSecurityContext*/, |
416 const TSecurityContext& /*aSecurityContext*/, |
414 TRequestStatus& aStatus ) |
417 TRequestStatus& aStatus ) |
415 { |
418 { |
416 FLOG_1( _L("CSisxSifPluginActiveImpl::Activate, aComponentId %d"), aComponentId ); |
419 FLOG_1( _L("CSisxSifPluginActiveImpl::Activate, aComponentId %d"), aComponentId ); |
417 if( !IsActive() ) |
420 if( !IsActive() ) |
418 { |
421 { |
419 aStatus = KRequestPending; |
422 aStatus = KRequestPending; |
420 iClientStatus = &aStatus; |
423 iClientStatus = &aStatus; |
438 else |
441 else |
439 { |
442 { |
440 FLOG( _L("CSisxSifPluginActiveImpl::Activate KErrInUse") ); |
443 FLOG( _L("CSisxSifPluginActiveImpl::Activate KErrInUse") ); |
441 CompleteClientRequest( KErrInUse ); |
444 CompleteClientRequest( KErrInUse ); |
442 } |
445 } |
443 } |
446 } |
444 |
447 |
445 // --------------------------------------------------------------------------- |
448 // --------------------------------------------------------------------------- |
446 // CSisxSifPluginActiveImpl::Deactivate() |
449 // CSisxSifPluginActiveImpl::Deactivate() |
447 // --------------------------------------------------------------------------- |
450 // --------------------------------------------------------------------------- |
448 // |
451 // |
449 void CSisxSifPluginActiveImpl::Deactivate( |
452 void CSisxSifPluginActiveImpl::Deactivate( |
450 TComponentId aComponentId, |
453 TComponentId aComponentId, |
451 const TSecurityContext& /*aSecurityContext*/, |
454 const TSecurityContext& /*aSecurityContext*/, |
452 TRequestStatus& aStatus ) |
455 TRequestStatus& aStatus ) |
453 { |
456 { |
454 FLOG_1( _L("CSisxSifPluginActiveImpl::Deactivate, aComponentId %d"), aComponentId ); |
457 FLOG_1( _L("CSisxSifPluginActiveImpl::Deactivate, aComponentId %d"), aComponentId ); |
455 if( !IsActive() ) |
458 if( !IsActive() ) |
456 { |
459 { |
457 aStatus = KRequestPending; |
460 aStatus = KRequestPending; |
458 iClientStatus = &aStatus; |
461 iClientStatus = &aStatus; |
502 iInstallPrefs = Swi::CInstallPrefs::NewL(); |
505 iInstallPrefs = Swi::CInstallPrefs::NewL(); |
503 iComponentInfo = CComponentInfo::NewL(); |
506 iComponentInfo = CComponentInfo::NewL(); |
504 } |
507 } |
505 |
508 |
506 // --------------------------------------------------------------------------- |
509 // --------------------------------------------------------------------------- |
507 // CSisxSifPluginActiveImpl::UiHandlerL() |
510 // CSisxSifPluginActiveImpl::CommonRequestPreamble() |
508 // --------------------------------------------------------------------------- |
511 // --------------------------------------------------------------------------- |
509 // |
512 // |
510 Swi::MUiHandler& CSisxSifPluginActiveImpl::UiHandlerL( TBool aUseSilentMode ) |
513 void CSisxSifPluginActiveImpl::CommonRequestPreamble( TRequestStatus& aStatus ) |
511 { |
514 { |
512 Swi::MUiHandler* handler = NULL; |
515 aStatus = KRequestPending; |
513 |
516 iClientStatus = &aStatus; |
514 if( aUseSilentMode ) |
517 |
515 { |
518 if( iInstallParams ) |
516 if( iUiHandler ) |
519 { |
517 { |
520 delete iInstallParams; |
518 delete iUiHandler; |
521 iInstallParams = NULL; |
519 iUiHandler = NULL; |
522 } |
520 } |
523 CreateUiHandlerL(); |
521 if( !iUiHandlerSilent ) |
524 |
522 { |
525 iInputParams = NULL; |
523 iUiHandlerSilent = CSisxSifPluginUiHandlerSilent::NewL( iFs ); |
526 iOutputParams = NULL; |
524 } |
|
525 handler = iUiHandlerSilent; |
|
526 } |
|
527 else |
|
528 { |
|
529 if( iUiHandlerSilent ) |
|
530 { |
|
531 delete iUiHandlerSilent; |
|
532 iUiHandlerSilent = NULL; |
|
533 } |
|
534 if( !iUiHandler ) |
|
535 { |
|
536 iUiHandler = CSisxSifPluginUiHandler::NewL( iFs ); |
|
537 } |
|
538 handler = iUiHandler; |
|
539 } |
|
540 |
|
541 return *handler; |
|
542 } |
527 } |
543 |
528 |
544 // --------------------------------------------------------------------------- |
529 // --------------------------------------------------------------------------- |
545 // CSisxSifPluginActiveImpl::CommonRequestPreamble() |
530 // CSisxSifPluginActiveImpl::CommonRequestPreamble() |
546 // --------------------------------------------------------------------------- |
531 // --------------------------------------------------------------------------- |
551 TRequestStatus& aStatus ) |
536 TRequestStatus& aStatus ) |
552 { |
537 { |
553 aStatus = KRequestPending; |
538 aStatus = KRequestPending; |
554 iClientStatus = &aStatus; |
539 iClientStatus = &aStatus; |
555 |
540 |
556 TInt silentInstall = 0; |
541 if( iInstallParams ) |
557 TRAPD( err, aInputParams.GetIntByNameL( KSifInParam_InstallSilently, silentInstall ) ); |
542 { |
558 iUseSilentMode = ( err == KErrNone && silentInstall != 0 ); |
543 delete iInstallParams; |
|
544 iInstallParams = NULL; |
|
545 } |
|
546 iInstallParams = CSisxSifPluginInstallParams::NewL( aInputParams ); |
|
547 CreateUiHandlerL(); |
559 |
548 |
560 iInputParams = &aInputParams; |
549 iInputParams = &aInputParams; |
561 iOutputParams = &aOutputParams; |
550 iOutputParams = &aOutputParams; |
562 |
551 } |
563 // TODO: KSifInParam_InstallInactive |
552 |
564 } |
553 // --------------------------------------------------------------------------- |
|
554 // CSisxSifPluginActiveImpl::CreateUiHandlerL() |
|
555 // --------------------------------------------------------------------------- |
|
556 // |
|
557 void CSisxSifPluginActiveImpl::CreateUiHandlerL() |
|
558 { |
|
559 if( iUiHandler ) |
|
560 { |
|
561 delete iUiHandler; |
|
562 iUiHandler = NULL; |
|
563 } |
|
564 if( IsSilentMode() ) |
|
565 { |
|
566 iUiHandler = CSisxSifPluginUiHandlerSilent::NewL( iFs ); |
|
567 } |
|
568 else |
|
569 { |
|
570 iUiHandler = CSisxSifPluginUiHandler::NewL( iFs ); |
|
571 } |
|
572 if( iInstallParams ) |
|
573 { |
|
574 iUiHandler->SetInstallParamsL( *iInstallParams ); |
|
575 } |
|
576 } |
|
577 |
|
578 // --------------------------------------------------------------------------- |
|
579 // CSisxSifPluginActiveImpl::IsSilentMode() |
|
580 // --------------------------------------------------------------------------- |
|
581 // |
|
582 TBool CSisxSifPluginActiveImpl::IsSilentMode() |
|
583 { |
|
584 return( iInstallParams && iInstallParams->IsSilentMode() ); |
|
585 } |
565 |
586 |
566 // --------------------------------------------------------------------------- |
587 // --------------------------------------------------------------------------- |
567 // CSisxSifPluginActiveImpl::CompleteClientRequest() |
588 // CSisxSifPluginActiveImpl::CompleteClientRequest() |
568 // --------------------------------------------------------------------------- |
589 // --------------------------------------------------------------------------- |
569 // |
590 // |
633 // CSisxSifPluginActiveImpl::DoHandleErrorL() |
654 // CSisxSifPluginActiveImpl::DoHandleErrorL() |
634 // --------------------------------------------------------------------------- |
655 // --------------------------------------------------------------------------- |
635 // |
656 // |
636 void CSisxSifPluginActiveImpl::DoHandleErrorL( TInt aError ) |
657 void CSisxSifPluginActiveImpl::DoHandleErrorL( TInt aError ) |
637 { |
658 { |
|
659 // TODO: add support for: |
|
660 // KSifOutParam_ErrCategory |
|
661 // KSifOutParam_ErrCode |
|
662 // KSifOutParam_ExtendedErrCode |
|
663 // KSifOutParam_ErrMessage |
|
664 // KSifOutParam_ErrMessageDetails |
|
665 |
638 if( iOutputParams ) |
666 if( iOutputParams ) |
639 { |
667 { |
640 iOutputParams->AddIntL( KSifOutParam_ExtendedErrCode, aError ); |
668 iOutputParams->AddIntL( KSifOutParam_ExtendedErrCode, aError ); |
641 } |
669 } |
642 TInt errorCode = ConvertToSifErrorCode( aError ); |
670 TInt errorCode = ConvertToSifErrorCode( aError ); |
643 if( !iUseSilentMode && ( errorCode != KErrCancel ) ) |
671 if( errorCode != KErrCancel ) |
644 { |
672 { |
645 iUiHandler->DisplayFailedL( errorCode ); |
673 iUiHandler->DisplayFailedL( errorCode ); |
646 } |
674 } |
647 } |
675 } |
648 |
676 |
828 // CSisxSifPluginActiveImpl::StartInstallingL() |
856 // CSisxSifPluginActiveImpl::StartInstallingL() |
829 // --------------------------------------------------------------------------- |
857 // --------------------------------------------------------------------------- |
830 // |
858 // |
831 void CSisxSifPluginActiveImpl::StartInstallingL() |
859 void CSisxSifPluginActiveImpl::StartInstallingL() |
832 { |
860 { |
833 Swi::MUiHandler& uiHandler = UiHandlerL( iUseSilentMode ); |
861 const CComponentInfo::CNode& rootNode( iComponentInfo->RootNodeL() ); |
834 |
862 TBool driveSelection = rootNode.DriveSeletionRequired(); |
835 if( !iUseSilentMode && iUiHandler ) |
863 iUiHandler->SetDriveSelectionRequired( driveSelection ); |
836 { |
864 TInt maxInstalledSize = rootNode.MaxInstalledSize(); |
837 const CComponentInfo::CNode& rootNode( iComponentInfo->RootNodeL() ); |
865 iUiHandler->SetMaxInstalledSize( maxInstalledSize ); |
838 TBool driveSelection = rootNode.DriveSeletionRequired(); |
|
839 iUiHandler->SetDriveSelectionRequired( driveSelection ); |
|
840 TInt maxInstalledSize = rootNode.MaxInstalledSize(); |
|
841 iUiHandler->SetMaxInstalledSize( maxInstalledSize ); |
|
842 } |
|
843 |
866 |
844 if( iFileHandle ) |
867 if( iFileHandle ) |
845 { |
868 { |
846 iAsyncLauncher->InstallL( uiHandler, *iFileHandle, *iInstallPrefs, iStatus ); |
869 iAsyncLauncher->InstallL( *iUiHandler, *iFileHandle, *iInstallPrefs, iStatus ); |
847 } |
870 } |
848 else if( iFileName ) |
871 else if( iFileName ) |
849 { |
872 { |
850 iAsyncLauncher->InstallL( uiHandler, *iFileName, *iInstallPrefs, iStatus ); |
873 iAsyncLauncher->InstallL( *iUiHandler, *iFileName, *iInstallPrefs, iStatus ); |
851 } |
874 } |
852 else |
875 else |
853 { |
876 { |
854 Panic( ESisxSifInternalError ); |
877 Panic( ESisxSifInternalError ); |
855 } |
878 } |