14 * Description: ?Description |
14 * Description: ?Description |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "cainstallnotifier.h" |
18 #include "cainstallnotifier.h" |
19 #include "cainstallstrategy.h" |
19 #include "cadef.h" |
|
20 |
|
21 using namespace Usif; |
20 |
22 |
21 EXPORT_C CCaInstallNotifier* CCaInstallNotifier::NewL( |
23 EXPORT_C CCaInstallNotifier* CCaInstallNotifier::NewL( |
22 MCaInstallListener& aListener, TNotificationType aNotificationType ) |
24 MCaInstallListener& aListener, TNotificationType aNotificationType ) |
23 { |
25 { |
24 CCaInstallNotifier* self = new ( ELeave ) CCaInstallNotifier( aListener ); |
26 CCaInstallNotifier* self = new ( ELeave ) CCaInstallNotifier( aListener ); |
28 return self; |
30 return self; |
29 } |
31 } |
30 |
32 |
31 CCaInstallNotifier::~CCaInstallNotifier() |
33 CCaInstallNotifier::~CCaInstallNotifier() |
32 { |
34 { |
33 Cancel(); |
35 delete iNotifier; |
34 iProperty.Close(); |
|
35 delete iNotifierStrategy; |
|
36 } |
36 } |
37 |
37 |
38 CCaInstallNotifier::CCaInstallNotifier( MCaInstallListener& aListener ) : |
38 CCaInstallNotifier::CCaInstallNotifier( MCaInstallListener& aListener ) : |
39 CActive( EPriorityNormal ), iListener( aListener ) |
39 iListener( aListener ) |
40 { |
40 { |
41 CActiveScheduler::Add( this ); |
41 } |
42 SetActive(); |
|
43 } |
|
44 |
42 |
45 void CCaInstallNotifier::ConstructL( TNotificationType aNotificationType ) |
43 void CCaInstallNotifier::ConstructL( TNotificationType aNotificationType ) |
46 { |
44 { |
47 switch( aNotificationType ) |
45 iNotifier = CSifOperationsNotifier::NewL( *this ); |
48 { |
46 iNotificationType = aNotificationType; |
49 case ESisInstallNotification: |
47 } |
50 iNotifierStrategy = CCaSwiInstallStrategy::NewL( iProperty ); |
|
51 break; |
|
52 case EUsifUninstallNotification: |
|
53 iNotifierStrategy = CCaUsifUninstallStrategy::NewL( iProperty ); |
|
54 break; |
|
55 case EJavaInstallNotification: |
|
56 iNotifierStrategy = CCaJavaInstallStrategy::NewL( iProperty ); |
|
57 break; |
|
58 default: |
|
59 User::Leave( KErrNotSupported ); |
|
60 break; |
|
61 } |
|
62 iProperty.Subscribe( iStatus ); |
|
63 } |
|
64 |
48 |
65 void CCaInstallNotifier::DoCancel() |
49 void CCaInstallNotifier::EndOperationHandler(const CSifOperationEndData& aEndData) |
66 { |
50 { |
67 iProperty.Cancel(); |
51 TRAP_IGNORE |
68 } |
52 ( |
|
53 if( aEndData.ErrorCode() == KErrNone ) |
|
54 { |
|
55 iListener.HandleInstallNotifyL(); |
|
56 } |
|
57 iNotifier->CancelSubscribeL( iKey ); |
|
58 ) |
|
59 } |
69 |
60 |
70 void CCaInstallNotifier::RunL() |
61 void CCaInstallNotifier::ProgressOperationHandler( |
71 { |
62 const CSifOperationProgressData& /*aProgressData*/) |
72 SetActive(); |
63 { |
73 iProperty.Subscribe( iStatus ); |
64 } |
74 iNotifierStrategy->NotifyListenerL( iProperty, iListener ); |
|
75 } |
|
76 |
65 |
77 TInt CCaInstallNotifier::RunError( TInt /*aError*/) |
66 void CCaInstallNotifier::StartOperationHandler( |
78 { |
67 TUint aKey, const CSifOperationStartData& aStartData) |
79 // No need to do anything |
68 { |
80 return KErrNone; |
69 TRAP_IGNORE |
81 } |
70 ( |
82 |
71 if( iNotificationType == EAllTypesNotification ) |
|
72 { |
|
73 iKey = aKey; |
|
74 iNotifier->SubscribeL( aKey, ETrue ); |
|
75 } |
|
76 else if ( iNotificationType == ESisInstallNotification |
|
77 && aStartData.SoftwareType().Compare( |
|
78 KCaAttrAppTypeValueNative ) == KErrNone ) |
|
79 { |
|
80 iKey = aKey; |
|
81 iNotifier->SubscribeL( aKey, ETrue ); |
|
82 } |
|
83 ) |
|
84 } |