calendarui/controller/src/calensendingstate.cpp
branchRCL_3
changeset 30 bd7edf625bdd
parent 29 12af337248b1
equal deleted inserted replaced
29:12af337248b1 30:bd7edf625bdd
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Calendar state machine
    14 * Description:   Calendar state machine
    15 *
    15 *
    16 */
    16 */
       
    17 
    17 
    18 
    18 
    19 
    19 // includes
    20 // includes
    20 #include "calensendingstate.h"
    21 #include "calensendingstate.h"
    21 #include "calendarui_debug.h"           // Debug macros
    22 #include "calendarui_debug.h"           // Debug macros
    22 #include "calencontroller.h"
    23 #include "calencontroller.h"
    23 #include "calenstatemachine.h"
    24 #include "calenstatemachine.h"
    24 #include "calennotifier.h"
    25 #include "calennotifier.h"
    25 #include "OstTraceDefinitions.h"
       
    26 #ifdef OST_TRACE_COMPILER_IN_USE
       
    27 #include "calensendingstateTraces.h"
       
    28 #endif
       
    29 
    26 
    30 // ----------------------------------------------------------------------------
    27 // ----------------------------------------------------------------------------
    31 // CCalenSendingState::NewLC
    28 // CCalenSendingState::NewLC
    32 // First stage construction
    29 // First stage construction
    33 // ----------------------------------------------------------------------------
    30 // ----------------------------------------------------------------------------
    34 CCalenSendingState* CCalenSendingState::NewLC( CCalenController& aController,
    31 CCalenSendingState* CCalenSendingState::NewLC( CCalenController& aController,
    35                                                     RHashSet<TCalenNotification>&  aOutstandingNotifications )
    32                                                     RHashSet<TCalenNotification>&  aOutstandingNotifications )
    36     {
    33     {
    37     OstTraceFunctionEntry0( CCALENSENDINGSTATE_NEWLC_ENTRY );
    34     TRACE_ENTRY_POINT;
    38     
    35 
    39     CCalenSendingState* self = new ( ELeave ) CCalenSendingState( aController,aOutstandingNotifications );
    36     CCalenSendingState* self = new ( ELeave ) CCalenSendingState( aController,aOutstandingNotifications );
    40     CleanupStack::PushL( self );
    37     CleanupStack::PushL( self );
    41     self->ConstructL();
    38     self->ConstructL();
    42 
    39 
    43     OstTraceFunctionExit0( CCALENSENDINGSTATE_NEWLC_EXIT );
    40     TRACE_EXIT_POINT;
    44     return self;
    41     return self;
    45     }
    42     }
    46 
    43 
    47 // ----------------------------------------------------------------------------
    44 // ----------------------------------------------------------------------------
    48 // CCalenSendingState::ConstructL
    45 // CCalenSendingState::ConstructL
    49 // Second stage construction
    46 // Second stage construction
    50 // ----------------------------------------------------------------------------
    47 // ----------------------------------------------------------------------------
    51 void CCalenSendingState::ConstructL()
    48 void CCalenSendingState::ConstructL()
    52     {
    49     {
    53     OstTraceFunctionEntry0( CCALENSENDINGSTATE_CONSTRUCTL_ENTRY );
    50     TRACE_ENTRY_POINT;
    54     
       
    55     BaseConstructL();
    51     BaseConstructL();
    56     
    52     
    57     OstTraceFunctionExit0( CCALENSENDINGSTATE_CONSTRUCTL_EXIT );
    53     TRACE_EXIT_POINT;
    58     }
    54     }
    59     
    55     
    60 // ----------------------------------------------------------------------------
    56 // ----------------------------------------------------------------------------
    61 // CCalenSendingState::CCalenSendingState
    57 // CCalenSendingState::CCalenSendingState
    62 // C++ Constructor
    58 // C++ Constructor
    63 // ----------------------------------------------------------------------------
    59 // ----------------------------------------------------------------------------
    64 CCalenSendingState::CCalenSendingState( CCalenController& aController,
    60 CCalenSendingState::CCalenSendingState( CCalenController& aController,
    65                                                     RHashSet<TCalenNotification>&  aOutstandingNotifications )
    61                                                     RHashSet<TCalenNotification>&  aOutstandingNotifications )
    66     : CCalenState( aController, aOutstandingNotifications )
    62     : CCalenState( aController, aOutstandingNotifications )
    67     {
    63     {
    68     OstTraceFunctionEntry0( CCALENSENDINGSTATE_CCALENSENDINGSTATE_ENTRY );
    64     TRACE_ENTRY_POINT;
    69     
    65     
    70     OstTraceFunctionExit0( CCALENSENDINGSTATE_CCALENSENDINGSTATE_EXIT );
    66     TRACE_EXIT_POINT;
    71     }
    67     }
    72     
    68     
    73 // ----------------------------------------------------------------------------
    69 // ----------------------------------------------------------------------------
    74 // CCalenSendingState::CCalenSendingState
    70 // CCalenSendingState::CCalenSendingState
    75 // Destructor
    71 // Destructor
    76 // ----------------------------------------------------------------------------    
    72 // ----------------------------------------------------------------------------    
    77 CCalenSendingState::~CCalenSendingState()
    73 CCalenSendingState::~CCalenSendingState()
    78     {
    74     {
    79     OstTraceFunctionEntry0( DUP1_CCALENSENDINGSTATE_CCALENSENDINGSTATE_ENTRY );
    75     TRACE_ENTRY_POINT;
    80     
    76     
    81     OstTraceFunctionExit0( DUP1_CCALENSENDINGSTATE_CCALENSENDINGSTATE_EXIT );
    77     TRACE_EXIT_POINT;
    82     }
    78     }
    83 
    79 
    84 // ----------------------------------------------------------------------------
    80 // ----------------------------------------------------------------------------
    85 // CCalenSendingState::HandleCommandL
    81 // CCalenSendingState::HandleCommandL
    86 // From CCalenState
    82 // From CCalenState
    87 // ----------------------------------------------------------------------------    
    83 // ----------------------------------------------------------------------------    
    88 TBool CCalenSendingState::HandleCommandL( const TCalenCommand& aCommand,
    84 TBool CCalenSendingState::HandleCommandL( const TCalenCommand& aCommand,
    89                                          CCalenStateMachine& aStateMachine )
    85                                          CCalenStateMachine& aStateMachine )
    90     {
    86     {
    91     OstTraceFunctionEntry0( CCALENSENDINGSTATE_HANDLECOMMANDL_ENTRY );
    87     TRACE_ENTRY_POINT;
    92     
       
    93     TInt cmd = aCommand.Command();
    88     TInt cmd = aCommand.Command();
    94     MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd );
    89     MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd );
    95     
    90     
    96     ASSERT( handler ); // FIXME: error ui
    91     ASSERT( handler ); // FIXME: error ui
    97     
    92     
    98     TBool cmdUsed = EFalse;
    93     TBool cmdUsed = EFalse;
    99     
    94     
   100     if( ECalenFasterAppExit == cmd )
    95     if(ECalenFasterAppExit == cmd)
   101         {
    96         {
   102         SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState );
    97         SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState );
   103         ActivateCurrentStateL(aStateMachine);
    98         ActivateCurrentStateL(aStateMachine);
   104         RequestCallbackL( handler, aCommand );
    99         RequestCallbackL( handler, aCommand );
   105         cmdUsed = ETrue;
   100         cmdUsed = ETrue;
   106         }
   101         }
       
   102     else if(ECalenStartActiveStep == cmd)
       
   103         {
       
   104         RequestCallbackL( handler, aCommand );
       
   105         cmdUsed = ETrue;
       
   106         }    
   107 
   107 
   108     OstTraceFunctionExit0( CCALENSENDINGSTATE_HANDLECOMMANDL_EXIT );
   108     TRACE_EXIT_POINT;
   109     return cmdUsed;
   109     return cmdUsed;
   110     }
   110     }
   111 
   111 
   112 // ----------------------------------------------------------------------------
   112 // ----------------------------------------------------------------------------
   113 // CCalenSendingState::HandleNotificationL
   113 // CCalenSendingState::HandleNotificationL
   114 // From CCalenState
   114 // From CCalenState
   115 // ----------------------------------------------------------------------------        
   115 // ----------------------------------------------------------------------------        
   116 void CCalenSendingState::HandleNotificationL(const TCalenNotification& aNotification,
   116 void CCalenSendingState::HandleNotificationL(const TCalenNotification& aNotification,
   117                                               CCalenStateMachine& aStateMachine )
   117                                               CCalenStateMachine& aStateMachine )
   118     {
   118     {
   119     OstTraceFunctionEntry0( CCALENSENDINGSTATE_HANDLENOTIFICATIONL_ENTRY );
   119     TRACE_ENTRY_POINT;
   120     
   120 
   121     switch( aNotification )
   121     switch( aNotification )
   122         {
   122         {
       
   123         case ECalenNotifyEntrySendCancel:
   123         case ECalenNotifyDialogClosed:  // issued when send method query dialog is cancelled
   124         case ECalenNotifyDialogClosed:  // issued when send method query dialog is cancelled
   124         	{
   125         	{
   125         	// FIXME Should have a ECalenNotifyEntrySent?
   126         	// FIXME Should have a ECalenNotifyEntrySent?
   126             SetCurrentState( aStateMachine, iPreviousState);
   127             SetCurrentState( aStateMachine, iPreviousState);
   127             iOutstandingNotifications.InsertL(aNotification);
   128             iOutstandingNotifications.InsertL(aNotification);
   137         default:
   138         default:
   138             CCalenState::HandleNotificationL( aNotification, aStateMachine );
   139             CCalenState::HandleNotificationL( aNotification, aStateMachine );
   139             break;
   140             break;
   140         }
   141         }
   141 
   142 
   142     OstTraceFunctionExit0( CCALENSENDINGSTATE_HANDLENOTIFICATIONL_EXIT );
   143     TRACE_EXIT_POINT;
   143     }
   144     }
   144 
   145 
   145 
   146 
   146  // end of file
   147  // end of file