52 CPhoneResources* self = CPhoneResources::NewLC(); |
51 CPhoneResources* self = CPhoneResources::NewLC(); |
53 CleanupStack::Pop(); |
52 CleanupStack::Pop(); |
54 return self; |
53 return self; |
55 } |
54 } |
56 |
55 |
|
56 CPhoneResources::~CPhoneResources() |
|
57 { |
|
58 } |
|
59 |
57 void CPhoneResources::ConstructL() |
60 void CPhoneResources::ConstructL() |
58 { |
61 { |
59 iCameraAvailability = -1; |
62 // If a P&S key is not found, set it to KErrNotFound. |
60 iKeypadAvailability = -1 ; |
63 // This is why the RProperty::Get return values are not handled below. |
61 iVideoPlayerAvailability = -1; |
64 iCameraAvailability = KErrNotFound; |
62 iCameraInformation = -1; |
65 RProperty::Get(NMusResourceApi::KCategoryUid, |
63 iKodiakPhoneCall = -1; |
66 NMusResourceApi::KCameraAvailability, |
64 iDummy = 1; // just a postive value , dirty idea but just works at this time |
67 iCameraAvailability); |
65 } |
68 |
66 |
69 iKeypadAvailability = KErrNotFound; |
67 void CPhoneResources::ReadL() |
70 RProperty::Get(NMusResourceApi::KCategoryUid, |
68 { |
71 NMusResourceApi::KKeypadAvailability, |
69 TInt err = KErrNone; |
72 iKeypadAvailability); |
70 // 1. camera property |
73 |
71 err = RProperty::Get( NMusResourceApi::KCategoryUid, |
74 iVideoPlayerAvailability = KErrNotFound; |
72 NMusResourceApi::KCameraAvailability, |
75 RProperty::Get(NMusResourceApi::KCategoryUid, |
73 iCameraAvailability); |
76 NMusResourceApi::KVideoPlayerAvailability, |
74 if(err)HandleError(ETrue,err,_L("CameraAvailability")); |
77 iVideoPlayerAvailability ); |
75 // 2. keypad property |
78 |
76 err = RProperty::Get( NMusResourceApi::KCategoryUid, |
79 iCameraInformation = KErrNotFound; |
77 NMusResourceApi::KKeypadAvailability, |
80 RProperty::Get(NMusResourceApi::KCategoryUid, |
78 iKeypadAvailability ); |
81 NMusResourceApi::KCameraInformation, |
79 if(err)HandleError(ETrue , err,_L("KeypadAvailability")); |
82 iCameraInformation ); |
80 // 3. video player property |
83 |
81 err = RProperty::Get( NMusResourceApi::KCategoryUid, |
84 iKodiakPhoneCall = KErrNotFound; |
82 NMusResourceApi::KVideoPlayerAvailability, |
85 TInt err = RProperty::Get(KPSUidCtsyCallInformation, |
83 iVideoPlayerAvailability ); |
86 KCTsyKodiakPtt, |
84 if(err)HandleError( ETrue, err ,_L("VideoPlayerAvailability")); |
87 iKodiakPhoneCall ); |
85 // 3. video player property |
88 if (err != KErrNone) |
86 err = RProperty::Get( NMusResourceApi::KCategoryUid, |
|
87 NMusResourceApi::KCameraInformation, |
|
88 iCameraInformation ); |
|
89 if(err)HandleError( ETrue, err ,_L("CameraInformation")); |
|
90 err = RProperty::Get( KPSUidCtsyCallInformation, |
|
91 KCTsyKodiakPtt, |
|
92 iKodiakPhoneCall ); |
|
93 if(err) |
|
94 { |
89 { |
95 iKodiakPhoneCall = EPSCTsyKodiakPttNotActive; |
90 iKodiakPhoneCall = EPSCTsyKodiakPttNotActive; |
96 RProperty::Define(KPSUidCtsyCallInformation,KCTsyKodiakPtt,EPSCTsyKodiakPttNotActive); |
91 RProperty::Define(KPSUidCtsyCallInformation,KCTsyKodiakPtt,EPSCTsyKodiakPttNotActive); |
97 } |
92 } |
98 } |
93 } |
99 |
94 |
100 |
|
101 CPhoneResources::~CPhoneResources() |
|
102 { |
|
103 } |
|
104 |
|
105 void CPhoneResources::SaveL() |
95 void CPhoneResources::SaveL() |
106 { |
96 { |
107 //TInt err = KErrNone; |
97 SetValueL(NMusResourceApi::KCategoryUid, |
108 |
98 NMusResourceApi::KCameraAvailability, |
109 User::LeaveIfError(SetValueL( NMusResourceApi::KCategoryUid, |
99 iCameraAvailability); |
110 NMusResourceApi::KCameraAvailability, |
100 |
111 iCameraAvailability)); |
101 SetValueL(NMusResourceApi::KCategoryUid, |
112 //if(err)HandleError( EFalse, err ,_L("CameraAvailability")); |
102 NMusResourceApi::KKeypadAvailability, |
113 // 2. keypad property |
103 iKeypadAvailability); |
114 User::LeaveIfError(SetValueL( NMusResourceApi::KCategoryUid, |
104 |
115 NMusResourceApi::KKeypadAvailability, |
105 SetValueL(NMusResourceApi::KCategoryUid, |
116 iKeypadAvailability )); |
106 NMusResourceApi::KVideoPlayerAvailability, |
117 //if(err)HandleError(EFalse, err,_L("KeypadAvailability")); |
107 iVideoPlayerAvailability); |
118 // 3. video player property |
108 |
119 User::LeaveIfError(SetValueL( NMusResourceApi::KCategoryUid, |
109 SetValueL(NMusResourceApi::KCategoryUid, |
120 NMusResourceApi::KVideoPlayerAvailability, |
110 NMusResourceApi::KCameraInformation, |
121 iVideoPlayerAvailability )); |
111 iCameraInformation); |
122 //if(err)HandleError(EFalse, err,_L("VideoPlayerAvailability")); |
112 |
123 // 3. video player property |
113 SetValueL(KPSUidCtsyCallInformation, |
124 User::LeaveIfError(SetValueL( NMusResourceApi::KCategoryUid, |
114 KCTsyKodiakPtt, |
125 NMusResourceApi::KCameraInformation, |
115 iKodiakPhoneCall); |
126 iCameraInformation )); |
116 } |
127 //if(err)HandleError(EFalse, err,_L("CameraInformation")); |
117 |
128 // 4. Kodiak PS Key |
118 void CPhoneResources::SetValueL(TUid aCategory, TUint aKey, TInt aValue) |
129 User::LeaveIfError(SetValueL( KPSUidCtsyCallInformation, |
119 { |
130 KCTsyKodiakPtt, |
120 // Don't care if the key is not found initially |
131 iKodiakPhoneCall )); |
121 if (aValue >= 0) |
132 //if(err)HandleError( EFalse, err ,_L("KodiakPSKeyInformation")); |
122 { |
133 } |
123 User::LeaveIfError(RProperty::Set(aCategory, aKey, aValue)); |
134 |
124 } |
135 TInt CPhoneResources::SetValueL(TUid aCategory, TUint aKey, TInt aValue) |
|
136 { |
|
137 if(aValue<0)return KErrNone; // dont care if the key is not read intially |
|
138 return RProperty::Set( aCategory, aKey, aValue ); |
|
139 } |
|
140 |
|
141 |
|
142 void CPhoneResources::HandleError(TBool aType ,TInt aError , TPtrC aKeyName ) |
|
143 { |
|
144 CAknErrorNote *dlg = new CAknErrorNote(ETrue); |
|
145 TBuf<100> buf; |
|
146 if(aType) |
|
147 { |
|
148 buf.Append(_L("Unable to Read Key ")); |
|
149 } |
|
150 else |
|
151 { |
|
152 buf.Append(_L("Unable to Save ")); |
|
153 } |
|
154 buf.Append(aKeyName); |
|
155 buf.Append(_L(" Error ")); |
|
156 buf.AppendNum(aError); |
|
157 dlg->ExecuteLD(buf); |
|
158 } |
125 } |
159 |
126 |
160 COtherResources* COtherResources::NewLC() |
127 COtherResources* COtherResources::NewLC() |
161 { |
128 { |
162 // create a new expense object |
|
163 COtherResources* self = new (ELeave) COtherResources(); |
129 COtherResources* self = new (ELeave) COtherResources(); |
164 CleanupStack::PushL(self); |
130 CleanupStack::PushL(self); |
165 self->ConstructL(); |
131 self->ConstructL(); |
166 return self; |
132 return self; |
167 } |
133 } |
173 return self; |
139 return self; |
174 } |
140 } |
175 |
141 |
176 void COtherResources::ConstructL() |
142 void COtherResources::ConstructL() |
177 { |
143 { |
178 iActivation = -1 ; |
144 iRepository = CRepository::NewL(MusSettingsKeys::KRepositoryUid); |
179 iOperatorVariant = -1 ; |
145 |
180 iAuditoryNotification = -1; |
146 // If a CenRep key is not found, set it to KErrNotFound. |
181 iPopupNotification = -1 ; |
147 // This is why the CRepository::Get return values are not handled below. |
182 iPopupNotificationType = -1 ; |
148 iActivation = KErrNotFound; |
183 iEdgeDtmSupport = -1 ; |
149 iRepository->Get(MusSettingsKeys::KActivation, iActivation); |
184 iSessionSetupMethod = -1 ; |
150 |
185 iAutoRecord = -1 ; |
151 iOperatorVariant = KErrNotFound; |
186 iVideoLocation = -1 ; |
152 iRepository->Get(MusSettingsKeys::KOperatorVariant,iOperatorVariant); |
187 iSipProfileId = -1 ; |
153 |
188 iUiOrientation = -1 ; |
154 iAuditoryNotification = KErrNotFound; |
189 iCapabilityQuery = -1; |
155 iRepository->Get(MusSettingsKeys::KAuditoryNotification, iAuditoryNotification); |
190 iProductModeVariation=-1; |
156 |
191 iEncodingDevice = -1; |
157 iPopupNotification = KErrNotFound; |
192 iPrivacyVariation = -1; |
158 iRepository->Get(MusSettingsKeys::KPopupNotification, iPopupNotification); |
193 iDummy = 1; // just a postive value |
159 |
194 } |
160 iPopupNotificationType = KErrNotFound; |
195 |
161 iRepository->Get(MusSettingsKeys::KPopupNotificationType, iPopupNotificationType); |
196 void COtherResources::ReadL() |
162 |
197 { |
163 iEdgeDtmSupport = KErrNotFound; |
198 |
164 iRepository->Get(MusSettingsKeys::KEdgeDtmSupport, iEdgeDtmSupport); |
199 TRAPD(err,ReadCRKeyValuesL()); |
165 |
200 if(err) HandleError (ETrue,err,_L("Read Error")); |
166 iSessionSetupMethod = KErrNotFound; |
201 |
167 iRepository->Get(MusSettingsKeys::KForceInternetSignaling, iSessionSetupMethod); |
202 } |
168 |
203 |
169 iAutoRecord = KErrNotFound; |
204 void COtherResources::ReadCRKeyValuesL() |
170 iRepository->Get(MusSettingsKeys::KAutoRecord, iAutoRecord); |
205 { |
171 |
206 |
172 iVideoLocation = KErrNotFound; |
207 TInt err=KErrNone; |
173 iRepository->Get(MusSettingsKeys::KVideoLocation, iVideoLocation); |
208 CRepository* cr = NULL ; |
174 |
209 TRAP(err,cr = CRepository::NewL( MusSettingsKeys::KRepositoryUid )); |
175 iSipProfileId = KErrNotFound; |
210 cr->CleanupCancelTransactionPushL(); |
176 iRepository->Get(MusSettingsKeys::KSipProfileId, iSipProfileId); |
211 if(err) |
177 |
212 { |
178 iUiOrientation = KErrNotFound; |
213 CAknErrorNote *dlg = new CAknErrorNote(ETrue); |
179 iRepository->Get(MusSettingsKeys::KUiOrientation, iUiOrientation); |
214 dlg->ExecuteLD(_L(\ |
180 |
215 "Unable to Construct CRepository for UID 0x1028238B")); |
181 iCapabilityQuery = KErrNotFound; |
216 return ; // dont leave |
182 iRepository->Get(MusSettingsKeys::KCapabilityQuery, iCapabilityQuery); |
|
183 |
|
184 iProductModeVariation = KErrNotFound; |
|
185 iRepository->Get(MusSettingsKeys::KProductModeVariation, iProductModeVariation); |
|
186 |
|
187 iRepository->Get(MusSettingsKeys::KEncoderConfigurationInfo, iEncoderInfo ); |
|
188 |
|
189 iEncodingDevice = KErrNotFound; |
|
190 iRepository->Get(MusSettingsKeys::KEncodingDevice, iEncodingDevice ); |
|
191 iEncodingDeviceStr.Zero(); |
|
192 if ( iEncodingDevice >= 0 ) |
|
193 { |
|
194 iEncodingDeviceStr.AppendNum(iEncodingDevice, EHex); |
|
195 } |
|
196 |
|
197 iOnlyWithActiveCSCall = KErrNotFound; |
|
198 iRepository->Get(MusSettingsKeys::KAllowOnlyWithActiveCSCall, iOnlyWithActiveCSCall); |
|
199 |
|
200 iOnlyIn3GNetwork = KErrNotFound; |
|
201 iRepository->Get(MusSettingsKeys::KAllowOnlyIn3GNetwork, iOnlyIn3GNetwork); |
|
202 |
|
203 iCameraUsage = KErrNotFound; |
|
204 iRepository->Get(MusSettingsKeys::KCameraUsage, iCameraUsage); |
|
205 |
|
206 iVideoDirection = KErrNotFound; |
|
207 iRepository->Get(MusSettingsKeys::KVideoDirection, iVideoDirection); |
|
208 |
|
209 iVideoBandwidth = KErrNotFound; |
|
210 iRepository->Get(MusSettingsKeys::KVideoBandwidth, iVideoBandwidth); |
|
211 |
|
212 iFastMode = KErrNotFound; |
|
213 iRepository->Get(MusSettingsKeys::KFastStartupMode, iFastMode); |
|
214 } |
|
215 |
|
216 COtherResources::~COtherResources() |
|
217 { |
|
218 delete iRepository; |
|
219 } |
|
220 |
|
221 void COtherResources::SaveL() |
|
222 { |
|
223 User::LeaveIfError( |
|
224 iRepository->StartTransaction(CRepository::EConcurrentReadWriteTransaction)); |
|
225 iRepository->CleanupCancelTransactionPushL(); |
|
226 |
|
227 SetKeyValueL(MusSettingsKeys::KActivation, iActivation); |
|
228 SetKeyValueL(MusSettingsKeys::KOperatorVariant, iOperatorVariant); |
|
229 SetKeyValueL(MusSettingsKeys::KAuditoryNotification, iAuditoryNotification); |
|
230 SetKeyValueL(MusSettingsKeys::KPopupNotification, iPopupNotification); |
|
231 SetKeyValueL(MusSettingsKeys::KPopupNotificationType, iPopupNotificationType); |
|
232 SetKeyValueL(MusSettingsKeys::KEdgeDtmSupport, iEdgeDtmSupport); |
|
233 SetKeyValueL(MusSettingsKeys::KForceInternetSignaling, iSessionSetupMethod); |
|
234 SetKeyValueL(MusSettingsKeys::KAutoRecord, iAutoRecord); |
|
235 SetKeyValueL(MusSettingsKeys::KVideoLocation, iVideoLocation); |
|
236 SetKeyValueL(MusSettingsKeys::KSipProfileId, iSipProfileId); |
|
237 SetKeyValueL(MusSettingsKeys::KUiOrientation, iUiOrientation); |
|
238 SetKeyValueL(MusSettingsKeys::KCapabilityQuery, iCapabilityQuery); |
|
239 SetKeyValueL(MusSettingsKeys::KProductModeVariation, iProductModeVariation); |
|
240 User::LeaveIfError( |
|
241 iRepository->Set(MusSettingsKeys::KEncoderConfigurationInfo, iEncoderInfo)); |
|
242 TLex lex( iEncodingDeviceStr ); |
|
243 TUint tmpUid; |
|
244 lex.SkipSpace(); |
|
245 if ( lex.Val(tmpUid, EHex) == KErrNone ) |
|
246 { |
|
247 iEncodingDevice = tmpUid; |
|
248 } |
|
249 else |
|
250 { |
|
251 iEncodingDevice = KErrNotFound; |
|
252 } |
|
253 SetKeyValueL(MusSettingsKeys::KEncodingDevice, iEncodingDevice); |
|
254 SetKeyValueL(MusSettingsKeys::KAllowOnlyWithActiveCSCall, iOnlyWithActiveCSCall); |
|
255 SetKeyValueL(MusSettingsKeys::KAllowOnlyIn3GNetwork, iOnlyIn3GNetwork); |
|
256 SetKeyValueL(MusSettingsKeys::KCameraUsage, iCameraUsage); |
|
257 SetKeyValueL(MusSettingsKeys::KVideoDirection, iVideoDirection); |
|
258 SetKeyValueL(MusSettingsKeys::KVideoBandwidth, iVideoBandwidth); |
|
259 SetKeyValueL(MusSettingsKeys::KFastStartupMode, iFastMode); |
|
260 |
|
261 TUint32 modifiedKeyCount(0); |
|
262 User::LeaveIfError(iRepository->CommitTransaction(modifiedKeyCount)); |
|
263 CleanupStack::Pop(); // transaction |
|
264 } |
|
265 |
|
266 void COtherResources::SetKeyValueL( |
|
267 const TUint32& aKey, |
|
268 TInt& aVal) |
|
269 { |
|
270 TBool keyExistsInRepository(EFalse); |
|
271 TInt tmpVal(0); |
|
272 keyExistsInRepository = (iRepository->Get(aKey,tmpVal) == KErrNone); |
|
273 if (aVal < 0) |
|
274 { |
|
275 if (keyExistsInRepository) |
|
276 { |
|
277 User::LeaveIfError(iRepository->Delete(aKey)); |
|
278 } |
|
279 } |
|
280 else |
|
281 { |
|
282 if (keyExistsInRepository) |
|
283 { |
|
284 User::LeaveIfError(iRepository->Set(aKey,aVal)); |
|
285 } |
|
286 else |
|
287 { |
|
288 User::LeaveIfError(iRepository->Create(aKey,aVal)); |
|
289 } |
217 } |
290 } |
218 |
|
219 ReadKeyValueL( cr, MusSettingsKeys::KActivation,iActivation ); |
|
220 ReadKeyValueL( cr, MusSettingsKeys::KOperatorVariant,iOperatorVariant); |
|
221 ReadKeyValueL( cr, MusSettingsKeys::KAuditoryNotification, iAuditoryNotification); |
|
222 ReadKeyValueL( cr, MusSettingsKeys::KPopupNotification, iPopupNotification); |
|
223 ReadKeyValueL( cr, MusSettingsKeys::KPopupNotificationType, iPopupNotificationType); |
|
224 ReadKeyValueL( cr, MusSettingsKeys::KEdgeDtmSupport, iEdgeDtmSupport); |
|
225 ReadKeyValueL( cr, MusSettingsKeys::KForceInternetSignaling, iSessionSetupMethod); |
|
226 ReadKeyValueL( cr, MusSettingsKeys::KAutoRecord, iAutoRecord); |
|
227 ReadKeyValueL( cr, MusSettingsKeys::KVideoLocation, iVideoLocation); |
|
228 ReadKeyValueL( cr, MusSettingsKeys::KSipProfileId, iSipProfileId); |
|
229 ReadKeyValueL( cr, MusSettingsKeys::KUiOrientation, iUiOrientation); |
|
230 ReadKeyValueL( cr, MusSettingsKeys::KCapabilityQuery, iCapabilityQuery); |
|
231 ReadKeyValueL( cr, MusSettingsKeys::KProductModeVariation, iProductModeVariation); |
|
232 ReadKeyValueL( cr, MusSettingsKeys::KEncoderConfigurationInfo, iEncoderInfo ); |
|
233 ReadKeyValueL( cr, MusSettingsKeys::KEncodingDevice, iEncodingDevice ); |
|
234 ReadKeyValueL( cr, MusSettingsKeys::KPrivacyExchange, iPrivacyVariation ); |
|
235 |
|
236 iEncodingDeviceStr.Zero(); |
|
237 iEncodingDeviceStr.AppendNum(iEncodingDevice, EHex); |
|
238 |
|
239 CleanupStack::PopAndDestroy(cr); |
|
240 delete cr; |
|
241 |
|
242 } |
|
243 |
|
244 |
|
245 COtherResources::~COtherResources() |
|
246 { |
|
247 } |
|
248 |
|
249 void COtherResources::SaveL() |
|
250 { |
|
251 |
|
252 TRAPD(err,SaveCRKeyValuesL()); |
|
253 if(err) HandleError (ETrue,err,_L("Save Error")); |
|
254 |
|
255 } |
|
256 |
|
257 void COtherResources::SaveCRKeyValuesL() |
|
258 { |
|
259 CRepository* cr = NULL ; |
|
260 TRAPD(err,cr = CRepository::NewL( MusSettingsKeys::KRepositoryUid )); |
|
261 cr->CleanupCancelTransactionPushL(); |
|
262 if(err) |
|
263 { |
|
264 CAknErrorNote *dlg = new CAknErrorNote(ETrue); |
|
265 dlg->ExecuteLD(_L(\ |
|
266 "Unable to Construct CRepository for UID 0x1028238B")); |
|
267 User::Leave(err); |
|
268 } |
|
269 SetKeyValueL( cr,MusSettingsKeys::KActivation, iActivation); |
|
270 SetKeyValueL( cr,MusSettingsKeys::KOperatorVariant, iOperatorVariant); |
|
271 SetKeyValueL( cr,MusSettingsKeys::KAuditoryNotification, iAuditoryNotification); |
|
272 SetKeyValueL( cr,MusSettingsKeys::KPopupNotification, iPopupNotification); |
|
273 SetKeyValueL( cr,MusSettingsKeys::KPopupNotificationType, iPopupNotificationType); |
|
274 SetKeyValueL( cr,MusSettingsKeys::KEdgeDtmSupport, iEdgeDtmSupport); |
|
275 SetKeyValueL( cr,MusSettingsKeys::KForceInternetSignaling, iSessionSetupMethod); |
|
276 SetKeyValueL( cr,MusSettingsKeys::KAutoRecord, iAutoRecord); |
|
277 SetKeyValueL( cr,MusSettingsKeys::KVideoLocation, iVideoLocation); |
|
278 SetKeyValueL( cr,MusSettingsKeys::KSipProfileId, iSipProfileId); |
|
279 SetKeyValueL( cr,MusSettingsKeys::KUiOrientation, iUiOrientation); |
|
280 SetKeyValueL( cr,MusSettingsKeys::KCapabilityQuery, iCapabilityQuery); |
|
281 SetKeyValueL( cr,MusSettingsKeys::KProductModeVariation, iProductModeVariation); |
|
282 SetKeyValueL( cr,MusSettingsKeys::KEncoderConfigurationInfo, iEncoderInfo ); |
|
283 SetKeyValueL( cr,MusSettingsKeys::KPrivacyExchange, iPrivacyVariation ); |
|
284 |
|
285 TLex lex( iEncodingDeviceStr ); |
|
286 TUint uid; |
|
287 err = lex.Val(uid, EHex); |
|
288 if ( (err == KErrNone) && lex.Eos() ) |
|
289 { |
|
290 iEncodingDevice = uid; |
|
291 SetKeyValueL( cr, MusSettingsKeys::KEncodingDevice, iEncodingDevice ); |
|
292 } |
|
293 |
|
294 CleanupStack::PopAndDestroy(cr); |
|
295 delete cr; |
|
296 } |
|
297 |
|
298 void COtherResources::SetKeyValueL(CRepository* repository, const TInt & aKey , TInt & aVal) |
|
299 { |
|
300 if(aVal<0) return; // dont care if key is not intially read |
|
301 TUint32 key(aKey); |
|
302 User::LeaveIfError(repository->StartTransaction( |
|
303 CRepository::EConcurrentReadWriteTransaction)); |
|
304 User::LeaveIfError(repository->Set(key,aVal)); |
|
305 User::LeaveIfError(repository->CommitTransaction(key)); |
|
306 } |
|
307 |
|
308 void COtherResources::ReadKeyValueL(CRepository* repository, const TInt & aKey , TInt & aVal) |
|
309 { |
|
310 TUint32 key(aKey); |
|
311 User::LeaveIfError(repository->StartTransaction( |
|
312 CRepository::EConcurrentReadWriteTransaction)); |
|
313 User::LeaveIfError(repository->Get(key,aVal)); |
|
314 User::LeaveIfError(repository->CommitTransaction(key)); |
|
315 } |
|
316 |
|
317 void COtherResources::SetKeyValueL(CRepository* repository, TInt aKey, const TDesC& aVal) |
|
318 { |
|
319 TUint32 key(aKey); |
|
320 User::LeaveIfError(repository->StartTransaction( |
|
321 CRepository::EConcurrentReadWriteTransaction)); |
|
322 User::LeaveIfError(repository->Set(key,aVal)); |
|
323 User::LeaveIfError(repository->CommitTransaction(key)); |
|
324 } |
|
325 |
|
326 void COtherResources::ReadKeyValueL(CRepository* repository, TInt aKey, TDes& aVal) |
|
327 { |
|
328 TUint32 key(aKey); |
|
329 User::LeaveIfError(repository->StartTransaction( |
|
330 CRepository::EConcurrentReadWriteTransaction)); |
|
331 User::LeaveIfError(repository->Get(key,aVal)); |
|
332 User::LeaveIfError(repository->CommitTransaction(key)); |
|
333 } |
|
334 |
|
335 void COtherResources::HandleError(TBool aType , |
|
336 TInt aError , TPtrC aKeyName ) |
|
337 { |
|
338 CAknErrorNote *dlg = new CAknErrorNote(ETrue); |
|
339 TBuf<100> buf; |
|
340 if(aType) |
|
341 { |
|
342 buf.Append(_L("Unable to Read Key ")); |
|
343 } |
|
344 else |
|
345 { |
|
346 buf.Append(_L("Unable to Save Key ")); |
|
347 } |
|
348 buf.Append(aKeyName); |
|
349 buf.Append(_L(" Error ")); |
|
350 buf.AppendNum(aError); |
|
351 dlg->ExecuteLD(buf); |
|
352 } |
291 } |
353 |
292 |
354 CMusApplication* CMusApplication::NewLC() |
293 CMusApplication* CMusApplication::NewLC() |
355 { |
294 { |
356 // create a new expense object |
|
357 CMusApplication* self = new (ELeave) CMusApplication(); |
295 CMusApplication* self = new (ELeave) CMusApplication(); |
358 CleanupStack::PushL(self); |
296 CleanupStack::PushL(self); |
359 self->ConstructL(); |
297 self->ConstructL(); |
360 return self; |
298 return self; |
361 } |
299 } |