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