|
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: Shared data handler for IMPSCommonUI |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CWVSETTINGSUISHAREDDATAHANDLER_H |
|
19 #define __CWVSETTINGSUISHAREDDATAHANDLER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include "MIMPSSharedData.h" |
|
23 #include "IMPSSharedDataDefs.h" |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <SharedDataClient.h> |
|
27 |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MIMPSSharedDataObserver; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Shared data handler |
|
36 * |
|
37 * @lib WVServiceSettingsUi.dll |
|
38 * @since 2.6 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CIMPSSharedDataHandler ) : public CBase, |
|
41 public MIMPSSharedData, |
|
42 public MSharedDataNotifyHandler |
|
43 { |
|
44 public: // New functions |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 * @param aResourceId the resource of the setting page |
|
48 * @param aSelectionItemList the selection item list of the setting page |
|
49 */ |
|
50 static CIMPSSharedDataHandler* NewL( MIMPSSharedDataObserver* aObserver, |
|
51 const TUid aUid, |
|
52 TBool aTemporary = EFalse ); |
|
53 |
|
54 private: // constructor and destructor |
|
55 |
|
56 /** |
|
57 * C++ default constructor. |
|
58 */ |
|
59 CIMPSSharedDataHandler( MIMPSSharedDataObserver* aObserver, |
|
60 const TUid aUid, |
|
61 TBool aTemporary ); |
|
62 |
|
63 /** |
|
64 * Symbian OS constructor. |
|
65 */ |
|
66 void ConstructL(); |
|
67 |
|
68 /** |
|
69 * Destructor. |
|
70 */ |
|
71 virtual ~CIMPSSharedDataHandler(); |
|
72 |
|
73 |
|
74 private: //Functions from base classes |
|
75 |
|
76 /** |
|
77 * From MIMPSSharedData |
|
78 * @see MIMPSSharedData |
|
79 */ |
|
80 TInt SubscribeChange( const TUid aUid, const TIMPSSharedKeys aKey ); |
|
81 |
|
82 /** |
|
83 * From MIMPSSharedData |
|
84 * @see MIMPSSharedData |
|
85 */ |
|
86 TInt SubscribeSet( const TUid aUid, const TIMPSSharedKeys aKey ); |
|
87 |
|
88 /** |
|
89 * From MIMPSSharedData |
|
90 * @see MIMPSSharedData |
|
91 */ |
|
92 void UnSubscribe( const TUid aUid, const TIMPSSharedKeys aKey ); |
|
93 |
|
94 /** |
|
95 * From MIMPSSharedData |
|
96 * @see MIMPSSharedData |
|
97 */ |
|
98 TInt GetStringKey( const TIMPSSharedKeys aKey, TDes& aValue ); |
|
99 |
|
100 /** |
|
101 * From MIMPSSharedData |
|
102 * @see MIMPSSharedData |
|
103 */ |
|
104 TInt GetIntKey( const TIMPSSharedKeys aKey, TInt& aValue ); |
|
105 |
|
106 /** |
|
107 * From MIMPSSharedData |
|
108 * @see MIMPSSharedData |
|
109 */ |
|
110 TInt SetStringKey( const TIMPSSharedKeys aKey, const TDesC& aValue ); |
|
111 |
|
112 /** |
|
113 * From MIMPSSharedData |
|
114 * @see MIMPSSharedData |
|
115 */ |
|
116 TInt SetIntKey( const TIMPSSharedKeys aKey, TInt aValue ); |
|
117 |
|
118 /** |
|
119 * From MIMPSSharedData |
|
120 * @see MIMPSSharedData |
|
121 */ |
|
122 TInt Signal( const TIMPSSharedKeys aKey ); |
|
123 |
|
124 /** |
|
125 * From MIMPSSharedData |
|
126 * @see MIMPSSharedData |
|
127 */ |
|
128 TInt CancelSignal( const TIMPSSharedKeys aKey ); |
|
129 |
|
130 |
|
131 /** |
|
132 * From MSharedDataNotifyHandler |
|
133 * @param aUid uid of the dll |
|
134 * @param aKey the shared data key |
|
135 * @param aValue the value of the key |
|
136 */ |
|
137 void HandleNotifyL( const TUid aUid, |
|
138 const TDesC& aKey, |
|
139 const TDesC& aValue ); |
|
140 |
|
141 /** |
|
142 * From MSharedDataNotifyHandler |
|
143 * Converts shared data keys to TIMPSSharedKeys |
|
144 * @param aKey keyword |
|
145 * @return error code |
|
146 */ |
|
147 TInt ConvertSharedDataKey( const TDesC& aSrc, TIMPSSharedKeys& aDest ); |
|
148 |
|
149 private: // new functions |
|
150 |
|
151 /** |
|
152 * Does the actual setting of the key |
|
153 * @see MIMPSSharedData |
|
154 */ |
|
155 void DoSetIntKeyL( const TIMPSSharedKeys aKey, TInt aValue ); |
|
156 |
|
157 /** |
|
158 * Converts the TIMPSSharedKeys to shared data keys |
|
159 * @param aKey the key from the enumeration that clients use |
|
160 * @param aSharedDataKey the shared data key |
|
161 * @return KErrNone if found, KErrNotFound if not found |
|
162 */ |
|
163 TInt MapKeysToSharedData( const TIMPSSharedKeys aKey, TDes& aSharedDataKey ); |
|
164 |
|
165 /** |
|
166 * Converts the shared data keys to TIMPSSharedKeys |
|
167 * @param aKey the key from the enumeration that clients use |
|
168 * @param aSharedDataKey the shared data key |
|
169 * @return KErrNone if found, KErrNotFound if not found |
|
170 */ |
|
171 TInt MapKeysToClient( TIMPSSharedKeys& aKey, const TDesC& aSharedDataKey ); |
|
172 |
|
173 /** |
|
174 * Creates the array of key mappings |
|
175 */ |
|
176 void AppendKeyPairsL( ); |
|
177 |
|
178 /** |
|
179 * Appends a key pair into the array of keys |
|
180 * @param aKey the key from the enumeration that clients use |
|
181 * @param aSharedDataKey the shared data key |
|
182 */ |
|
183 void DoAppendKeyPairL( TIMPSSharedKeys aKey, const TDesC& aSharedDataKey ); |
|
184 |
|
185 /** |
|
186 * Does the actual signalling |
|
187 * @param aKey the key to signal |
|
188 */ |
|
189 void DoSignalL( const TIMPSSharedKeys aKey ); |
|
190 |
|
191 /** |
|
192 * Does the actual cancelling |
|
193 * @param aKey the key to signal |
|
194 */ |
|
195 void DoCancelSignalL( const TIMPSSharedKeys aKey ); |
|
196 |
|
197 private: // Data |
|
198 // Doesn't own: observer for the shared data. |
|
199 MIMPSSharedDataObserver* iObserver; |
|
200 |
|
201 ///Shared data client to read common settings, owned |
|
202 RSharedDataClient iSharedDataClient; |
|
203 |
|
204 // identifier of the ini file we are interested in |
|
205 TUid iUid; |
|
206 |
|
207 //Array of key pairs |
|
208 RArray<TIMPSSharedKeyPairs> iKeys; |
|
209 |
|
210 // tells if we should use temporary keys |
|
211 TBool iTemporary; |
|
212 }; |
|
213 |
|
214 #endif // __CWVSETTINGSUISHAREDDATAHANDLER_H |
|
215 |
|
216 // End of File |