appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandlersilent.cpp
changeset 60 245df5276b97
parent 52 92f864ef0288
child 72 a0dc14075813
--- a/appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandlersilent.cpp	Tue Jul 06 14:23:31 2010 +0300
+++ b/appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandlersilent.cpp	Wed Aug 18 09:55:45 2010 +0300
@@ -20,6 +20,7 @@
 #include "sisxsifpluginerrorhandler.h"      // CSisxSifPluginErrorHandler
 #include "sisxsifplugin.pan"                // Panic codes
 #include "sisxsifcleanuputils.h"            // CleanupResetAndDestroyPushL
+#include "sisxsifpluginerrors.h"            // Error codes
 
 using namespace Usif;
 
@@ -54,9 +55,10 @@
 // ---------------------------------------------------------------------------
 //
 TBool CSisxSifPluginUiHandlerSilent::DisplayTextL( const Swi::CAppInfo& /*aAppInfo*/,
-        Swi::TFileTextOption /*aOption*/, const TDesC& /*aText*/ )
+        Swi::TFileTextOption aOption, const TDesC& aText )
     {
 	TBool okToContinue = EFalse;
+
 	if( iInstallParams )
 		{
 		switch( iInstallParams->PackageInfo() )
@@ -65,13 +67,33 @@
 				okToContinue = ETrue;
 				break;
 			case EUserConfirm:
-				// TODO: EPolicyUserConfirm
+			    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;
+			        }
 				break;
 			case ENotAllowed:
 			default:
+		        SetErrorL( KErrPermissionDenied, ESifUiNeedsPackageInfoParameter, aText );
 				break;
 			}
 		}
+
     return okToContinue;
     }
 
@@ -82,7 +104,7 @@
 void CSisxSifPluginUiHandlerSilent::DisplayErrorL( const Swi::CAppInfo& /*aAppInfo*/,
         Swi::TErrorDialog aType, const TDesC& aParam )
     {
-    SetDisplayErrorL( aType, aParam );
+    SetErrorSwiErrorL( aType, aParam );
     }
 
 // ---------------------------------------------------------------------------
@@ -93,6 +115,7 @@
         const RPointerArray<TDesC>& /*aComponents*/ )
     {
 	TBool okToContinue = EFalse;
+
 	if( iInstallParams )
 		{
 		switch( iInstallParams->AllowAppBreakDependency() )
@@ -103,9 +126,11 @@
 			case EUserConfirm:
 			case ENotAllowed:
 			default:
+			    SetErrorL( KErrPermissionDenied, ESifUiNeedsAllowAppBreakDependencyParameter );
 				break;
 			}
 		}
+
     return okToContinue;
     }
 
@@ -117,6 +142,7 @@
         const RPointerArray<TDesC>& /*aAppNames*/ )
     {
 	TBool okToContinue = EFalse;
+
 	if( iInstallParams )
 		{
 		switch( iInstallParams->AllowAppShutdown() )
@@ -127,9 +153,11 @@
 			case EUserConfirm:
 			case ENotAllowed:
 			default:
+			    SetErrorL( KErrPermissionDenied, ESifUiNeedsAllowAppShutdownParameter );
 				break;
 			}
 		}
+
     return okToContinue;
     }
 
@@ -138,9 +166,10 @@
 // ---------------------------------------------------------------------------
 //
 TBool CSisxSifPluginUiHandlerSilent::DisplayQuestionL( const Swi::CAppInfo& /*aAppInfo*/,
-        Swi::TQuestionDialog aQuestion, const TDesC& /*aDes*/ )
+        Swi::TQuestionDialog aQuestion, const TDesC& aDes )
     {
 	TBool okToContinue = EFalse;
+
     switch( aQuestion )
         {
         case Swi::EQuestionIncompatible:
@@ -157,6 +186,10 @@
 						break;
 					}
         		}
+        	if( !okToContinue )
+        	    {
+                SetErrorL( KErrPermissionDenied, ESifUiNeedsAllowIncompatibleParameter, aDes );
+        	    }
             break;
 
         case Swi::EQuestionOverwriteFile:
@@ -173,11 +206,17 @@
 						break;
 					}
         		}
+        	if( !okToContinue )
+        	    {
+                SetErrorL( KErrPermissionDenied, ESifUiNeedsAllowOverwriteParameter, aDes );
+                }
         	break;
 
         default:
+            SetErrorL( KErrNotSupported, KErrNotSupported, aDes );
             break;
         }
+
     return okToContinue;
     }
 
@@ -189,6 +228,7 @@
         const CApaMaskedBitmap* /*aLogo*/,
         const RPointerArray<Swi::CCertificateInfo>& /*aCertificates*/ )
     {
+    iOperationPhase = EInstalling;
     return ETrue;
     }
 
@@ -200,6 +240,7 @@
         const TCapabilitySet& /*aCapabilitySet*/ )
     {
 	TBool okToContinue = EFalse;
+
 	if( iInstallParams )
 		{
 		switch( iInstallParams->GrantCapabilities() )
@@ -210,9 +251,11 @@
 			case EUserConfirm:
 			case ENotAllowed:
 			default:
+			    SetErrorL( KErrPermissionDenied, ESifUiNeedsGrantCapabilitiesParameter );
 				break;
 			}
 		}
+
     return okToContinue;
     }
 
@@ -338,8 +381,31 @@
 // ---------------------------------------------------------------------------
 //
 TBool CSisxSifPluginUiHandlerSilent::HandleInstallEventL( const Swi::CAppInfo& /*aAppInfo*/,
-        Swi::TInstallEvent /*aEvent*/, TInt /*aValue*/, const TDesC& /*aDes*/ )
+        Swi::TInstallEvent aEvent, TInt aValue, const TDesC& /*aDes*/ )
     {
+    switch( aEvent )
+        {
+        case Swi::EEventSetProgressBarFinalValue:
+            iProgressBarFinalValue = aValue;
+            break;
+
+        case Swi::EEventUpdateProgressBar:
+            iProgressBarCurrentValue += aValue;
+            PublishProgressL( EFileOperation );
+            break;
+
+        case Swi::EEventDevCert:
+        case Swi::EEventOcspCheckEnd:
+        case Swi::EEventAbortedInstall:
+        case Swi::EEventAbortedUnInstall:
+        case Swi::EEventCompletedInstall:
+        case Swi::EEventCompletedUnInstall:
+        case Swi::EEventCompletedNoMessage:
+        case Swi::EEventLeave:
+        default:
+            break;
+        }
+
     return ETrue;
     }
 
@@ -348,9 +414,21 @@
 // ---------------------------------------------------------------------------
 //
 void CSisxSifPluginUiHandlerSilent::HandleCancellableInstallEventL(
-        const Swi::CAppInfo& /*aAppInfo*/, Swi::TInstallCancellableEvent /*aEvent*/,
+        const Swi::CAppInfo& /*aAppInfo*/, Swi::TInstallCancellableEvent aEvent,
         Swi::MCancelHandler& /*aCancelHandler*/, TInt /*aValue*/, const TDesC& /*aDes*/ )
     {
+    switch( aEvent )
+        {
+        case Swi::EEventOcspCheckStart:
+            PublishProgressL( EOCSPCheck );
+            break;
+
+        case Swi::EEventRemovingFiles:
+        case Swi::EEventCopyingFiles:
+        case Swi::EEventShuttingDownApps:
+        default:
+            break;
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -407,24 +485,33 @@
 // ---------------------------------------------------------------------------
 //
 TBool CSisxSifPluginUiHandlerSilent::DisplayOcspResultL( const Swi::CAppInfo& /*aAppInfo*/,
-        Swi::TRevocationDialogMessage /*aMessage*/, RPointerArray<TOCSPOutcome>& /*aOutcomes*/,
+        Swi::TRevocationDialogMessage aMessage, RPointerArray<TOCSPOutcome>& /*aOutcomes*/,
         RPointerArray<Swi::CCertificateInfo>& /*aCertificates*/, TBool aWarningOnly )
     {
 	TBool okToContinue = EFalse;
-	// TODO: KSWInstallerOcspProcedure setting (off/on/must)
-	if( iInstallParams && aWarningOnly )
+
+	if( aWarningOnly && !IsOcspMandatoryL() )
 		{
-		switch( iInstallParams->IgnoreOCSPWarnings() )
-			{
-			case EAllowed:
-				okToContinue = ETrue;
-				break;
-			case EUserConfirm:
-			case ENotAllowed:
-			default:
-				break;
-			}
+	    if( iInstallParams )
+	        {
+            switch( iInstallParams->IgnoreOCSPWarnings() )
+                {
+                case EAllowed:
+                    okToContinue = ETrue;
+                    break;
+                case EUserConfirm:
+                case ENotAllowed:
+                default:
+                    break;
+                }
+	        }
 		}
+
+	if( !okToContinue )
+	    {
+	    SetOcspErrorL( aMessage );
+	    }
+
     return okToContinue;
     }
 
@@ -433,9 +520,12 @@
 // ---------------------------------------------------------------------------
 //
 void CSisxSifPluginUiHandlerSilent::DisplayCannotOverwriteFileL( const Swi::CAppInfo& /*aAppInfo*/,
-        const Swi::CAppInfo& /*aInstalledAppInfo*/, const TDesC& /*aFileName*/ )
+        const Swi::CAppInfo& /*aInstalledAppInfo*/, const TDesC& aFileName )
     {
-	// TODO: error handling
+    // TODO: localized UI string needed: "The package tries to overwrite file '%1' it does not own."
+	TName detailsString;
+	detailsString.Format( _L("The package tries to overwrite file '%S' it does not own."), &aFileName );
+    SetErrorL( KErrPermissionDenied, ESifUiCannotOverwriteFile, detailsString );
     }
 
 // ---------------------------------------------------------------------------
@@ -447,6 +537,7 @@
         TVersion /*aWantedVersionTo*/, TVersion /*aInstalledVersion*/ )
     {
 	TBool okToContinue = EFalse;
+
 	if( iInstallParams )
 		{
 		switch( iInstallParams->AllowAppBreakDependency() )
@@ -460,6 +551,12 @@
 				break;
 			}
 		}
+
+	if( !okToContinue )
+	    {
+        SetErrorL( KErrSifMissingDependencies, 0, KNullDesC );
+	    }
+
     return okToContinue;
     }
 
@@ -469,6 +566,7 @@
 //
 TBool CSisxSifPluginUiHandlerSilent::DisplayUninstallL( const Swi::CAppInfo& /*aAppInfo*/ )
     {
+    iOperationPhase = EUninstalling;
     return ETrue;
     }