32 #include "DialogWrapper.h" |
32 #include "DialogWrapper.h" |
33 |
33 |
34 using namespace Swi; |
34 using namespace Swi; |
35 |
35 |
36 const static TInt KWaitTime = 3000000; // 2 secs |
36 const static TInt KWaitTime = 3000000; // 2 secs |
37 const TInt KMimeTextLength = 64; |
|
38 |
37 |
39 // ----------------------------------------------------------------------- |
38 // ----------------------------------------------------------------------- |
40 // Two phased construction |
39 // Two phased construction |
41 // ----------------------------------------------------------------------- |
40 // ----------------------------------------------------------------------- |
42 // |
41 // |
113 User::LeaveIfError( iFs.Connect() ); |
112 User::LeaveIfError( iFs.Connect() ); |
114 User::LeaveIfError( iApaSession.Connect() ); |
113 User::LeaveIfError( iApaSession.Connect() ); |
115 iFs.ShareProtected(); |
114 iFs.ShareProtected(); |
116 iUidArrayIndex = 0; |
115 iUidArrayIndex = 0; |
117 iSilentUninstaller = NULL; |
116 iSilentUninstaller = NULL; |
118 iState = EUninstallerStateIdle; |
117 iState = EUninstallerStateIdle; |
119 |
118 // Alloc descriptor for mime type sis/sisx |
120 // Alloc descriptor for mime type sis/sisx |
119 iMime = SwiUI::KSisxMimeType().AllocL(); |
121 iMime = HBufC::NewL( KMimeTextLength ); |
|
122 TPtr iMimePtr = iMime->Des(); |
|
123 iMimePtr.Copy( SwiUI::KSisxMimeType ); |
|
124 |
|
125 // Note this will create new instance for dialog class and |
120 // Note this will create new instance for dialog class and |
126 // also new dialog watcher AO for uninstaller. |
121 // also new dialog watcher AO for uninstaller. |
127 // Since uninstaller is used rarely this is not big issue. |
122 // Since uninstaller is used rarely this is not big issue. |
128 // In future dialog class could be added to CProgramStatus class |
123 // In future dialog class could be added to CProgramStatus class |
129 // member from where both installer and uninstaller could us it. |
124 // member from where both installer and uninstaller could us it. |
279 if ( iUidArrayIndex < iPkgUidArray.Count() ) |
274 if ( iUidArrayIndex < iPkgUidArray.Count() ) |
280 { |
275 { |
281 // Display installing note for user. |
276 // Display installing note for user. |
282 iDialogs->ShowWaitingNoteForUninstallerL(); |
277 iDialogs->ShowWaitingNoteForUninstallerL(); |
283 |
278 |
284 if ( iUidArrayIndex == 0 ) |
|
285 { |
|
286 // Set uninstall mode for universal indicator and |
|
287 // set percent value to 0%. |
|
288 iDialogs->SetModeToIndicatorL( KSWIDaemonUninstallerMode ); |
|
289 } |
|
290 else |
|
291 { |
|
292 // Calculate current percent value to iPercentValue. |
|
293 CalcPercentValue(); |
|
294 // Activate new value to universal indicator. |
|
295 iDialogs->ActivateIndicatorL( iPercentValue ); |
|
296 } |
|
297 |
|
298 FLOG_1( _L("[SISUninstaller] Run uninstall index = %d"), |
279 FLOG_1( _L("[SISUninstaller] Run uninstall index = %d"), |
299 iUidArrayIndex ); |
280 iUidArrayIndex ); |
300 |
281 |
301 // Get next UID. |
282 // Get next UID. |
302 iUID = iPkgUidArray[ iUidArrayIndex ]; |
283 iUID = iPkgUidArray[ iUidArrayIndex ]; |
359 // ----------------------------------------------------------------------- |
340 // ----------------------------------------------------------------------- |
360 // |
341 // |
361 void CSisPkgUninstaller::UninstallationCompleted( TInt /*aResult*/ ) |
342 void CSisPkgUninstaller::UninstallationCompleted( TInt /*aResult*/ ) |
362 { |
343 { |
363 FLOG( _L("[SISUninstaller] UninstallationCompleted") ); |
344 FLOG( _L("[SISUninstaller] UninstallationCompleted") ); |
364 // Update indicator value last time and show 100% to user. |
|
365 iDialogs->ActivateIndicatorL( 100 ); |
|
366 |
345 |
367 if ( EStateUninstalling == iProgramStatus->GetProgramStatus() ) |
346 if ( EStateUninstalling == iProgramStatus->GetProgramStatus() ) |
368 { |
347 { |
369 FLOG( _L("[SISUninstaller] Set status to idle")); |
348 FLOG( _L("[SISUninstaller] Set status to idle")); |
370 iProgramStatus->SetProgramStatusToIdle(); |
349 iProgramStatus->SetProgramStatusToIdle(); |
372 |
351 |
373 iUidArrayIndex = 0; |
352 iUidArrayIndex = 0; |
374 iState = EUninstallerStateIdle; |
353 iState = EUninstallerStateIdle; |
375 |
354 |
376 // Cancel waiting note. |
355 // Cancel waiting note. |
377 TRAP_IGNORE( iDialogs->CancelWaitingNoteForUninstaller()); |
356 TRAP_IGNORE( iDialogs->CancelWaitingNoteL() ); |
378 // Close indicator. |
|
379 iDialogs->CancelIndicatorL(); |
|
380 } |
357 } |
381 |
358 |
382 |
359 |
383 // ----------------------------------------------------------------------- |
360 // ----------------------------------------------------------------------- |
384 // This is for self exit. |
361 // This is for self exit. |
390 // Uninstall is completed and we do not need uninstaller anymore. |
367 // Uninstall is completed and we do not need uninstaller anymore. |
391 // Call revisor's destructor. |
368 // Call revisor's destructor. |
392 iRevisor->Exit(); |
369 iRevisor->Exit(); |
393 } |
370 } |
394 |
371 |
395 // ----------------------------------------------------------------------- |
|
396 // CSisInstaller::CalcPrecentValue |
|
397 // ----------------------------------------------------------------------- |
|
398 // |
|
399 void CSisPkgUninstaller::CalcPercentValue() |
|
400 { |
|
401 FLOG( _L("[SISUninstaller] CalcPercentValue") ); |
|
402 FLOG_1( _L("[SISUninstaller] iUidArrayIndex = %d"), iUidArrayIndex ); |
|
403 // Let's calculate indicator value for UI now. |
|
404 TInt packageUidCount = iPkgUidArray.Count(); |
|
405 FLOG_1( _L("[SISUninstaller] pkg UID count = %d"), packageUidCount ); |
|
406 |
|
407 iPercentValue = 0; |
|
408 |
|
409 if ( iUidArrayIndex && packageUidCount ) |
|
410 { |
|
411 // Let's calculate new precent value. |
|
412 if ( iUidArrayIndex <= packageUidCount ) |
|
413 { |
|
414 TReal32 realArrayIndex = iUidArrayIndex; |
|
415 TReal32 realPkgCount = packageUidCount; |
|
416 iPercentValue = (realArrayIndex/realPkgCount)*100; |
|
417 } |
|
418 else |
|
419 { |
|
420 // Most probably all is uninstalled if index is bigger then |
|
421 // filen count. Let's not show over 100% to user. |
|
422 iPercentValue = 100; |
|
423 } |
|
424 } |
|
425 |
|
426 FLOG_1( _L("[SISUninstaller] percent value = %d"), (TInt)iPercentValue ); |
|
427 } |
|
428 |
|
429 //EOF |
372 //EOF |