calendarui/controller/src/calenviewingstate.cpp
changeset 51 0b38fc5b94c6
parent 18 c198609911f9
child 89 b57382753122
equal deleted inserted replaced
46:ecd7b9840282 51:0b38fc5b94c6
    20 #include "calenviewingstate.h"
    20 #include "calenviewingstate.h"
    21 #include "calendarui_debug.h"           // Debug macros
    21 #include "calendarui_debug.h"           // Debug macros
    22 #include "calencontroller.h"
    22 #include "calencontroller.h"
    23 #include "calenstatemachine.h"
    23 #include "calenstatemachine.h"
    24 #include "calennotifier.h"
    24 #include "calennotifier.h"
       
    25 #include "OstTraceDefinitions.h"
       
    26 #ifdef OST_TRACE_COMPILER_IN_USE
       
    27 #include "calenviewingstateTraces.h"
       
    28 #endif
    25 
    29 
    26 // ----------------------------------------------------------------------------
    30 // ----------------------------------------------------------------------------
    27 // CCalenViewingState::NewLC
    31 // CCalenViewingState::NewLC
    28 // First stage construction
    32 // First stage construction
    29 // ----------------------------------------------------------------------------
    33 // ----------------------------------------------------------------------------
    30 CCalenViewingState* CCalenViewingState::NewLC( CCalenController& aController,
    34 CCalenViewingState* CCalenViewingState::NewLC( CCalenController& aController,
    31                                                    RHashSet<TCalenNotification>& aOutstandingNotifications )
    35                                                    RHashSet<TCalenNotification>& aOutstandingNotifications )
    32     {
    36     {
    33     TRACE_ENTRY_POINT;
    37     OstTraceFunctionEntry0( CCALENVIEWINGSTATE_NEWLC_ENTRY );
    34 
    38     
    35     CCalenViewingState* self = new ( ELeave ) CCalenViewingState( aController,aOutstandingNotifications );
    39     CCalenViewingState* self = new ( ELeave ) CCalenViewingState( aController,aOutstandingNotifications );
    36     CleanupStack::PushL( self );
    40     CleanupStack::PushL( self );
    37     self->ConstructL();
    41     self->ConstructL();
    38 
    42 
    39     TRACE_EXIT_POINT;
    43     OstTraceFunctionExit0( CCALENVIEWINGSTATE_NEWLC_EXIT );
    40     return self;
    44     return self;
    41     }
    45     }
    42 
    46 
    43 // ----------------------------------------------------------------------------
    47 // ----------------------------------------------------------------------------
    44 // CCalenViewingState::ConstructL
    48 // CCalenViewingState::ConstructL
    45 // Second stage construction
    49 // Second stage construction
    46 // ----------------------------------------------------------------------------
    50 // ----------------------------------------------------------------------------
    47 void CCalenViewingState::ConstructL()
    51 void CCalenViewingState::ConstructL()
    48     {
    52     {
    49     TRACE_ENTRY_POINT;
    53     OstTraceFunctionEntry0( CCALENVIEWINGSTATE_CONSTRUCTL_ENTRY );
       
    54     
    50     BaseConstructL();
    55     BaseConstructL();
    51     
    56     
    52     TRACE_EXIT_POINT;
    57     OstTraceFunctionExit0( CCALENVIEWINGSTATE_CONSTRUCTL_EXIT );
    53     }
    58     }
    54     
    59     
    55 // ----------------------------------------------------------------------------
    60 // ----------------------------------------------------------------------------
    56 // CCalenIdleState::CCalenIdleState
    61 // CCalenIdleState::CCalenIdleState
    57 // C++ Constructor
    62 // C++ Constructor
    58 // ----------------------------------------------------------------------------
    63 // ----------------------------------------------------------------------------
    59 CCalenViewingState::CCalenViewingState( CCalenController& aController,
    64 CCalenViewingState::CCalenViewingState( CCalenController& aController,
    60                                                     RHashSet<TCalenNotification>& aOutstandingNotifications )
    65                                                     RHashSet<TCalenNotification>& aOutstandingNotifications )
    61     : CCalenState( aController, aOutstandingNotifications )
    66     : CCalenState( aController, aOutstandingNotifications )
    62     {
    67     {
    63     TRACE_ENTRY_POINT;
    68     OstTraceFunctionEntry0( CCALENVIEWINGSTATE_CCALENVIEWINGSTATE_ENTRY );
    64     
    69     
    65     TRACE_EXIT_POINT;
    70     OstTraceFunctionExit0( CCALENVIEWINGSTATE_CCALENVIEWINGSTATE_EXIT );
    66     }
    71     }
    67     
    72     
    68 // ----------------------------------------------------------------------------
    73 // ----------------------------------------------------------------------------
    69 // CCalenViewingState::CCalenViewingState
    74 // CCalenViewingState::CCalenViewingState
    70 // Destructor
    75 // Destructor
    71 // ----------------------------------------------------------------------------    
    76 // ----------------------------------------------------------------------------    
    72 CCalenViewingState::~CCalenViewingState()
    77 CCalenViewingState::~CCalenViewingState()
    73     {
    78     {
    74     TRACE_ENTRY_POINT;
    79     OstTraceFunctionEntry0( DUP1_CCALENVIEWINGSTATE_CCALENVIEWINGSTATE_ENTRY );
    75     
    80     
    76     TRACE_EXIT_POINT;
    81     OstTraceFunctionExit0( DUP1_CCALENVIEWINGSTATE_CCALENVIEWINGSTATE_EXIT );
    77     }
    82     }
    78 
    83 
    79 // ----------------------------------------------------------------------------
    84 // ----------------------------------------------------------------------------
    80 // CCalenViewingState::HandleCommandL
    85 // CCalenViewingState::HandleCommandL
    81 // From CCalenState
    86 // From CCalenState
    82 // ----------------------------------------------------------------------------    
    87 // ----------------------------------------------------------------------------    
    83 TBool CCalenViewingState::HandleCommandL( const TCalenCommand& aCommand,
    88 TBool CCalenViewingState::HandleCommandL( const TCalenCommand& aCommand,
    84                                         CCalenStateMachine& aStateMachine )
    89                                         CCalenStateMachine& aStateMachine )
    85     {
    90     {
    86     TRACE_ENTRY_POINT;
    91     OstTraceFunctionEntry0( CCALENVIEWINGSTATE_HANDLECOMMANDL_ENTRY );
    87     
    92     
    88     TInt cmd = aCommand.Command();
    93     TInt cmd = aCommand.Command();
    89     MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd );
    94     MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd );
    90     
    95     
    91     ASSERT( handler ); // FIXME: error ui
    96     ASSERT( handler ); // FIXME: error ui
   145     		{    		
   150     		{    		
   146     		}
   151     		}
   147         }
   152         }
   148     RequestCallbackL( handler, aCommand );
   153     RequestCallbackL( handler, aCommand );
   149 
   154 
   150     TRACE_EXIT_POINT;
   155     OstTraceFunctionExit0( CCALENVIEWINGSTATE_HANDLECOMMANDL_EXIT );
   151     return cmdUsed;
   156     return cmdUsed;
   152     }
   157     }
   153 
   158 
   154 // ----------------------------------------------------------------------------
   159 // ----------------------------------------------------------------------------
   155 // CCalenViewingState::HandleNotificationL
   160 // CCalenViewingState::HandleNotificationL
   156 // From CCalenState
   161 // From CCalenState
   157 // ----------------------------------------------------------------------------        
   162 // ----------------------------------------------------------------------------        
   158 void CCalenViewingState::HandleNotificationL(const TCalenNotification& aNotification,
   163 void CCalenViewingState::HandleNotificationL(const TCalenNotification& aNotification,
   159                                               CCalenStateMachine& aStateMachine )
   164                                               CCalenStateMachine& aStateMachine )
   160     {
   165     {
   161     TRACE_ENTRY_POINT;
   166     OstTraceFunctionEntry0( CCALENVIEWINGSTATE_HANDLENOTIFICATIONL_ENTRY );
   162 
   167     
   163     switch( aNotification )
   168     switch( aNotification )
   164         {
   169         {
   165         case ECalenNotifyEntryClosed:
   170         case ECalenNotifyEntryClosed:
   166         	{
   171         	{
   167         	SetCurrentState( aStateMachine, iPreviousState );
   172         	SetCurrentState( aStateMachine, iPreviousState );
   180         default:
   185         default:
   181             CCalenState::HandleNotificationL( aNotification, aStateMachine );
   186             CCalenState::HandleNotificationL( aNotification, aStateMachine );
   182             break;
   187             break;
   183         }
   188         }
   184     
   189     
   185     TRACE_EXIT_POINT;
   190     OstTraceFunctionExit0( CCALENVIEWINGSTATE_HANDLENOTIFICATIONL_EXIT );
   186     } 
   191     } 
   187     
   192     
   188 // ----------------------------------------------------------------------------
   193 // ----------------------------------------------------------------------------
   189 // CCalenViewingState::HandleStateActivationL
   194 // CCalenViewingState::HandleStateActivationL
   190 // Behavior when state is activated.
   195 // Behavior when state is activated.
   191 // ----------------------------------------------------------------------------
   196 // ----------------------------------------------------------------------------
   192 void CCalenViewingState::HandleStateActivationL(CCalenStateMachine& aStateMachine)
   197 void CCalenViewingState::HandleStateActivationL(CCalenStateMachine& aStateMachine)
   193     {
   198     {
   194     TRACE_ENTRY_POINT;
   199     OstTraceFunctionEntry0( CCALENVIEWINGSTATE_HANDLESTATEACTIVATIONL_ENTRY );
   195     
   200     
   196     if( iOutstandingNotifications.Find(ECalenNotifyEntryDeleted) )
   201     if( iOutstandingNotifications.Find(ECalenNotifyEntryDeleted) )
   197     	{
   202     	{
   198     	SetCurrentState( aStateMachine, iPreviousState );
   203     	SetCurrentState( aStateMachine, iPreviousState );
   199         ActivateCurrentStateL(aStateMachine);
   204         ActivateCurrentStateL(aStateMachine);
   200     	}
   205     	}
   201     else 
   206     else 
   202     	{
   207     	{
   203     	CCalenState::HandleStateActivationL(aStateMachine);
   208     	CCalenState::HandleStateActivationL(aStateMachine);
   204     	}
   209     	}
   205     TRACE_EXIT_POINT;
   210     
       
   211     OstTraceFunctionExit0( CCALENVIEWINGSTATE_HANDLESTATEACTIVATIONL_EXIT );
   206     }    
   212     }    
   207     
   213     
   208  // end of file
   214  // end of file