appinstaller/AppinstUi/sisxsifplugin/src/sisxsifplugininstallparams.cpp
changeset 37 6e7b00453237
child 42 d17dc5398051
equal deleted inserted replaced
33:8110bf1194d1 37:6e7b00453237
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Installation parameters class.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "sisxsifplugininstallparams.h" // CSisxSifPluginInstallParams
       
    19 #include <f32file.h>                    // EDriveC
       
    20 
       
    21 using namespace Usif;
       
    22 
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // CSisxSifPluginInstallParams::NewL()
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 CSisxSifPluginInstallParams* CSisxSifPluginInstallParams::NewL(
       
    29         const COpaqueNamedParams& aParams )
       
    30     {
       
    31     CSisxSifPluginInstallParams* self = new ( ELeave ) CSisxSifPluginInstallParams;
       
    32     CleanupStack::PushL( self );
       
    33     self->ConstructL( aParams );
       
    34     CleanupStack::Pop( self );
       
    35     return self;
       
    36     }
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // CSisxSifPluginInstallParams::NewL()
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 CSisxSifPluginInstallParams* CSisxSifPluginInstallParams::NewL(
       
    43         const CSisxSifPluginInstallParams& aParams )
       
    44     {
       
    45     CSisxSifPluginInstallParams* self = new ( ELeave ) CSisxSifPluginInstallParams;
       
    46     CleanupStack::PushL( self );
       
    47     self->ConstructL( aParams );
       
    48     CleanupStack::Pop( self );
       
    49     return self;
       
    50     }
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // CSisxSifPluginInstallParams::~CSisxSifPluginInstallParams()
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 CSisxSifPluginInstallParams::~CSisxSifPluginInstallParams()
       
    57     {
       
    58     delete iOCSPUrl;
       
    59     }
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // CSisxSifPluginInstallParams::IsSilentMode()
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 TBool CSisxSifPluginInstallParams::IsSilentMode() const
       
    66     {
       
    67     return iUseSilentMode;
       
    68     }
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // CSisxSifPluginInstallParams::IsInstallInactive()
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 TBool CSisxSifPluginInstallParams::IsInstallInactive() const
       
    75     {
       
    76     return iIsInstallInactive;
       
    77     }
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // CSisxSifPluginInstallParams::Drive()
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 TUint CSisxSifPluginInstallParams::Drive() const
       
    84     {
       
    85     return iDrive;
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CSisxSifPluginInstallParams::Language()
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 TLanguage CSisxSifPluginInstallParams::Language() const
       
    93     {
       
    94     return iLanguage;
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CSisxSifPluginInstallParams::OCSPUrl()
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 const TDesC& CSisxSifPluginInstallParams::OCSPUrl() const
       
   102     {
       
   103     if( iOCSPUrl )
       
   104         {
       
   105         return *iOCSPUrl;
       
   106         }
       
   107     return KNullDesC;
       
   108     }
       
   109 
       
   110 // ---------------------------------------------------------------------------
       
   111 // CSisxSifPluginInstallParams::PerformOCSP()
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 TSifPolicy CSisxSifPluginInstallParams::PerformOCSP() const
       
   115     {
       
   116     return iPerformOCSP;
       
   117     }
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // CSisxSifPluginInstallParams::IgnoreOCSPWarnings()
       
   121 // ---------------------------------------------------------------------------
       
   122 //
       
   123 TSifPolicy CSisxSifPluginInstallParams::IgnoreOCSPWarnings() const
       
   124     {
       
   125     return iIgnoreOCSPWarnings;
       
   126     }
       
   127 
       
   128 // ---------------------------------------------------------------------------
       
   129 // CSisxSifPluginInstallParams::AllowUpgrade()
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 TSifPolicy CSisxSifPluginInstallParams::AllowUpgrade() const
       
   133     {
       
   134     return iAllowUpgrade;
       
   135     }
       
   136 
       
   137 // ---------------------------------------------------------------------------
       
   138 // CSisxSifPluginInstallParams::InstallOptionalItems()
       
   139 // ---------------------------------------------------------------------------
       
   140 //
       
   141 TSifPolicy CSisxSifPluginInstallParams::InstallOptionalItems() const
       
   142     {
       
   143     return iInstallOptionalItems;
       
   144     }
       
   145 
       
   146 // ---------------------------------------------------------------------------
       
   147 // CSisxSifPluginInstallParams::AllowUntrusted()
       
   148 // ---------------------------------------------------------------------------
       
   149 //
       
   150 TSifPolicy CSisxSifPluginInstallParams::AllowUntrusted() const
       
   151     {
       
   152     return iAllowUntrusted;
       
   153     }
       
   154 
       
   155 // ---------------------------------------------------------------------------
       
   156 // CSisxSifPluginInstallParams::GrantCapabilities()
       
   157 // ---------------------------------------------------------------------------
       
   158 //
       
   159 TSifPolicy CSisxSifPluginInstallParams::GrantCapabilities() const
       
   160     {
       
   161     return iGrantCapabilities;
       
   162     }
       
   163 
       
   164 // ---------------------------------------------------------------------------
       
   165 // CSisxSifPluginInstallParams::AllowAppShutdown()
       
   166 // ---------------------------------------------------------------------------
       
   167 //
       
   168 TSifPolicy CSisxSifPluginInstallParams::AllowAppShutdown() const
       
   169     {
       
   170     return iAllowAppShutdown;
       
   171     }
       
   172 
       
   173 // ---------------------------------------------------------------------------
       
   174 // CSisxSifPluginInstallParams::AllowAppBreakDependency()
       
   175 // ---------------------------------------------------------------------------
       
   176 //
       
   177 TSifPolicy CSisxSifPluginInstallParams::AllowAppBreakDependency() const
       
   178     {
       
   179     return iAllowAppBreakDependency;
       
   180     }
       
   181 
       
   182 // ---------------------------------------------------------------------------
       
   183 // CSisxSifPluginInstallParams::AllowOverwrite()
       
   184 // ---------------------------------------------------------------------------
       
   185 //
       
   186 TSifPolicy CSisxSifPluginInstallParams::AllowOverwrite() const
       
   187     {
       
   188     return iAllowOverwrite;
       
   189     }
       
   190 
       
   191 // ---------------------------------------------------------------------------
       
   192 // CSisxSifPluginInstallParams::PackageInfo()
       
   193 // ---------------------------------------------------------------------------
       
   194 //
       
   195 TSifPolicy CSisxSifPluginInstallParams::PackageInfo() const
       
   196     {
       
   197     return iPackageInfo;
       
   198     }
       
   199 
       
   200 // ---------------------------------------------------------------------------
       
   201 // CSisxSifPluginInstallParams::CSisxSifPluginInstallParams()
       
   202 // ---------------------------------------------------------------------------
       
   203 //
       
   204 CSisxSifPluginInstallParams::CSisxSifPluginInstallParams() : iAllowUntrusted( ENotAllowed )
       
   205     {
       
   206     }
       
   207 
       
   208 // ---------------------------------------------------------------------------
       
   209 // CSisxSifPluginInstallParams::ConstructL()
       
   210 // ---------------------------------------------------------------------------
       
   211 //
       
   212 void CSisxSifPluginInstallParams::ConstructL( const COpaqueNamedParams& aParams )
       
   213     {
       
   214     iUseSilentMode = GetIntParamL( aParams, KSifInParam_InstallSilently, EFalse );
       
   215     iIsInstallInactive = GetIntParamL( aParams, KSifInParam_InstallInactive, EFalse );
       
   216     iDrive = static_cast<TUint>( GetIntParamL( aParams, KSifInParam_Drive, EDriveC ) );
       
   217     iLanguage = static_cast<TLanguage>( GetIntParamL( aParams, KSifInParam_Languages,
       
   218             ELangNone ) );
       
   219     GetStringParamL( aParams, KSifInParam_OCSPUrl, iOCSPUrl );
       
   220     GetPolicyParamL( aParams, KSifInParam_PerformOCSP, iPerformOCSP, EAllowed );
       
   221     GetPolicyParamL( aParams, KSifInParam_IgnoreOCSPWarnings, iIgnoreOCSPWarnings, EAllowed );
       
   222     GetPolicyParamL( aParams, KSifInParam_AllowUpgrade, iAllowUpgrade, EAllowed );
       
   223     GetPolicyParamL( aParams, KSifInParam_InstallOptionalItems, iInstallOptionalItems, EAllowed );
       
   224     GetPolicyParamL( aParams, KSifInParam_AllowUntrusted, iAllowUntrusted, ENotAllowed );
       
   225     GetPolicyParamL( aParams, KSifInParam_GrantCapabilities, iGrantCapabilities, EAllowed );
       
   226     GetPolicyParamL( aParams, KSifInParam_AllowAppShutdown, iAllowAppShutdown, EAllowed );
       
   227     GetPolicyParamL( aParams, KSifInParam_AllowAppBreakDependency, iAllowAppBreakDependency,
       
   228             EAllowed );
       
   229     GetPolicyParamL( aParams, KSifInParam_AllowOverwrite, iAllowOverwrite, EAllowed );
       
   230     GetPolicyParamL( aParams, KSifInParam_PackageInfo, iPackageInfo, EAllowed );
       
   231     }
       
   232 
       
   233 // ---------------------------------------------------------------------------
       
   234 // CSisxSifPluginInstallParams::ConstructL()
       
   235 // ---------------------------------------------------------------------------
       
   236 //
       
   237 void CSisxSifPluginInstallParams::ConstructL( const CSisxSifPluginInstallParams& aParams )
       
   238     {
       
   239 	iUseSilentMode = aParams.iUseSilentMode;
       
   240 	iIsInstallInactive = aParams.iIsInstallInactive;
       
   241     iDrive = aParams.iDrive;
       
   242     iLanguage = aParams.iLanguage;
       
   243     if( aParams.iOCSPUrl )
       
   244         {
       
   245         iOCSPUrl = aParams.iOCSPUrl->AllocL();
       
   246         }
       
   247     iPerformOCSP = aParams.iPerformOCSP;
       
   248     iIgnoreOCSPWarnings = aParams.iIgnoreOCSPWarnings;
       
   249     iAllowUpgrade = aParams.iAllowUpgrade;
       
   250     iInstallOptionalItems = aParams.iInstallOptionalItems;
       
   251     iAllowUntrusted = aParams.iAllowUntrusted;
       
   252     iGrantCapabilities = aParams.iGrantCapabilities;
       
   253     iAllowAppShutdown = aParams.iAllowAppShutdown;
       
   254     iAllowAppBreakDependency = aParams.iAllowAppBreakDependency;
       
   255     iAllowOverwrite = aParams.iAllowOverwrite;
       
   256     iPackageInfo = aParams.iPackageInfo;
       
   257     }
       
   258 
       
   259 // ---------------------------------------------------------------------------
       
   260 // CSisxSifPluginInstallParams::GetIntParamL()
       
   261 // ---------------------------------------------------------------------------
       
   262 //
       
   263 TInt CSisxSifPluginInstallParams::GetIntParamL( const COpaqueNamedParams& aParams,
       
   264         const TDesC& aParamName, TInt aDefaultValue )
       
   265     {
       
   266     TInt value = aDefaultValue;
       
   267     TBool paramFound = EFalse;
       
   268     TRAPD( err, paramFound = aParams.GetIntByNameL( aParamName, value ) );
       
   269     if( !err && paramFound )
       
   270         {
       
   271         return value;
       
   272         }
       
   273     return aDefaultValue;
       
   274     }
       
   275 
       
   276 // ---------------------------------------------------------------------------
       
   277 // CSisxSifPluginInstallParams::GetPolicyParamL()
       
   278 // ---------------------------------------------------------------------------
       
   279 //
       
   280 void CSisxSifPluginInstallParams::GetPolicyParamL( const COpaqueNamedParams& aParams,
       
   281         const TDesC& aParamName, TSifPolicy& aPolicy, const TSifPolicy& aDefault )
       
   282     {
       
   283     TInt value = aDefault;
       
   284     TBool paramFound = EFalse;
       
   285     TRAPD( err, paramFound = aParams.GetIntByNameL( aParamName, value ) );
       
   286     if( !err && paramFound )
       
   287         {
       
   288         aPolicy = static_cast<TSifPolicy>( value );
       
   289         }
       
   290     }
       
   291 
       
   292 // ---------------------------------------------------------------------------
       
   293 // CSisxSifPluginInstallParams::GetStringParamL()
       
   294 // ---------------------------------------------------------------------------
       
   295 //
       
   296 void CSisxSifPluginInstallParams::GetStringParamL( const COpaqueNamedParams& aParams,
       
   297         const TDesC& aParamName, HBufC*& aBuf )
       
   298     {
       
   299     TPtr value( NULL, 0 );
       
   300     TRAPD( err, value = aParams.StringByNameL( aParamName ) );
       
   301     if( !err && value.Length() )
       
   302         {
       
   303         if( aBuf )
       
   304             {
       
   305             delete aBuf;
       
   306             aBuf = NULL;
       
   307             }
       
   308         aBuf = value.AllocL();
       
   309         }
       
   310     }
       
   311