appinstaller/AppinstUi/Plugin/SisxUI/Src/SisxUIResult.cpp
changeset 80 9dcba1ee99f7
parent 77 d1838696558c
equal deleted inserted replaced
77:d1838696558c 80:9dcba1ee99f7
     1 /*
       
     2 * Copyright (c) 2002-2004 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:   This file contains the implementation of CSisxUI
       
    15 *                class member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include <SWInstDefs.h>
       
    23 
       
    24 #include "SisxUIResult.h"
       
    25 
       
    26 using namespace SwiUI;
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // TSisxUIResult::TSisxUIResult
       
    30 // C++ default constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 TSisxUIResult::TSisxUIResult()
       
    35     : iResult( EUiResultNoResult ), iDetailedErrorCode( 0 )
       
    36     {
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // TSisxUIResult::TSisxUIResult
       
    41 // C++ default constructor can NOT contain any code, that
       
    42 // might leave.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 TSisxUIResult::TSisxUIResult( const TSisxResultCode& aResult )
       
    46     : iResult( aResult ), iDetailedErrorCode( 0 )
       
    47     {
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // TSisxUIResult::TSisxUIResult
       
    52 // C++ default constructor can NOT contain any code, that
       
    53 // might leave.
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 TSisxUIResult::TSisxUIResult( const Swi::TRevocationDialogMessage& aResult )
       
    57     {
       
    58     switch ( aResult )
       
    59         {
       
    60         case Swi::EInvalidRevocationServerUrl:
       
    61             iResult = EUiResultInvalidRevocationServerUrl;            
       
    62             break;
       
    63             
       
    64         case Swi::EUnableToObtainCertificateStatus: 
       
    65             iResult = EUiResultUnableToObtainCertificateStatus;
       
    66             break;
       
    67 
       
    68         case Swi::EResponseSignatureValidationFailure:
       
    69             iResult = EUiResultResponseSignatureValidationFailure;
       
    70             break;
       
    71 
       
    72         case Swi::EInvalidRevocationServerResponse:
       
    73             iResult = EUiResultInvalidRevocationServerResponse;
       
    74             break;
       
    75 
       
    76         case Swi::EInvalidCertificateStatusInformation:
       
    77             iResult = EUiResultInvalidCertificateStatusInformation;
       
    78             break;
       
    79 
       
    80         case Swi::ECertificateStatusIsUnknown:
       
    81             iResult = EUiResultCertificateStatusIsUnknown;
       
    82             break;
       
    83 
       
    84         case Swi::ECertificateStatusIsRevoked:  
       
    85             iResult = EUiResultCertificateStatusIsRevoked;
       
    86             break;
       
    87 
       
    88         case Swi::ECertificateStatusIsUnknownSelfSigned:
       
    89             iResult = EUiResultCertificateStatusIsUnknownSelfSigned;
       
    90             break;
       
    91 
       
    92         default:
       
    93             iResult = EUiResultGeneralError;
       
    94             iDetailedErrorCode = aResult;
       
    95             break; 
       
    96         }
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // TSisxUIResult::TSisxUIResult
       
   101 // C++ default constructor can NOT contain any code, that
       
   102 // might leave.
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 TSisxUIResult::TSisxUIResult( const Swi::TSignatureValidationResult& aResult )
       
   106     {
       
   107     switch ( aResult )
       
   108         {
       
   109         case Swi::ESignatureNotPresent:
       
   110             iResult = EUiResultSignatureNotPresent;            
       
   111             break;    
       
   112  
       
   113         case Swi::ENoCertificate:
       
   114             iResult = EUiResultNoCertificate;            
       
   115             break; 
       
   116     
       
   117         case Swi::ECertificateValidationError:
       
   118             iResult = EUiResultCertificateValidationError;            
       
   119             break; 
       
   120     
       
   121         case Swi::ENoCodeSigningExtension:
       
   122             iResult = EUiResultNoCodeSigningExtension;
       
   123             break; 
       
   124     
       
   125         case Swi::ENoSupportedPolicyExtension:
       
   126             iResult = EUiResultNoSupportedPolicyExtension;
       
   127             break;
       
   128      
       
   129         case Swi::ESignatureCouldNotBeValidated:
       
   130             iResult = EUiResultSignatureCouldNotBeValidated;
       
   131             break;  
       
   132    
       
   133         case Swi::EMandatorySignatureMissing:
       
   134             iResult = EUiResultMandatorySignatureMissing;
       
   135             break;
       
   136 
       
   137         case Swi::ESignatureSelfSigned:
       
   138             iResult = EUiResultSignatureSelfSigned;            
       
   139             break;
       
   140             
       
   141         default:
       
   142             iResult = EUiResultGeneralError;
       
   143             iDetailedErrorCode = aResult;
       
   144             break;            
       
   145         }
       
   146     }
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // TSisxUIResult::TSisxUIResult
       
   150 // C++ default constructor can NOT contain any code, that
       
   151 // might leave.
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 TSisxUIResult::TSisxUIResult( const Swi::TErrorDialog& aResult )
       
   155     {
       
   156     switch ( aResult )
       
   157         {
       
   158         case Swi::EUiAlreadyInRom:
       
   159             iResult = EUiResultAlreadyInRom;
       
   160             break;
       
   161 
       
   162         case Swi::EUiMissingDependency:
       
   163             iResult = EUiResultMissingDependency;
       
   164             break;
       
   165 
       
   166         case Swi::EUiRequireVer:	
       
   167             iResult = EUiResultRequireVer;
       
   168             break;
       
   169 
       
   170         case Swi::EUiRequireVerOrGreater:
       
   171             iResult = EUiResultRequireVerOrGreater;
       
   172             break;
       
   173 
       
   174         case Swi::EUiFileCorrupt:	
       
   175             iResult = EUiResultFileCorrupt;
       
   176             break;
       
   177 
       
   178         case Swi::EUiDiskNotPresent:
       
   179             iResult = EUiResultDiskNotPresent;
       
   180             break;
       
   181 
       
   182         case Swi::EUiCannotRead: 
       
   183             iResult = EUiResultCannotRead;
       
   184             break;
       
   185 
       
   186         case Swi::EUiCannotDelete:  
       
   187             iResult = EUiResultCannotDelete;
       
   188             break;
       
   189 
       
   190         case Swi::EUiInvalidFileName:
       
   191             iResult = EUiResultInvalidFileName;
       
   192             break;
       
   193 
       
   194         case Swi::EUiFileNotFound: 
       
   195             iResult = EUiResultFileNotFound;
       
   196             break;
       
   197 
       
   198         case Swi::EUiInsufficientSpaceOnDrive:
       
   199         case Swi::EUiNoMemoryInDrive:
       
   200             iResult = EUiResultInsufficientSpaceOnDrive;
       
   201             break;
       
   202 
       
   203         case Swi::EUiCapabilitiesCannotBeGranted:
       
   204             iResult = EUiResultCapabilitiesCannotBeGranted;
       
   205             break;
       
   206 
       
   207         case Swi::EUiUnknownFile:
       
   208             iResult = EUiResultUnknownFile;
       
   209             break;
       
   210 
       
   211         case Swi::EUiMissingBasePackage:
       
   212             iResult = EUiResultMissingBasePackage;
       
   213             break;
       
   214 
       
   215         case Swi::EUiConstraintsExceeded:
       
   216             iResult = EUiResultConstraintsExceeded;            
       
   217             break;
       
   218             
       
   219         case Swi::EUiSIDViolation:
       
   220             iResult = EUiResultSIDViolation;            
       
   221             break;
       
   222             
       
   223         case Swi::EUiVIDViolation:
       
   224             iResult = EUiResultVIDViolation;            
       
   225             break;
       
   226 
       
   227         case Swi::EUiUIDPackageViolation:
       
   228             iResult = EUiResultUIDPackageViolation;
       
   229             break;            
       
   230 
       
   231         case Swi::EUiBlockingEclipsingFile:
       
   232             iResult = EUiResultBlockingEclipsingFile;
       
   233             break;            
       
   234 
       
   235         case Swi::EUiOSExeViolation:
       
   236             iResult = EUiResultOSExeViolation;
       
   237             break;
       
   238 
       
   239         case Swi::EUiSIDMismatch:
       
   240             iResult = EUiResultSIDMismatch;
       
   241             break;
       
   242 
       
   243         default:
       
   244             iResult = EUiResultGeneralError;
       
   245             iDetailedErrorCode = aResult;
       
   246             break;     
       
   247         }     
       
   248     }
       
   249 
       
   250 // -----------------------------------------------------------------------------
       
   251 // TSisxUIResult::CommonResult
       
   252 // Returns the common SWInst result code for this result.
       
   253 // (other items were commented in a header).
       
   254 // -----------------------------------------------------------------------------
       
   255 //
       
   256 TInt TSisxUIResult::CommonResult() const
       
   257     {
       
   258     TInt result( KErrNone );
       
   259     
       
   260     switch ( iResult )
       
   261         {
       
   262         case EUiResultOk:
       
   263             result = KErrNone;            
       
   264             break;
       
   265             
       
   266         case EUiResultCancelled:
       
   267             result = KSWInstErrUserCancel;            
       
   268             break;
       
   269 
       
   270         case EUiResultAlreadyInRom:
       
   271         case EUiResultUnableToOverwrite:
       
   272         case EUiResultCannotDelete:          	
       
   273             result = KSWInstErrFileInUse;
       
   274             break;
       
   275 
       
   276         case EUiResultUnknownFile:
       
   277         case EUiResultFileNotFound:
       
   278         case EUiResultInvalidFileName:		
       
   279         case EUiResultFileCorrupt:
       
   280         case EUiResultCannotRead:  
       
   281             result = KSWInstErrFileCorrupted;            
       
   282             break;            
       
   283 
       
   284         case EUiResultInsufficientMemory:
       
   285         case EUiResultInsufficientSpaceOnDrive:
       
   286             result = KSWInstErrInsufficientMemory;
       
   287             break;            
       
   288             
       
   289         case EUiResultNoCertificate:
       
   290         case EUiResultCertificateValidationError:
       
   291         case EUiResultSignatureNotPresent:
       
   292         case EUiResultSignatureCouldNotBeValidated:
       
   293         case EUiResultNoCodeSigningExtension:
       
   294         case EUiResultNoSupportedPolicyExtension:  
       
   295         case EUiResultMandatorySignatureMissing:
       
   296         case EUiResultInvalidRevocationServerResponse:
       
   297         case EUiResultInvalidRevocationServerUrl:
       
   298         case EUiResultUnableToObtainCertificateStatus:  
       
   299         case EUiResultResponseSignatureValidationFailure:
       
   300         case EUiResultInvalidCertificateStatusInformation:
       
   301         case EUiResultCertificateStatusIsUnknown:
       
   302         case EUiResultCertificateStatusIsRevoked: 
       
   303         case EUiResultCertificateStatusIsUnknownSelfSigned:
       
   304         case EUiResultCertificateExpired:
       
   305         case EUiResultCertificateValidInFuture:
       
   306         case EUiResultSignatureSelfSigned:
       
   307         case EUiResultCapabilitiesCannotBeGranted:
       
   308         case EUiResultSIDViolation:
       
   309         case EUiResultVIDViolation:
       
   310         case EUiResultConstraintsExceeded:
       
   311         case EUiResultUIDPackageViolation:
       
   312         case EUiResultSIDMismatch:
       
   313             result = KSWInstErrSecurityFailure;
       
   314             break;
       
   315 
       
   316         case EUiResultAccessDenied:
       
   317         case EUiResultCannotUninstallPartialUpgrade:
       
   318         case EUiResultOSExeViolation:
       
   319             result = KSWInstErrAccessDenied;
       
   320             break;
       
   321             
       
   322         case EUiResultMissingDependency:			
       
   323         case EUiResultRequireVer:		
       
   324         case EUiResultRequireVerOrGreater:
       
   325         case EUiResultMissingBasePackage:
       
   326             result = KSWInstErrMissingDependency;
       
   327             break;  
       
   328 
       
   329         case EUiResultInvalidUpgrade:
       
   330         case EUiResultBlockingEclipsingFile:
       
   331             result = KSWInstUpgradeError;
       
   332             break;            
       
   333 
       
   334         case EUiResultGeneralError:            
       
   335         case EUiResultDiskNotPresent:
       
   336         case EUiResultNoResult:
       
   337         default:            
       
   338             result = KSWInstErrGeneralError;
       
   339             break;            
       
   340         }  
       
   341 
       
   342     return result;    
       
   343     }
       
   344 
       
   345 
       
   346 //  End of File