alarmui/src/alarmutils.cpp
branchRCL_3
changeset 30 d68a4b5d5885
parent 27 55d60436f00b
child 65 12af337248b1
--- a/alarmui/src/alarmutils.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/src/alarmutils.cpp	Tue May 25 12:41:10 2010 +0300
@@ -32,6 +32,7 @@
 #include "alarmcontextfwsupport.h"
 #endif // RD_ALMALERT__SENSOR_SUPPORT
 
+#include <w32std.h>
 #include <almconst.h>
 #include <eikenv.h>
 #include <AknCapServer.h>
@@ -1668,4 +1669,51 @@
     return iCalendarAlarmViewer;
     }
 
+// ---------------------------------------------------------
+// Silence the notifying alarm 
+// ---------------------------------------------------------
+//
+void CAlarmUtils::DoSilence()
+    {
+    TRACE_ENTRY_POINT;
+    
+    // silence only if snoozing is possible
+    // this way user must hear the last "call"
+    if( CanSnooze() )
+        {
+        delete iAlarmPlayer;
+        iAlarmPlayer = NULL;
+        SetBackLight( EFalse );
+        
+        if( IsCalendarAlarm() )
+            {
+    
+            // calendar alarm needs extra handling due to having stop - silence
+            //simulate right softkey pressing
+            RWsSession wsSession=CCoeEnv::Static()->WsSession();
+            TKeyEvent keyEvent;
+            keyEvent.iCode = EKeyCBA2;  
+            keyEvent.iScanCode = EStdKeyDevice1;
+            keyEvent.iModifiers = 0;
+            keyEvent.iRepeats = 0;
+            wsSession.SimulateKeyEvent( keyEvent );
+            wsSession.Flush();
+            }
+        // clockalarm
+        else
+            {
+            StartAutoSnoozeTimer();
+            }
+    
+        #if defined( RD_ALMALERT__SENSOR_SUPPORT )
+        // notify the result through the context framework
+        if( iCFSupport )
+            {
+            PIM_TRAPD_ASSERT( iCFSupport->PublishAlarmResultL( EResultAlarmSilenced ); )
+            }
+        #endif // RD_ALMALERT__SENSOR_SUPPORT
+        }
+    TRACE_EXIT_POINT;     
+    }
+
 // End of File