alarmui/src/alarmcontextfwsupport.cpp
branchRCL_3
changeset 65 12af337248b1
parent 30 d68a4b5d5885
child 66 bd7edf625bdd
equal deleted inserted replaced
60:96907930389d 65:12af337248b1
    30 #include <cfactionindication.h>
    30 #include <cfactionindication.h>
    31 
    31 
    32 // USER INCLUDE
    32 // USER INCLUDE
    33 #include "alarmcontextfwsupport.h"
    33 #include "alarmcontextfwsupport.h"
    34 #include "AlmAlarmControl.h"
    34 #include "AlmAlarmControl.h"
    35 #include "alarmutils.h"
       
    36 
    35 
    37 #include "pim_trace.h"
    36 #include "pim_trace.h"
    38 
    37 
    39 // ======== MEMBER FUNCTIONS ========
    38 // ======== MEMBER FUNCTIONS ========
    40 
    39 
    86             }
    85             }
    87         else if( contextObject.Value() == TPtrC( KAlarmUISourceCommandValues[ECommandAlarmSnooze] ) )
    86         else if( contextObject.Value() == TPtrC( KAlarmUISourceCommandValues[ECommandAlarmSnooze] ) )
    88             {
    87             {
    89             // snooze alarm
    88             // snooze alarm
    90             if(iAlarmControl->CanSnooze())
    89             if(iAlarmControl->CanSnooze())
    91               iAlarmControl->ExternalSnoozeAlarm();
    90 	            {
    92             }
    91 	            iAlarmControl->ExternalSnoozeAlarm();
    93         else if( contextObject.Value() == TPtrC( KAlarmUISourceCommandValues[ECommandAlarmSilence] ) )
    92 	            }
    94             {
       
    95             SilenceAlarm();
       
    96             }
    93             }
    97         else
    94         else
    98             {
    95             {
    99             // value didn't match
    96             // value didn't match
   100             }
    97             }
   115     TRACE_ENTRY_POINT;
   112     TRACE_ENTRY_POINT;
   116 
   113 
   117     if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionSnooze] ) )
   114     if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionSnooze] ) )
   118         {
   115         {
   119         // snooze the alarm
   116         // snooze the alarm
   120         if(iAlarmControl->CanSnooze())
   117 		if(iAlarmControl->CanSnooze())
   121           iAlarmControl->ExternalSnoozeAlarm();
   118         	iAlarmControl->ExternalSnoozeAlarm();
   122         }
   119         }
   123     else if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionSilence] ) )
       
   124         {
       
   125         SilenceAlarm();
       
   126         }    
       
   127     else if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionStop] ) )
   120     else if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionStop] ) )
   128         {
   121         {
   129         //Do not stop the alarm internally but force the user to stop the alarm manually.
   122         //Do not stop the alarm internally but force the user to stop the alarm manually.
   130         //iAlarmControl->ExternalStopAlarm();
   123         //iAlarmControl->ExternalStopAlarm();
   131         }
   124         }
   188     DefineContextL( KAlarmUISource, KAlarmUISourceCommand, KAlarmUISourceCommandSec );
   181     DefineContextL( KAlarmUISource, KAlarmUISourceCommand, KAlarmUISourceCommandSec );
   189     DefineContextL( KAlarmUISource, KAlarmUISourceResult, KAlarmUISourceResultSec  );
   182     DefineContextL( KAlarmUISource, KAlarmUISourceResult, KAlarmUISourceResultSec  );
   190 
   183 
   191     // define actions(s)
   184     // define actions(s)
   192     DefineActionL( EActionSnooze );
   185     DefineActionL( EActionSnooze );
   193     DefineActionL( EActionSilence );    
       
   194 
   186 
   195     //Stop action definition should not be defined as the alarm component should not automatically stop the alarm on observing context events
   187     //Stop action definition should not be defined as the alarm component should not automatically stop the alarm on observing context events
   196     // but continue to expire the alarm and force the user to manually stop the alarm
   188     // but continue to expire the alarm and force the user to manually stop the alarm
   197     //DefineActionL( EActionStop );  
   189     //DefineActionL( EActionStop );  
   198 
   190 
   305     // open client session(closed in StopL)
   297     // open client session(closed in StopL)
   306     OpenCFClientL();  // closed in StopL
   298     OpenCFClientL();  // closed in StopL
   307 
   299 
   308     // subscribe for action(s)
   300     // subscribe for action(s)
   309     SubscribeActionL( EActionSnooze );
   301     SubscribeActionL( EActionSnooze );
   310     SubscribeActionL( EActionSilence );
       
   311 
   302 
   312     //Subscription to stop action definition from the context events should not be defined as the alarm component should not automatically stop the alarm on observing context events
   303     //Subscription to stop action definition from the context events should not be defined as the alarm component should not automatically stop the alarm on observing context events
   313     // but continue to expire the alarm and force the user to manually stop the alarm
   304     // but continue to expire the alarm and force the user to manually stop the alarm
   314     //SubscribeActionL( EActionStop );
   305     //SubscribeActionL( EActionStop );
   315 
   306 
   458     iSubscribedContexts.Close();
   449     iSubscribedContexts.Close();
   459     
   450     
   460     TRACE_EXIT_POINT;	
   451     TRACE_EXIT_POINT;	
   461 	}
   452 	}
   462 
   453 
   463 void CAlarmContextFwSupport::SilenceAlarm()
   454 
   464     {
       
   465     if( iAlarmControl->AlarmUtils() )
       
   466         {
       
   467         iAlarmControl->AlarmUtils()->DoSilence();
       
   468         }
       
   469     }
       
   470 // End of File
   455 // End of File