diff -r 96907930389d -r 12af337248b1 calendarui/controller/src/calenbackgroundstate.cpp --- a/calendarui/controller/src/calenbackgroundstate.cpp Thu Aug 19 09:53:43 2010 +0300 +++ b/calendarui/controller/src/calenbackgroundstate.cpp Tue Aug 31 15:13:43 2010 +0300 @@ -11,18 +11,21 @@ * * Contributors: * -* Description: Calendar state machine +* Description: Calendar state machine * */ - // includes #include "calenbackgroundstate.h" #include "calendarui_debug.h" // Debug macros #include "calencontroller.h" #include "calenstatemachine.h" #include "calennotifier.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "calenbackgroundstateTraces.h" +#endif // ---------------------------------------------------------------------------- // CCalenBackgroundState::NewLC @@ -31,13 +34,13 @@ CCalenBackgroundState* CCalenBackgroundState::NewLC( CCalenController& aController, RHashSet& aOutstandingNotifications ) { - TRACE_ENTRY_POINT; - + OstTraceFunctionEntry0( CCALENBACKGROUNDSTATE_NEWLC_ENTRY ); + CCalenBackgroundState* self = new ( ELeave ) CCalenBackgroundState( aController,aOutstandingNotifications ); CleanupStack::PushL( self ); self->ConstructL(); - TRACE_EXIT_POINT; + OstTraceFunctionExit0( CCALENBACKGROUNDSTATE_NEWLC_EXIT ); return self; } @@ -47,10 +50,11 @@ // ---------------------------------------------------------------------------- void CCalenBackgroundState::ConstructL() { - TRACE_ENTRY_POINT; + OstTraceFunctionEntry0( CCALENBACKGROUNDSTATE_CONSTRUCTL_ENTRY ); + BaseConstructL(); - TRACE_EXIT_POINT; + OstTraceFunctionExit0( CCALENBACKGROUNDSTATE_CONSTRUCTL_EXIT ); } // ---------------------------------------------------------------------------- @@ -61,9 +65,9 @@ RHashSet& aOutstandingNotifications ) : CCalenState( aController, aOutstandingNotifications ) { - TRACE_ENTRY_POINT; + OstTraceFunctionEntry0( CCALENBACKGROUNDSTATE_CCALENBACKGROUNDSTATE_ENTRY ); - TRACE_EXIT_POINT; + OstTraceFunctionExit0( CCALENBACKGROUNDSTATE_CCALENBACKGROUNDSTATE_EXIT ); } // ---------------------------------------------------------------------------- @@ -72,9 +76,9 @@ // ---------------------------------------------------------------------------- CCalenBackgroundState::~CCalenBackgroundState() { - TRACE_ENTRY_POINT; + OstTraceFunctionEntry0( DUP1_CCALENBACKGROUNDSTATE_CCALENBACKGROUNDSTATE_ENTRY ); - TRACE_EXIT_POINT; + OstTraceFunctionExit0( DUP1_CCALENBACKGROUNDSTATE_CCALENBACKGROUNDSTATE_EXIT ); } // ---------------------------------------------------------------------------- @@ -84,7 +88,8 @@ TBool CCalenBackgroundState::HandleCommandL( const TCalenCommand& aCommand, CCalenStateMachine& aStateMachine ) { - TRACE_ENTRY_POINT; + OstTraceFunctionEntry0( CCALENBACKGROUNDSTATE_HANDLECOMMANDL_ENTRY ); + //When application is pushed background //1,when launched from active idle ,( AI screen or missed alarm softnotification/small indicator), @@ -101,10 +106,8 @@ switch( cmd ) { + case ECalenAgendaView: case ECalenDayView: - case ECalenTodoView: - case ECalenMonthView: - case ECalenWeekView: SetCurrentState(aStateMachine,CCalenStateMachine::ECalenIdleState); cmdUsed = ETrue; break; @@ -112,22 +115,8 @@ SetCurrentState(aStateMachine,CCalenStateMachine::ECalenViewingState); cmdUsed = ETrue; break; - case ECalenEventViewFromAlarm: - case ECalenEventViewFromAlarmStopOnly: - SetCurrentState(aStateMachine,CCalenStateMachine::ECalenAlarmState); - cmdUsed = ETrue; - break; - case ECalenFasterAppExit: - if(iPreviousState == CCalenStateMachine::ECalenMapState) - { - // Issue map launch cancel notification - iController.BroadcastNotification(ECalenNotifyCancelMapLaunch); - SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState ); - ActivateCurrentStateL(aStateMachine); - cmdUsed = ETrue; - break; - } - else if(iPreviousState == CCalenStateMachine::ECalenDeletingState) + case ECalenFasterAppExit: + if(iPreviousState == CCalenStateMachine::ECalenDeletingState) { // Issue ECalenNotifyDeleteFailed notification to cancel the delete iController.BroadcastNotification(ECalenNotifyDeleteFailed); @@ -135,24 +124,24 @@ ActivateCurrentStateL(aStateMachine); cmdUsed = ETrue; } - else if( iPreviousState == CCalenStateMachine::ECalenSettingsState + else + { + if( iPreviousState == CCalenStateMachine::ECalenSettingsState || iPreviousState == CCalenStateMachine::ECalenEditingState - || iPreviousState == CCalenStateMachine::ECalenSendingState - || iPreviousState == CCalenStateMachine::ECalenIdleState - || iPreviousState == CCalenStateMachine::ECalenViewingState - || iPreviousState == CCalenStateMachine::ECalenAttachmentState) - { - SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState ); - ActivateCurrentStateL(aStateMachine); - cmdUsed = ETrue; - } + || iPreviousState == CCalenStateMachine::ECalenSendingState ) + { + SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState ); + ActivateCurrentStateL(aStateMachine); + cmdUsed = ETrue; + } + } default: break; } - if(cmdUsed) + RequestCallbackL( handler, aCommand ); - TRACE_EXIT_POINT; + OstTraceFunctionExit0( CCALENBACKGROUNDSTATE_HANDLECOMMANDL_EXIT ); return cmdUsed; } @@ -163,20 +152,13 @@ void CCalenBackgroundState::HandleNotificationL(const TCalenNotification& aNotification, CCalenStateMachine& aStateMachine ) { - TRACE_ENTRY_POINT; + OstTraceFunctionEntry0( CCALENBACKGROUNDSTATE_HANDLENOTIFICATIONL_ENTRY ); switch( aNotification ) { case ECalenNotifyAppForegrounded: { - if( iPreviousState == CCalenStateMachine::ECalenSendingState ) - { - SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState ); - } - else - { - SetCurrentState( aStateMachine, iPreviousState ); - } + SetCurrentState( aStateMachine, iPreviousState ); // We set iOutstandingNotifications for two reasons. // 1. The new state i.e. the state we are moving back can have notification info. // 2. When we move to newstate we broadcast all notification from iOutstandingNotifications @@ -195,7 +177,7 @@ break; } - TRACE_EXIT_POINT; + OstTraceFunctionExit0( CCALENBACKGROUNDSTATE_HANDLENOTIFICATIONL_EXIT ); } // ---------------------------------------------------------------------------- @@ -204,13 +186,14 @@ // ---------------------------------------------------------------------------- void CCalenBackgroundState::HandleStateActivationL(CCalenStateMachine& aStateMachine) { - TRACE_ENTRY_POINT; + OstTraceFunctionEntry0( CCALENBACKGROUNDSTATE_HANDLESTATEACTIVATIONL_ENTRY ); + if(iOutstandingNotifications.Find(ECalenNotifyAppBackgrounded)) { CCalenState::HandleStateActivationL(aStateMachine); } - TRACE_EXIT_POINT; + OstTraceFunctionExit0( CCALENBACKGROUNDSTATE_HANDLESTATEACTIVATIONL_EXIT ); } // end of file