356 } |
356 } |
357 CProEngVTObserver* observer = new ( ELeave ) CProEngVTObserver(*iSchedulerUtility); |
357 CProEngVTObserver* observer = new ( ELeave ) CProEngVTObserver(*iSchedulerUtility); |
358 CleanupStack::PushL( observer ); |
358 CleanupStack::PushL( observer ); |
359 |
359 |
360 MProEngProfile* generalProfile = engine->ProfileLC( EProfileGeneralId ); |
360 MProEngProfile* generalProfile = engine->ProfileLC( EProfileGeneralId ); |
361 MProEngToneSettings& ts2( generalProfile->ToneSettings() ); |
361 // MProEngToneSettings& ts2( generalProfile->ToneSettings() ); |
362 TRAP_IGNORE( |
362 TRAP_IGNORE( |
363 nh->RequestProfileNotificationsL( *observer, |
363 nh->RequestProfileNotificationsL( *observer, |
364 EProfileGeneralId ) ); |
364 EProfileGeneralId ) ); |
365 ts2.SetVibratingAlert( !ts2.VibratingAlert() ); |
365 //ts2.SetVibratingAlert( !ts2.VibratingAlert() ); |
|
366 MProEngTones& pt = generalProfile->ProfileTones(); |
|
367 const TDesC& emailAlertTone = pt.EmailAlertTone(); |
|
368 _LIT( KFile1, "z:\\data\\sounds\\digital\\alarm.aac" ); |
|
369 _LIT( KFile2, "z:\\data\\sounds\\digital\\Buzzer.aac" ); |
|
370 |
|
371 TBuf<100> buf1(KFile1); |
|
372 TBuf<100> buf2(KFile2); |
|
373 |
|
374 if ( emailAlertTone.Compare( buf1 ) ) |
|
375 { |
|
376 TRAP_IGNORE( pt.SetEmailAlertToneL(buf1)); |
|
377 } |
|
378 else |
|
379 { |
|
380 TRAP_IGNORE(pt.SetEmailAlertToneL(buf2)); |
|
381 } |
366 generalProfile->CommitChangeL(); |
382 generalProfile->CommitChangeL(); |
367 iSchedulerUtility->Start(); |
383 iSchedulerUtility->Start(); |
368 CleanupStack::PopAndDestroy(); // generalProfile |
384 CleanupStack::PopAndDestroy(); // generalProfile |
369 CleanupStack::PopAndDestroy( observer ); |
385 CleanupStack::PopAndDestroy( observer ); |
370 CleanupStack::PopAndDestroy( wrapper ); |
386 CleanupStack::PopAndDestroy( wrapper ); |
392 wrapper->SetObject( nh ); // takes ownership |
408 wrapper->SetObject( nh ); // takes ownership |
393 } |
409 } |
394 CProEngVTObserver* observer = new ( ELeave ) CProEngVTObserver(*iSchedulerUtility); |
410 CProEngVTObserver* observer = new ( ELeave ) CProEngVTObserver(*iSchedulerUtility); |
395 CleanupStack::PushL( observer ); |
411 CleanupStack::PushL( observer ); |
396 MProEngProfile* generalProfile = engine->ProfileLC( EProfileGeneralId ); |
412 MProEngProfile* generalProfile = engine->ProfileLC( EProfileGeneralId ); |
397 MProEngToneSettings& ts2( generalProfile->ToneSettings() ); |
413 // MProEngToneSettings& ts2( generalProfile->ToneSettings() ); |
398 TRAP_IGNORE( |
414 TRAP_IGNORE( |
399 nh->RequestProfileNotificationsL( *observer, |
415 nh->RequestProfileNotificationsL( *observer, |
400 EProfileGeneralId ) ); |
416 EProfileGeneralId ) ); |
401 ts2.SetVibratingAlert( !ts2.VibratingAlert() ); |
417 MProEngTones& pt = generalProfile->ProfileTones(); |
|
418 const TDesC& emailAlertTone = pt.EmailAlertTone(); |
|
419 _LIT( KFile1, "z:\\data\\sounds\\digital\\alarm.aac" ); |
|
420 _LIT( KFile2, "z:\\data\\sounds\\digital\\Buzzer.aac" ); |
|
421 |
|
422 TBuf<100> buf1(KFile1); |
|
423 TBuf<100> buf2(KFile2); |
|
424 |
|
425 if ( emailAlertTone.Compare( buf1 ) ) |
|
426 { |
|
427 TRAP_IGNORE( pt.SetEmailAlertToneL(buf1)); |
|
428 } |
|
429 else |
|
430 { |
|
431 TRAP_IGNORE(pt.SetEmailAlertToneL(buf2)); |
|
432 } |
402 generalProfile->CommitChangeL(); |
433 generalProfile->CommitChangeL(); |
403 iSchedulerUtility->Start(); |
434 iSchedulerUtility->Start(); |
404 //CSchedulerUtility::InstanceL()->Start(); // observer stops this |
435 nh->CancelProfileNotifications( EProfileGeneralId ); |
405 nh->CancelProfileNotifications( EProfileMeetingId ); |
|
406 CleanupStack::PopAndDestroy(); // generalProfile |
436 CleanupStack::PopAndDestroy(); // generalProfile |
407 CleanupStack::PopAndDestroy( observer ); |
437 CleanupStack::PopAndDestroy( observer ); |
408 CleanupStack::PopAndDestroy( wrapper ); |
438 CleanupStack::PopAndDestroy( wrapper ); |
409 CleanupStack::PopAndDestroy(); // engine |
439 CleanupStack::PopAndDestroy(); // engine |
410 return KErrNone; |
440 return KErrNone; |