diff -r ae54820ef82c -r 245df5276b97 appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandler.cpp --- a/appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandler.cpp Tue Jul 06 14:23:31 2010 +0300 +++ b/appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandler.cpp Wed Aug 18 09:55:45 2010 +0300 @@ -23,6 +23,7 @@ #include // CSifUi #include // CSifUiAppInfo #include // CSifUiCertificateInfo +#include // CSifUiErrorInfo #include // BaflUtils #include // DriveInfo #include // FeatureManager @@ -78,11 +79,32 @@ // --------------------------------------------------------------------------- // TBool CSisxSifPluginUiHandler::DisplayTextL( const Swi::CAppInfo& /*aAppInfo*/, - Swi::TFileTextOption /*aOption*/, const TDesC& /*aText*/ ) + Swi::TFileTextOption aOption, const TDesC& aText ) { FLOG( _L("CSisxSifPluginUiHandler::DisplayTextL") ); + TBool okToContinue = EFalse; - return ETrue; + switch( aOption ) + { + case Swi::EInstFileTextOptionContinue: + ShowQuestionWithContinueL( aText ); + okToContinue = ETrue; + break; + case Swi::EInstFileTextOptionSkipOneIfNo: + okToContinue = ShowQuestionL( aText ); + break; + case Swi::EInstFileTextOptionAbortIfNo: + case Swi::EInstFileTextOptionExitIfNo: + okToContinue = ShowQuestionL( aText ); + break; + case Swi::EInstFileTextOptionForceAbort: + ShowQuestionWithContinueL( aText ); + break; + default: + break; + } + + return okToContinue; } // --------------------------------------------------------------------------- @@ -93,19 +115,24 @@ Swi::TErrorDialog aType, const TDesC& aParam ) { FLOG( _L("CSisxSifPluginUiHandler::DisplayErrorL") ); - SetDisplayErrorL( aType, aParam ); + SetErrorSwiErrorL( aType, aParam ); } // --------------------------------------------------------------------------- -// CSisxSifPluginUiHandler:: +// CSisxSifPluginUiHandler::DisplayDependencyBreakL() // --------------------------------------------------------------------------- // TBool CSisxSifPluginUiHandler::DisplayDependencyBreakL( const Swi::CAppInfo& /*aAppInfo*/, const RPointerArray& /*aComponents*/ ) { FLOG( _L("CSisxSifPluginUiHandler::DisplayDependencyBreakL") ); + TBool okToContinue = EFalse; - return ETrue; + // TODO: localized UI string needed + _LIT( KText, "Removal may stop other applications working. Continue?" ); + okToContinue = ShowQuestionL( KText ); + + return okToContinue; } // --------------------------------------------------------------------------- @@ -116,8 +143,7 @@ const RPointerArray& /*aAppNames*/ ) { FLOG( _L("CSisxSifPluginUiHandler::DisplayApplicationsInUseL") ); - - return ETrue; + return ETrue; // silently accepted } // --------------------------------------------------------------------------- @@ -128,23 +154,30 @@ Swi::TQuestionDialog aQuestion, const TDesC& /*aDes*/ ) { FLOG( _L("CSisxSifPluginUiHandler::DisplayQuestionL") ); + TBool okToContinue = EFalse; - TBool result = ETrue; switch( aQuestion ) { case Swi::EQuestionIncompatible: if( !iQuestionIncompatibleDisplayed ) { - // TODO: show dialog + _LIT( KText, "Application not compatible with phone. Continue anyway?" ); + okToContinue = ShowQuestionL( KText ); iQuestionIncompatibleDisplayed = ETrue; } + else + { + okToContinue = ETrue; // already accepted once + } break; + case Swi::EQuestionOverwriteFile: default: - // silently accepted + okToContinue = ETrue; // silently accepted break; } - return result; + + return okToContinue; } // --------------------------------------------------------------------------- @@ -157,7 +190,7 @@ { FLOG( _L("CSisxSifPluginUiHandler::DisplayInstallL") ); - iMode = EModeInstall; + iOperationPhase = EInstalling; return ETrue; } @@ -166,11 +199,14 @@ // --------------------------------------------------------------------------- // TBool CSisxSifPluginUiHandler::DisplayGrantCapabilitiesL( const Swi::CAppInfo& /*aAppInfo*/, - const TCapabilitySet& /*aCapabilitySet*/ ) + const TCapabilitySet& aCapabilitySet ) { FLOG( _L("CSisxSifPluginUiHandler::DisplayGrantCapabilitiesL") ); + TBool okToContinue = EFalse; - return ETrue; + okToContinue = iSifUi->ShowGrantCapabilitiesL( aCapabilitySet ); + + return okToContinue; } // --------------------------------------------------------------------------- @@ -259,35 +295,30 @@ return EFalse; } - TSifOperationPhase phase = ( iMode == EModeInstall ? EInstalling : EUninstalling ); switch( aEvent ) { case Swi::EEventSetProgressBarFinalValue: iProgressBarFinalValue = aValue; - if( iMode == EModeInstall ) + if( iOperationPhase == EInstalling ) { - CSifUiAppInfo *appInfo = GetAppInfoLC( aAppInfo ); - iSifUi->ShowProgressL( *appInfo, aValue ); - CleanupStack::PopAndDestroy( appInfo ); + ShowProgressL( aAppInfo, iProgressBarFinalValue, CSifUi::EInstalling ); } break; case Swi::EEventUpdateProgressBar: - if( iMode == EModeInstall ) + if( iOperationPhase == EInstalling ) { iSifUi->IncreaseProgressBarValueL( aValue ); } - PublishProgressL( phase, EFileOperation, aValue, iProgressBarFinalValue ); - break; - - case Swi::EEventOcspCheckEnd: - // TODO: do something + iProgressBarCurrentValue += aValue; + PublishProgressL( EFileOperation ); break; case Swi::EEventDevCert: // TODO: show "developer certificate" warning note break; + case Swi::EEventOcspCheckEnd: case Swi::EEventAbortedInstall: case Swi::EEventAbortedUnInstall: case Swi::EEventCompletedInstall: @@ -305,13 +336,33 @@ // CSisxSifPluginUiHandler::HandleCancellableInstallEventL() // --------------------------------------------------------------------------- // -void CSisxSifPluginUiHandler::HandleCancellableInstallEventL( const Swi::CAppInfo& /*aAppInfo*/, - Swi::TInstallCancellableEvent /*aEvent*/, Swi::MCancelHandler& /*aCancelHandler*/, - TInt /*aValue*/,const TDesC& /*aDes*/ ) +void CSisxSifPluginUiHandler::HandleCancellableInstallEventL( const Swi::CAppInfo& aAppInfo, + Swi::TInstallCancellableEvent aEvent, Swi::MCancelHandler& aCancelHandler, + TInt aValue, const TDesC& /*aDes*/ ) { - FLOG( _L("CSisxSifPluginUiHandler::HandleCancellableInstallEventL") ); + FLOG_2( _L("CSisxSifPluginUiHandler::HandleCancellableInstallEventL: aEvent %d, aValue %d"), aEvent, aValue ); - // TODO: Swi::EEventOcspCheckStart + if( iSifUi->IsCancelled() ) + { + aCancelHandler.HandleCancel(); + } + else + { + switch( aEvent ) + { + case Swi::EEventOcspCheckStart: + ShowProgressL( aAppInfo, aValue, CSifUi::ECheckingCerts ); + iProgressBarCurrentValue += aValue; + PublishProgressL( EOCSPCheck ); + break; + + case Swi::EEventRemovingFiles: + case Swi::EEventCopyingFiles: + case Swi::EEventShuttingDownApps: + default: + break; + } + } } // --------------------------------------------------------------------------- @@ -336,11 +387,7 @@ switch( aSigValidationResult ) { case Swi::EValidationSucceeded: - { - CSifUiAppInfo *appInfo = GetAppInfoLC( aAppInfo ); - result = iSifUi->ShowConfirmationL( *appInfo ); - CleanupStack::PopAndDestroy( appInfo ); - } + result = ShowConfirmationL( aAppInfo ); break; case Swi::ESignatureSelfSigned: @@ -353,9 +400,7 @@ case Swi::EMandatorySignatureMissing: if( aInstallAnyway ) { - CSifUiAppInfo *appInfo = GetAppInfoLC( aAppInfo ); - result = iSifUi->ShowConfirmationL( *appInfo ); - CleanupStack::PopAndDestroy( appInfo ); + result = ShowConfirmationL( aAppInfo ); } break; @@ -371,12 +416,28 @@ // --------------------------------------------------------------------------- // TBool CSisxSifPluginUiHandler::DisplayOcspResultL( const Swi::CAppInfo& /*aAppInfo*/, - Swi::TRevocationDialogMessage /*aMessage*/, RPointerArray& /*aOutcomes*/, - RPointerArray& /*aCertificates*/, TBool /*aWarningOnly*/ ) + Swi::TRevocationDialogMessage aMessage, RPointerArray& /*aOutcomes*/, + RPointerArray& /*aCertificates*/, TBool aWarningOnly ) { FLOG( _L("CSisxSifPluginUiHandler::DisplayOcspResultL") ); + TBool okToContinue = EFalse; - return ETrue; + if( aWarningOnly && !IsOcspMandatoryL() ) + { + // TODO: localised UI string needed, see R_SISXUI_OCSP_SECURITY_WARNING + _LIT( KText, "Installation security warning. Unable to verify supplier. Continue anyway?" ); + if( ShowQuestionL( KText ) ) + { + okToContinue = ETrue; + } + } + + if( !okToContinue ) + { + SetOcspErrorL( aMessage ); + } + + return okToContinue; } // --------------------------------------------------------------------------- @@ -411,7 +472,7 @@ { FLOG( _L("CSisxSifPluginUiHandler::DisplayUninstallL") ); - iMode = EModeUninstall; + iOperationPhase = EUninstalling; return ETrue; // uninstall is always silent } @@ -434,7 +495,6 @@ FLOG( _L("CSisxSifPluginUiHandler::DisplayCompleteL") ); iSifUi->ShowCompleteL(); - iMode = EModeUndefined; } // --------------------------------------------------------------------------- @@ -445,8 +505,11 @@ { FLOG_1( _L("CSisxSifPluginUiHandler::DisplayFailedL, error code %d"), aError.ErrorCode() ); - // TODO: add error details - iSifUi->ShowFailedL( aError.ErrorCode(), aError.ErrorMessage() ); + CSifUiErrorInfo* errorInfo = CSifUiErrorInfo::NewLC( aError.ErrorCategory(), + aError.ErrorCode(), aError.ExtendedErrorCode(), aError.ErrorMessage(), + aError.ErrorMessageDetails() ); + iSifUi->ShowFailedL( *errorInfo ); + CleanupStack::PopAndDestroy( errorInfo ); } // --------------------------------------------------------------------------- @@ -542,3 +605,26 @@ return appInfo; } +// --------------------------------------------------------------------------- +// CSisxSifPluginUiHandler::ShowProgressL() +// --------------------------------------------------------------------------- +// +void CSisxSifPluginUiHandler::ShowProgressL( const Swi::CAppInfo& aAppInfo, + TInt aProgressBarFinalValue, CSifUi::TInstallingPhase aPhase ) + { + CSifUiAppInfo *appInfo = GetAppInfoLC( aAppInfo ); + iSifUi->ShowProgressL( *appInfo, aProgressBarFinalValue, aPhase ); + CleanupStack::PopAndDestroy( appInfo ); + } + +// --------------------------------------------------------------------------- +// CSisxSifPluginUiHandler::ShowConfirmationL() +// --------------------------------------------------------------------------- +// +TBool CSisxSifPluginUiHandler::ShowConfirmationL( const Swi::CAppInfo& aAppInfo ) + { + CSifUiAppInfo *appInfo = GetAppInfoLC( aAppInfo ); + TBool result = iSifUi->ShowConfirmationL( *appInfo ); + CleanupStack::PopAndDestroy( appInfo ); + return result; + }