15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <javadomainpskeys.h> |
18 #include <javadomainpskeys.h> |
19 #include "mcsinstallnotifier.h" |
19 #include "mcsinstallnotifier.h" |
20 #include "mcsinstallstrategy.h" |
20 #include <sacls.h> |
|
21 |
|
22 CMcsInstallNotifier* CMcsInstallNotifier::NewL(MMcsInstallListener& aListener, TInt aKey) |
|
23 { |
|
24 CMcsInstallNotifier* self = new (ELeave) CMcsInstallNotifier( aListener, aKey ); |
|
25 CleanupStack::PushL( self ); |
|
26 self->ConstructL( ); |
|
27 CleanupStack::Pop( self ); |
|
28 |
|
29 return self; |
|
30 } |
|
31 |
|
32 CMcsInstallNotifier::~CMcsInstallNotifier() |
|
33 { |
|
34 Cancel( ); |
|
35 iProperty.Close( ); |
|
36 } |
|
37 |
|
38 CMcsInstallNotifier::CMcsInstallNotifier( MMcsInstallListener& aListener, TInt aKey ) : |
|
39 CActive(EPriorityNormal), iListener(aListener) |
|
40 { |
|
41 iKey = aKey; |
|
42 // Prepare automatically |
|
43 iProperty.Attach( KUidSystemCategory, iKey ); |
|
44 CActiveScheduler::Add( this ); |
|
45 iProperty.Subscribe( iStatus ); |
|
46 SetActive( ); |
|
47 } |
21 |
48 |
22 |
49 |
23 CMcsInstallNotifier* CMcsInstallNotifier::NewL( |
50 void CMcsInstallNotifier::ConstructL() |
24 MMcsInstallListener& aListener, TNotificationType aNotificationType ) |
51 { |
25 { |
|
26 CMcsInstallNotifier* self = new ( ELeave ) CMcsInstallNotifier( aListener ); |
|
27 CleanupStack::PushL( self ); |
|
28 self->ConstructL( aNotificationType ); |
|
29 CleanupStack::Pop( self ); |
|
30 return self; |
|
31 } |
|
32 |
52 |
33 CMcsInstallNotifier::~CMcsInstallNotifier() |
53 } |
34 { |
|
35 Cancel(); |
|
36 iProperty.Close(); |
|
37 delete iNotifierStrategy; |
|
38 } |
|
39 |
54 |
40 CMcsInstallNotifier::CMcsInstallNotifier( MMcsInstallListener& aListener ) : |
|
41 CActive( EPriorityNormal ), iListener( aListener ) |
|
42 { |
|
43 CActiveScheduler::Add( this ); |
|
44 SetActive(); |
|
45 } |
|
46 |
|
47 void CMcsInstallNotifier::ConstructL( TNotificationType aNotificationType ) |
|
48 { |
|
49 switch( aNotificationType ) |
|
50 { |
|
51 case ESisInstallNotification: |
|
52 iNotifierStrategy = CMcsSwiInstallStrategy::NewL( |
|
53 iProperty, iListener ); |
|
54 break; |
|
55 case EJavaInstallNotification: |
|
56 iNotifierStrategy = CMcsJavaInstallStrategy::NewL( |
|
57 iProperty, iListener ); |
|
58 break; |
|
59 default: |
|
60 User::Leave( KErrNotSupported ); |
|
61 break; |
|
62 } |
|
63 iProperty.Subscribe( iStatus ); |
|
64 } |
|
65 |
55 |
66 void CMcsInstallNotifier::DoCancel() |
56 void CMcsInstallNotifier::DoCancel() |
67 { |
57 { |
68 iProperty.Cancel(); |
58 iProperty.Cancel( ); |
69 } |
59 } |
|
60 |
70 |
61 |
71 void CMcsInstallNotifier::RunL() |
62 void CMcsInstallNotifier::RunL() |
72 { |
63 { |
73 SetActive(); |
64 SetActive( ); |
74 iProperty.Subscribe( iStatus ); |
65 iProperty.Subscribe( iStatus ); |
75 iNotifierStrategy->NotifyListenerL(); |
66 TInt status; |
76 } |
67 User::LeaveIfError( iProperty.Get( KUidSystemCategory, |
|
68 iKey, status ) ); |
77 |
69 |
78 TInt CMcsInstallNotifier::RunError( TInt /*aError*/) |
70 if (( iKey == KPSUidJavaLatestInstallation ) || |
79 { |
71 ((status & EInstOpInstall )||(status & EInstOpUninstall )) && |
80 // No need to do anything |
72 (status & EInstOpStatusSuccess) ) |
|
73 { |
|
74 iListener.HandleInstallNotifyL(status); |
|
75 } |
|
76 |
|
77 } |
|
78 |
|
79 |
|
80 TInt CMcsInstallNotifier::RunError( TInt /*aError*/ ) |
|
81 { |
|
82 // No need to do anything |
81 return KErrNone; |
83 return KErrNone; |
82 } |
84 } |
83 |
|