diff -r a5a39a295112 -r 8baec10861af menucontentsrv/srvsrc/mcsinstallnotifier.cpp --- a/menucontentsrv/srvsrc/mcsinstallnotifier.cpp Wed Sep 01 12:22:09 2010 +0100 +++ b/menucontentsrv/srvsrc/mcsinstallnotifier.cpp Tue Sep 14 21:55:16 2010 +0300 @@ -17,68 +17,67 @@ #include #include "mcsinstallnotifier.h" -#include - -CMcsInstallNotifier* CMcsInstallNotifier::NewL(MMcsInstallListener& aListener, TInt aKey) - { - CMcsInstallNotifier* self = new (ELeave) CMcsInstallNotifier( aListener, aKey ); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - - return self; - } - -CMcsInstallNotifier::~CMcsInstallNotifier() - { - Cancel( ); - iProperty.Close( ); - } - -CMcsInstallNotifier::CMcsInstallNotifier( MMcsInstallListener& aListener, TInt aKey ) : - CActive(EPriorityNormal), iListener(aListener) - { - iKey = aKey; - // Prepare automatically - iProperty.Attach( KUidSystemCategory, iKey ); - CActiveScheduler::Add( this ); - iProperty.Subscribe( iStatus ); - SetActive( ); - } +#include "mcsinstallstrategy.h" -void CMcsInstallNotifier::ConstructL() - { +CMcsInstallNotifier* CMcsInstallNotifier::NewL( + MMcsInstallListener& aListener, TNotificationType aNotificationType ) + { + CMcsInstallNotifier* self = new ( ELeave ) CMcsInstallNotifier( aListener ); + CleanupStack::PushL( self ); + self->ConstructL( aNotificationType ); + CleanupStack::Pop( self ); + return self; + } + +CMcsInstallNotifier::~CMcsInstallNotifier() + { + Cancel(); + iProperty.Close(); + delete iNotifierStrategy; + } - } +CMcsInstallNotifier::CMcsInstallNotifier( MMcsInstallListener& aListener ) : + CActive( EPriorityNormal ), iListener( aListener ) + { + CActiveScheduler::Add( this ); + SetActive(); + } +void CMcsInstallNotifier::ConstructL( TNotificationType aNotificationType ) + { + switch( aNotificationType ) + { + case ESisInstallNotification: + iNotifierStrategy = CMcsSwiInstallStrategy::NewL( + iProperty, iListener ); + break; + case EJavaInstallNotification: + iNotifierStrategy = CMcsJavaInstallStrategy::NewL( + iProperty, iListener ); + break; + default: + User::Leave( KErrNotSupported ); + break; + } + iProperty.Subscribe( iStatus ); + } void CMcsInstallNotifier::DoCancel() - { - iProperty.Cancel( ); - } - + { + iProperty.Cancel(); + } void CMcsInstallNotifier::RunL() - { - SetActive( ); - iProperty.Subscribe( iStatus ); - TInt status; - User::LeaveIfError( iProperty.Get( KUidSystemCategory, - iKey, status ) ); + { + SetActive(); + iProperty.Subscribe( iStatus ); + iNotifierStrategy->NotifyListenerL(); + } - if (( iKey == KPSUidJavaLatestInstallation ) || - ((status & EInstOpInstall )||(status & EInstOpUninstall )) && - (status & EInstOpStatusSuccess) ) - { - iListener.HandleInstallNotifyL(status); - } +TInt CMcsInstallNotifier::RunError( TInt /*aError*/) + { + // No need to do anything + return KErrNone; + } - } - - -TInt CMcsInstallNotifier::RunError( TInt /*aError*/ ) - { - // No need to do anything - return KErrNone; - }