|
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: Used for observing property changes and notifying listeners. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __FREESTYLEEMAILUIPROPERTYSUBSCRIBER_H__ |
|
19 #define __FREESTYLEEMAILUIPROPERTYSUBSCRIBER_H__ |
|
20 |
|
21 #include <e32base.h> // For CActive, link against: euser.lib |
|
22 #include <e32property.h> // Observer for property change events. |
|
23 |
|
24 /** |
|
25 * Observer interface for property changes. |
|
26 */ |
|
27 class MFreestyleEmailUiPropertyChangedObserver |
|
28 { |
|
29 public: |
|
30 |
|
31 virtual void PropertyChangedL( TInt aValue ) = 0; |
|
32 }; |
|
33 |
|
34 |
|
35 /** |
|
36 * Subcribes property from P&S and listens to property changes. |
|
37 */ |
|
38 NONSHARABLE_CLASS( CFreestyleEmailUiPropertySubscriber ) : public CActive |
|
39 { |
|
40 public: // Construction and destruction. |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * @param aUid P&S property category. |
|
45 * @param aKey P&S property key. |
|
46 * @param aObserver The given property changed observer. |
|
47 */ |
|
48 static CFreestyleEmailUiPropertySubscriber* NewL( |
|
49 const TUid aUid, |
|
50 const TUint32 aKey, |
|
51 MFreestyleEmailUiPropertyChangedObserver& aObserver ); |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 * @param aUid P&S property category. |
|
56 * @param aKey P&S property key. |
|
57 * @param aObserver The given property changed observer. |
|
58 */ |
|
59 static CFreestyleEmailUiPropertySubscriber* NewLC( |
|
60 const TUid aUid, |
|
61 const TUint32 aKey, |
|
62 MFreestyleEmailUiPropertyChangedObserver& aObserver ); |
|
63 |
|
64 /** |
|
65 * Cancels and destroys the instance. |
|
66 */ |
|
67 ~CFreestyleEmailUiPropertySubscriber(); |
|
68 |
|
69 |
|
70 private: // Construction. |
|
71 |
|
72 /** |
|
73 * C++ constructor. |
|
74 * @param aObserver The given property changed observer. |
|
75 */ |
|
76 CFreestyleEmailUiPropertySubscriber( |
|
77 MFreestyleEmailUiPropertyChangedObserver& aObserver ); |
|
78 |
|
79 /** |
|
80 * Second phase constructor. |
|
81 * @param aUid P&S property category. |
|
82 * @param aKey P&S property key. |
|
83 */ |
|
84 void ConstructL( const TUid aUid, const TUint32 aKey ); |
|
85 |
|
86 |
|
87 private: // From CActive. |
|
88 |
|
89 /** |
|
90 * Handles completion. |
|
91 */ |
|
92 void RunL(); |
|
93 |
|
94 /** |
|
95 * How to cancel me. |
|
96 */ |
|
97 void DoCancel(); |
|
98 |
|
99 |
|
100 private: |
|
101 |
|
102 // The observer for property changes. |
|
103 MFreestyleEmailUiPropertyChangedObserver& iPropertyChangeObserver; |
|
104 |
|
105 // The property to listen to. |
|
106 RProperty iProperty; |
|
107 }; |
|
108 |
|
109 |
|
110 #endif /* __FREESTYLEEMAILUIPROPERTYSUBSCRIBER_H__ */ |
|
111 |
|
112 // End of file. |
|
113 |