appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandler.cpp
changeset 55 ac7f90a6ff4c
parent 44 329d304c1aa1
child 58 67f2119dc623
--- a/appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandler.cpp	Thu Jul 08 20:28:00 2010 +0300
+++ b/appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandler.cpp	Thu Jul 22 14:08:51 2010 +0300
@@ -157,7 +157,7 @@
     {
     FLOG( _L("CSisxSifPluginUiHandler::DisplayInstallL") );
 
-    iMode = EModeInstall;
+    iOperationPhase = EInstalling;
     return ETrue;
     }
 
@@ -259,35 +259,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 +300,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 +351,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 +364,7 @@
         case Swi::EMandatorySignatureMissing:
             if( aInstallAnyway )
                 {
-                CSifUiAppInfo *appInfo = GetAppInfoLC( aAppInfo );
-                result = iSifUi->ShowConfirmationL( *appInfo );
-                CleanupStack::PopAndDestroy( appInfo );
+                result = ShowConfirmationL( aAppInfo );
                 }
             break;
 
@@ -371,12 +380,28 @@
 // ---------------------------------------------------------------------------
 //
 TBool CSisxSifPluginUiHandler::DisplayOcspResultL( const Swi::CAppInfo& /*aAppInfo*/,
-        Swi::TRevocationDialogMessage /*aMessage*/, RPointerArray<TOCSPOutcome>& /*aOutcomes*/,
-        RPointerArray<Swi::CCertificateInfo>& /*aCertificates*/, TBool /*aWarningOnly*/ )
+        Swi::TRevocationDialogMessage aMessage, RPointerArray<TOCSPOutcome>& /*aOutcomes*/,
+        RPointerArray<Swi::CCertificateInfo>& /*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 +436,7 @@
     {
     FLOG( _L("CSisxSifPluginUiHandler::DisplayUninstallL") );
 
-    iMode = EModeUninstall;
+    iOperationPhase = EUninstalling;
     return ETrue;       // uninstall is always silent
     }
 
@@ -434,7 +459,6 @@
     FLOG( _L("CSisxSifPluginUiHandler::DisplayCompleteL") );
 
     iSifUi->ShowCompleteL();
-    iMode = EModeUndefined;
     }
 
 // ---------------------------------------------------------------------------
@@ -542,3 +566,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;
+    }