appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandler.cpp
branchRCL_3
changeset 25 7333d7932ef7
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Native SISX SIF (Software Install Framework) plugin.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "sisxsifpluginuihandler.h"     // CSisxSifPluginUiHandler
       
    19 #include "sisxsifpluginerrorhandler.h"  // CSisxSifPluginErrorHandler
       
    20 #include "sisxsifplugin.pan"            // Panic codes
       
    21 #include "sisxsifcleanuputils.h"        // CleanupResetAndDestroyPushL
       
    22 #include "sisxsifuiselectioncache.h"    // CSisxUISelectionCache
       
    23 #include <sifui.h>                      // CSifUi
       
    24 #include <sifuiappinfo.h>               // CSifUiAppInfo
       
    25 #include <sifuicertificateinfo.h>       // CSifUiCertificateInfo
       
    26 #include <sifuierrorinfo.h>             // CSifUiErrorInfo
       
    27 #include <bautils.h>                    // BaflUtils
       
    28 #include <driveinfo.h>                  // DriveInfo
       
    29 #include <featmgr.h>                    // FeatureManager
       
    30 
       
    31 using namespace Usif;
       
    32 
       
    33 const TInt KFreeSpaceTreshold = 128*1024;   // bytes
       
    34 
       
    35 // TODO: replace with proper tracing support
       
    36 #ifdef _DEBUG
       
    37 #define FLOG(x)         RDebug::Print(x);
       
    38 #define FLOG_1(x,y)     RDebug::Print(x, y);
       
    39 #define FLOG_2(x,y,z)   RDebug::Print(x, y, z);
       
    40 #else
       
    41 #define FLOG(x)
       
    42 #define FLOG_1(x,y)
       
    43 #define FLOG_2(x,y,z)
       
    44 #endif
       
    45 
       
    46 
       
    47 // ======== MEMBER FUNCTIONS ========
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // CSisxSifPluginUiHandler::NewL()
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CSisxSifPluginUiHandler* CSisxSifPluginUiHandler::NewL( RFs& aFs,
       
    54         CSisxSifPluginErrorHandler& aErrorHandler )
       
    55     {
       
    56     FLOG( _L("CSisxSifPluginUiHandler::NewL") );
       
    57     CSisxSifPluginUiHandler *self = new( ELeave ) CSisxSifPluginUiHandler( aFs, aErrorHandler );
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL();
       
    60     CleanupStack::Pop( self );
       
    61     return self;
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // CSisxSifPluginUiHandler::~CSisxSifPluginUiHandler()
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 CSisxSifPluginUiHandler::~CSisxSifPluginUiHandler()
       
    69     {
       
    70     FLOG( _L("CSisxSifPluginUiHandler::~CSisxSifPluginUiHandler") );
       
    71     delete iSelectionCache;
       
    72     delete iSifUi;
       
    73     iSelectableDrives.Close();
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // CSisxSifPluginUiHandler::DisplayTextL()
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 TBool CSisxSifPluginUiHandler::DisplayTextL( const Swi::CAppInfo& /*aAppInfo*/,
       
    81         Swi::TFileTextOption aOption, const TDesC& aText )
       
    82     {
       
    83     FLOG( _L("CSisxSifPluginUiHandler::DisplayTextL") );
       
    84     TBool okToContinue = EFalse;
       
    85 
       
    86     switch( aOption )
       
    87         {
       
    88         case Swi::EInstFileTextOptionContinue:
       
    89             ShowQuestionWithContinueL( aText );
       
    90             okToContinue = ETrue;
       
    91             break;
       
    92         case Swi::EInstFileTextOptionSkipOneIfNo:
       
    93             okToContinue = ShowQuestionL( aText );
       
    94             break;
       
    95         case Swi::EInstFileTextOptionAbortIfNo:
       
    96         case Swi::EInstFileTextOptionExitIfNo:
       
    97             okToContinue = ShowQuestionL( aText );
       
    98             break;
       
    99         case Swi::EInstFileTextOptionForceAbort:
       
   100             ShowQuestionWithContinueL( aText );
       
   101             break;
       
   102         default:
       
   103             break;
       
   104         }
       
   105 
       
   106     return okToContinue;
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // CSisxSifPluginUiHandler::DisplayErrorL()
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 void CSisxSifPluginUiHandler::DisplayErrorL( const Swi::CAppInfo& /*aAppInfo*/,
       
   114         Swi::TErrorDialog aType, const TDesC& aParam )
       
   115     {
       
   116     FLOG( _L("CSisxSifPluginUiHandler::DisplayErrorL") );
       
   117     SetErrorSwiErrorL( aType, aParam );
       
   118     }
       
   119 
       
   120 // ---------------------------------------------------------------------------
       
   121 // CSisxSifPluginUiHandler::DisplayDependencyBreakL()
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 TBool CSisxSifPluginUiHandler::DisplayDependencyBreakL( const Swi::CAppInfo& /*aAppInfo*/,
       
   125         const RPointerArray<TDesC>& /*aComponents*/ )
       
   126     {
       
   127     FLOG( _L("CSisxSifPluginUiHandler::DisplayDependencyBreakL") );
       
   128     TBool okToContinue = EFalse;
       
   129 
       
   130     // TODO: localized UI string needed
       
   131     _LIT( KText, "Removal may stop other applications working. Continue?" );
       
   132     okToContinue = ShowQuestionL( KText );
       
   133 
       
   134     return okToContinue;
       
   135     }
       
   136 
       
   137 // ---------------------------------------------------------------------------
       
   138 // CSisxSifPluginUiHandler::DisplayApplicationsInUseL()
       
   139 // ---------------------------------------------------------------------------
       
   140 //
       
   141 TBool CSisxSifPluginUiHandler::DisplayApplicationsInUseL( const Swi::CAppInfo& /*aAppInfo*/,
       
   142         const RPointerArray<TDesC>& /*aAppNames*/ )
       
   143     {
       
   144     FLOG( _L("CSisxSifPluginUiHandler::DisplayApplicationsInUseL") );
       
   145     return ETrue;   // silently accepted
       
   146     }
       
   147 
       
   148 // ---------------------------------------------------------------------------
       
   149 // CSisxSifPluginUiHandler::DisplayQuestionL()
       
   150 // ---------------------------------------------------------------------------
       
   151 //
       
   152 TBool CSisxSifPluginUiHandler::DisplayQuestionL( const Swi::CAppInfo& /*aAppInfo*/,
       
   153         Swi::TQuestionDialog aQuestion, const TDesC& /*aDes*/ )
       
   154     {
       
   155     FLOG( _L("CSisxSifPluginUiHandler::DisplayQuestionL") );
       
   156     TBool okToContinue = EFalse;
       
   157 
       
   158     switch( aQuestion )
       
   159         {
       
   160         case Swi::EQuestionIncompatible:
       
   161             if( !iQuestionIncompatibleDisplayed )
       
   162                 {
       
   163                 _LIT( KText, "Application not compatible with phone. Continue anyway?" );
       
   164                 okToContinue = ShowQuestionL( KText );
       
   165                 iQuestionIncompatibleDisplayed = ETrue;
       
   166                 }
       
   167             else
       
   168                 {
       
   169                 okToContinue = ETrue;   // already accepted once
       
   170                 }
       
   171             break;
       
   172 
       
   173         case Swi::EQuestionOverwriteFile:
       
   174         default:
       
   175             okToContinue = ETrue;   // silently accepted
       
   176             break;
       
   177         }
       
   178 
       
   179     return okToContinue;
       
   180     }
       
   181 
       
   182 // ---------------------------------------------------------------------------
       
   183 // CSisxSifPluginUiHandler::DisplayInstallL()
       
   184 // ---------------------------------------------------------------------------
       
   185 //
       
   186 TBool CSisxSifPluginUiHandler::DisplayInstallL( const Swi::CAppInfo& /*aAppInfo*/,
       
   187         const CApaMaskedBitmap* /*aLogo*/,
       
   188         const RPointerArray<Swi::CCertificateInfo>& /*aCertificates*/ )
       
   189     {
       
   190     FLOG( _L("CSisxSifPluginUiHandler::DisplayInstallL") );
       
   191     iOperationPhase = EInstalling;
       
   192     return ETrue;
       
   193     }
       
   194 
       
   195 // ---------------------------------------------------------------------------
       
   196 // CSisxSifPluginUiHandler::DisplayGrantCapabilitiesL()
       
   197 // ---------------------------------------------------------------------------
       
   198 //
       
   199 TBool CSisxSifPluginUiHandler::DisplayGrantCapabilitiesL( const Swi::CAppInfo& /*aAppInfo*/,
       
   200         const TCapabilitySet& aCapabilitySet )
       
   201     {
       
   202     FLOG( _L("CSisxSifPluginUiHandler::DisplayGrantCapabilitiesL") );
       
   203     TBool okToContinue = iSifUi->ShowGrantCapabilitiesL( aCapabilitySet );
       
   204     return okToContinue;
       
   205     }
       
   206 
       
   207 // ---------------------------------------------------------------------------
       
   208 // CSisxSifPluginUiHandler::DisplayLanguageL()
       
   209 // ---------------------------------------------------------------------------
       
   210 //
       
   211 TInt CSisxSifPluginUiHandler::DisplayLanguageL( const Swi::CAppInfo& /*aAppInfo*/,
       
   212         const RArray<TLanguage>& aLanguages )
       
   213     {
       
   214     FLOG( _L("CSisxSifPluginUiHandler::DisplayLanguageL") );
       
   215     TInt langIndex = iSifUi->ShowSelectLanguageL( aLanguages );
       
   216     return langIndex;
       
   217     }
       
   218 
       
   219 // ---------------------------------------------------------------------------
       
   220 // CSisxSifPluginUiHandler::DisplayDriveL()
       
   221 // ---------------------------------------------------------------------------
       
   222 //
       
   223 TInt CSisxSifPluginUiHandler::DisplayDriveL( const Swi::CAppInfo& /*aAppInfo*/,
       
   224         TInt64 /*aSize*/, const RArray<TChar>& aDriveLetters,
       
   225         const RArray<TInt64>& /*aDriveSpaces*/ )
       
   226     {
       
   227     FLOG( _L("CSisxSifPluginUiHandler::DisplayDriveL") );
       
   228 
       
   229     TInt err = KErrNone;
       
   230     TInt driveNumber = EDriveC;
       
   231     if( iSifUi )
       
   232         {
       
   233         err = iSifUi->SelectedDrive( driveNumber );
       
   234         if( err )
       
   235             {
       
   236             FLOG_1( _L("CSisxSifPluginUiHandler::DisplayDriveL; SelectedDrive err=%d"), err );
       
   237             }
       
   238         }
       
   239 
       
   240     TChar driveLetter = 'C';
       
   241     err = RFs::DriveToChar( driveNumber, driveLetter );
       
   242     if( err )
       
   243         {
       
   244         FLOG_1( _L("CSisxSifPluginUiHandler::DisplayDriveL; DriveToChar err=%d"), err );
       
   245         }
       
   246 
       
   247     TInt index = aDriveLetters.Find( driveLetter );
       
   248     if( index >= 0 && index < aDriveLetters.Count() )
       
   249         {
       
   250         return index;
       
   251         }
       
   252     return 0;
       
   253     }
       
   254 
       
   255 // ---------------------------------------------------------------------------
       
   256 // CSisxSifPluginUiHandler::DisplayUpgradeL()
       
   257 // ---------------------------------------------------------------------------
       
   258 //
       
   259 TBool CSisxSifPluginUiHandler::DisplayUpgradeL( const Swi::CAppInfo& /*aAppInfo*/,
       
   260         const Swi::CAppInfo& /*aExistingAppInfo*/ )
       
   261     {
       
   262     FLOG( _L("CSisxSifPluginUiHandler::DisplayUpgradeL") );
       
   263 
       
   264     return ETrue;
       
   265     }
       
   266 
       
   267 // ---------------------------------------------------------------------------
       
   268 // CSisxSifPluginUiHandler::DisplayOptionsL()
       
   269 // ---------------------------------------------------------------------------
       
   270 //
       
   271 TBool CSisxSifPluginUiHandler::DisplayOptionsL( const Swi::CAppInfo& /*aAppInfo*/,
       
   272         const RPointerArray<TDesC>& aOptions, RArray<TBool>& aSelections )
       
   273     {
       
   274     FLOG( _L("CSisxSifPluginUiHandler::DisplayOptionsL") );
       
   275     TInt optionCount = aOptions.Count();
       
   276     CPtrCArray* selectableItems = new( ELeave ) CPtrC16Array( optionCount );
       
   277     CleanupStack::PushL( selectableItems );
       
   278     for( TInt index = 0; index < optionCount; index++ )
       
   279         {
       
   280         selectableItems->AppendL( *aOptions[ index ] );
       
   281         }
       
   282 
       
   283     RArray<TInt> selectedIndexes;
       
   284     TBool isSelected = iSifUi->ShowSelectOptionsL( *selectableItems, selectedIndexes );
       
   285     if( isSelected && selectedIndexes.Count() )
       
   286         {
       
   287         TInt selectionsCount = aSelections.Count();
       
   288         __ASSERT_DEBUG( selectionsCount == optionCount, User::Invariant() );
       
   289         for( TInt index = 0; index < selectionsCount; index++ )
       
   290             {
       
   291             aSelections[ index ] = ( selectedIndexes.Find( index ) != KErrNotFound );
       
   292             }
       
   293         }
       
   294     return isSelected;
       
   295     }
       
   296 
       
   297 // ---------------------------------------------------------------------------
       
   298 // CSisxSifPluginUiHandler::HandleInstallEventL()
       
   299 // ---------------------------------------------------------------------------
       
   300 //
       
   301 TBool CSisxSifPluginUiHandler::HandleInstallEventL( const Swi::CAppInfo& aAppInfo,
       
   302         Swi::TInstallEvent aEvent, TInt aValue, const TDesC& /*aDes*/ )
       
   303     {
       
   304     FLOG_2( _L("CSisxSifPluginUiHandler::HandleInstallEventL: aEvent %d, aValue %d"), aEvent, aValue );
       
   305 
       
   306     if( iSifUi->IsCancelled() )
       
   307         {
       
   308         return EFalse;
       
   309         }
       
   310 
       
   311     switch( aEvent )
       
   312         {
       
   313         case Swi::EEventSetProgressBarFinalValue:
       
   314             iProgressBarFinalValue = aValue;
       
   315             if( iOperationPhase == EInstalling )
       
   316                 {
       
   317                 ShowProgressL( aAppInfo, iProgressBarFinalValue, CSifUi::EInstalling );
       
   318                 }
       
   319             break;
       
   320 
       
   321         case Swi::EEventUpdateProgressBar:
       
   322             if( iOperationPhase == EInstalling )
       
   323                 {
       
   324                 iSifUi->IncreaseProgressBarValueL( aValue );
       
   325                 }
       
   326             iProgressBarCurrentValue += aValue;
       
   327             PublishProgressL( EFileOperation );
       
   328             break;
       
   329 
       
   330         case Swi::EEventDevCert:
       
   331             // TODO: show "developer certificate" warning note
       
   332             break;
       
   333 
       
   334         case Swi::EEventOcspCheckEnd:
       
   335         case Swi::EEventAbortedInstall:
       
   336         case Swi::EEventAbortedUnInstall:
       
   337         case Swi::EEventCompletedInstall:
       
   338         case Swi::EEventCompletedUnInstall:
       
   339         case Swi::EEventCompletedNoMessage:
       
   340         case Swi::EEventLeave:
       
   341         default:
       
   342             break;
       
   343         }
       
   344 
       
   345     return ETrue;
       
   346     }
       
   347 
       
   348 // ---------------------------------------------------------------------------
       
   349 // CSisxSifPluginUiHandler::HandleCancellableInstallEventL()
       
   350 // ---------------------------------------------------------------------------
       
   351 //
       
   352 void CSisxSifPluginUiHandler::HandleCancellableInstallEventL( const Swi::CAppInfo& aAppInfo,
       
   353         Swi::TInstallCancellableEvent aEvent, Swi::MCancelHandler& aCancelHandler,
       
   354         TInt aValue, const TDesC& /*aDes*/ )
       
   355     {
       
   356     FLOG_2( _L("CSisxSifPluginUiHandler::HandleCancellableInstallEventL: aEvent %d, aValue %d"), aEvent, aValue );
       
   357 
       
   358     if( iSifUi->IsCancelled() )
       
   359         {
       
   360         aCancelHandler.HandleCancel();
       
   361         }
       
   362     else
       
   363         {
       
   364         switch( aEvent )
       
   365             {
       
   366             case Swi::EEventOcspCheckStart:
       
   367                 ShowProgressL( aAppInfo, aValue, CSifUi::ECheckingCerts );
       
   368                 iProgressBarCurrentValue += aValue;
       
   369                 PublishProgressL( EOCSPCheck );
       
   370                 break;
       
   371 
       
   372             case Swi::EEventRemovingFiles:
       
   373             case Swi::EEventCopyingFiles:
       
   374             case Swi::EEventShuttingDownApps:
       
   375             default:
       
   376                 break;
       
   377             }
       
   378         }
       
   379     }
       
   380 
       
   381 // ---------------------------------------------------------------------------
       
   382 // CSisxSifPluginUiHandler::DisplaySecurityWarningL()
       
   383 // ---------------------------------------------------------------------------
       
   384 //
       
   385 TBool CSisxSifPluginUiHandler::DisplaySecurityWarningL( const Swi::CAppInfo& aAppInfo,
       
   386         Swi::TSignatureValidationResult aSigValidationResult,
       
   387         RPointerArray<CPKIXValidationResultBase>& aPkixResults,
       
   388         RPointerArray<Swi::CCertificateInfo>& aCertificates,
       
   389         TBool aInstallAnyway )
       
   390     {
       
   391     FLOG( _L("CSisxSifPluginUiHandler::DisplaySecurityWarningL") );
       
   392     TBool result = EFalse;
       
   393 
       
   394     if( iIsDriveSelectionRequired )
       
   395         {
       
   396         AddMemorySelectionL();
       
   397         }
       
   398     AddCertificatesL( aCertificates, aPkixResults );
       
   399 
       
   400     switch( aSigValidationResult )
       
   401         {
       
   402         case Swi::EValidationSucceeded:
       
   403             result = ShowConfirmationL( aAppInfo );
       
   404             break;
       
   405 
       
   406         case Swi::ESignatureSelfSigned:
       
   407         case Swi::ENoCertificate:
       
   408         case Swi::ECertificateValidationError:
       
   409         case Swi::ESignatureNotPresent:
       
   410         case Swi::ESignatureCouldNotBeValidated:
       
   411         case Swi::ENoCodeSigningExtension:
       
   412         case Swi::ENoSupportedPolicyExtension:
       
   413         case Swi::EMandatorySignatureMissing:
       
   414             if( aInstallAnyway )
       
   415                 {
       
   416                 result = ShowConfirmationL( aAppInfo );
       
   417                 }
       
   418             break;
       
   419 
       
   420         default:
       
   421             break;
       
   422         }
       
   423 
       
   424     return result;
       
   425     }
       
   426 
       
   427 // ---------------------------------------------------------------------------
       
   428 // CSisxSifPluginUiHandler::DisplayOcspResultL()
       
   429 // ---------------------------------------------------------------------------
       
   430 //
       
   431 TBool CSisxSifPluginUiHandler::DisplayOcspResultL( const Swi::CAppInfo& /*aAppInfo*/,
       
   432         Swi::TRevocationDialogMessage aMessage, RPointerArray<TOCSPOutcome>& /*aOutcomes*/,
       
   433         RPointerArray<Swi::CCertificateInfo>& /*aCertificates*/, TBool aWarningOnly )
       
   434     {
       
   435     FLOG( _L("CSisxSifPluginUiHandler::DisplayOcspResultL") );
       
   436     TBool okToContinue = EFalse;
       
   437 
       
   438     if( aWarningOnly && !IsOcspMandatoryL() )
       
   439         {
       
   440         // TODO: localised UI string needed, see R_SISXUI_OCSP_SECURITY_WARNING
       
   441         _LIT( KText, "Installation security warning. Unable to verify supplier. Continue anyway?" );
       
   442         if( ShowQuestionL( KText ) )
       
   443             {
       
   444             okToContinue = ETrue;
       
   445             }
       
   446         }
       
   447 
       
   448     if( !okToContinue )
       
   449         {
       
   450         SetOcspErrorL( aMessage );
       
   451         }
       
   452 
       
   453     return okToContinue;
       
   454     }
       
   455 
       
   456 // ---------------------------------------------------------------------------
       
   457 // CSisxSifPluginUiHandler::DisplayCannotOverwriteFileL()
       
   458 // ---------------------------------------------------------------------------
       
   459 //
       
   460 void CSisxSifPluginUiHandler::DisplayCannotOverwriteFileL( const Swi::CAppInfo& /*aAppInfo*/,
       
   461         const Swi::CAppInfo& /*aInstalledAppInfo*/, const TDesC& /*aFileName*/ )
       
   462     {
       
   463     FLOG( _L("CSisxSifPluginUiHandler::DisplayCannotOverwriteFileL") );
       
   464 
       
   465     }
       
   466 
       
   467 // ---------------------------------------------------------------------------
       
   468 // CSisxSifPluginUiHandler::DisplayMissingDependencyL()
       
   469 // ---------------------------------------------------------------------------
       
   470 //
       
   471 TBool CSisxSifPluginUiHandler::DisplayMissingDependencyL( const Swi::CAppInfo& /*aAppInfo*/,
       
   472         const TDesC& /*aDependencyName*/, TVersion /*aWantedVersionFrom*/,
       
   473         TVersion /*aWantedVersionTo*/, TVersion /*aInstalledVersion*/ )
       
   474     {
       
   475     FLOG( _L("CSisxSifPluginUiHandler::DisplayMissingDependencyL") );
       
   476 
       
   477     return ETrue;
       
   478     }
       
   479 
       
   480 // ---------------------------------------------------------------------------
       
   481 // CSisxSifPluginUiHandler::DisplayUninstallL()
       
   482 // ---------------------------------------------------------------------------
       
   483 //
       
   484 TBool CSisxSifPluginUiHandler::DisplayUninstallL( const Swi::CAppInfo& /*aAppInfo*/ )
       
   485     {
       
   486     FLOG( _L("CSisxSifPluginUiHandler::DisplayUninstallL") );
       
   487 
       
   488     iOperationPhase = EUninstalling;
       
   489     return ETrue;       // uninstall is always silent
       
   490     }
       
   491 
       
   492 // ---------------------------------------------------------------------------
       
   493 // CSisxSifPluginUiHandler::DisplayPreparingInstallL()
       
   494 // ---------------------------------------------------------------------------
       
   495 //
       
   496 void CSisxSifPluginUiHandler::DisplayPreparingInstallL( const TDesC& /*aFileName*/ )
       
   497     {
       
   498     FLOG( _L("CSisxSifPluginUiHandler::DisplayPreparingInstallL") );
       
   499     // TODO: display preparing install
       
   500     }
       
   501 
       
   502 // ---------------------------------------------------------------------------
       
   503 // CSisxSifPluginUiHandler::DisplayCompleteL()
       
   504 // ---------------------------------------------------------------------------
       
   505 //
       
   506 void CSisxSifPluginUiHandler::DisplayCompleteL()
       
   507     {
       
   508     FLOG( _L("CSisxSifPluginUiHandler::DisplayCompleteL") );
       
   509 
       
   510     iSifUi->ShowCompleteL();
       
   511     }
       
   512 
       
   513 // ---------------------------------------------------------------------------
       
   514 // CSisxSifPluginUiHandler::DisplayFailedL()
       
   515 // ---------------------------------------------------------------------------
       
   516 //
       
   517 void CSisxSifPluginUiHandler::DisplayFailedL( const CSisxSifPluginErrorHandler& aError )
       
   518     {
       
   519     FLOG_1( _L("CSisxSifPluginUiHandler::DisplayFailedL, error code %d"), aError.ErrorCode() );
       
   520 
       
   521     CSifUiErrorInfo* errorInfo = CSifUiErrorInfo::NewLC( aError.ErrorCategory(),
       
   522         aError.ErrorCode(), aError.ExtendedErrorCode(), aError.ErrorMessage(),
       
   523         aError.ErrorMessageDetails() );
       
   524     iSifUi->ShowFailedL( *errorInfo );
       
   525     CleanupStack::PopAndDestroy( errorInfo );
       
   526     }
       
   527 
       
   528 // ---------------------------------------------------------------------------
       
   529 // CSisxSifPluginUiHandler::CSisxSifPluginUiHandler()
       
   530 // ---------------------------------------------------------------------------
       
   531 //
       
   532 CSisxSifPluginUiHandler::CSisxSifPluginUiHandler( RFs& aFs,
       
   533         CSisxSifPluginErrorHandler& aErrorHandler ) :
       
   534         CSisxSifPluginUiHandlerBase( aFs, aErrorHandler )
       
   535     {
       
   536     }
       
   537 
       
   538 // ---------------------------------------------------------------------------
       
   539 // CSisxSifPluginUiHandler::ConstructL()
       
   540 // ---------------------------------------------------------------------------
       
   541 //
       
   542 void CSisxSifPluginUiHandler::ConstructL()
       
   543     {
       
   544     iSifUi = CSifUi::NewL();
       
   545     iSelectionCache = CSisxSifUiSelectionCache::NewL();
       
   546     }
       
   547 
       
   548 // ---------------------------------------------------------------------------
       
   549 // CSisxSifPluginUiHandler::AddMemorySelectionL()
       
   550 // ---------------------------------------------------------------------------
       
   551 //
       
   552 void CSisxSifPluginUiHandler::AddMemorySelectionL()
       
   553     {
       
   554     TInt64 adjustedSize = iMaxInstalledSize + KFreeSpaceTreshold;
       
   555 
       
   556     TDriveList driveList;
       
   557     TInt driveCount = 0;
       
   558     TInt err = DriveInfo::GetUserVisibleDrives( iFs, driveList, driveCount );
       
   559     User::LeaveIfError( err );
       
   560 
       
   561     iSelectableDrives.Reset();
       
   562     TInt driveListLength = driveList.Length();
       
   563     for( TInt driveNumber = 0; driveNumber < driveListLength; driveNumber++ )
       
   564         {
       
   565         if( driveList[ driveNumber ] )
       
   566             {
       
   567             TUint driveStatus = 0;
       
   568             err = DriveInfo::GetDriveStatus( iFs, driveNumber, driveStatus );
       
   569             if( !err && !( driveStatus & DriveInfo::EDriveRemote ) )
       
   570                 {
       
   571                 TVolumeInfo volumeInfo;
       
   572                 err = iFs.Volume( volumeInfo, driveNumber );
       
   573                 if( !err && volumeInfo.iFree > adjustedSize )
       
   574                     {
       
   575                     iSelectableDrives.Append( driveNumber );
       
   576                     }
       
   577                 }
       
   578             }
       
   579         }
       
   580     iSifUi->SetMemorySelectionL( iSelectableDrives );
       
   581     }
       
   582 
       
   583 // ---------------------------------------------------------------------------
       
   584 // CSisxSifPluginUiHandler::AddCertificatesL()
       
   585 // ---------------------------------------------------------------------------
       
   586 //
       
   587 void CSisxSifPluginUiHandler::AddCertificatesL(
       
   588         RPointerArray<Swi::CCertificateInfo>& aCertificates,
       
   589         RPointerArray<CPKIXValidationResultBase>& aPkixResults )
       
   590     {
       
   591     ASSERT( aCertificates.Count() == aPkixResults.Count() );
       
   592 
       
   593     RPointerArray<CSifUiCertificateInfo> certificates;
       
   594     CleanupResetAndDestroyPushL( certificates );
       
   595 
       
   596     for( TInt index = 0; index < aCertificates.Count(); ++index )
       
   597         {
       
   598         TValidationStatus status = aPkixResults[ index ]->Error();
       
   599         if( status.iReason == EValidatedOK )
       
   600             {
       
   601             CSifUiCertificateInfo* cert = CSifUiCertificateInfo::NewLC( *aCertificates[ index ] );
       
   602             certificates.AppendL( cert );
       
   603             CleanupStack::Pop( cert );
       
   604             }
       
   605         }
       
   606     iSifUi->SetCertificateInfoL( certificates );
       
   607     CleanupStack::PopAndDestroy( &certificates );
       
   608     }
       
   609 
       
   610 // ---------------------------------------------------------------------------
       
   611 // CSisxSifPluginUiHandler::GetAppInfoLC()
       
   612 // ---------------------------------------------------------------------------
       
   613 //
       
   614 CSifUiAppInfo* CSisxSifPluginUiHandler::GetAppInfoLC( const Swi::CAppInfo& aAppInfo )
       
   615     {
       
   616     CSifUiAppInfo *appInfo = CSifUiAppInfo::NewLC( aAppInfo.AppName(), aAppInfo.AppVendor(),
       
   617             aAppInfo.AppVersion(), iMaxInstalledSize, iLogo );
       
   618     return appInfo;
       
   619     }
       
   620 
       
   621 // ---------------------------------------------------------------------------
       
   622 // CSisxSifPluginUiHandler::ShowProgressL()
       
   623 // ---------------------------------------------------------------------------
       
   624 //
       
   625 void CSisxSifPluginUiHandler::ShowProgressL( const Swi::CAppInfo& aAppInfo,
       
   626         TInt aProgressBarFinalValue, CSifUi::TInstallingPhase aPhase )
       
   627     {
       
   628     CSifUiAppInfo *appInfo = GetAppInfoLC( aAppInfo );
       
   629     iSifUi->ShowProgressL( *appInfo, aProgressBarFinalValue, aPhase );
       
   630     CleanupStack::PopAndDestroy( appInfo );
       
   631     }
       
   632 
       
   633 // ---------------------------------------------------------------------------
       
   634 // CSisxSifPluginUiHandler::ShowConfirmationL()
       
   635 // ---------------------------------------------------------------------------
       
   636 //
       
   637 TBool CSisxSifPluginUiHandler::ShowConfirmationL( const Swi::CAppInfo& aAppInfo )
       
   638     {
       
   639     CSifUiAppInfo *appInfo = GetAppInfoLC( aAppInfo );
       
   640     TBool result = iSifUi->ShowConfirmationL( *appInfo );
       
   641     CleanupStack::PopAndDestroy( appInfo );
       
   642     return result;
       
   643     }