--- a/appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandlerbase.cpp Tue Jul 06 14:23:31 2010 +0300
+++ b/appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandlerbase.cpp Wed Aug 18 09:55:45 2010 +0300
@@ -19,6 +19,10 @@
#include "sisxsifplugininstallparams.h" // CSisxSifPluginInstallParams
#include "sisxsifpluginerrorhandler.h" // CSisxSifPluginErrorHandler
#include "sisxsifcleanuputils.h" // CleanupResetAndDestroyPushL
+#include <centralrepository.h> // CRepository
+#include <SWInstallerInternalCRKeys.h> // KCRUidSWInstallerSettings
+#include <hb/hbwidgets/hbdevicemessageboxsymbian.h> // CHbDeviceMessageBoxSymbian
+#include <usif/scr/screntries.h> // CComponentEntry
using namespace Usif;
@@ -42,8 +46,8 @@
CSisxSifPluginUiHandlerBase::~CSisxSifPluginUiHandlerBase()
{
delete iInstallParams;
+ delete iPublishSifOperationInfo;
delete iGlobalComponentId;
- delete iPublishSifOperationInfo;
}
// ---------------------------------------------------------------------------
@@ -80,6 +84,19 @@
}
// ---------------------------------------------------------------------------
+// CSisxSifPluginUiHandlerBase::IsOcspMandatoryL()
+// ---------------------------------------------------------------------------
+//
+TBool CSisxSifPluginUiHandlerBase::IsOcspMandatoryL() const
+ {
+ CRepository* cenRep = CRepository::NewLC( KCRUidSWInstallerSettings );
+ TInt ocspProcedure = ESWInstallerOcspProcedureOff;
+ User::LeaveIfError( cenRep->Get( KSWInstallerOcspProcedure, ocspProcedure ) );
+ CleanupStack::PopAndDestroy( cenRep );
+ return ( ocspProcedure == ESWInstallerOcspProcedureMust );
+ }
+
+// ---------------------------------------------------------------------------
// CSisxSifPluginUiHandlerBase::PublishStartL()
// ---------------------------------------------------------------------------
//
@@ -110,7 +127,38 @@
CSifOperationStartData* data = CSifOperationStartData::NewLC( *iGlobalComponentId,
aRootNode.ComponentName(), appNames, appIcons, aRootNode.MaxInstalledSize(),
- KNullDesC, KNullDesC, aRootNode.SoftwareTypeName() );
+ KNullDesC, KNullDesC, aRootNode.SoftwareTypeName(), iOperationPhase );
+
+ if( !iPublishSifOperationInfo )
+ {
+ iPublishSifOperationInfo = CPublishSifOperationInfo::NewL();
+ }
+ iPublishSifOperationInfo->PublishStartL( *data );
+
+ CleanupStack::PopAndDestroy( 3, &appNames ); // data, appIcons, appNames
+ }
+
+// ---------------------------------------------------------------------------
+// CSisxSifPluginUiHandlerBase::PublishStartL()
+// ---------------------------------------------------------------------------
+//
+void CSisxSifPluginUiHandlerBase::PublishStartL( const CComponentEntry& aEntry )
+ {
+ RPointerArray<HBufC> appNames;
+ CleanupResetAndDestroyPushL( appNames );
+ RPointerArray<HBufC> appIcons;
+ CleanupResetAndDestroyPushL( appIcons );
+
+ if( iGlobalComponentId )
+ {
+ delete iGlobalComponentId;
+ iGlobalComponentId = NULL;
+ }
+ iGlobalComponentId = aEntry.GlobalId().AllocL();
+
+ CSifOperationStartData* data = CSifOperationStartData::NewLC( *iGlobalComponentId,
+ aEntry.Name(), appNames, appIcons, aEntry.ComponentSize(),
+ KNullDesC, KNullDesC, aEntry.SoftwareType(), iOperationPhase );
if( !iPublishSifOperationInfo )
{
@@ -125,12 +173,11 @@
// CSisxSifPluginUiHandlerBase::PublishProgressL()
// ---------------------------------------------------------------------------
//
-void CSisxSifPluginUiHandlerBase::PublishProgressL( TSifOperationPhase aPhase,
- TSifOperationSubPhase aSubPhase, TInt aCurrentProgress, TInt aTotal )
+void CSisxSifPluginUiHandlerBase::PublishProgressL( TSifOperationSubPhase aSubPhase )
{
User::LeaveIfNull( iPublishSifOperationInfo );
CSifOperationProgressData* data = CSifOperationProgressData::NewLC( *iGlobalComponentId,
- aPhase, aSubPhase, aCurrentProgress, aTotal );
+ iOperationPhase, aSubPhase, iProgressBarCurrentValue, iProgressBarFinalValue );
iPublishSifOperationInfo->PublishProgressL( *data );
CleanupStack::PopAndDestroy( data );
}
@@ -139,25 +186,103 @@
// CSisxSifPluginUiHandlerBase::PublishCompletionL()
// ---------------------------------------------------------------------------
//
-void CSisxSifPluginUiHandlerBase::PublishCompletionL( const CSisxSifPluginErrorHandler& aError )
+void CSisxSifPluginUiHandlerBase::PublishCompletionL()
{
User::LeaveIfNull( iPublishSifOperationInfo );
CSifOperationEndData* data = CSifOperationEndData::NewLC( *iGlobalComponentId,
- aError.ErrorCategory(), aError.ErrorCode(), aError.ErrorMessage(),
- aError.ErrorMessageDetails() );
+ iErrorHandler.ErrorCategory(), iErrorHandler.ErrorCode(),
+ iErrorHandler.ErrorMessage(), iErrorHandler.ErrorMessageDetails() );
iPublishSifOperationInfo->PublishCompletionL( *data );
CleanupStack::PopAndDestroy( data );
}
// ---------------------------------------------------------------------------
-// CSisxSifPluginUiHandlerBase::SetDisplayErrorL()
+// CSisxSifPluginUiHandlerBase::SetErrorL()
// ---------------------------------------------------------------------------
//
-void CSisxSifPluginUiHandlerBase::SetDisplayErrorL( Swi::TErrorDialog aType, const TDesC& aParam )
+void CSisxSifPluginUiHandlerBase::SetErrorL( TInt aErrorCode, TInt aExtErrorCode )
{
- iErrorHandler.SetExtendedErrorCode( aType );
+ iErrorHandler.SetErrorCode( aErrorCode );
+ iErrorHandler.SetExtendedErrorCode( aExtErrorCode );
+ // TODO: localized UI strings needed
+ switch( iErrorHandler.ErrorCategory() )
+ {
+ case ELowMemory:
+ // txt_error_info_there_is_not_enough_memory_currentl
+ iErrorHandler.SetErrorMessage( _L("There is not enough memory currently.") );
+ break;
+ case ELowDiskSpace:
+ // txt_error_info_there_is_not_enough_space_currently
+ iErrorHandler.SetErrorMessage( _L("There is not enough space currently in this drive.") );
+ break;
+ case ENetworkUnavailable:
+ // txt_error_info_network_is_unavailable_currently
+ iErrorHandler.SetErrorMessage( _L("Network is unavailable currently.") );
+ break;
+ case EInstallerBusy:
+ // txt_error_info_installer_is_busy_currently
+ iErrorHandler.SetErrorMessage( _L("Installer is busy currently.") );
+ break;
+ case ECorruptedPackage:
+ // txt_error_info_installation_package_is_corrupted
+ iErrorHandler.SetErrorMessage( _L("Installation package is corrupted. You may want to try again.") );
+ break;
+ case EApplicationNotCompatible:
+ // txt_error_info_application_is_not_compatible_with
+ iErrorHandler.SetErrorMessage( _L("Application is not compatible with this device.") );
+ break;
+ case ESecurityError:
+ // txt_error_info_there_is_a_security_issue_with_this
+ iErrorHandler.SetErrorMessage( _L("There is a security issue with this application.") );
+ break;
+ case EUnexpectedError:
+ case EUnknown:
+ // txt_error_info_an_unexpected_error_occurred
+ iErrorHandler.SetErrorMessage( _L("An unexpected error occurred.") );
+ break;
+ case EUserCancelled:
+ if( iOperationPhase == EInstalling )
+ {
+ // txt_error_info_application_not_installed
+ iErrorHandler.SetErrorMessage( _L("Application not installed.") );
+ }
+ else
+ {
+ // txt_error_info_application_not_deleted
+ iErrorHandler.SetErrorMessage( _L("Application not deleted. ") );
+ }
+ break;
+ case EUninstallationBlocked:
+ // txt_error_info_application_cannot_be_deleted
+ iErrorHandler.SetErrorMessage( _L("Application cannot be deleted.") );
+ break;
+ case ENone:
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSisxSifPluginUiHandlerBase::SetErrorL()
+// ---------------------------------------------------------------------------
+//
+void CSisxSifPluginUiHandlerBase::SetErrorL( TInt aErrorCode, TInt aExtErrorCode,
+ const TDesC& aErrMsgDetails )
+ {
+ SetErrorL( aErrorCode, aExtErrorCode );
+ iErrorHandler.SetErrorMessageDetails( aErrMsgDetails );
+ }
+
+// ---------------------------------------------------------------------------
+// CSisxSifPluginUiHandlerBase::SetErrorSwiErrorL()
+// ---------------------------------------------------------------------------
+//
+void CSisxSifPluginUiHandlerBase::SetErrorSwiErrorL( Swi::TErrorDialog aType,
+ const TDesC& /*aParam*/ )
+ {
// TODO: localised detailed error messages
+ // TODO: append aParam when message supports parameters
TBuf<512> details;
switch( aType )
{
@@ -195,7 +320,8 @@
details.Copy(_L("EUiInsufficientSpaceOnDrive"));
break;
case Swi::EUiCapabilitiesCannotBeGranted:
- details.Copy(_L("EUiCapabilitiesCannotBeGranted"));
+ // aParam contains list of capability names
+ details.Copy(_L("Cannot grant capabilities requested by the application."));
break;
case Swi::EUiUnknownFile:
details.Copy(_L("EUiUnknownFile"));
@@ -231,10 +357,95 @@
break;
}
- if( aParam.Length() )
+ SetErrorL( KErrGeneral, aType, details );
+ }
+
+// ---------------------------------------------------------------------------
+// CSisxSifPluginUiHandlerBase::SetOcspErrorL()
+// ---------------------------------------------------------------------------
+//
+void CSisxSifPluginUiHandlerBase::SetOcspErrorL( Swi::TRevocationDialogMessage aMessage )
+ {
+ // TODO: localised error strings needed
+ iErrorHandler.SetErrorMessage( _L("Unable to check certificate validity online." ) );
+ iErrorHandler.SetExtendedErrorCode( aMessage );
+ switch( aMessage )
{
- details.Append( _L("\n") );
- details.Append( aParam );
+ case Swi::EInvalidRevocationServerUrl:
+ iErrorHandler.SetErrorCode( KErrGeneral );
+ iErrorHandler.SetErrorMessageDetails( _L("Invalid server URL. Check settings.") );
+ break;
+ case Swi::EUnableToObtainCertificateStatus:
+ iErrorHandler.SetErrorCode( KErrGeneral );
+ iErrorHandler.SetErrorMessageDetails( _L("Unable to obtain certificate status. Try again later.") );
+ break;
+ case Swi::EResponseSignatureValidationFailure:
+ iErrorHandler.SetErrorCode( KErrGeneral );
+ iErrorHandler.SetErrorMessageDetails( _L("Response signature validation failure. Check settings.") );
+ break;
+ case Swi::EInvalidRevocationServerResponse:
+ iErrorHandler.SetErrorCode( KErrGeneral );
+ iErrorHandler.SetErrorMessageDetails( _L("The OCSP server reply is invalid. Check settings.") );
+ break;
+ case Swi::EInvalidCertificateStatusInformation:
+ case Swi::ECertificateStatusIsUnknownSelfSigned:
+ iErrorHandler.SetErrorCode( KErrGeneral );
+ iErrorHandler.SetErrorMessageDetails( _L("Invalid certificate status information. Try again later.") );
+ break;
+ case Swi::ECertificateStatusIsUnknown:
+ iErrorHandler.SetErrorCode( KErrGeneral );
+ iErrorHandler.SetErrorMessageDetails( _L("Unknown certificate. Try again later.") );
+ break;
+ case Swi::ECertificateStatusIsRevoked:
+ iErrorHandler.SetErrorCode( KErrAccessDenied );
+ iErrorHandler.SetErrorMessageDetails( _L("The certificate has been revoked.") );
+ break;
+ default:
+ break;
}
}
+// ---------------------------------------------------------------------------
+// CSisxSifPluginUiHandlerBase::ShowQuestionL()
+// ---------------------------------------------------------------------------
+//
+TBool CSisxSifPluginUiHandlerBase::ShowQuestionL( const TDesC& aText ) const
+ {
+ TBool questionAccepted = EFalse;
+
+ CHbDeviceMessageBoxSymbian *note = NULL;
+ note = CHbDeviceMessageBoxSymbian::NewL( CHbDeviceMessageBoxSymbian::EQuestion );
+ CleanupStack::PushL( note );
+
+ note->SetTextL( aText );
+ note->SetTimeout( 0 );
+ if( note->ExecL() == CHbDeviceMessageBoxSymbian::EAcceptButton )
+ {
+ questionAccepted = ETrue;
+ }
+
+ CleanupStack::PopAndDestroy( note );
+ return questionAccepted;
+ }
+
+// ---------------------------------------------------------------------------
+// CSisxSifPluginUiHandlerBase::ShowQuestionWithContinueL()
+// ---------------------------------------------------------------------------
+//
+void CSisxSifPluginUiHandlerBase::ShowQuestionWithContinueL( const TDesC& aText ) const
+ {
+ CHbDeviceMessageBoxSymbian *note = NULL;
+ note = CHbDeviceMessageBoxSymbian::NewL( CHbDeviceMessageBoxSymbian::EQuestion );
+ CleanupStack::PushL( note );
+
+ note->SetTextL( aText );
+ note->SetTimeout( 0 );
+ note->SetButton( CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse );
+ note->SetButton( CHbDeviceMessageBoxSymbian::ERejectButton, ETrue );
+ // TODO: localized UI string needed
+ note->SetButtonTextL( CHbDeviceMessageBoxSymbian::ERejectButton, _L("Continue") );
+ (void)note->ExecL();
+
+ CleanupStack::PopAndDestroy( note );
+ }
+