gsprofilesrv_pub/profiles_engine_wrapper_api/tsrc/BC/ProfilesEngineWrapperAPI/src/ProEngWrapAPIBlocks.cpp
changeset 59 4868a89ec1e3
parent 0 8c5d936e5675
--- a/gsprofilesrv_pub/profiles_engine_wrapper_api/tsrc/BC/ProfilesEngineWrapperAPI/src/ProEngWrapAPIBlocks.cpp	Thu Sep 02 20:42:34 2010 +0300
+++ b/gsprofilesrv_pub/profiles_engine_wrapper_api/tsrc/BC/ProfilesEngineWrapperAPI/src/ProEngWrapAPIBlocks.cpp	Fri Sep 17 08:31:27 2010 +0300
@@ -358,11 +358,27 @@
     CleanupStack::PushL( observer );
 
     MProEngProfile* generalProfile = engine->ProfileLC( EProfileGeneralId );
-    MProEngToneSettings& ts2( generalProfile->ToneSettings() );
+//    MProEngToneSettings& ts2( generalProfile->ToneSettings() );
     TRAP_IGNORE( 
             nh->RequestProfileNotificationsL( *observer,
                                                    EProfileGeneralId ) );
-    ts2.SetVibratingAlert( !ts2.VibratingAlert() );
+    //ts2.SetVibratingAlert( !ts2.VibratingAlert() );
+    MProEngTones& pt = generalProfile->ProfileTones();
+    const TDesC& emailAlertTone = pt.EmailAlertTone();
+    _LIT( KFile1, "z:\\data\\sounds\\digital\\alarm.aac" );
+    _LIT( KFile2, "z:\\data\\sounds\\digital\\Buzzer.aac" );
+
+    TBuf<100> buf1(KFile1);
+    TBuf<100> buf2(KFile2);
+    
+    if ( emailAlertTone.Compare( buf1 ) )
+        {
+        TRAP_IGNORE( pt.SetEmailAlertToneL(buf1));
+        }
+    else 
+        {
+        TRAP_IGNORE(pt.SetEmailAlertToneL(buf2));
+        }
     generalProfile->CommitChangeL();
     iSchedulerUtility->Start();
     CleanupStack::PopAndDestroy(); // generalProfile
@@ -394,15 +410,29 @@
     CProEngVTObserver* observer = new ( ELeave ) CProEngVTObserver(*iSchedulerUtility);
     CleanupStack::PushL( observer );
     MProEngProfile* generalProfile = engine->ProfileLC( EProfileGeneralId );
-    MProEngToneSettings& ts2( generalProfile->ToneSettings() );
+//    MProEngToneSettings& ts2( generalProfile->ToneSettings() );
     TRAP_IGNORE( 
             nh->RequestProfileNotificationsL( *observer,
                                                    EProfileGeneralId ) );
-    ts2.SetVibratingAlert( !ts2.VibratingAlert() );
+    MProEngTones& pt = generalProfile->ProfileTones();
+    const TDesC& emailAlertTone = pt.EmailAlertTone();
+    _LIT( KFile1, "z:\\data\\sounds\\digital\\alarm.aac" );
+    _LIT( KFile2, "z:\\data\\sounds\\digital\\Buzzer.aac" );
+
+    TBuf<100> buf1(KFile1);
+    TBuf<100> buf2(KFile2);
+    
+    if ( emailAlertTone.Compare( buf1 ) )
+        {
+        TRAP_IGNORE( pt.SetEmailAlertToneL(buf1));
+        }
+    else 
+        {
+        TRAP_IGNORE(pt.SetEmailAlertToneL(buf2));
+        }
     generalProfile->CommitChangeL();
     iSchedulerUtility->Start();
-    //CSchedulerUtility::InstanceL()->Start(); // observer stops this
-    nh->CancelProfileNotifications( EProfileMeetingId );
+    nh->CancelProfileNotifications( EProfileGeneralId );
     CleanupStack::PopAndDestroy(); // generalProfile
     CleanupStack::PopAndDestroy( observer );
     CleanupStack::PopAndDestroy( wrapper );