ncdengine/provider/deviceinteraction/src/ncdsilentinstallactiveobserver.cpp
branchRCL_3
changeset 65 7333d7932ef7
parent 0 ba25891c3a9e
child 66 8b7f4e561641
--- a/ncdengine/provider/deviceinteraction/src/ncdsilentinstallactiveobserver.cpp	Thu Aug 19 10:02:49 2010 +0300
+++ b/ncdengine/provider/deviceinteraction/src/ncdsilentinstallactiveobserver.cpp	Tue Aug 31 15:21:33 2010 +0300
@@ -19,6 +19,8 @@
 #include "ncdsilentinstallactiveobserver.h"
 #include "ncdasyncsilentinstallobserver.h"
 
+#include <usif/scr/scr.h>
+
 
 CNcdSilentInstallActiveObserver* CNcdSilentInstallActiveObserver::NewL( MNcdAsyncSilentInstallObserver& aObserver )
     {
@@ -49,6 +51,9 @@
 
 void CNcdSilentInstallActiveObserver::ConstructL()
     {
+    
+    iResults = 0;
+    
     CActiveScheduler::Add( this );
     }
 
@@ -60,6 +65,9 @@
     // cancel install operation and closes the silent installer. 
     // If no operation is going on, the installer is already closed. 
     // So, no need to close the silent launcher here separately.
+    
+    delete (iResults);
+
     CancelAsyncOperation();
     }
 
@@ -72,12 +80,13 @@
     // Notice, that we do not call the callback functions of the observer here
     // because we suppose that the observer has started the cancel operation itself
     // or the caller will inform the observer itself.
-    SilentLauncher().CancelAsyncRequest( iCancelCode );
+    
+    SilentLauncher().CancelOperation();
     }
 
 
 void CNcdSilentInstallActiveObserver::StartToObserveL( const TDesC& aFileName,
-                                                       const SwiUI::TInstallOptionsPckg& aSilentInstallOptionsPckg )
+                                                       const Usif::COpaqueNamedParams* aSilentInstallOptions )
     {
     // For silent installation
     // Notice that if the user does not have TrustedUI capabilities
@@ -86,19 +95,22 @@
     // because the launcher will be shown in the application list.
     // So, it would not be nice to connect in the ConstructL and to show
     // the icon in the list all the time.
+    // User::LeaveIfError( SilentLauncher().Connect() );
     User::LeaveIfError( SilentLauncher().Connect() );
     
-    iCancelCode = SwiUI::ERequestSilentInstall;
-    SilentLauncher().SilentInstall( iStatus,
-                                    aFileName,
-                                    aSilentInstallOptionsPckg );
+    if (!iResults)
+        {
+        iResults = Usif::COpaqueNamedParams::NewL();
+        }
+    
+    iInstaller.Install( aFileName, *aSilentInstallOptions, *iResults, iStatus ); 
+        
 
-    SetActive();
     }
 
 
 void CNcdSilentInstallActiveObserver::StartToObserveL( RFile& aFile,
-                                                       const SwiUI::TInstallOptionsPckg& aSilentInstallOptionsPckg )
+                                                       const Usif::COpaqueNamedParams* aSilentInstallOptions )
     {
     // For silent installation
     // Notice that if the user does not have TrustedUI capabilities
@@ -107,13 +119,16 @@
     // because the launcher will be shown in the application list.
     // So, it would not be nice to connect in the ConstructL and to show
     // the icon in the list all the time.
+
     User::LeaveIfError( SilentLauncher().Connect() );
     
-    iCancelCode = SwiUI::ERequestSilentInstallHandle;
-    SilentLauncher().SilentInstall( iStatus,
-                                    aFile,
-                                    aSilentInstallOptionsPckg );
-
+    if (!iResults)
+        {
+        iResults = Usif::COpaqueNamedParams::NewL();
+        }
+    
+    iInstaller.Install( aFile, *aSilentInstallOptions, *iResults, iStatus ); 
+    
     SetActive();
     }
 
@@ -140,6 +155,15 @@
     // Close the installer. 
     // The launcher is shown in the application list.
     // So, it would not be nice to leave it there after operation is completed.
+    
+   
+    TInt ErrCategory = 0;
+    TInt ErrCode = 0;
+    TInt ExtendedErrCode =0;
+    
+    TBool ret = iResults->GetIntByNameL(Usif::KSifOutParam_ErrCategory, ErrCategory);
+    ret = iResults->GetIntByNameL(Usif::KSifOutParam_ErrCode, ErrCode);
+    ret = iResults->GetIntByNameL(Usif::KSifOutParam_ExtendedErrCode, ExtendedErrCode);
     SilentLauncher().Close();
 
     TInt errorCode( ConvertErrorCode( iStatus.Int() ) );
@@ -154,34 +178,15 @@
     return iObserver;
     }
 
-
-SwiUI::RSWInstSilentLauncher& CNcdSilentInstallActiveObserver::SilentLauncher()
+Usif::RSoftwareInstall& CNcdSilentInstallActiveObserver::SilentLauncher()
     {
-    return iSilentLauncher;
+    // return iSilentLauncher;
+    return iInstaller;
     }
 
 
 TInt CNcdSilentInstallActiveObserver::ConvertErrorCode( TInt aErrorCode )
     {
-    switch ( aErrorCode )
-        {
-        case SwiUI::KSWInstErrUserCancel:
-            // To simplify the cancel response and cancel handling,
-            // convert the error code to normal cancel error code.
-            aErrorCode = KErrCancel;
-            break;
-
-        case SwiUI::KSWInstErrInsufficientMemory:
-            // To simplify the insufficient memory response and its handling,
-            // convert the error code to normal no memory code.
-            aErrorCode = KErrNoMemory;
-            break;
-                    
-        default:
-            // Nothing to do here.
-            break;
-        }
-
     return aErrorCode;
     }