appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandlerbase.cpp
changeset 42 d17dc5398051
parent 37 6e7b00453237
child 44 329d304c1aa1
--- a/appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandlerbase.cpp	Thu May 27 12:58:35 2010 +0300
+++ b/appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginuihandlerbase.cpp	Fri Jun 11 13:45:18 2010 +0300
@@ -17,6 +17,7 @@
 
 #include "sisxsifpluginuihandlerbase.h"     // CSisxSifPluginUiHandlerBase
 #include "sisxsifplugininstallparams.h"     // CSisxSifPluginInstallParams
+#include "sisxsifcleanuputils.h"            // CleanupResetAndDestroyPushL
 
 using namespace Usif;
 
@@ -38,6 +39,8 @@
 CSisxSifPluginUiHandlerBase::~CSisxSifPluginUiHandlerBase()
     {
     delete iInstallParams;
+    delete iGlobalComponentId;
+    delete iPublishSifOperationInfo;
     }
 
 // ---------------------------------------------------------------------------
@@ -73,3 +76,73 @@
     iIsDriveSelectionRequired = aIsRequired;
     }
 
+// ---------------------------------------------------------------------------
+// CSisxSifPluginUiHandlerBase::PublishStartL()
+// ---------------------------------------------------------------------------
+//
+void CSisxSifPluginUiHandlerBase::PublishStartL( const CComponentInfo::CNode& aRootNode )
+    {
+    RPointerArray<HBufC> appNames;
+    CleanupResetAndDestroyPushL( appNames );
+    RPointerArray<HBufC> appIcons;
+    CleanupResetAndDestroyPushL( appIcons );
+
+    const RPointerArray<CComponentInfo::CApplicationInfo>& apps = aRootNode.Applications();
+    for( TInt index = 0; index < apps.Count(); ++index )
+        {
+        HBufC* name = apps[ index ]->Name().AllocLC();
+        appNames.AppendL( name );
+        CleanupStack::Pop( name );
+        HBufC* icon = apps[ index ]->IconFileName().AllocLC();
+        appIcons.AppendL( icon );
+        CleanupStack::Pop( icon );
+        }
+
+    if( iGlobalComponentId )
+        {
+        delete iGlobalComponentId;
+        iGlobalComponentId = NULL;
+        }
+    iGlobalComponentId = aRootNode.GlobalComponentId().AllocL();
+
+    CSifOperationStartData* data = CSifOperationStartData::NewLC( *iGlobalComponentId,
+            aRootNode.ComponentName(), appNames, appIcons, aRootNode.MaxInstalledSize(),
+            KNullDesC, KNullDesC, aRootNode.SoftwareTypeName() );
+
+    if( !iPublishSifOperationInfo )
+        {
+        iPublishSifOperationInfo = CPublishSifOperationInfo::NewL();
+        }
+    iPublishSifOperationInfo->PublishStartL( *data );
+
+    CleanupStack::PopAndDestroy( 3, &appNames );    // data, appIcons, appNames
+    }
+
+// ---------------------------------------------------------------------------
+// CSisxSifPluginUiHandlerBase::PublishProgressL()
+// ---------------------------------------------------------------------------
+//
+void CSisxSifPluginUiHandlerBase::PublishProgressL( TSifOperationPhase aPhase,
+        TSifOperationSubPhase aSubPhase, TInt aCurrentProgress, TInt aTotal )
+    {
+    User::LeaveIfNull( iPublishSifOperationInfo );
+    CSifOperationProgressData* data = CSifOperationProgressData::NewLC( *iGlobalComponentId,
+            aPhase, aSubPhase, aCurrentProgress, aTotal );
+    iPublishSifOperationInfo->PublishProgressL( *data );
+    CleanupStack::PopAndDestroy( data );
+    }
+
+// ---------------------------------------------------------------------------
+// CSisxSifPluginUiHandlerBase::PublishCompletionL()
+// ---------------------------------------------------------------------------
+//
+void CSisxSifPluginUiHandlerBase::PublishCompletionL( TErrorCategory aErrorCategory,
+        TInt aErrorCode, const TDesC& aErrorMessage, const TDesC& aErrorDetails )
+    {
+    User::LeaveIfNull( iPublishSifOperationInfo );
+    CSifOperationEndData* data = CSifOperationEndData::NewLC( *iGlobalComponentId,
+            aErrorCategory, aErrorCode, aErrorMessage, aErrorDetails );
+    iPublishSifOperationInfo->PublishCompletionL( *data );
+    CleanupStack::PopAndDestroy( data );
+    }
+