calendarui/controller/src/calensendingstate.cpp
changeset 0 f979ecb2b13e
child 12 38571fd2a704
child 18 c198609911f9
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2007 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 state machine
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // includes
       
    21 #include "calensendingstate.h"
       
    22 #include "calendarui_debug.h"           // Debug macros
       
    23 #include "calencontroller.h"
       
    24 #include "calenstatemachine.h"
       
    25 #include "calennotifier.h"
       
    26 
       
    27 // ----------------------------------------------------------------------------
       
    28 // CCalenSendingState::NewLC
       
    29 // First stage construction
       
    30 // ----------------------------------------------------------------------------
       
    31 CCalenSendingState* CCalenSendingState::NewLC( CCalenController& aController,
       
    32                                                     RHashSet<TCalenNotification>&  aOutstandingNotifications )
       
    33     {
       
    34     TRACE_ENTRY_POINT;
       
    35 
       
    36     CCalenSendingState* self = new ( ELeave ) CCalenSendingState( aController,aOutstandingNotifications );
       
    37     CleanupStack::PushL( self );
       
    38     self->ConstructL();
       
    39 
       
    40     TRACE_EXIT_POINT;
       
    41     return self;
       
    42     }
       
    43 
       
    44 // ----------------------------------------------------------------------------
       
    45 // CCalenSendingState::ConstructL
       
    46 // Second stage construction
       
    47 // ----------------------------------------------------------------------------
       
    48 void CCalenSendingState::ConstructL()
       
    49     {
       
    50     TRACE_ENTRY_POINT;
       
    51     BaseConstructL();
       
    52     
       
    53     TRACE_EXIT_POINT;
       
    54     }
       
    55     
       
    56 // ----------------------------------------------------------------------------
       
    57 // CCalenSendingState::CCalenSendingState
       
    58 // C++ Constructor
       
    59 // ----------------------------------------------------------------------------
       
    60 CCalenSendingState::CCalenSendingState( CCalenController& aController,
       
    61                                                     RHashSet<TCalenNotification>&  aOutstandingNotifications )
       
    62     : CCalenState( aController, aOutstandingNotifications )
       
    63     {
       
    64     TRACE_ENTRY_POINT;
       
    65     
       
    66     TRACE_EXIT_POINT;
       
    67     }
       
    68     
       
    69 // ----------------------------------------------------------------------------
       
    70 // CCalenSendingState::CCalenSendingState
       
    71 // Destructor
       
    72 // ----------------------------------------------------------------------------    
       
    73 CCalenSendingState::~CCalenSendingState()
       
    74     {
       
    75     TRACE_ENTRY_POINT;
       
    76     
       
    77     TRACE_EXIT_POINT;
       
    78     }
       
    79 
       
    80 // ----------------------------------------------------------------------------
       
    81 // CCalenSendingState::HandleCommandL
       
    82 // From CCalenState
       
    83 // ----------------------------------------------------------------------------    
       
    84 TBool CCalenSendingState::HandleCommandL( const TCalenCommand& aCommand,
       
    85                                          CCalenStateMachine& aStateMachine )
       
    86     {
       
    87     TRACE_ENTRY_POINT;
       
    88     TInt cmd = aCommand.Command();
       
    89     MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd );
       
    90     
       
    91     ASSERT( handler ); // FIXME: error ui
       
    92     
       
    93     TBool cmdUsed = EFalse;
       
    94     
       
    95     if(ECalenFasterAppExit == cmd)
       
    96         {
       
    97         SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState );
       
    98         ActivateCurrentStateL(aStateMachine);
       
    99         RequestCallbackL( handler, aCommand );
       
   100         cmdUsed = ETrue;
       
   101         }
       
   102     else if(ECalenStartActiveStep == cmd)
       
   103         {
       
   104         RequestCallbackL( handler, aCommand );
       
   105         cmdUsed = ETrue;
       
   106         }    
       
   107 
       
   108     TRACE_EXIT_POINT;
       
   109     return cmdUsed;
       
   110     }
       
   111 
       
   112 // ----------------------------------------------------------------------------
       
   113 // CCalenSendingState::HandleNotificationL
       
   114 // From CCalenState
       
   115 // ----------------------------------------------------------------------------        
       
   116 void CCalenSendingState::HandleNotificationL(const TCalenNotification& aNotification,
       
   117                                               CCalenStateMachine& aStateMachine )
       
   118     {
       
   119     TRACE_ENTRY_POINT;
       
   120 
       
   121     switch( aNotification )
       
   122         {
       
   123         case ECalenNotifyDialogClosed:  // issued when send method query dialog is cancelled
       
   124         	{
       
   125         	// FIXME Should have a ECalenNotifyEntrySent?
       
   126             SetCurrentState( aStateMachine, iPreviousState);
       
   127             iOutstandingNotifications.InsertL(aNotification);
       
   128         	ActivateCurrentStateL(aStateMachine);
       
   129         	}
       
   130             break;
       
   131         case ECalenNotifyEntrySent:
       
   132         	{
       
   133             SetCurrentState( aStateMachine, iPreviousState);
       
   134             iOutstandingNotifications.InsertL(aNotification);
       
   135         	ActivateCurrentStateL(aStateMachine);
       
   136         	}
       
   137         default:
       
   138             CCalenState::HandleNotificationL( aNotification, aStateMachine );
       
   139             break;
       
   140         }
       
   141 
       
   142     TRACE_EXIT_POINT;
       
   143     }
       
   144 
       
   145 
       
   146  // end of file