|
1 /* |
|
2 * Copyright (c) 2004 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: Central repository key change observer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CIMPSCENREPOBSERVER_H |
|
21 #define CIMPSCENREPOBSERVER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> // CActive |
|
25 #include <centralrepository.h> // Cenrep |
|
26 |
|
27 #include "MIMPSPropertyNotificationObserver.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MIMPSPropertyNotificationObserver; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Implementation of the Publish & Subscribe property change observer |
|
36 * |
|
37 * @lib MGXMediaFileAPI.lib |
|
38 * @since 2.6 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CIMPSCenrepObserver ) : public CActive |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 * @param aObserver Observer to be informed when observed property changes |
|
47 */ |
|
48 static CIMPSCenrepObserver* NewL( MIMPSPropertyNotificationObserver& aObserver ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~CIMPSCenrepObserver(); |
|
54 |
|
55 public: // New functions |
|
56 |
|
57 /** |
|
58 * Starts observing the given key for any changes |
|
59 * Notifies the observer when the property changes |
|
60 * @since 2.6 |
|
61 * @param aCategory, Category of the observed property |
|
62 * @param aKey, Observed property |
|
63 */ |
|
64 void ObservePropertyChangeL( TUid aCategory, TUint aKey ); |
|
65 |
|
66 /** |
|
67 * Stops observing the key given with call ObserverPropertyChangeL |
|
68 */ |
|
69 void CancelObserve( ); |
|
70 |
|
71 /** |
|
72 * Gets the uid this observer is observing |
|
73 * @return the category |
|
74 */ |
|
75 TUid Category(); |
|
76 |
|
77 /** |
|
78 * Gets the uid this observer is observing |
|
79 * @return the key |
|
80 */ |
|
81 TUint Key(); |
|
82 |
|
83 |
|
84 protected: // Functions from base classes |
|
85 |
|
86 /** |
|
87 * From CActive |
|
88 */ |
|
89 void RunL(); |
|
90 |
|
91 /** |
|
92 * From CActive |
|
93 */ |
|
94 void DoCancel(); |
|
95 |
|
96 private: |
|
97 |
|
98 /** |
|
99 * C++ default constructor. |
|
100 */ |
|
101 CIMPSCenrepObserver( MIMPSPropertyNotificationObserver& aObserver ); |
|
102 |
|
103 /** |
|
104 * Symbian 2nd phase constructor.. |
|
105 */ |
|
106 void ConstructL(); |
|
107 |
|
108 private: // Data |
|
109 |
|
110 // Owns: Observed property |
|
111 CRepository* iRepository; |
|
112 |
|
113 // Observer to be informed when property changes |
|
114 MIMPSPropertyNotificationObserver& iObserver; |
|
115 |
|
116 // the category this observer is attached to |
|
117 TUid iCategory; |
|
118 // the key this observer is attached to |
|
119 TUint iKey; |
|
120 |
|
121 }; |
|
122 |
|
123 #endif // CIMPSCENREPOBSERVER_H |
|
124 |
|
125 // End of File |