|
1 /* |
|
2 * Copyright (c) 2008 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cainstallnotifier.h" |
|
19 |
|
20 EXPORT_C CCaInstallNotifier* CCaInstallNotifier::NewL( |
|
21 MCaInstallListener& aListener, TNotificationType aNotificationType ) |
|
22 { |
|
23 CCaInstallNotifier* self = new ( ELeave ) CCaInstallNotifier( |
|
24 aListener, aNotificationType ); |
|
25 CleanupStack::PushL( self ); |
|
26 self->ConstructL(); |
|
27 CleanupStack::Pop( self ); |
|
28 return self; |
|
29 } |
|
30 |
|
31 CCaInstallNotifier::~CCaInstallNotifier() |
|
32 { |
|
33 Cancel(); |
|
34 iProperty.Close(); |
|
35 } |
|
36 |
|
37 CCaInstallNotifier::CCaInstallNotifier( MCaInstallListener& aListener, |
|
38 TNotificationType aNotificationType ) : |
|
39 CActive( EPriorityNormal ), iListener( aListener ) |
|
40 { |
|
41 iRPropertyKey = aNotificationType; |
|
42 iProperty.Attach( KUidSystemCategory, iRPropertyKey ); |
|
43 CActiveScheduler::Add( this ); |
|
44 iProperty.Subscribe( iStatus ); |
|
45 SetActive(); |
|
46 } |
|
47 |
|
48 void CCaInstallNotifier::ConstructL() |
|
49 { |
|
50 } |
|
51 |
|
52 void CCaInstallNotifier::DoCancel() |
|
53 { |
|
54 iProperty.Cancel(); |
|
55 } |
|
56 |
|
57 void CCaInstallNotifier::RunL() |
|
58 { |
|
59 SetActive(); |
|
60 iProperty.Subscribe( iStatus ); |
|
61 TInt appUid; |
|
62 User::LeaveIfError( iProperty.Get( KUidSystemCategory, iRPropertyKey, |
|
63 appUid ) ); |
|
64 if( appUid ) |
|
65 { |
|
66 iListener.HandleInstallNotifyL( appUid ); |
|
67 } |
|
68 } |
|
69 |
|
70 TInt CCaInstallNotifier::RunError( TInt /*aError*/) |
|
71 { |
|
72 // No need to do anything |
|
73 return KErrNone; |
|
74 } |