229 profileSettings.mMessageVibra = vibraSettings.MessageAlertVibra(); |
207 profileSettings.mMessageVibra = vibraSettings.MessageAlertVibra(); |
230 profileSettings.mEmailVibra = vibraSettings.EmailAlertVibra(); |
208 profileSettings.mEmailVibra = vibraSettings.EmailAlertVibra(); |
231 profileSettings.mReminderAlertVibra = vibraSettings.ReminderAlarmVibra(); |
209 profileSettings.mReminderAlertVibra = vibraSettings.ReminderAlarmVibra(); |
232 profileSettings.mNotificationVibra = vibraSettings.InformationVibra(); |
210 profileSettings.mNotificationVibra = vibraSettings.InformationVibra(); |
233 profileSettings.mKeyTouchScreenVibra = feedbackSettings.TactileFeedback(); |
211 profileSettings.mKeyTouchScreenVibra = feedbackSettings.TactileFeedback(); |
234 |
212 |
235 CleanupStack::PopAndDestroy(profileExtend); |
|
236 return err; |
|
237 } |
213 } |
238 int CpProfileModelPrivate::setProfileSettings(int profileId, CpProfileSettings& profileSettings) |
214 int CpProfileModelPrivate::setProfileSettings(int profileId, CpProfileSettings& profileSettings) |
239 { |
215 { |
240 MProfileExtended2 *profileExtend = 0; |
216 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
241 TRAPD( err, |
|
242 profileExtend = mEngine->Profile2L(profileId); |
|
243 |
|
244 ) |
|
245 if (err!=KErrNone) { |
|
246 return err; |
|
247 } |
|
248 CleanupReleasePushL(*profileExtend); |
|
249 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
217 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
250 TProfileToneSettings &toneSettings = setTones.SetToneSettings(); |
218 TProfileToneSettings &toneSettings = setTones.SetToneSettings(); |
251 MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2(); |
219 MProfileSetExtraTones2 &setExtTones = |
252 MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings(); |
220 profileExtend->ProfileSetExtraTones2(); |
253 MProfileSetExtraSettings &extraSettings = profileExtend->ProfileSetExtraSettings(); |
221 MProfileSetVibraSettings &setVibraSettings = |
254 MProfileSetFeedbackSettings &setFeedbackSettings = extraSettings.ProfileSetFeedbackSettings(); |
222 profileExtend->ProfileSetVibraSettings(); |
255 |
223 MProfileSetExtraSettings &extraSettings = |
|
224 profileExtend->ProfileSetExtraSettings(); |
|
225 MProfileSetFeedbackSettings &setFeedbackSettings = |
|
226 extraSettings.ProfileSetFeedbackSettings(); |
|
227 // ignore here, wait for the exception deal framework of qt-symbian |
256 TRAP_IGNORE( |
228 TRAP_IGNORE( |
257 setTones.SetRingingTone1L( *descriptorFromString(profileSettings.mRingTone) ); |
229 setTones.SetRingingTone1L(*descriptorFromString( |
258 setTones.SetMessageAlertToneL( *descriptorFromString(profileSettings.mMessageTone) ); |
230 profileSettings.mRingTone)); |
259 setExtTones.SetEmailAlertToneL( *descriptorFromString(profileSettings.mEmailTone) ); |
231 setTones.SetMessageAlertToneL(*descriptorFromString( |
260 setExtTones.SetReminderToneL( *descriptorFromString(profileSettings.mReminderTone) ); |
232 profileSettings.mMessageTone)); |
261 ) |
233 setExtTones.SetEmailAlertToneL(*descriptorFromString( |
262 |
234 profileSettings.mEmailTone)); |
263 toneSettings.iWarningAndGameTones = profileSettings.mNotificationTone; |
235 setExtTones.SetReminderToneL(*descriptorFromString( |
264 toneSettings.iKeypadVolume = static_cast<TProfileKeypadVolume>(profileSettings.mKeyTouchScreenTone); |
236 profileSettings.mReminderTone)); |
265 setVibraSettings.SetRingAlertVibra( profileSettings.mRingAlertVibra ); |
237 ) |
266 setVibraSettings.SetMessageAlertVibra ( profileSettings.mMessageVibra ); |
238 toneSettings.iWarningAndGameTones |
267 setVibraSettings.SetEmailAlertVibra ( profileSettings.mEmailVibra ); |
239 = profileSettings.mNotificationTone; |
268 setVibraSettings.SetReminderAlarmVibra ( profileSettings.mReminderAlertVibra ); |
240 toneSettings.iKeypadVolume |
269 setVibraSettings.SetInformationVibra ( profileSettings.mNotificationVibra ); |
241 = static_cast<TProfileKeypadVolume> (profileSettings.mKeyTouchScreenTone); |
270 setFeedbackSettings.SetTactileFeedback(static_cast<TProfileTactileFeedback>(profileSettings.mKeyTouchScreenVibra)); |
242 setVibraSettings.SetRingAlertVibra(profileSettings.mRingAlertVibra); |
271 |
243 setVibraSettings.SetMessageAlertVibra(profileSettings.mMessageVibra); |
272 TRAPD(err2, |
244 setVibraSettings.SetEmailAlertVibra(profileSettings.mEmailVibra); |
273 mEngine->CommitChangeL(*profileExtend); |
245 setVibraSettings.SetReminderAlarmVibra( |
274 CleanupStack::PopAndDestroy(profileExtend); |
246 profileSettings.mReminderAlertVibra); |
275 ) |
247 setVibraSettings.SetInformationVibra( |
276 return err2; |
248 profileSettings.mNotificationVibra); |
|
249 setFeedbackSettings.SetTactileFeedback( |
|
250 static_cast<TProfileTactileFeedback> (profileSettings.mKeyTouchScreenVibra)); |
|
251 |
|
252 TRAPD(err, |
|
253 mEngine->CommitChangeL(*profileExtend); |
|
254 ) |
|
255 return err; |
277 } |
256 } |
278 |
257 |
279 QString CpProfileModelPrivate::ringTone() const |
258 QString CpProfileModelPrivate::ringTone() const |
280 { |
259 { |
281 MProfileExtended2 *profileExtend = 0; |
260 MProfileExtended2 *profileExtend = mProfileList.value(EProfileWrapperGeneralId); |
282 |
261 QString ringTone = stringFromDescriptor( |
283 TRAPD(err, |
262 profileExtend->ProfileTones().RingingTone1()); |
284 profileExtend = mEngine->Profile2L(EProfileWrapperGeneralId); |
|
285 //CleanupReleasePushL(*profileExtend); |
|
286 ) |
|
287 if (err!=KErrNone) { |
|
288 return QString(""); |
|
289 } |
|
290 CleanupReleasePushL(*profileExtend); |
|
291 |
|
292 QString ringTone = stringFromDescriptor(profileExtend->ProfileTones().RingingTone1()); |
|
293 CleanupStack::PopAndDestroy(profileExtend); |
|
294 return ringTone; |
263 return ringTone; |
295 CPFW_LOG("CpProfileModelPrivate::ringTone(), END with invalid mProfileExt. "); |
|
296 |
|
297 } |
264 } |
298 |
265 |
299 void CpProfileModelPrivate::setRingTone(const QString& filePath) |
266 void CpProfileModelPrivate::setRingTone(const QString& filePath) |
300 { |
267 { |
301 TInt ids[] = {EProfileGeneralId,EProfileMeetingId}; |
268 int ids[] = {EProfileWrapperGeneralId,EProfileWrapperMeetingId}; |
302 |
269 |
303 for (TInt i = 0; i < sizeof(ids)/sizeof(ids[0]); ++i) |
270 for (TInt i = 0; i < sizeof(ids)/sizeof(ids[0]); ++i) { |
304 { |
271 MProfileExtended2 *profileExtend = mProfileList.value(ids[i]); |
305 MProfileExtended2 *profileExtend = 0; |
272 |
306 TRAP_IGNORE( |
|
307 profileExtend = mEngine->Profile2L(ids[i]); |
|
308 ) |
|
309 CleanupReleasePushL(*profileExtend); |
|
310 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
273 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
311 setTones.SetRingingTone1L( *descriptorFromString(filePath) ); |
|
312 mEngine ->CommitChangeL(*profileExtend); |
|
313 CleanupStack::PopAndDestroy(profileExtend); |
|
314 } |
|
315 } |
|
316 |
|
317 int CpProfileModelPrivate::masterVolume() const |
|
318 { |
|
319 //NEED L FUNCTION? |
|
320 TInt masterVolume = mEngine->MasterVolumeL(); |
|
321 return masterVolume; |
|
322 } |
|
323 |
|
324 void CpProfileModelPrivate::setMasterVolume(int volume) |
|
325 { |
|
326 //NEED L FUNCTION ? |
|
327 TRAP_IGNORE(mEngine->SetMasterVolumeL( volume );) |
|
328 } |
|
329 |
|
330 bool CpProfileModelPrivate::masterVibra() const |
|
331 { |
|
332 bool masterVibra = mEngine->MasterVibraL(); |
|
333 return masterVibra; |
|
334 } |
|
335 void CpProfileModelPrivate::setMasterVibra(bool isVibra) |
|
336 { |
|
337 TRAP_IGNORE(mEngine->SetMasterVibraL( isVibra );) |
|
338 } |
|
339 |
|
340 bool CpProfileModelPrivate::isSilenceMode() const |
|
341 { |
|
342 bool isSlience = mEngine->SilenceModeL(); |
|
343 return isSlience; |
|
344 } |
|
345 void CpProfileModelPrivate::setSilenceMode(bool isSilence) |
|
346 { |
|
347 TRAP_IGNORE(mEngine->SetSilenceModeL( isSilence );) |
|
348 } |
|
349 |
|
350 bool CpProfileModelPrivate::isOffLineMode() const |
|
351 { |
|
352 int offLineMode = 0; |
|
353 User::LeaveIfError(mOffLineCenRep->Get( KSettingsAirplaneMode, offLineMode )); |
|
354 |
|
355 return offLineMode; |
|
356 } |
|
357 void CpProfileModelPrivate::setOffLineMode(bool isOffLine) |
|
358 { |
|
359 User::LeaveIfError(mOffLineCenRep->Set(KSettingsAirplaneMode, isOffLine)); |
|
360 } |
|
361 |
|
362 QString CpProfileModelPrivate::ringTone(int profileId) const |
|
363 { |
|
364 MProfileExtended2 *profileExtend = 0; |
|
365 TRAPD(err, |
|
366 profileExtend = mEngine->Profile2L(profileId); |
|
367 //CleanupReleasePushL(*profileExtend); |
|
368 ) |
|
369 if (err != KErrNone) { |
|
370 return QString(""); |
|
371 } |
|
372 CleanupReleasePushL(*profileExtend); |
|
373 const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
374 |
|
375 |
|
376 QString ringTone = stringFromDescriptor(setTones.RingingTone1()); |
|
377 CleanupStack::PopAndDestroy(profileExtend); |
|
378 return ringTone; |
|
379 } |
|
380 |
|
381 void CpProfileModelPrivate::setRingTone(int profileId, const QString& filePath) |
|
382 { |
|
383 MProfileExtended2 *profileExtend = 0; |
|
384 TRAPD( err, |
|
385 profileExtend = mEngine->Profile2L(profileId); |
|
386 //CleanupReleasePushL(*profileExtend); |
|
387 ) |
|
388 if (err==KErrNone) { |
|
389 CleanupReleasePushL(*profileExtend); |
|
390 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
|
391 |
|
392 TRAP_IGNORE( |
274 TRAP_IGNORE( |
393 setTones.SetRingingTone1L( *descriptorFromString(filePath) ); |
275 setTones.SetRingingTone1L( *descriptorFromString(filePath) ); |
394 mEngine->CommitChangeL(*profileExtend); |
276 mEngine ->CommitChangeL(*profileExtend); |
395 ) |
277 ) |
396 CleanupStack::PopAndDestroy(profileExtend); |
278 // ERROR SHOULD BE DEAL HERE OR RETURN A ERROR CODE |
397 } |
279 } |
|
280 } |
|
281 |
|
282 int CpProfileModelPrivate::masterVolume() const |
|
283 { |
|
284 int masterVolume = 0; |
|
285 TRAP_IGNORE(masterVolume = mEngine->MasterVolumeL();) |
|
286 return masterVolume; |
|
287 } |
|
288 |
|
289 void CpProfileModelPrivate::setMasterVolume(int volume) |
|
290 { |
|
291 TRAP_IGNORE(mEngine->SetMasterVolumeL( volume );) |
|
292 } |
|
293 |
|
294 bool CpProfileModelPrivate::masterVibra() const |
|
295 { |
|
296 bool masterVibra = false; |
|
297 TRAP_IGNORE(masterVibra = mEngine->MasterVibraL();) |
|
298 return masterVibra; |
|
299 } |
|
300 void CpProfileModelPrivate::setMasterVibra(bool isVibra) |
|
301 { |
|
302 TRAP_IGNORE(mEngine->SetMasterVibraL( isVibra );) |
|
303 } |
|
304 |
|
305 bool CpProfileModelPrivate::silenceMode() const |
|
306 { |
|
307 bool isSlience = false; |
|
308 TRAP_IGNORE(isSlience = mEngine->SilenceModeL();) |
|
309 return isSlience; |
|
310 } |
|
311 void CpProfileModelPrivate::setSilenceMode(bool isSilence) |
|
312 { |
|
313 TRAP_IGNORE(mEngine->SetSilenceModeL( isSilence );) |
|
314 } |
|
315 |
|
316 bool CpProfileModelPrivate::offLineMode() const |
|
317 { |
|
318 int offLineMode = 0; |
|
319 // What we should do if we can't set offline mode |
|
320 mOffLineCenRep->Get( KSettingsAirplaneMode, offLineMode ); |
|
321 |
|
322 return offLineMode; |
|
323 } |
|
324 void CpProfileModelPrivate::setOffLineMode(bool isOffLine) |
|
325 { |
|
326 mOffLineCenRep->Set(KSettingsAirplaneMode, isOffLine); |
|
327 } |
|
328 |
|
329 QString CpProfileModelPrivate::ringTone(int profileId) const |
|
330 { |
|
331 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
|
332 const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
333 |
|
334 QString ringTone = stringFromDescriptor(setTones.RingingTone1()); |
|
335 return ringTone; |
|
336 } |
|
337 |
|
338 void CpProfileModelPrivate::setRingTone(int profileId, const QString& filePath) |
|
339 { |
|
340 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
|
341 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
|
342 TRAP_IGNORE( |
|
343 setTones.SetRingingTone1L(*descriptorFromString(filePath)); |
|
344 mEngine->CommitChangeL(*profileExtend); |
|
345 ) |
398 } |
346 } |
399 |
347 |
400 QString CpProfileModelPrivate::messageTone(int profileId) const |
348 QString CpProfileModelPrivate::messageTone(int profileId) const |
401 { |
349 { |
402 MProfileExtended2 *profileExtend = 0; |
350 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
403 TRAPD(err, |
351 |
404 profileExtend = mEngine->Profile2L(profileId); |
|
405 //CleanupReleasePushL(*profileExtend); |
|
406 ) |
|
407 if (err != KErrNone) { |
|
408 return QString(""); |
|
409 } |
|
410 CleanupReleasePushL(*profileExtend); |
|
411 const MProfileTones &setTones = profileExtend->ProfileTones(); |
352 const MProfileTones &setTones = profileExtend->ProfileTones(); |
412 |
353 |
413 QString messageTone = stringFromDescriptor(setTones.MessageAlertTone()); |
354 QString messageTone = stringFromDescriptor(setTones.MessageAlertTone()); |
414 |
355 |
415 CleanupStack::PopAndDestroy(profileExtend); |
|
416 return messageTone; |
356 return messageTone; |
417 |
|
418 } |
357 } |
419 |
358 |
420 void CpProfileModelPrivate::setMessageTone(int profileId, const QString& filePath) |
359 void CpProfileModelPrivate::setMessageTone(int profileId, const QString& filePath) |
421 { |
360 { |
422 MProfileExtended2 *profileExtend = 0; |
361 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
423 TRAPD( err, |
362 MProfileSetTones &setTones = |
424 profileExtend = mEngine->Profile2L(profileId); |
363 profileExtend->ProfileSetTones(); |
425 //CleanupReleasePushL(*profileExtend); |
364 TRAP_IGNORE( |
426 ) |
365 setTones.SetMessageAlertToneL(*descriptorFromString(filePath)); |
427 if (err==KErrNone) { |
366 mEngine->CommitChangeL(*profileExtend); |
428 CleanupReleasePushL(*profileExtend); |
367 ) |
429 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
|
430 |
|
431 TRAP_IGNORE( |
|
432 setTones.SetMessageAlertToneL( *descriptorFromString(filePath) ); |
|
433 mEngine->CommitChangeL(*profileExtend); |
|
434 ) |
|
435 CleanupStack::PopAndDestroy(profileExtend); |
|
436 } |
|
437 |
|
438 } |
368 } |
439 |
369 |
440 QString CpProfileModelPrivate::emailTone(int profileId) const |
370 QString CpProfileModelPrivate::emailTone(int profileId) const |
441 { |
371 { |
442 MProfileExtended2 *profileExtend = 0; |
372 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
443 TRAPD(err, |
373 const MProfileExtraTones2 &extTones = |
444 profileExtend = mEngine->Profile2L(profileId); |
374 profileExtend->ProfileExtraTones2(); |
445 //CleanupReleasePushL(*profileExtend); |
375 |
446 ) |
376 QString emailTone = stringFromDescriptor(extTones.EmailAlertTone()); |
447 if (err != KErrNone) { |
|
448 return QString(""); |
|
449 } |
|
450 CleanupReleasePushL(*profileExtend); |
|
451 const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); |
|
452 |
|
453 QString emailTone = stringFromDescriptor(extTones.EmailAlertTone()); |
|
454 |
|
455 CleanupStack::PopAndDestroy(profileExtend); |
|
456 return emailTone; |
377 return emailTone; |
457 |
|
458 } |
378 } |
459 |
379 |
460 void CpProfileModelPrivate::setEmailTone(int profileId, const QString& filePath) |
380 void CpProfileModelPrivate::setEmailTone(int profileId, const QString& filePath) |
461 { |
381 { |
462 MProfileExtended2 *profileExtend = 0; |
382 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
463 TRAPD( err, |
383 MProfileSetExtraTones2 &setExtTones = |
464 profileExtend = mEngine->Profile2L(profileId); |
384 profileExtend->ProfileSetExtraTones2(); |
465 //CleanupReleasePushL(*profileExtend); |
385 TRAP_IGNORE ( |
466 ) |
386 setExtTones.SetEmailAlertToneL(*descriptorFromString(filePath)); |
467 if (err==KErrNone) { |
387 mEngine->CommitChangeL(*profileExtend); |
468 CleanupReleasePushL(*profileExtend); |
388 ) |
469 MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2(); |
|
470 |
|
471 TRAP_IGNORE( |
|
472 setExtTones.SetEmailAlertToneL( *descriptorFromString(filePath) ); |
|
473 mEngine->CommitChangeL(*profileExtend); |
|
474 ) |
|
475 CleanupStack::PopAndDestroy(profileExtend); |
|
476 } |
|
477 } |
389 } |
478 |
390 |
479 QString CpProfileModelPrivate::reminderTone(int profileId) const |
391 QString CpProfileModelPrivate::reminderTone(int profileId) const |
480 { |
392 { |
481 MProfileExtended2 *profileExtend = 0; |
393 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
482 TRAPD(err, |
|
483 profileExtend = mEngine->Profile2L(profileId); |
|
484 //CleanupReleasePushL(*profileExtend); |
|
485 ) |
|
486 if (err != KErrNone) { |
|
487 return QString(""); |
|
488 } |
|
489 CleanupReleasePushL(*profileExtend); |
|
490 const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); |
394 const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); |
491 |
395 |
492 QString reminderTone = stringFromDescriptor(extTones.ReminderTone()); |
396 QString reminderTone = stringFromDescriptor(extTones.ReminderTone()); |
493 |
397 return reminderTone; |
494 CleanupStack::PopAndDestroy(profileExtend); |
|
495 return reminderTone; |
|
496 |
|
497 } |
398 } |
498 |
399 |
499 void CpProfileModelPrivate::setReminderTone(int profileId, const QString& filePath) |
400 void CpProfileModelPrivate::setReminderTone(int profileId, const QString& filePath) |
500 { |
401 { |
501 MProfileExtended2 *profileExtend = 0; |
402 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
502 TRAPD( err, |
403 MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2(); |
503 profileExtend = mEngine->Profile2L(profileId); |
404 |
504 //CleanupReleasePushL(*profileExtend); |
405 TRAP_IGNORE( |
505 ) |
406 setExtTones.SetReminderToneL( *descriptorFromString(filePath) ); |
506 if (err==KErrNone) { |
407 mEngine->CommitChangeL(*profileExtend); |
507 CleanupReleasePushL(*profileExtend); |
408 ) |
508 MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2(); |
|
509 |
|
510 TRAP_IGNORE( |
|
511 setExtTones.SetReminderToneL( *descriptorFromString(filePath) ); |
|
512 mEngine->CommitChangeL(*profileExtend); |
|
513 ) |
|
514 CleanupStack::PopAndDestroy(profileExtend); |
|
515 } |
|
516 } |
409 } |
517 |
410 |
518 bool CpProfileModelPrivate::notificationTone(int profileId) const |
411 bool CpProfileModelPrivate::notificationTone(int profileId) const |
519 { |
412 { |
520 MProfileExtended2 *profileExtend = 0; |
413 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
521 TRAPD(err, |
|
522 profileExtend = mEngine->Profile2L(profileId); |
|
523 //CleanupReleasePushL(*profileExtend); |
|
524 ) |
|
525 if (err != KErrNone) { |
|
526 return false; // ?????? |
|
527 } |
|
528 CleanupReleasePushL(*profileExtend); |
|
529 const MProfileTones &setTones = profileExtend->ProfileTones(); |
414 const MProfileTones &setTones = profileExtend->ProfileTones(); |
530 const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
415 const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
531 |
416 |
532 bool notificationTone = toneSettings.iWarningAndGameTones; |
417 bool notificationTone = toneSettings.iWarningAndGameTones; |
533 |
418 return notificationTone; |
534 CleanupStack::PopAndDestroy(profileExtend); |
|
535 return notificationTone; |
|
536 } |
419 } |
537 |
420 |
538 void CpProfileModelPrivate::setNotificationTone(int profileId, bool isActive) |
421 void CpProfileModelPrivate::setNotificationTone(int profileId, bool isActive) |
539 { |
422 { |
540 MProfileExtended2 *profileExtend = 0; |
423 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
541 TRAPD( err, |
424 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
542 profileExtend = mEngine->Profile2L(profileId); |
425 TProfileToneSettings &toneSettings = setTones.SetToneSettings(); |
543 //CleanupReleasePushL(*profileExtend); |
426 |
544 ) |
427 toneSettings.iWarningAndGameTones = isActive; |
545 if (err==KErrNone) { |
428 TRAP_IGNORE( |
546 CleanupReleasePushL(*profileExtend); |
429 mEngine->CommitChangeL(*profileExtend); |
547 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
430 ) |
548 TProfileToneSettings &toneSettings = setTones.SetToneSettings(); |
|
549 |
|
550 |
|
551 toneSettings.iWarningAndGameTones = isActive; |
|
552 |
|
553 TRAP_IGNORE( |
|
554 mEngine->CommitChangeL(*profileExtend); |
|
555 ) |
|
556 CleanupStack::PopAndDestroy(profileExtend); |
|
557 } |
|
558 } |
431 } |
559 |
432 |
560 int CpProfileModelPrivate::keyTouchScreenTone(int profileId) const |
433 int CpProfileModelPrivate::keyTouchScreenTone(int profileId) const |
561 { |
434 { |
562 MProfileExtended2 *profileExtend = 0; |
435 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
563 TRAPD(err, |
436 |
564 profileExtend = mEngine->Profile2L(profileId); |
|
565 //CleanupReleasePushL(*profileExtend); |
|
566 ) |
|
567 if (err != KErrNone) { |
|
568 return -1; |
|
569 } |
|
570 CleanupReleasePushL(*profileExtend); |
|
571 const MProfileTones &setTones = profileExtend->ProfileTones(); |
437 const MProfileTones &setTones = profileExtend->ProfileTones(); |
572 const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
438 const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
573 |
439 |
574 int keyTouchScreenTone = toneSettings.iKeypadVolume; |
440 int keyTouchScreenTone = toneSettings.iKeypadVolume; |
575 |
441 return keyTouchScreenTone; |
576 CleanupStack::PopAndDestroy(profileExtend); |
|
577 return keyTouchScreenTone; |
|
578 |
|
579 } |
442 } |
580 |
443 |
581 void CpProfileModelPrivate::setKeyTouchScreenTone(int profileId, int level) |
444 void CpProfileModelPrivate::setKeyTouchScreenTone(int profileId, int level) |
582 { |
445 { |
583 MProfileExtended2 *profileExtend = 0; |
446 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
584 TRAPD( err, |
447 MProfileSetTones &setTones = |
585 profileExtend = mEngine->Profile2L(profileId); |
448 profileExtend->ProfileSetTones(); |
586 //CleanupReleasePushL(*profileExtend); |
449 TProfileToneSettings &toneSettings = |
587 ) |
450 setTones.SetToneSettings(); |
588 if (err==KErrNone) { |
451 |
589 CleanupReleasePushL(*profileExtend); |
452 toneSettings.iKeypadVolume |
590 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
453 = static_cast<TProfileKeypadVolume> (level); |
591 TProfileToneSettings &toneSettings = setTones.SetToneSettings(); |
454 TRAP_IGNORE ( |
592 |
455 mEngine->CommitChangeL(*profileExtend); |
593 toneSettings.iKeypadVolume = static_cast<TProfileKeypadVolume>(level); |
456 ) |
594 |
|
595 TRAP_IGNORE( |
|
596 mEngine->CommitChangeL(*profileExtend); |
|
597 ) |
|
598 CleanupStack::PopAndDestroy(profileExtend); |
|
599 } |
|
600 |
|
601 } |
457 } |
602 |
458 |
603 bool CpProfileModelPrivate::ringAlertVibra(int profileId) const |
459 bool CpProfileModelPrivate::ringAlertVibra(int profileId) const |
604 { |
460 { |
605 MProfileExtended2 *profileExtend = 0; |
461 MProfileExtended2 *profileExtend = 0; |
808 } |
664 } |
809 } |
665 } |
810 |
666 |
811 int CpProfileModelPrivate::keyTouchScreenVibra(int profileId)const |
667 int CpProfileModelPrivate::keyTouchScreenVibra(int profileId)const |
812 { |
668 { |
813 MProfileExtended2 *profileExtend = 0; |
669 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
814 TRAPD(err, |
670 |
815 profileExtend = mEngine->Profile2L(profileId); |
|
816 //CleanupReleasePushL(*profileExtend); |
|
817 ) |
|
818 if (err != KErrNone) { |
|
819 return -1; |
|
820 } |
|
821 CleanupReleasePushL(*profileExtend); |
|
822 const MProfileExtraSettings &extraSettings = |
671 const MProfileExtraSettings &extraSettings = |
823 profileExtend->ProfileExtraSettings(); |
672 profileExtend->ProfileExtraSettings(); |
824 const MProfileFeedbackSettings &feedbackSettings = |
673 const MProfileFeedbackSettings &feedbackSettings = |
825 extraSettings.ProfileFeedbackSettings(); |
674 extraSettings.ProfileFeedbackSettings(); |
826 |
675 |
827 |
676 int keyTouchScreenVibra = feedbackSettings.TactileFeedback(); |
828 bool keyTouchScreenVibra = feedbackSettings.TactileFeedback(); |
677 return keyTouchScreenVibra; |
829 |
|
830 CleanupStack::PopAndDestroy(profileExtend); |
|
831 return keyTouchScreenVibra; |
|
832 |
|
833 } |
678 } |
834 |
679 |
835 void CpProfileModelPrivate::setKeyTouchScreenVibra(int profileId, int level) |
680 void CpProfileModelPrivate::setKeyTouchScreenVibra(int profileId, int level) |
836 { |
681 { |
837 MProfileExtended2 *profileExtend = 0; |
682 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
838 TRAPD( err, |
683 MProfileSetExtraSettings &extraSettings = |
839 profileExtend = mEngine->Profile2L(profileId); |
684 profileExtend->ProfileSetExtraSettings(); |
840 //CleanupReleasePushL(*profileExtend); |
685 MProfileSetFeedbackSettings &setFeedbackSettings = |
841 ) |
686 extraSettings.ProfileSetFeedbackSettings(); |
842 if (err==KErrNone) { |
687 setFeedbackSettings.SetTactileFeedback( |
843 CleanupReleasePushL(*profileExtend); |
688 static_cast<TProfileTactileFeedback> (level)); |
844 MProfileSetExtraSettings &extraSettings = profileExtend->ProfileSetExtraSettings(); |
689 |
845 MProfileSetFeedbackSettings &setFeedbackSettings = extraSettings.ProfileSetFeedbackSettings(); |
690 TRAP_IGNORE( |
846 setFeedbackSettings.SetTactileFeedback(static_cast<TProfileTactileFeedback>(level)); |
691 mEngine->CommitChangeL(*profileExtend); |
847 |
692 ) |
848 TRAP_IGNORE( |
|
849 mEngine->CommitChangeL(*profileExtend); |
|
850 ) |
|
851 |
|
852 CleanupStack::PopAndDestroy(profileExtend); |
|
853 } |
|
854 } |
|
855 ///* |
|
856 // * Set a profile as current editing profile |
|
857 // */ |
|
858 //int CpProfileModelPrivate::setEditingProfile(int profileId) |
|
859 //{ |
|
860 // CPFW_LOG("CpProfileModelPrivate::setEditingProfile(), START."); |
|
861 // TRAPD( err, UpdateProfileSettingsL( profileId );); |
|
862 // CPFW_LOG("CpProfileModelPrivate::setEditingProfile(), END."); |
|
863 // return err; |
|
864 //} |
|
865 // |
|
866 ///* |
|
867 // * Get path and file name of ring tone file |
|
868 // */ |
|
869 //QString CpProfileModelPrivate::ringTone() |
|
870 //{ |
|
871 // if ( mProfileExt ){ |
|
872 // return stringFromDescriptor( mProfileExt->ProfileTones().RingingTone1() ); |
|
873 // } |
|
874 // CPFW_LOG("CpProfileModelPrivate::ringTone(), END with invalid mProfileExt. "); |
|
875 // return ""; |
|
876 //} |
|
877 // |
|
878 ///* |
|
879 // * Set path and file to ring tone |
|
880 // */ |
|
881 //int CpProfileModelPrivate::setRingTone(const QString& filePath) |
|
882 //{ |
|
883 // if ( mProfileExt ){ |
|
884 // TRAPD(err, mProfileExt->ProfileSetTones().SetRingingTone1L( *descriptorFromString(filePath) )); |
|
885 // commitChange(); |
|
886 // return err; |
|
887 // } |
|
888 // CPFW_LOG("CpProfileModelPrivate::setRingTone(), END with invalid mProfileExt."); |
|
889 // return -1; |
|
890 //} |
|
891 // |
|
892 ///* |
|
893 // * Get path and file name of message tone file |
|
894 // */ |
|
895 //QString CpProfileModelPrivate::messageTone() |
|
896 //{ |
|
897 // if ( mProfileExt ){ |
|
898 // return stringFromDescriptor( mProfileExt->ProfileTones().MessageAlertTone() ); |
|
899 // } |
|
900 // CPFW_LOG("CpProfileModelPrivate::messageTone(), END with invalid mProfileExt."); |
|
901 // return ""; |
|
902 //} |
|
903 // |
|
904 ///* |
|
905 // * Set path and file to message tone |
|
906 // */ |
|
907 //int CpProfileModelPrivate::setMessageTone(const QString& filePath) |
|
908 //{ |
|
909 // if ( mProfileExt ){ |
|
910 // TRAPD(err, mProfileExt->ProfileSetTones().SetMessageAlertToneL( *descriptorFromString(filePath) )); |
|
911 // commitChange(); |
|
912 // return err; |
|
913 // } |
|
914 // CPFW_LOG("CpProfileModelPrivate::setMessageTone(), END with invalid mProfileExt."); |
|
915 // return -1; |
|
916 //} |
|
917 // |
|
918 ///* |
|
919 // * Get path and file name of email tone file |
|
920 // */ |
|
921 //QString CpProfileModelPrivate::emailTone() |
|
922 //{ |
|
923 // if ( mProfileExt ){ |
|
924 // return stringFromDescriptor( mProfileExt->ProfileExtraTones().EmailAlertTone() ); |
|
925 // } |
|
926 // CPFW_LOG("CpProfileModelPrivate::emailTone(), END with invalid mProfileExt."); |
|
927 // return ""; |
|
928 //} |
|
929 // |
|
930 ///* |
|
931 // * Set path and file to email tone |
|
932 // */ |
|
933 //int CpProfileModelPrivate::setEmailTone(const QString& filePath) |
|
934 //{ |
|
935 // if ( mProfileExt ){ |
|
936 // TRAPD(err, mProfileExt->ProfileSetExtraTones().SetEmailAlertToneL( *descriptorFromString(filePath) )); |
|
937 // commitChange(); |
|
938 // return err; |
|
939 // } |
|
940 // CPFW_LOG("CpProfileModelPrivate::setEmailTone(), END with invalid mProfileExt."); |
|
941 // return -1; |
|
942 //} |
|
943 // |
|
944 ///* |
|
945 // * Get path and file name of calendar event tone file |
|
946 // */ |
|
947 //QString CpProfileModelPrivate::calendarTone() |
|
948 //{ |
|
949 // return ""; |
|
950 //} |
|
951 // |
|
952 ///* |
|
953 // * Set path and file to calendar event tone |
|
954 // */ |
|
955 //void CpProfileModelPrivate::setCalendarTone(const QString& filePath) |
|
956 //{ |
|
957 // Q_UNUSED(filePath); |
|
958 //} |
|
959 // |
|
960 ///* |
|
961 // * Get path and file name of clock alarm tone file |
|
962 // */ |
|
963 //QString CpProfileModelPrivate::alarmTone() |
|
964 //{ |
|
965 // return ""; |
|
966 //} |
|
967 // |
|
968 ///* |
|
969 // * Set path and file to clock alarm tone |
|
970 // */ |
|
971 //void CpProfileModelPrivate::setAlarmTone(const QString& filePath) |
|
972 //{ |
|
973 // Q_UNUSED(filePath); |
|
974 //} |
|
975 // |
|
976 ///* |
|
977 // * Get the value of master volume |
|
978 // */ |
|
979 //int CpProfileModelPrivate::ringVolume() |
|
980 //{ |
|
981 // CPFW_LOG("CpProfileModelPrivate::ringVolume(), START."); |
|
982 // if ( mToneSettings ){ |
|
983 // CPFW_LOG("CpProfileModelPrivate::ringVolume(), End."); |
|
984 // return mToneSettings->iRingingVolume; |
|
985 // } |
|
986 // CPFW_LOG("CpProfileModelPrivate::ringVolume(), END with invalid mToneSettings."); |
|
987 // return -1; |
|
988 //} |
|
989 // |
|
990 ///* |
|
991 // * Set master volume, the value should be between 1-10 |
|
992 // */ |
|
993 //void CpProfileModelPrivate::setRingVolume(int volume) |
|
994 //{ |
|
995 // CPFW_LOG("CpProfileModelPrivate::setRingVolume(), START."); |
|
996 // if ( !mToneSettings ) { |
|
997 // CPFW_LOG("CpProfileModelPrivate::setRingVolume(), END with invalid mToneSettings."); |
|
998 // return; |
|
999 // } |
|
1000 // if ( EProfileWrapperSilentId == mEditingProfileId || volume < 0 || volume >10 ) |
|
1001 // { |
|
1002 // return; |
|
1003 // } |
|
1004 // |
|
1005 // mToneSettings->iRingingType = EProfileRingingTypeRinging; |
|
1006 // mToneSettings->iRingingVolume = volume; |
|
1007 // commitChange(); |
|
1008 // |
|
1009 // // General profile and meeting profile should have same ring tone volume |
|
1010 // int profileId = activeProfileId(); |
|
1011 // if ( EProfileWrapperMeetingId == profileId ){ |
|
1012 // profileId = EProfileWrapperGeneralId; |
|
1013 // } else if ( EProfileWrapperGeneralId == profileId ) { |
|
1014 // profileId = EProfileWrapperMeetingId; |
|
1015 // } |
|
1016 // MProfileExtended* profileExt = 0; |
|
1017 // TRAPD( err0, profileExt = mEngine->ProfileL( profileId );); |
|
1018 // Q_UNUSED(err0); |
|
1019 // TProfileToneSettings& toneSettings = profileExt->ProfileSetTones().SetToneSettings(); |
|
1020 // toneSettings.iRingingType = EProfileRingingTypeRinging; |
|
1021 // toneSettings.iRingingVolume = volume; |
|
1022 // TRAPD( err, mEngine->CommitChangeL(*profileExt) ); |
|
1023 // Q_UNUSED(err); |
|
1024 // CPFW_LOG("CpProfileModelPrivate::setRingVolume(), END."); |
|
1025 // // currently implementation: keep the two profiles same volume |
|
1026 //} |
|
1027 // |
|
1028 ///* |
|
1029 // * Activate master volume to beep |
|
1030 // */ |
|
1031 //void CpProfileModelPrivate::activateBeep() |
|
1032 //{ |
|
1033 // if ( mToneSettings ){ |
|
1034 // mToneSettings->iRingingType = EProfileRingingTypeBeepOnce; |
|
1035 // commitChange(); |
|
1036 // } else { |
|
1037 // CPFW_LOG("CpProfileModelPrivate::activateBeep(), END with invalid mToneSettings."); |
|
1038 // } |
|
1039 //} |
|
1040 // |
|
1041 ///* |
|
1042 // * Get beep status in master volume |
|
1043 // */ |
|
1044 //bool CpProfileModelPrivate::isBeep() |
|
1045 //{ |
|
1046 // if ( mToneSettings ){ |
|
1047 // return (EProfileRingingTypeBeepOnce == mToneSettings->iRingingType) ? true : false; |
|
1048 // } |
|
1049 // CPFW_LOG("CpProfileModelPrivate::isBeep(), END with invalid mToneSettings."); |
|
1050 // return false; |
|
1051 //} |
|
1052 // |
|
1053 ///* |
|
1054 // * Activate master volume to silent |
|
1055 // */ |
|
1056 //void CpProfileModelPrivate::activateSilent() |
|
1057 //{ |
|
1058 // if ( mToneSettings ){ |
|
1059 // mToneSettings->iRingingType = EProfileRingingTypeSilent; |
|
1060 // commitChange(); |
|
1061 // } else { |
|
1062 // CPFW_LOG("CpProfileModelPrivate::vibraStatus(), END with invalid mToneSettings."); |
|
1063 // } |
|
1064 //} |
|
1065 // |
|
1066 ///* |
|
1067 // * Get silent status in master volume |
|
1068 // */ |
|
1069 //bool CpProfileModelPrivate::isSilent() |
|
1070 //{ |
|
1071 // if ( mToneSettings ){ |
|
1072 // return (EProfileRingingTypeSilent == mToneSettings->iRingingType) ? true : false; |
|
1073 // } else { |
|
1074 // CPFW_LOG("CpProfileModelPrivate::vibraStatus(), END with invalid mToneSettings."); |
|
1075 // return false; |
|
1076 // } |
|
1077 //} |
|
1078 // |
|
1079 ///* |
|
1080 // * Get master vibra's status |
|
1081 // */ |
|
1082 //bool CpProfileModelPrivate::vibraStatus() |
|
1083 //{ |
|
1084 // CPFW_LOG("CpProfileModelPrivate::vibraStatus(), Start."); |
|
1085 // if ( mToneSettings ){ |
|
1086 // CPFW_LOG("CpProfileModelPrivate::vibraStatus(), End."); |
|
1087 // return mToneSettings->iVibratingAlert; |
|
1088 // } |
|
1089 // CPFW_LOG("CpProfileModelPrivate::vibraStatus(), END with invalid mToneSettings."); |
|
1090 // return false; |
|
1091 //} |
|
1092 // |
|
1093 ///* |
|
1094 // * Set master vibra's status |
|
1095 // */ |
|
1096 //void CpProfileModelPrivate::setVibraStatus(bool status) |
|
1097 //{ |
|
1098 // CPFW_LOG("CpProfileModelPrivate::setVibraStatus(), Start."); |
|
1099 // if ( mVibraCenRep ){ |
|
1100 // mVibraCenRep->Set(KVibraCtrlProfileVibraEnabled, status ); |
|
1101 // } |
|
1102 // |
|
1103 // if ( mToneSettings ){ |
|
1104 // mToneSettings->iVibratingAlert = status; |
|
1105 // commitChange(); |
|
1106 // } |
|
1107 // CPFW_LOG("CpProfileModelPrivate::setVibraStatus(), END."); |
|
1108 //} |
|
1109 // |
|
1110 ///* |
|
1111 // * Get keypad' volume |
|
1112 // */ |
|
1113 //int CpProfileModelPrivate::keyVolume() |
|
1114 //{ |
|
1115 // CPFW_LOG("CpProfileModelPrivate::keyVolume(), Start."); |
|
1116 // if ( mToneSettings ){ |
|
1117 // CPFW_LOG("CpProfileModelPrivate::keyVolume(), END."); |
|
1118 // return mToneSettings->iKeypadVolume; |
|
1119 // } |
|
1120 // CPFW_LOG("CpProfileModelPrivate::keyVolume(), END with invalid mToneSettings."); |
|
1121 // return -1; |
|
1122 //} |
|
1123 // |
|
1124 ///* |
|
1125 // * Set keypad's volume, |
|
1126 // * the value of the volume should be between 0-3 |
|
1127 // */ |
|
1128 //void CpProfileModelPrivate::setKeyVolume(int volume) |
|
1129 //{ |
|
1130 // CPFW_LOG("CpProfileModelPrivate::setKeyVolume(), Start."); |
|
1131 // if (volume < 0 || volume > 3) |
|
1132 // { |
|
1133 // CPFW_LOG("CpProfileModelPrivate::setKeyVolume(), End with invalid volume."); |
|
1134 // return; |
|
1135 // } |
|
1136 // |
|
1137 // if ( mToneSettings ){ |
|
1138 // mToneSettings->iKeypadVolume = (TProfileKeypadVolume)volume; |
|
1139 // commitChange(); |
|
1140 // } |
|
1141 // CPFW_LOG("CpProfileModelPrivate::setKeyVolume(), End."); |
|
1142 //} |
|
1143 // |
|
1144 ///* |
|
1145 // * Get screen tone's volume |
|
1146 // */ |
|
1147 //int CpProfileModelPrivate::screenVolume() |
|
1148 //{ |
|
1149 // CPFW_LOG("CpProfileModelPrivate::screenVolume(), Start."); |
|
1150 // if ( mFeedbackSettings ){ |
|
1151 // CPFW_LOG("CpProfileModelPrivate::screenVolume(), End."); |
|
1152 // return mFeedbackSettings->AudioFeedback(); |
|
1153 // } |
|
1154 // CPFW_LOG("CpProfileModelPrivate::screenVolume(), End."); |
|
1155 // return -1; |
|
1156 //} |
|
1157 // |
|
1158 ///* |
|
1159 // * Set screen tone's volume, |
|
1160 // * the value of the volume should be between 0-3 |
|
1161 // */ |
|
1162 //void CpProfileModelPrivate::setScreenVolume(int volume) |
|
1163 //{ |
|
1164 // CPFW_LOG("CpProfileModelPrivate::setScreenVolume(), Start."); |
|
1165 // if (volume < 0 || volume > 3) |
|
1166 // { |
|
1167 // CPFW_LOG("CpProfileModelPrivate::setScreenVolume(), End with invalid volume."); |
|
1168 // return; |
|
1169 // } |
|
1170 // |
|
1171 // if ( mSetFeedbackSettings ){ |
|
1172 // mSetFeedbackSettings->SetAudioFeedback( (TProfileAudioFeedback)volume ); |
|
1173 // commitChange(); |
|
1174 // } |
|
1175 // CPFW_LOG("CpProfileModelPrivate::setScreenVolume(), End."); |
|
1176 //} |
|
1177 // |
|
1178 ///* |
|
1179 // * Get screen vibra's level |
|
1180 // */ |
|
1181 //int CpProfileModelPrivate::screenVibra() |
|
1182 //{ |
|
1183 // CPFW_LOG("CpProfileModelPrivate::screenVibra(), Start."); |
|
1184 // if ( mFeedbackSettings ){ |
|
1185 // CPFW_LOG("CpProfileModelPrivate::screenVibra(), End."); |
|
1186 // return mFeedbackSettings->TactileFeedback(); |
|
1187 // } |
|
1188 // CPFW_LOG("CpProfileModelPrivate::screenVibra(), End with invalid mFeedbackSettings."); |
|
1189 // return -1; |
|
1190 //} |
|
1191 // |
|
1192 ///* |
|
1193 // * Set screen vibra's level, |
|
1194 // * the value of the level should be between 0-3 |
|
1195 // */ |
|
1196 //void CpProfileModelPrivate::setScreenVibra(int volume) |
|
1197 //{ |
|
1198 // if (volume < 0 || volume > 3) |
|
1199 // { |
|
1200 // return; |
|
1201 // } |
|
1202 // |
|
1203 // if ( mSetFeedbackSettings ){ |
|
1204 // mSetFeedbackSettings->SetTactileFeedback( (TProfileTactileFeedback)volume ); |
|
1205 // commitChange(); |
|
1206 // } |
|
1207 //} |
|
1208 |
|
1209 /* |
|
1210 * Commit changes when change settings value in profile. |
|
1211 */ |
|
1212 int CpProfileModelPrivate::commitChange() |
|
1213 { |
|
1214 /* TRAPD( err, mEngine->CommitChangeL(*mProfileExt) ); |
|
1215 return err;*/ |
|
1216 return 0; |
|
1217 } |
693 } |
1218 |
694 |
1219 // End of file |
695 // End of file |
1220 |
696 |
|
697 |