iaupdate/IAD/engine/controller/src/iaupdateutils.cpp
branchRCL_3
changeset 66 8b7f4e561641
parent 65 7333d7932ef7
child 70 e8965914fac7
--- a/iaupdate/IAD/engine/controller/src/iaupdateutils.cpp	Tue Aug 31 15:21:33 2010 +0300
+++ b/iaupdate/IAD/engine/controller/src/iaupdateutils.cpp	Wed Sep 01 12:22:02 2010 +0100
@@ -39,8 +39,7 @@
 #include <ncdpurchaseoption.h>
 
 #include <catalogsutils.h>
-//#include <WidgetRegistryClient.h>
-#include <usif/scr/scr.h>
+#include <widgetregistryclient.h>
 
 //Constants
 const TText KVersionSeparator( '.' );
@@ -304,47 +303,6 @@
 
 EXPORT_C TBool IAUpdateUtils::IsWidgetInstalledL(const TDesC& aIdentifier, TIAUpdateVersion& aVersion )
     {
-    
-    TBool retVal = EFalse;
-    
-    // Connect to registry
-    Usif::RSoftwareComponentRegistry scrSession;  
-    CleanupClosePushL( scrSession );
-    User::LeaveIfError( scrSession.Connect());
-       
-    // // Get widget component id by identifier
-    Usif::TComponentId compId = 0;
-    TRAPD( err, compId = 
-           scrSession.GetComponentIdL( aIdentifier, Usif::KSoftwareTypeWidget ));
-    
-    if ( err == KErrNotFound )
-        {
-        retVal = EFalse;
-        }
-    else if  (err != KErrNone )
-        {
-        User::Leave( err );
-        }
-    else
-        {
-        // Widget found
-        retVal = ETrue;
-        
-        // Get entry 
-        Usif::CComponentEntry* entry = Usif::CComponentEntry::NewLC();
-        retVal = scrSession.GetComponentL(compId, *entry);
-        
-        // Convert version
-        DesToVersionL ( entry->Version(), aVersion.iMajor, aVersion.iMinor, aVersion.iBuild  );
-    
-        CleanupStack::PopAndDestroy(entry);
-        }
-    
-    CleanupStack::PopAndDestroy( &scrSession ); 
-    
-    return retVal;
-    
-    /*
     RWidgetRegistryClientSession widgetRegistry;
 
     User::LeaveIfError( widgetRegistry.Connect() );
@@ -381,7 +339,6 @@
     CleanupStack::PopAndDestroy( &widgetInfoArr );
     CleanupStack::PopAndDestroy( &widgetRegistry);
     return EFalse;
-    */
       
      
     }
@@ -504,60 +461,79 @@
     return exeFound;
     }
 
+
 // ---------------------------------------------------------------------------
-// IAUpdateUtils::UsifSilentInstallOptionsL
+// IAUpdateUtils::SilentInstallOptionsL
 // 
 // ---------------------------------------------------------------------------
-
-void  IAUpdateUtils::UsifSilentInstallOptionsL( 
-        Usif::COpaqueNamedParams * aOptions )
+//
+SwiUI::TInstallOptions IAUpdateUtils::SilentInstallOptionsL(
+    const CIAUpdateBaseNode& aNode )
     {
-
-    aOptions->AddIntL( Usif::KSifInParam_InstallSilently, ETrue );
+    IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() begin");
+    SwiUI::TInstallOptions options;
 
-    // Upgrades are allowed 
-    aOptions->AddIntL( Usif::KSifInParam_AllowUpgrade, Usif::EAllowed );
-    
+    // Upgrades are allowed        
+    options.iUpgrade = SwiUI::EPolicyAllowed;
+
     // Install all if optional packets exist.
-    aOptions->AddIntL( Usif::KSifInParam_InstallOptionalItems, Usif::EAllowed );
-    
+    options.iOptionalItems = SwiUI::EPolicyAllowed;
+
     // Prevent online cert revocation check.
-    aOptions->AddIntL( Usif::KSifInParam_PerformOCSP, Usif::ENotAllowed );
+    options.iOCSP = SwiUI::EPolicyNotAllowed;
     
     // See iOCSP setting above
-    aOptions->AddIntL( Usif::KSifInParam_IgnoreOCSPWarnings, Usif::EAllowed );
-    
+    options.iIgnoreOCSPWarnings = SwiUI::EPolicyAllowed;
+
     // Do not allow installation of uncertified packages.
-    aOptions->AddIntL( Usif::KSifInParam_AllowUntrusted, Usif::ENotAllowed );
-    
-    // If filetexts are included in SIS package, show them.
-    aOptions->AddIntL( Usif::KSifInParam_PackageInfo, Usif::EAllowed );
+    options.iUntrusted = SwiUI::EPolicyNotAllowed;
+
+    // If filetexts are included in SIS package. Then, show them.
+    options.iPackageInfo = SwiUI::EPolicyUserConfirm;
     
     // Automatically grant user capabilities.
-    // See also KSifInParam_AllowUntrusted above.
-    aOptions->AddIntL( Usif::KSifInParam_GrantCapabilities, Usif::EAllowed );
-    
+    // See also iUntrusted above.
+    options.iCapabilities = SwiUI::EPolicyAllowed;
+
     // Open application will be closed.
-    aOptions->AddIntL( Usif::KSifInParam_AllowAppShutdown, Usif::EAllowed );
+    options.iKillApp = SwiUI::EPolicyAllowed;
     
     // Files can be overwritten.
-    aOptions->AddIntL( Usif::KSifInParam_AllowOverwrite, Usif::EAllowed  );
-    
-    // Incompatible allowed
-    aOptions->AddIntL( Usif::KSifInParam_AllowIncompatible, Usif::EAllowed  );
+    options.iOverwrite = SwiUI::EPolicyAllowed;
     
     // This only affects Java applications.
-    aOptions->AddIntL( Usif::KSifInParam_AllowDownload, Usif::EAllowed  );
+    options.iDownload = SwiUI::EPolicyAllowed;
     
     // Where to save.
-    //aOptions->AddIntL( Usif::KSifInParam_Drive, EDriveC );
+    IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() before DriveToInstallL");
+    TDriveUnit driveUnit;
+    if ( aNode.Mime().Compare( IAUpdateProtocolConsts::KMimeWidget ) == 0 )
+        {
+        driveUnit = IAUpdateUtils::DriveToInstallWidgetL( aNode.Identifier() );
+        }
+    else
+        {
+        driveUnit = IAUpdateUtils::DriveToInstallL( aNode.Uid(), aNode.OwnContentSizeL() );
+        }
+     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() after DriveToInstallL");
+    
+    TDriveName driveName = driveUnit.Name();
+    IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() driveName: %S", &driveName );
+    options.iDrive = driveName[0];
     
     // Choose the phone language.
-    TLanguage lang = User::Language();
-    //aOptions->AddIntL( Usif::KSifInParam_Languages, lang ); // User::Language() );
+    options.iLang = User::Language();
+    
+    // If language is asked, then use the current phone language.
+    options.iUsePhoneLang = ETrue;
     
-    //aOptions->AddIntL( Usif::KSifInParam_Drive, IAUpdateUtils::DriveToInstallL( aUid, aSize ) );
+    // Does not affect SISX. This is for Java.
+    options.iUpgradeData = SwiUI::EPolicyAllowed;
+    IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::SilentInstallOptionsL() end");
+    return options;
     }
+
+
 // -----------------------------------------------------------------------------
 // IAUpdateUtils::InstalledDriveL
 // 
@@ -677,11 +653,6 @@
                                            TDriveUnit& aLocationDrive )
     {
     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin");
-    aLocationDrive = EDriveC;
-    
-    //HLa: Widget registry remove
-    
-    /*
     TFileName widgetPath;
     aWidgetRegistry.GetWidgetPath( aUid, widgetPath );
     aLocationDrive = widgetPath.Mid( 0, 2 );
@@ -703,8 +674,6 @@
             IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Physically removable drive not present, install to C:");
             }
         }
-    */
-    
     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin");
     }
 
@@ -793,12 +762,7 @@
     {
     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() begin");
     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() identifier: %S", &aIdentifier );
-    
-
     TDriveUnit targetDriveUnit( EDriveC );
-    
-    //HLa: Widget registry remove
-    /*
     RWidgetRegistryClientSession widgetRegistry;
 
     User::LeaveIfError( widgetRegistry.Connect() );
@@ -832,11 +796,8 @@
         
     CleanupStack::PopAndDestroy( &widgetInfoArr );
     CleanupStack::PopAndDestroy( &widgetRegistry);
-    */
     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() end");
-
     return targetDriveUnit;
-
     }