calendarui/controller/src/calenalarmstate.cpp
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Calendar alarm state machine  
       
    15 *
       
    16 */
       
    17 
       
    18 // includes
       
    19 #include "calenalarmstate.h"
       
    20 #include "calendarui_debug.h"           // Debug macros
       
    21 #include "calencontroller.h"
       
    22 #include "calenstatemachine.h"
       
    23 #include "calennotifier.h"
       
    24 #include <eikon.hrh>
       
    25 
       
    26 // ----------------------------------------------------------------------------
       
    27 // CCalenAlarmState::NewLC
       
    28 // First stage construction
       
    29 // ----------------------------------------------------------------------------
       
    30 CCalenAlarmState* CCalenAlarmState::NewLC( CCalenController& aController,
       
    31                                                                     RHashSet<TCalenNotification>&  aOutstandingNotifications )
       
    32     {
       
    33     TRACE_ENTRY_POINT;
       
    34 
       
    35     CCalenAlarmState* self = new ( ELeave ) CCalenAlarmState( aController,
       
    36                                                                      aOutstandingNotifications );
       
    37     CleanupStack::PushL( self );
       
    38     self->ConstructL();
       
    39 
       
    40     TRACE_EXIT_POINT;
       
    41     return self;
       
    42     }
       
    43 
       
    44 // ----------------------------------------------------------------------------
       
    45 // CCalenAlarmState::ConstructL
       
    46 // Second stage construction
       
    47 // ----------------------------------------------------------------------------
       
    48 void CCalenAlarmState::ConstructL()
       
    49     {
       
    50     TRACE_ENTRY_POINT;
       
    51     BaseConstructL();
       
    52     
       
    53     TRACE_EXIT_POINT;
       
    54     }
       
    55     
       
    56 // ----------------------------------------------------------------------------
       
    57 // CCalenIdleState::CCalenIdleState
       
    58 // C++ Constructor
       
    59 // ----------------------------------------------------------------------------
       
    60 CCalenAlarmState::CCalenAlarmState( CCalenController& aController,
       
    61                                                          RHashSet<TCalenNotification>&  aOutstandingNotifications )
       
    62     : CCalenState( aController, aOutstandingNotifications )
       
    63     {
       
    64     TRACE_ENTRY_POINT;
       
    65     
       
    66     TRACE_EXIT_POINT;
       
    67     }
       
    68     
       
    69 // ----------------------------------------------------------------------------
       
    70 // CCalenAlarmState::CCalenAlarmState
       
    71 // Destructor
       
    72 // ----------------------------------------------------------------------------    
       
    73 CCalenAlarmState::~CCalenAlarmState()
       
    74     {
       
    75     TRACE_ENTRY_POINT;
       
    76     
       
    77     TRACE_EXIT_POINT;
       
    78     }
       
    79     
       
    80 // ----------------------------------------------------------------------------
       
    81 // CCalenAlarmState::HandleCommandL
       
    82 // From CCalenState
       
    83 // ----------------------------------------------------------------------------    
       
    84 TBool CCalenAlarmState::HandleCommandL( const TCalenCommand& /*aCommand*/,
       
    85                                         CCalenStateMachine& /*aStateMachine*/ )
       
    86     {
       
    87     TRACE_ENTRY_POINT;
       
    88     TRACE_EXIT_POINT;
       
    89     return EFalse;
       
    90     }
       
    91     
       
    92 // ----------------------------------------------------------------------------
       
    93 // CCalenAlarmState::HandleNotificationL
       
    94 // From CCalenState
       
    95 // ----------------------------------------------------------------------------        
       
    96 void CCalenAlarmState::HandleNotificationL(const TCalenNotification& aNotification,
       
    97                                               CCalenStateMachine& aStateMachine )
       
    98     {
       
    99     TRACE_ENTRY_POINT;
       
   100 
       
   101     switch( aNotification )
       
   102         {
       
   103         case ECalenNotifyAlarmStopped:
       
   104         case ECalenNotifyStopAlarm:
       
   105         	{
       
   106         	SetCurrentState( aStateMachine, CCalenStateMachine::ECalenViewingState );
       
   107         	iOutstandingNotifications.InsertL(aNotification);
       
   108             ActivateCurrentStateL(aStateMachine);
       
   109         	}
       
   110 	        break;
       
   111         
       
   112         case ECalenNotifyAlarmSnoozed:
       
   113         	{
       
   114         	SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState );
       
   115         	iOutstandingNotifications.InsertL(aNotification);
       
   116             ActivateCurrentStateL(aStateMachine);
       
   117        		}
       
   118        		break;
       
   119 			
       
   120 		case ECalenNotifyEntryClosed:
       
   121         	{
       
   122         	SetCurrentState( aStateMachine, iPreviousState );
       
   123         	iOutstandingNotifications.InsertL(aNotification);           
       
   124             ActivateCurrentStateL(aStateMachine);
       
   125         	}
       
   126 	        break;
       
   127         default:
       
   128             CCalenState::HandleNotificationL( aNotification, aStateMachine );
       
   129             break;
       
   130         }
       
   131     
       
   132     TRACE_EXIT_POINT;
       
   133     } 
       
   134     
       
   135 // ----------------------------------------------------------------------------
       
   136 // CCalenAlarmState::HandleStateActivationL
       
   137 // Behavior when state is activated.
       
   138 // ----------------------------------------------------------------------------
       
   139 void CCalenAlarmState::HandleStateActivationL(CCalenStateMachine& /*aStateMachine*/)
       
   140     {
       
   141     TRACE_ENTRY_POINT;
       
   142     TRACE_EXIT_POINT;
       
   143     }
       
   144     
       
   145  // end of file
       
   146