|
1 /* |
|
2 * Copyright (c) 2010 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: Wrapper class for Central Repository handling. |
|
15 * Using this helper class is most helpful when one class needs |
|
16 * to observe state changes in several repositories. |
|
17 */ |
|
18 |
|
19 #ifndef DIALERCENREPWRAPPER_H |
|
20 #define DIALERCENREPWRAPPER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <cenrepnotifyhandler.h> |
|
26 |
|
27 // CALLBACK INTERFACE |
|
28 NONSHARABLE_CLASS( MDialerCenRepObserver ) |
|
29 { |
|
30 public: |
|
31 virtual void HandleRepositoryChange( TUid aRepository, TUint32 aKey ) = 0; |
|
32 }; |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CRepository; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * CDialerCenRepWrapper |
|
41 * |
|
42 */ |
|
43 NONSHARABLE_CLASS( CDialerCenRepWrapper ): |
|
44 public CBase, public MCenRepNotifyHandlerCallback |
|
45 { |
|
46 public: // constructors and destructor |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 ~CDialerCenRepWrapper(); |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 */ |
|
56 static CDialerCenRepWrapper* NewL( |
|
57 MDialerCenRepObserver& aObserver, TUid aRepository ); |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 */ |
|
62 static CDialerCenRepWrapper* NewLC( |
|
63 MDialerCenRepObserver& aObserver, TUid aRepository ); |
|
64 |
|
65 private: // consturctors |
|
66 |
|
67 /** |
|
68 * Constructor for performing 1st stage construction |
|
69 */ |
|
70 CDialerCenRepWrapper( |
|
71 MDialerCenRepObserver& aObserver, TUid aRepository ); |
|
72 |
|
73 /** |
|
74 * Symbian default constructor for performing 2nd stage construction |
|
75 */ |
|
76 void ConstructL(); |
|
77 |
|
78 public: // from MCenRepNotifyHandlerCallback |
|
79 |
|
80 /** |
|
81 * @see MCenRepNotifyHandlerCallback |
|
82 */ |
|
83 void HandleNotifyGeneric( TUint32 aId ); |
|
84 |
|
85 public: // new methods |
|
86 |
|
87 /** |
|
88 * Get integer value from the repository. |
|
89 * @see CRepository::Get |
|
90 */ |
|
91 TInt Get( TUint32 aKey, TInt& aValue ); |
|
92 |
|
93 // Getters for other data types may be added here if needed |
|
94 |
|
95 private: // data |
|
96 |
|
97 /** Observer is notified on repository changes */ |
|
98 MDialerCenRepObserver& iObserver; |
|
99 |
|
100 /** UID of the repository */ |
|
101 TUid iRepositoryId; |
|
102 |
|
103 /** Repository handle. Owned. */ |
|
104 CRepository* iRepository; |
|
105 |
|
106 /** Helper for reacting to repository changes. */ |
|
107 CCenRepNotifyHandler* iCenRepNotifyHandler; |
|
108 }; |
|
109 |
|
110 #endif // DIALERCENREPWRAPPER_H |