--- a/widgets/widgetinstaller/src/WidgetUIOperationsWatcher.cpp Tue Feb 02 00:56:45 2010 +0200
+++ b/widgets/widgetinstaller/src/WidgetUIOperationsWatcher.cpp Fri Mar 19 09:52:28 2010 +0200
@@ -29,7 +29,6 @@
#include <SWInstLogTaskParam.h>
#include <apacmdln.h>
#include <s32mem.h>
-#include <e32property.h>
#include <widgetappdefs.rh>
#include "WidgetUIOperationsWatcher.h"
@@ -61,14 +60,6 @@
// removable memory cards means that drive letters may change.
-static void NotifyCommandHandled()
- {
- const TUid KMyPropertyCat = { 0x10282E5A };
- enum TMyPropertyKeys { EMyPropertyState = 109 };
- TInt state( 3 );
- RProperty::Set( KMyPropertyCat, EMyPropertyState , state );
- }
-
using namespace SwiUI;
// =========================== MEMBER FUNCTIONS ===============================
@@ -215,27 +206,6 @@
if ( PromptUserForInstallL( replaceExisting )
&& PromptUserForUntrustedWidgetL( ) )
{
- if ( replaceExisting )
- {
- //Runnning widget should be first closed
- RApaLsSession apaLsSession;
- apaLsSession.Connect();
- TApaAppInfo info;
- TUid aUid = TUid::Uid( *(iPropertyValues[EUid]) );
-
- User::LeaveIfError( apaLsSession.GetAppInfo( info, aUid ) );
- iWidgetName = info.iFullName;
- HBufC *widgetName = iWidgetName.AllocLC();
- if(iWidgetInHS)
- NotifyCommandHandled();
-
- HandleWidgetCommandL(apaLsSession, *widgetName, aUid, Deactivate);
-
- CleanupStack::PopAndDestroy( widgetName );
- apaLsSession.Close();
- }
-
-
// reinitialize
delete iMembers;
iMembers = NULL;
@@ -477,6 +447,21 @@
found = ETrue;
TUid aUid = TUid::Uid( *(iPropertyValues[EUid]) );
iWidgetInHS = iRegistry.IsWidgetInMiniView( aUid );
+ if ( iRegistry.IsWidgetRunning( aUid ) )
+ {
+ //Runnning widget should be first closed
+ RApaLsSession apaLsSession;
+ apaLsSession.Connect();
+ TApaAppInfo info;
+
+ User::LeaveIfError( apaLsSession.GetAppInfo( info, aUid ) );
+ iWidgetName = info.iFullName;
+ HBufC *widgetName = iWidgetName.AllocLC();
+ HandleWidgetCommandL(apaLsSession, *widgetName, aUid, Deactivate);
+
+ CleanupStack::PopAndDestroy( widgetName );
+ apaLsSession.Close();
+ }
// get original install dir from registry in case user
// decides to "overrite" to another memory location
iOriginalDir = *( iRegistry.GetWidgetPropertyValueL(
@@ -774,6 +759,7 @@
// TODO if registration steps fail does it leave inconsistent state???
+ iRegistry.RegisterWidgetL( iPropertyValues );
iAppManager->RegisterWidgetL( *(iPropertyValues[EMainHTML]),
*(iPropertyValues[EBundleDisplayName]),
@@ -781,14 +767,21 @@
*(iPropertyValues[EDriveName]),
TUid::Uid( *(iPropertyValues[EUid]) ) );
- iRegistry.RegisterWidgetL( iPropertyValues );
-
-
-
if ( iOverwriting )
{
// delete backup
- (void)iFileMgr->RmDir( iBackupDir );
+ (void)iFileMgr->RmDir( iBackupDir );
+ if ( iWidgetInHS )
+ {
+ RApaLsSession apaLsSession;
+ apaLsSession.Connect();
+
+ HBufC* widgetName = iWidgetName.AllocLC();
+ HandleWidgetCommandL(apaLsSession, *widgetName, TUid::Uid( *(iPropertyValues[EUid]) ), WidgetRestart);
+ CleanupStack::PopAndDestroy( widgetName );
+
+ apaLsSession.Close();
+ }
}
if ( !iSilent )
{