|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <javadomainpskeys.h> |
|
19 #include "mcsinstallnotifier.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 } |
|
48 |
|
49 |
|
50 void CMcsInstallNotifier::ConstructL() |
|
51 { |
|
52 |
|
53 } |
|
54 |
|
55 |
|
56 void CMcsInstallNotifier::DoCancel() |
|
57 { |
|
58 iProperty.Cancel( ); |
|
59 } |
|
60 |
|
61 |
|
62 void CMcsInstallNotifier::RunL() |
|
63 { |
|
64 SetActive( ); |
|
65 iProperty.Subscribe( iStatus ); |
|
66 TInt status; |
|
67 User::LeaveIfError( iProperty.Get( KUidSystemCategory, |
|
68 iKey, status ) ); |
|
69 |
|
70 if (( iKey == KPSUidJavaLatestInstallation ) || |
|
71 ((status & EInstOpInstall )||(status & EInstOpUninstall )) && |
|
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 |
|
83 return KErrNone; |
|
84 } |