appinstaller/AppinstUi/sisxsifplugin/tsrc/testinstaller/activerunner_symbian.cpp
changeset 29 26b6f0522fd8
parent 25 98b66e4fb0be
child 42 d17dc5398051
--- a/appinstaller/AppinstUi/sisxsifplugin/tsrc/testinstaller/activerunner_symbian.cpp	Fri Apr 16 15:05:20 2010 +0300
+++ b/appinstaller/AppinstUi/sisxsifplugin/tsrc/testinstaller/activerunner_symbian.cpp	Mon May 03 12:38:03 2010 +0300
@@ -21,12 +21,12 @@
 
 ActiveRunnerPrivate::ActiveRunnerPrivate(ActiveRunner *aRunner) :
         CActive( CActive::EPriorityStandard ), q_ptr( aRunner )
-{
+    {
     CActiveScheduler::Add(this);
-}
+    }
 
 ActiveRunnerPrivate::~ActiveRunnerPrivate()
-{
+    {
     Cancel();
     if( iUseSif )
         {
@@ -39,10 +39,10 @@
     delete iFileName;
     delete iArguments;
     delete iResults;
-}
+    }
 
 TInt ActiveRunnerPrivate::Initialize( bool aUseSif )
-{
+    {
     iUseSif = aUseSif;
     TInt ret = KErrNone;
     if( iUseSif )
@@ -54,16 +54,28 @@
         ret = iSWInstLauncher.Connect();
         }
     return ret;
-}
+    }
 
 TInt ActiveRunnerPrivate::Install( const QString& aFileName, bool aSilent )
-{
+    {
     TRAPD( err, DoInstallL( aFileName, aSilent ) );
     return err;
-}
+    }
+
+TInt ActiveRunnerPrivate::Remove( const Usif::TComponentId& aComponentId, bool aSilent )
+    {
+    TRAPD( err, DoRemoveL( aComponentId, aSilent ) );
+    return err;
+    }
+
+TInt ActiveRunnerPrivate::Remove( const TUid& aUid, const TDesC8& aMime, bool aSilent )
+    {
+    TRAPD( err, DoRemoveL( aUid, aMime, aSilent ) );
+    return err;
+    }
 
 void ActiveRunnerPrivate::DoCancel()
-{
+    {
     if( iUseSif )
         {
         iSoftwareInstall.CancelOperation();
@@ -72,26 +84,28 @@
         {
         iSWInstLauncher.CancelAsyncRequest( SwiUI::ERequestInstall );
         }
-}
+    }
 
 void ActiveRunnerPrivate::RunL()
-{
+    {
     User::LeaveIfError( iStatus.Int() );
 
     RDebug::Printf( "USIFTestInstaller: Installation completed" );
-    if( q_ptr ) {
+    if( q_ptr )
+        {
         q_ptr->handleCompletion();
+        }
     }
-}
 
 TInt ActiveRunnerPrivate::RunError( TInt aError )
-{
+    {
     RDebug::Printf( "USIFTestInstaller: Error %d", aError );
-    if( q_ptr ) {
+    if( q_ptr )
+        {
         q_ptr->handleError( aError );
-    }
+        }
     return KErrNone;
-}
+    }
 
 void ActiveRunnerPrivate::DoInstallL( const QString& aFileName, bool aSilent )
     {
@@ -151,3 +165,40 @@
     SetActive();
     }
 
+void ActiveRunnerPrivate::DoRemoveL( const Usif::TComponentId& aComponentId, bool aSilent )
+    {
+    if( aSilent )
+        {
+        delete iArguments;
+        iArguments = NULL;
+        iArguments = Usif::COpaqueNamedParams::NewL();
+        iArguments->AddIntL( Usif::KSifInParam_InstallSilently, 1 );
+
+        delete iResults;
+        iResults = NULL;
+        iResults = Usif::COpaqueNamedParams::NewL();
+
+        iSoftwareInstall.Uninstall( aComponentId, *iArguments, *iResults, iStatus );
+        }
+    else
+        {
+        iSoftwareInstall.Uninstall( aComponentId, iStatus );
+        }
+    SetActive();
+    }
+
+void ActiveRunnerPrivate::DoRemoveL( const TUid& aUid, const TDesC8& aMime, bool aSilent )
+    {
+    if( aSilent )
+        {
+        SwiUI::TUninstallOptions defaultOptions;
+        SwiUI::TUninstallOptionsPckg optPckg( defaultOptions );
+        iSWInstLauncher.SilentUninstall( iStatus, aUid, optPckg, aMime );
+        }
+    else
+        {
+        iSWInstLauncher.Uninstall( iStatus, aUid, aMime );
+        }
+    SetActive();
+    }
+