|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __APGNOTIF_H__ |
|
17 #define __APGNOTIF_H__ |
|
18 |
|
19 #include <apgcli.h> |
|
20 |
|
21 |
|
22 class MApaAppListServObserver |
|
23 /** |
|
24 MApaAppListServObserver is interface to get application list change notifications. |
|
25 |
|
26 @publishedPartner |
|
27 @released |
|
28 */ |
|
29 { |
|
30 public: |
|
31 enum TApaAppListEvent |
|
32 { |
|
33 EAppListChanged=1 |
|
34 }; |
|
35 virtual void HandleAppListEvent(TInt aEvent)=0; |
|
36 protected: |
|
37 IMPORT_C MApaAppListServObserver(); |
|
38 private: |
|
39 IMPORT_C virtual void MApaAppListServObserver_Reserved1(); |
|
40 IMPORT_C virtual void MApaAppListServObserver_Reserved2(); |
|
41 private: |
|
42 TInt iMApaAppListServObserver_Reserved1; |
|
43 }; |
|
44 |
|
45 |
|
46 class CApaAppListNotifier : public CActive |
|
47 /** |
|
48 * CApaAppListNotifier is an active object which notifies the client when an application list is changed. |
|
49 * Provides notification when applications are added, deleted or if the localisable data of an application |
|
50 * is modified. |
|
51 * |
|
52 * Clients can create instance of this class using NewL function which takes MApaAppListServObserver |
|
53 * observer as one of the parameters. When application list is changed, CApaAppListNotifier will call |
|
54 * HandleAppListEvent function of the provided observer. |
|
55 * |
|
56 * |
|
57 * Example: |
|
58 * |
|
59 * //Implementation of observer interface |
|
60 * class CAppListChangeObserver:public CBase, public MApaAppListServObserver |
|
61 * { |
|
62 * public: |
|
63 * void HandleAppListEvent(TInt aEvent); |
|
64 * CApaAppListNotifier* iNotifier; |
|
65 * }; |
|
66 * |
|
67 * //This function is called by CApaAppListNotifier when an application list is changed |
|
68 * void CAppListChangeObserver::HandleAppListEvent(TInt aEvent) |
|
69 * { |
|
70 * //Handle application list change event |
|
71 * ... |
|
72 * } |
|
73 * |
|
74 * |
|
75 * TInt E32Main() |
|
76 * { |
|
77 * .... |
|
78 * |
|
79 * CAppListChangeObserver* obs=new(ELeave) CAppListChangeObserver(); |
|
80 * CApaAppListNotifier *notif=CApaAppListNotifier::NewL(obs, CActive::EPriorityStandard); |
|
81 * |
|
82 * .... |
|
83 * } |
|
84 * |
|
85 * |
|
86 |
|
87 @publishedPartner |
|
88 @released */ |
|
89 { |
|
90 public: |
|
91 IMPORT_C ~CApaAppListNotifier(); |
|
92 IMPORT_C static CApaAppListNotifier* NewL(MApaAppListServObserver* aObserver, TPriority aPriority); |
|
93 private: // from CActive |
|
94 void DoCancel(); |
|
95 void RunL(); |
|
96 TInt RunError(TInt aError); |
|
97 private: |
|
98 CApaAppListNotifier(MApaAppListServObserver& aObserver, TPriority aPriority); |
|
99 void ConstructL(); |
|
100 private: |
|
101 MApaAppListServObserver& iObserver; |
|
102 RApaLsSession iLsSession; |
|
103 }; |
|
104 |
|
105 #endif |