iaupdate/IAD/engine/controller/src/iaupdateutils.cpp
changeset 52 92f864ef0288
parent 33 8110bf1194d1
child 53 ae54820ef82c
--- a/iaupdate/IAD/engine/controller/src/iaupdateutils.cpp	Fri Jun 11 13:45:18 2010 +0300
+++ b/iaupdate/IAD/engine/controller/src/iaupdateutils.cpp	Wed Jun 23 18:20:02 2010 +0300
@@ -39,7 +39,8 @@
 #include <ncdpurchaseoption.h>
 
 #include <catalogsutils.h>
-#include <WidgetRegistryClient.h>
+//#include <WidgetRegistryClient.h>
+#include <usif/scr/scr.h>
 
 //Constants
 const TText KVersionSeparator( '.' );
@@ -303,6 +304,47 @@
 
 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() );
@@ -339,6 +381,7 @@
     CleanupStack::PopAndDestroy( &widgetInfoArr );
     CleanupStack::PopAndDestroy( &widgetRegistry);
     return EFalse;
+    */
       
      
     }
@@ -461,7 +504,57 @@
     return exeFound;
     }
 
+// ---------------------------------------------------------------------------
+// IAUpdateUtils::UsifSilentInstallOptionsL
+// 
+// ---------------------------------------------------------------------------
 
+EXPORT_C void  IAUpdateUtils::UsifSilentInstallOptionsL( 
+        Usif::COpaqueNamedParams * aOptions )
+    {
+
+    aOptions->AddIntL( Usif::KSifInParam_InstallSilently, ETrue );
+
+    // Upgrades are allowed 
+    aOptions->AddIntL( Usif::KSifInParam_AllowUpgrade, ETrue );
+    
+    // Install all if optional packets exist.
+    aOptions->AddIntL( Usif::KSifInParam_InstallOptionalItems, ETrue );
+    
+    // Prevent online cert revocation check.
+    aOptions->AddIntL( Usif::KSifInParam_PerformOCSP, EFalse );
+    
+    // See iOCSP setting above
+    aOptions->AddIntL( Usif::KSifInParam_IgnoreOCSPWarnings, ETrue );
+    
+    // Do not allow installation of uncertified packages.
+    aOptions->AddIntL( Usif::KSifInParam_AllowUntrusted, EFalse );
+    
+    // If filetexts are included in SIS package, show them.
+    aOptions->AddIntL( Usif::KSifInParam_PackageInfo, ETrue );
+    
+    // Automatically grant user capabilities.
+    // See also KSifInParam_AllowUntrusted above.
+    aOptions->AddIntL( Usif::KSifInParam_GrantCapabilities, EFalse );
+    
+    // Open application will be closed.
+    aOptions->AddIntL( Usif::KSifInParam_AllowAppShutdown, ETrue );
+    
+    // Files can be overwritten.
+    aOptions->AddIntL( Usif::KSifInParam_AllowOverwrite, ETrue );
+    
+    // This only affects Java applications.
+    aOptions->AddIntL( Usif::KSifInParam_AllowDownload, ETrue );
+    
+    // Where to save.
+    aOptions->AddIntL( Usif::KSifInParam_Drive, EDriveC );
+    
+    // Choose the phone language.
+    TLanguage lang = User::Language();
+    // aOptions->AddIntL( Usif::KSifInParam_Languages, lang ); // User::Language() );
+    
+    //aOptions->AddIntL( Usif::KSifInParam_Drive, IAUpdateUtils::DriveToInstallL( aUid, aSize ) );
+    }
 // ---------------------------------------------------------------------------
 // IAUpdateUtils::SilentInstallOptionsL
 // 
@@ -653,6 +746,11 @@
                                            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 );
@@ -674,6 +772,8 @@
             IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() Physically removable drive not present, install to C:");
             }
         }
+    */
+    
     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::InstalledDriveWidgetL() begin");
     }
 
@@ -762,7 +862,12 @@
     {
     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() );
@@ -796,8 +901,11 @@
         
     CleanupStack::PopAndDestroy( &widgetInfoArr );
     CleanupStack::PopAndDestroy( &widgetRegistry);
+    */
     IAUPDATE_TRACE("[IAUPDATE] IAUpdateUtils::DriveToInstallWidgetL() end");
+
     return targetDriveUnit;
+
     }